Epilog
What
versus
How
 

Introductory Tour of Sierralite


1. Introduction

Sierralite is a browser-based integrated development environment (IDE) for Epilog. It allows users to view and edit datasets and rulesets. It provides tools for evaluating defined functions and defined relations and applying defined operations. As changes are made, it automatically updates visible datasets in spreadsheet-like fashion in accordance with the user's rules.

Click the About button above to show or hide this pane. Click the tool buttons in the center of the command bar to show or hide interaction panes for various tools. Click the Rules and Data buttons to show or hide the Rules and Data panes. To get started, enter rules and data in the Rules and Data panes and click the tools buttons to process your data and rules.

This document provides a brief introductory tour of Sierralite. We show how to load Sierralite; we show how to create, view, and edit datasets and rulesets; and we show how to save work for later use. We suggest performing the steps shown here in your own browser as we proceed through the tour.

This tour presumes the reader is already familiar with Epilog or another logic programming language, such as Prolog. (See http://logicprogramming.stanford.edu for a course on Logic Programming in general and Epilog in particular.)

2. Getting Started

Since Sierralite is browser-based, we start by loading a suitable browser. (Sierralite runs in Safari, Chrome, Firefox, and other browsers. In our examples here, we use Safari, though the appearance and interaction are virtually the same in all major browsers.) Once our browser is started, we load Sierralite by going to the following URL.

http://epilog.stanford.edu/homepage/sierralite.php

This brings up a page that looks like the following.

  Sierralite
What
versus
How
 
        
About
Sierralite is a browser-based integrated development environment (IDE) for Epilog. It allows users to view and edit datasets and rulesets. It provides tools for evaluating defined functions and defined relations and applying defined operations. As changes are made, it automatically updates visible datasets in spreadsheet-like fashion in accordance with the user's rules. Click here for a brief overview of Sierralite.

Click the Rules and Data buttons to show or hide the Rules and Data panes. Click the tool buttons in the center of the command bar to show or hide interaction panes for various tools. Click the About button above to show or hide this pane. To get started, enter rules and data in the Rules and Data panes and click the tools buttons to process your data and rules.

Sierralite is a simplified version of the Sierra IDE for Epilog. Although Sierralite does not have all of the capabilities and flexibility of Sierra, it is easier to learn, and it is adequate for simple knowledge representation and/or logic programming tasks. Click here to access Sierra.

Rules
    
Data
    

The page is divided into several panes. The header (at the top) simply identifies the page as Sierralite. The command bar (immediately below the header) allows the user to invoke various tools. The tool panes (below the command bar) provide details of the available tools. The rules pane (second from the bottom) allows the user to view and edit the system's current rules. And the data pane (last on the page) allows the user to view and edit the system's current data.

The command bar across the top provides access to all available tools. Clicking one of these buttons toggles the visibility of the corresponding tool pane, typically an area for specifying parameters for the tool and a results area. We introduce these tools one by one as we proceed with our tour. But, first, we start with descriptions of the data pane and the rules pane.

3. Data

The data pane shows the contents of Sierralite's current dataset. In the example below, we have populated the window with facts describing the initial state of a game of Tic Tac Toe. There are nine cells arranged in three rows and three columns, and all nine cells are blank in this state. There is also a fact stating that it is x's turn to play.

Data
    

At this point, we can modify the data if we wish. For example, we can change the b to x in the first fact to indicate that there is an x in the corresponding cell, and we can replace x with o in the last fact to change control from x to o. The window changes color to indicate that we have made changes but we have not yet committed those changes to the database.

Data
    

Clicking the Update button records the data in the system's dataset and removes the highlighting, indicating that the window is showing the current data.

Data
    

Suppose we edit the data and the result is syntactically illegal, as shown below.

Data
    

If we click Update, we will get an error message like the following, and the database will not be modified.

Data
    

    Syntax error.

Close    

At this point, we can either repair the problem and try again, or we can click the Revert button to return to the current state of the database, as we have done here.

Data
    

The Load option allows us to read a local file and load the contents into the current dataset. The Save option allows us to write the current dataset to the local file system.

4. Rules

In addition to viewing and editing data, Sierralite allows us to view and edit the system's rules - function definitions, view definitions, and operation definitions. Sierralite's rules pane shows the rules contained in the system's current rule set.

If the user makes changes, the window changes color to indicate that we have made changes but we have not yet committed those changes to the rule set. Clicking the Update button after a change stores the new rules and removes the highlighting, indicating that the window is showing the current ruleset, as shown below. Clicking Revert leaves the current rule set as is and resets the contents of the editor window to the state before editing began.

In the example below, we have populated the window with operation definitions for the game of Tic Tac Toe. Marking a cell removes the blank in the cell and adds the mark of the player in control; it also reverses control.

Rules
    

We can modify the system's current rule set by modifying the contents of the rules pane. In the situation below, we have added a definition for the line relation. A line is either a row, a column, or a diagonal.

Rules
    

Finally, we can define the reward function for the players. A player gets 100 points if there is a line of his marks; he gets 0 points if there is a line of his opponent's marks; otherwise he gets 50 points.

Rules
    

Once we have written rules to define functions, views, and operations, we can see the effects using the primary tools mentioned in the command pane - evaluate, query, execute - as described in the following sections.

5. Evaluate

If we select the evaluate tool, the action pane switches to a tool like the one shown below.

Evaluate
Query  
   Unification Limit    Autorefresh

The evaluate tool allows us to compute the values of functional terms. To specify a term for evaluation, we enter the term to be evaluated in the Query field. Here, we are asking for the x's reward in the state described by the data in the preceding sections.

Evaluate
Query  
   Unification Limit    Autorefresh

Clicking the Show button produces the value of this term in the results area. In this case, the answer is 50, which is the correct value given our current state and the definition of reward in the rule set.

Evaluate
Query  
   Unification Limit    Autorefresh

The evaluate tool also evaluates terms containing built-in operators, like plus, times, and countofall. In the situation shown below, we have the changed the Query term to countofall(cell(M,N,b),cell(M,N,b)).

Evaluate
Query  
   Unification Limit    Autorefresh

Clicking the Show button causes Sierralite to evaluate the specified term and place the result in the result field. In this case the answer is 8, since there are 8 cells containing blanks.

Evaluate
Query  
   Unification Limit    Autorefresh

Changing the Unifications field changes the maximum number of unifications the system will attempt while evaluating terms. By default, the system performs a maximum of 100,000 unifications.

If the autorefresh box is checked, changing the system's data or rules automatically results in different values being shown for the specified query term. Otherwise, the user must click the Show button to see the result in the new context. Suppose, for example, we check the autorefresh box on the preceding query, as shown below.

Evaluate
Query  
   Unification Limit    Autorefresh

Now, suppose we change the dataset as shown below. Here, we have placed an o in the second cell of the first row and changed the coltrol form o to x.

Data
    

In this situation, the value of the query in the evaluate tool is automatically recomputed and displayed, as shown below.

Evaluate
Query  
   Unification Limit    Autorefresh

The autorefresh functionality is useful when debugging data or rules, as it allows us to see the effects of our changes instantaneously, in spreadsheet-like fashion.

6. Query

Sierralite also provides a means for getting answers to relational queries. If we select the Query tool, we get a pane like the one shown below.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

To form a query, we enter an expression for our desired answer in the Pattern field and we enter our query in the Query field. Here, we are asking for all expressions of the form empty(M,N) where cell(M,N,b) is true, i.e. all cells that contain a blank.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

Clicking the Show button causes Sierralite to evaluate the query and show the results in the query window. In this case, there are seven answers.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

In general, queries can have many answers. By default, the Query tool shows only 100 answers, as shown in the Results field. We can change this default by changing the value in this field. In the example, below, we have changed the Results field from 100 to 4, and the system has changed its response to just four answers. In the case of expensive queries, it is often desirable to ask for just one result.

Query
Pattern  
Query  
 Results    Unification Limit    Autorefresh

As with the Evaluate tool, changing the Unifications field changes the maximum number of unifications the system will attempt before evaluating queries. By default, the system performs a maximum of 100,000 unifications. It is often useful to increase this to 1,000,000 unifications or more, though this will increase the amount of time needed to evaluate queries.

Also, in keeping with the Evaluate tool, if the Autorefresh check box is checked, the system automatically refreshes the results whenever changes are made to the database (either by manually editing lambda or by executing actions that change lambda).

7. Execute

If we have an operation defined, we can use the execute tool to execute that operation. In the example below, we have clicked Execute on the command bar and gotten an empty Execute tool.

Execute
Action  
  Expansion Depth     Autorefresh  

Using the Execute tool, we can express an action we want to execute. In this case, we have entered mark(3,1).

Execute
Action  
  Expansion Depth     Autorefresh  

If we press the Expand button, we see a list of all facts that will be added and those that will be deleted if we execute the mark(3,1) action. Note that, if executed, these facts would be removed in a single step, i.e. operation execution is an "atomic" action.

Execute
Action  
  Expansion Depth     Autorefresh  

Clicking the Execute button causes Sierralite to make these changes, resulting in the state shown below.

Data
    

The Expansion Depth field allows us to specify the depth of recursion in expanding operation definitions. The Autorefresh check box determines whether Sierralite automatically displays expansions in the event of changes to the system's rules or data.



Comments and complaints to genesereth@stanford.edu.