Process Programming by Hindsight Pankaj K. Garg Hewlett-Packard Labs 1501 Page Mill Road P. O. Box 10490 Palo Alto , CA 94303-0969 garg@hplabs.hp.com -LRB-415-RRB-857-4709 Sanjay Bhansali Knowledge Systems Laboratory Stanford University 701 Welch Road , Bldg. , C Palo Alto , CA 94304 bhansali@sumex-aim.stanford.edu -LRB-415-RRB-723-8387 Abstract Process programming refers to the activity of algorithmicly describing models of programming activities -LRB- processes -RRB- . A serious limitation of process programming has been that it is often hard to describe a programming process a priori . In this paper we present an approach to process programming which overcomes this limitation . Our approach is based on the premise that process programs are easier to describe in hindsight rather than by foresight , and hence can be synthesized by observing and analyzing a recorded process history . In this paper we describe an adaptation of the well-known explanation-based learning algorithm to synthesize a process fragment from a process history . We demonstrate the usefulness of the approach on a realistic example of co-coordinating file changes through a version control system . 1 Introduction Since the inception of software engineering , models of the activities which lead to the development of software systems have been considered important -LRB- for example , see -LSB- 10 , 19 , 30 -RSB- -RRB- . One use of such models has been to improve the resulting software system by prescribing a disciplined approach for software development . For example , Wirth 's ideas on stepwise-refinement -LSB- 30 -RSB- , and Dijkstra 's ideas on A Discipline of Programming -LSB- 10 -RSB- have significantly influenced structured programming . Another use of such models is for understanding the large and complex set of activities which need to be carried out to develop , maintain , and use a programming system product1 . Boehm 's Spiral life cycle model -LSB- 5 -RSB- is an example of such a process model . More recently , several suggestions have been made to develop algorithmic process models -LRB- for example , see -LSB- 1 , 13 , 24 -RSB- -RRB- . The hope is that we can mechanize the application of such process models , thereby reducing the intellectual burden of the people involved in the process . The process of developing such models has been termed software process programming -LCB- or process programming -LCB- by Osterweil -LSB- 24 -RSB- . Although attractive , software process programming suffers from the limitation that it is often difficult to a priori 1As Frederick Brooks defines it in The Mythical-Man Month -LSB- 6 -RSB- the development of a programming system product typically involves a -LRB- varying -RRB- number of people cooperating over extended time periods specify an algorithm for an essentially human process . This may be due to the variations in the skills of the people involved -LSB- 8 -RSB- or simply because it is hard to predict all the parameters which may influence a project at some future time -LSB- 18 -RSB- . In this paper we present a technique based on explanation-based generalization to synthesize process fragments by generalizing histories of previous activities . 2 Background The idea of synthesizing a program from a trace of computations is quite old and dates back to the Autoprogrammer system developed by Biermann and Krishnaswamy -LSB- 3 -RSB- . The Autoprogrammer system was based on the idea of dividing the responsibility of program construction by assigning to a human the task of furnishing a trace of an algorithm on example problems and the system the task of generating code that is consistent with the examples . In the past decade , the idea of reusing the trace of a problem solving activity has been successfully applied by researchers in program transformation , design , and planbased problem solving in a variety of domains -LRB- e.g. , -LSB- 2 , 4 , 15 , 17 , 21 , 22 , 26 , 28 -RSB- -RRB- . Instead of generalizing a problem solving history into a program , most of these systems -LRB- with the exception of -LSB- 17 -RSB- -RRB- simply record the history of a problemsolving activity . This history is then replayed to increase the efficiency of the problem solving process in a new , analogous context . Some of the earlier replay systems -LRB- e.g. , -LSB- 28 , 21 -RSB- -RRB- do not explicitly represent the goals of each step of the process ; in such systems it is difficult to generalize a process script which can be automatically replayed in other situations and typically such systems are used for design iteration . More recent systems -LRB- e.g. , -LSB- 2 , 17 , 4 -RSB- -RRB- explicitly represent the goals of the problem-solving steps , and can obtain generalizations of a particular design history which can be used to solve several , analogous problems . In the process programming domain , the idea of viewing process programming as a mapping between between explicitly represented goals and a sequence of environment actions was first proposed by Huff and Lesser -LSB- 16 -RSB- . Their system , GRAPPLE , uses the planning paradigm for planning -LRB- constructing a sequence of actions to achieve a given goal -RRB- as well as plan recognition -LRB- inferring a plan and its goal from a sequence of actions -RRB- . The domain knowledge in GRAPPLE consists of a library of pre-defined higher level planning operators -LRB- e.g. , build a system -RRB- which can be used to map the goal of building a system to a sequence of primitive operations -LRB- e.g. , unit-check-in , check-out -RRB- . A similar plan-based program synthesis approach is described by Bhansali and Harandi to synthesize UNIX shell scripts from user defined goals -LSB- 2 , 14 -RSB- . However , for the same reasons that it is difficult to a priori specify algorithms for process programs , it is difficult to build a plan library with useful , pre-defined process plans . The approach we propose seeks to learn these plans by observing and analyzing a process history against a userdefined goal . Our approach is based on a well known learning technique called explanation-based generalization -LRB- EBG -RRB- . In particular , we were inspired by the application of EBG to the problem of learning from untutored observation -LRB- e.g. , -LSB- 25 , 29 -RSB- -RRB- . Such a learning situation enables a programmer to work unencumbered without having to articulate the rationale for each step of a process ; the system unobtrusively observes the programmer 's actions and learns by creating an explanation of how those actions satisfy a given goal . Of the several systems that learn from untutored observation , the one most similar to our work is the ARMS system developed by Segre -LSB- 25 -RSB- which learns sequences of manipulator motions of a robot arm . The algorithm described in this paper can be considered an adaptation of the algorithm used in ARMS , extended to handle a finer notion of operator -LRB- with conditional effects and different kinds of preconditions -RRB- . 3 Process Programming by Hindsight : A Motivating Ex - ample Software process models such as the Waterfall or Spiral lifecycle models , describe -LRB- and prescribe -RRB- the activities of a soft - ware project at a very general level . However , in order to embed process models in a programming environment , we have to detail out the finer activities which comprise the general activities described in such models -LSB- 12 -RSB- . For example , the high level activity of \ Understand Requirements '' can be decomposed into several finer grained activities such as read requirements document , develop annotations for the requirements document , collate the annotations , etc. . These finer grained activities , in turn , may be composed of several primitive actions which are the commands available to the environment user . A process fragment is simply a grouping of primitive actions which achieve a certain goal given certain preconditions . Given a process programming environment , most stages in a process can be characterized as belonging to one of two cases : Case 1 , in which a pre-defined process fragment is applicable to the given situation , and case 2 in which a novel situation is encountered and none of the pre-defined process fragments is applicable . In case 1 , the programmer can simply apply the relevant process fragment . In case 2 , the programmer may continue to work by using the primitive actions available in the environment . The environment keeps track of the primitive actions invoked by the user . Eventually , the programmer may realize that the situation and the subsequent sequence of actions taken is likely to be repeated in the future . The user can use this hindsight to formulate the specific goal that was achieved by his actions . From this goal and the sequence of tracked activities , the environment can help the user in creating a general process fragment which can be used in a class of situations . We introduce a simple , motivating example to illustrate process programming by hindsight ; the example will also be used later to explain our learning algorithm . Suppose there are two users U1 and U2 working off a shared pool of files , Ps . Suppose that U1 has a working pool of files , P1 , and U2 has a working pool of files , P2 . The normal mode of operation is that either U1 or U2 locks a file F1 in Ps . If U1 has locked F1 , then U1 is allowed to make modifications to his copy of F1 while U2 has a read-only copy of F1 . Ideally , when U1 has finished making his modifications , he creates a new version F ' 1 of F1 in Ps . At this point , U2 has two options : she can either continue using F1 , or check out F ' 1 from Ps . One of the ways in which this normal process can break down is when both U1 and U2 have checked out a file F1 and neither of them have locked the file . Assume that both U1 and U2 are allowed to make modifications2 to their version of F1 . However , at some point , changes made in the two versions have to be consolidated . There are two alternative approaches to achieve this : -LRB- 1 -RRB- Use the changed version of either U1 or U2 , or -LRB- 2 -RRB- Try to merge the changes made by both U1 and U2 . The steps carried out in Alternative 1 are : 1 . Login into U1 's machine . 2 . Go to pool P1 . 3 . Move F1 to F1.cp 4 . Lock F1 in Ps and obtain the shared version of F1 . 5 . Move F1.cp to F1 . 6 . Check in F1 to Ps . 7 . Login into U2 's machine . 8 . Goto P2 . 9 . Check out F1 . This is an example of a process which might be repeated quite often in situations where U1 and U2 have forgotten to lock F1 and have inadvertently made modifications to F1 . Thus , it would be useful to generalize the activity history into a process fragment , e.g. , a Unix shell script shown in figure 1 . This process fragment , call it forced-check-in , generalizes the history as follows : For each element in given set of files , it determines if the shared version of that file is different from the user 's version . If it is , then it checks if that file is locked by any user or not . If the file is not locked , then the program renames the user 's version of the file . It then checks out the shared version of the file and locks the shared copy . Finally , it moves the changed copy which it had saved in a temporary location , to be used as the latest version of the file . 2This is possible because typically version control systems can not exercise control over the users ' copy of the files which are maintained by the host 's file system . foreach file -LRB- $ argv -RRB- set lock = ` rlog ? L $ file ` if -LRB- f rcsdiff $ file > & = dev = null g -RRB- then echo $ file is same else echo $ file is different if -LRB- $ lock == $ file -RRB- then echo $ file is locked else mv $ file $ file.cp 10 co ? l $ file mv $ file.cp $ file ci ? u ? m '' '' $ file echo $ file checked?in . endif endif end Figure 1 : Example process fragment : forced-check-in 4 Explanation Based General - ization Explanation based generalization is a technique to formulate a general concept on the basis of a specific training example . There are different variations of the general EBG algorithm described in the literature -LCB- the one that we use is adapted from Dejong and Mooney -LSB- 9 -RSB- and Segre -LSB- 25 -RSB- . We first introduce some terminology from the planning and explanation-based learning literature . Objects are entities which may have certain properties and relations to other objects . A specification of all the objects and their properties and relations is termed a world state . There is a finite set of operators that map one world state into another by creating or deleting objects or modifying their properties or relations . An operator is specified by specifying the conditions under which it can be applied and its effects . A problem is specified by specifying a partial world state , called the goal state and another partial state called the initial state . A plan is a partially ordered set of operators , linked causally , and a solution to a problem is a plan , that transforms the initial problem state into a goal state . The input to the EBG algorithm is the following : ffl Goal : A specification of the goal state . ffl Initial State : A specification of the initial state of objects and their properties . ffl Domain theory : A set of inference rules and problemsolving operators that can be used to form a plan for achieving the goal state . ffl -LRB- Optional -RRB- Observed operator/state sequence : A sequence of operator applications / states which achieves an instance of the goal . Given these four inputs , the task of the EBG algorithm is to determine a plan and a generalization of the plan that achieves the goal in a general way . The EBG algorithm consists of two stages : Explain : If there is no observed operator input , construct a plan which achieves the goal state . Otherwise , build a causal explanation of how the operators in the input sequence achieve the goal . Generalize : Determine a set of conditions under which the explanation holds . This is typically done by regressing the goal through the explanation structure using a modified version of the goal-regression algorithm described by Waldinger -LSB- 27 -RSB- and Nilsson -LSB- 23 -RSB- . The conjunction of the resulting expressions determine the conditions under which the generalized plan can be used to achieve the goal . See -LSB- 9 -RSB- , -LSB- 20 -RSB- , and -LSB- 25 -RSB- for further details . These two steps can be summarized as follows : The first step creates an explanation structure that determines the relevant steps in a sequence of operations that are necessary to achieve the goal . The second step analyses this explanation to determine the constraints that are sufficient for this explanation to apply in general . Since a process history may be defined as a sequence of low-level activities , one could use the EBG approach to create an explanation of how a subsequence of an arbitrary sequence of these activities achieves a specific goal , and then generalize this explanation to create a general process fragment which would be applicable in several different situations . 5 Process model Before discussing how we adapt the general EBG algorithm to synthesize process programs , we describe the process programming domain , the representation of the primitive operators in the domain , the notion of a process history , and a formal specification of the generalization problem . The relevant objects in the process programming domains for the purposes of this paper are users , files , the set of integers , the set of text-strings , and the file-system . The file system is a rooted directed acyclic graph of files . Each file in a file system can have a finite number of versions . A condition is a formula in first-order logic and can be in one of the following forms : ffl -LRB- x -RRB- ffl OR -LRB- 1 -LRB- x -RRB- ; 2 -LRB- x -RRB- -RRB- ffl 8xff -LRB- x -RRB- where is a signed or unsigned predicate over the arguments x. All free variables in a condition are existentially quantified . A state is represented as a set of -LRB- conjunctive -RRB- conditions specifying the properties and relationships between objects . A primitive action is an operation on state si to yield state si +1 . Definition 5.1 -LRB- Primitive Action -RRB- A primitive action , A , is represented as a tuple < Ps ; Ph ; F ; O ; E ; CE > where : ffl Ps ; Ph -LRB- soft and hard preconditions , respectively -RRB- and F -LRB- filters -RRB- are conditions that must be true for A to be applicable in a given state , S . The difference between Ps , Ph , and F is as follows : if Ps -LRB- or Ph -RRB- is not true in S , then one may first create a sub-plan that transforms S into a state S0 such that Ps -LRB- or Ph -RRB- is true in S0 and then execute A , whereas if F is not true then A must be rejected , and an alternative action or plan must be found . If Ps can not be satisfied , even then A can be applied -LRB- possibly with some undesirable side-effects3 -RRB- , while if Ph can not be satisfied , A can not be applied . 3For example , the operation move -LRB- f1 ; f2 -RRB- can be applied even though f2 exists , but has the harmful side-effect of overwriting f2 . ffl O is an operation with or more arguments . ffl E -LRB- effect -RRB- is a set of conditions which are true in the state resulting from the application of A in S. ffl CE -LRB- conditional effect -RRB- is a condition-effect pair < Cc ; Ce > , such that if the condition Cc is true in state S , then the effect Ce will be true in the state resulting from the application of A . We make the simplifying assumption that a primitive action does not change the truth value of a predicate unless explicitly stated in the effects of the primitive action -LRB- this is the well-known STRIPS assumption -LSB- 11 -RSB- -RRB- . In addition , we assume that a primitive action is instantaneous and there are no other agents in the world . This allows us to model time as a sequence of discrete points , where each point corresponds to a distinct state . Definition 5.2 -LRB- Process History -RRB- A Process History is a total order < fO1 ; O2 ; ? ? ? ; Ong ; > where each Oi is an operation with non-variable arguments and is the \ temporally-precedes '' relation . Definition 5.3 -LRB- Process Fragment -RRB- A Process Fragment , P , is a tuple < P ; O ; G > , where : ffl P -LRB- pre-condition -RRB- is a set of conditions which must be true in the state for P to be applicable . ffl O is a partial order : < fO1 ; O2 ; ? ? ? ; Ong ; > where each Oi is an operation . ffl G -LRB- Goal -RRB- is a set of conditions that are true in the state resulting from the application of any total ordering of the operations comprising O. Definition 5.4 -LRB- Domain Theory -RRB- A domain theory , D is specified as a tuple < N ;P ; F ; A > , where : ffl N is a set of Objects . ffl P is a set of predicates on N . ffl F is a set of functions which take arguments from O. ffl A is a set of primitive actions . The generalization problem which we are interested in , can now be summarized as follows : Given : ffl A domain theory . ffl A goal-state -LRB- or post-condition -RRB- and an initial-state ; ffl An observed process history that is known to achieve the post-condition ; Determine : ffl A process fragment that achieves the post-condition in a general way . 6 The modified EBG algorithm The algorithm we use for generating a process fragment from a process history is an extension of the general EBG algorithm mentioned earlier , and consists of two steps : ffl Explanation construction : Construct an explanation to show how the process history achieves the given postconditions . ffl Generalization : Generalize the explanation to determine a process fragment and a set of conditions that are sufficient for the process fragment to achieve a generalized post-condition . We introduce some notation necessary to describe the explanation construction process . Definition 6.1 -LRB- Satisfies -RRB- Satisfies -LRB- ff ; -RRB- is defined recursively as follows : ffl satisfies -LRB- ff ; -RRB- ffl satisfies -LRB- 8x -LRB- x -RRB- ; -LSB- -LRB- x -RRB- -RSB- x = C -RRB- ffl satisfies -LRB- ff ; OR -LRB- 1 ; 2 -RRB- -RRB- if satisfies -LRB- ff ; 1 -RRB- or satisfies -LRB- ff ; 2 -RRB- where x denotes a set of variables and -LSB- -LRB- x -RRB- -RSB- x = C denotes a formula in which all occurrences of variables x have been replaced by constants C. Analogously , we define denies -LRB- ff ; -RRB- : Definition 6.2 -LRB- Denies -RRB- Denies -LRB- , -RRB- is defined recursively as follows : ffl denies -LRB- ; : -RRB- ffl denies -LRB- : ; -RRB- ffl denies -LRB- 8x -LRB- x -RRB- ; -LSB- : -LRB- x -RRB- -RSB- x = C -RRB- ffl denies -LRB- 8x : -LRB- x -RRB- ; -LSB- -LRB- x -RRB- -RSB- x = C -RRB- ffl denies -LRB- -LSB- : -LRB- x -RRB- -RSB- x = C ; 8x -LRB- x -RRB- -RRB- ffl denies -LRB- -LSB- -LRB- x -RRB- -RSB- x = C ; 8x : -LRB- x -RRB- -RRB- ffl denies -LRB- ff ; OR -LRB- 1 ; 2 -RRB- -RRB- if denies -LRB- ff ; 1 -RRB- and denies -LRB- ff ; 2 -RRB- Here represents an arbitrary condition . Let oei be a substitution of all free variables in the effects and preconditions of the primitive action Ai . We will use Ei to denote the effects , CEi to denote the conditional effects and PCi to denote the filter and hard preconditions of a primitive action Ai . We will describe the explanation construction algorithm using the notion of supported effects and supported preconditions of a primitive action . Informally , if an effect is supported then it can be used to infer predicates that form the preconditions of subsequent primitive actions in a process history . A precondition is supported if it can be inferred from the effects of a set of preceding primitive actions . We assume that each process history begins with a primitive action start which has no preconditions and whose effect is the INITIAL-STATE and ends with a primitive action end which has no effect , and whose precondition is the GOAL - STATE . Definition 6.3 -LRB- Supported Effect -RRB- Ei is supported if all PCi 's are supported . Definition 6.4 -LRB- Supported Conditional effect -RRB- Let < Cc ; Ce > 2 CEi . Ce is supported if all PCi 's are supported and Cc is supported . The definition of supported preconditions is based on the modal truth criterion in -LSB- 7 -RSB- . Definition 6.5 -LRB- Supported Precondition -RRB- Let C 2 PCi . C is supported if : -LRB- 1 -RRB- there exists E 2 Ej , Aj Ai , Ej is supported , Eoej satisfies Coei , OR there exists < Cc ; Ce > 2 CEj , Aj Ai , Ce is supported , Ceoej satisfies Coei , and -LRB- 2 -RRB- there does not exist E0 , Ek , such that Aj Ak Ai , E0 2 Ek , Ek is supported , and E0oek denies Coei , and -LRB- 3 -RRB- there does not exist < Cc ; Ce > ; CEk such that < Cc ; Ce > 2 CEk ; Aj Ak Ai , Ce is supported , and Ceoek denies Coei . A clobbered precondition , which refers to a precondition known to be false in a state , is defined analogously as above -LRB- substituting clobbered for supported , denies for satisfies , and satisfies for denies -RRB- . A precondition that is neither supported or clobbered is said to be unsupported . Definition 6.6 -LRB- Conditionally supported -RRB- Let E 2 Ei . E is conditionally supported if none of the PCi 's are clobbered and there is atleast one C 2 PCi that is unsupported . C is called a supporting-condition of E. Let < Cc ; Ce > 2 CEi . Ce is conditionally supported if none of the PCi 's or Cc is clobbered , and at least one of C 2 PCi or Cc is unsupported . The explanation construction algorithm can now be simply defined as determining a set of substitutions of the free variables in the primitive actions belonging to the process history , such that each condition in the goal-state is supported . The network of all the supporting links used in determining the set of supports for the goal conditions constitutes an explanation . If there is no explanation in which none of the conditions in the goal-state is clobbered , then the explanation phase fails . -LRB- Thus , an explanation is considered valid even if some of the goal conditions are not supported , as long as none of them is clobbered . -RRB- Otherwise , the explanation with the maximum number of supported goals is selected and is generalized in the second stage of the algorithm . The generalization algorithm begins with generalizing the postconditions of the problem -LRB- replacing all the constants by variables -RRB- as far as possible while ensuring the correctness of the supporting links . This algorithm is similar to the classical EBG generalization and consists of matching an expression with the effect of an operator to yield a set of substitutions ; the substitution which preserves the validity of the explanation is then applied to the preconditions of the rule to yield a new set of regressed expressions . Preconditions that are not supported are simply added to the regressed expression -LRB- with the substitutions applied to them -RRB- . The set of regressed expressions left at the end become the preconditions for the process fragment . Next , starting with the generalized preconditions , the algorithm rederives the explanation to obtain the generalized goals . See -LSB- 9 -RSB- for an explanation of why this step is necessary . Intuitively , it is needed to ensure that we do not overgeneralize the postconditions of the the problem . Finally , the EBG algorithm derives the ordering constraints between primitive actions . We will say that a primitive action Ai supports another primitive action Aj using Ei if Ei is an effect/conditional-effect of Ai that supports a precondition of Aj . The ordering constraints are determined as follows : -LRB- 1 -RRB- If Ai supports Aj then Ai Aj . -LRB- 2 -RRB- If Ai supports Aj using Ei , and there exists E0 2 Ek such that E0oe denies Ei for some substitution oe , then either Ak Ai or Aj Ak . -LRB- In planning terminology , the interval between the states just after Ai and just before Aj is called a protection interval for Ei . E0 is a conflicting action and the conflict is resolved by placing E0 either before or after the protection interval . -RRB- Once these constraints are determined , it can be used to determine a generalized process fragment in the form of a shell script . 7 The forced-check-in Example Revisited We now illustrate the application of the modified EBG algorithm to generate a process fragment for the forced-check-in example given in section 3 . We first define the domain theory , D , as follows . N is a set of variables , a set of symbols denoting users , the File System , the set of integers , and the set of arbitrary text strings . P contains the following predicates : f ile -LRB- f ; p -RRB- which is true iff f is a leaf node and p is an internal node and there is a path from p to f in the File System . locked -LRB- u ; f ; ps ; p ; n -RRB- where u is a user , f is a leaf node , ps , and p are internal nodes , n is an integer , and the nth version of f in ps can be modified only by user u. F contains the following functions : contents -LRB- p ; f ; m -RRB- whose arguments are an internal node , p , of the File System , a leaf node , f , of the file system and an integer , m , and whose output is a text string . If f does not exist under p , contents -LRB- p ; f ; m -RRB- returns a special symbol nil . last version -LRB- p ; f -RRB- which returns the last version of the leaf node f under p . We assume the availability of an ` = ' predicate for arbitrary text strings . We also assume that all versions of a file can be put into one total ordering according their creation time . Using these definitions , the set , A , of primitive actions used in our example can be described as follows . For simplicity , we ignore the soft-preconditions in this example . All lower case objects in the following are variables . Move The move primitive action renames an existing object in the object system . This primitive action can be described as : Operation : Move -LRB- f1 ; f2 -RRB- Hard Pre Condition : contents -LRB- p ; f2 ; 1 -RRB- = k2 ^ contents -LRB- p ; f1 ; 1 -RRB- = k1 ^ f ile -LRB- f1 ; p -RRB- Effect : : f ile -LRB- f1 ; p -RRB- ^ contents -LRB- p ; f2 ; 1 -RRB- = k1 ^ f ile -LRB- f2 ; p -RRB- Lock The lock primitive action , locks an object in the shared pool , with respect to a particular user and a particular pool for the user . Operation : Lock -LRB- v ; f ; ps ; n -RRB- Hard Pre Condition : -LRB- -LRB- contents -LRB- p ; f ; 1 -RRB- = contents -LRB- ps ; f ; n -RRB- -RRB- _ : f ile -LRB- f ; p -RRB- -RRB- F ilter : 8v : locked -LRB- v ; f ; ps ; n -RRB- Effect : locked -LRB- v ; f ; ps ; p ; n -RRB- Check-In The check-in primitive action checks in a file into the shared pool of files and unlocks the file in the shared pool . Operation : check?in -LRB- u ; f ; pfrom ; pto -RRB- Hard Pre Condition : f ile -LRB- f1 ; pfrom -RRB- ^ locked -LRB- u ; f ; pto ; pfrom ; m -RRB- Effect : -LRB- -LRB- contents -LRB- pfrom ; f ; 1 -RRB- = contents -LRB- pto ; f ; m + 1 -RRB- -RRB- ^ m + 1 = last version -LRB- pto ; f -RRB- -RRB- Check-Out The check-out primitive action checks out the latest version of a file from the shared pool to the specified user pool . Operation : check?out -LRB- u ; f ; pfrom ; pto ; m -RRB- Hard Pre Condition : : f ile -LRB- f ; pto -RRB- _ -LRB- -LRB- contents -LRB- pto ; f ; 1 -RRB- = contents -LRB- pfrom ; f ; n -RRB- -RRB- ^ n < = m -RRB- Effect : contents -LRB- pto ; f ; 1 -RRB- = contents -LRB- pfrom ; f ; m -RRB- ^ f ile -LRB- f ; pto -RRB- Figure 2 : The process history of the training example . S1-S5 are the states resulting after each primitive action in the history . Figure 3 : An example showing precondition-clobbering . Precondition 15 which represents a disjunction can be satisfied either by 16 or 17 . 17 has a support from effect 28 . However , this gets clobbered by effect 20 of the CHECK-OUT action , which lies in the interval from MOVE -LRB- F1 : CP ; F1 ; P1 -RRB- to LOCK -LRB- U1 ; F1 ; PS ; P1 ; M -RRB- . The correct explanation is through 16 which is supported by effect 19 of CHECK-OUT . Figure 4 : The complete explanation structure for the example . The numbers in the figure refer to conditions in figure 2 7.1 The example problem The initial state and the goal state -LRB- or postcondition -RRB- of our example problem is : GOAL-STATE : 1 . contents -LRB- P1 ; F1 ; 1 -RRB- = contents -LRB- Ps ; F1 ; M + 1 -RRB- 2 . M + 1 = last-version -LRB- Ps ; F1 -RRB- 3 . contents -LRB- P1 ; F1 ; 1 -RRB- = C INITIAL-STATE : 1 . contents -LRB- P1 ; F1 ; 1 -RRB- = C Figure 2 shows the process history containing the 5 primitive actions and the initial and goal states . Since each primitive action in the initial process history is a ground action -LRB- i.e. , having non-variable -RRB- arguments , the substitution oei is nil for most primitive actions . The substitution for the remaining variables is obtained by determining the most specific substitution needed to satisfy the preconditions of a supported primitive action . For example , the substitution f ? x = Mg is used to form a support from effect 5 to the goal condition M + 1 = last-version -LRB- Ps ; F1 -RRB- . The example also illustrates an instance of precondition clobbering shown in figure 3 . The complete explanation structure generated after the explanation stage is shown in figure 4 . There are two preconditions that are unsupported -LRB- condition 14 and 31 -RRB- . Next , the explanation is generalized using goal regression . The generalized preconditions left at the end of this step are -LRB- all lowercase arguments denote variables -RRB- : ffl 8 u : -LRB- locked -LRB- u ; f1 ; pS ; p1 ; x -RRB- ffl file -LRB- f1 ; p1 -RRB- ffl contents -LRB- p1 ; f1 ; 1 -RRB- = c The free variables in the above preconditions form the parameters for the generalized process fragment . Finally , the system generates the ordering constraints between the primitive arguments . The final process fragment < P ;O ; G > that is generated for this example is : ffl P = 8u : -LRB- locked -LRB- u ; f1 ; pS ; p1 ; x -RRB- ^ file -LRB- f1 ; p1 -RRB- ^ contents -LRB- p1 ; f1 ; 1 -RRB- = c ffl O = < fA1 ; A2 ; A3 ; A4 ; A5g , > where : A1 = MOVE -LRB- f1 ; f2 ; p1 -RRB- A2 = CHECK-OUT -LRB- u1 ; f1 ; pS ; p1 ; x -RRB- A3 = LOCK -LRB- u1 ; f1 ; pS ; p1 ; x -RRB- A4 = MOVE -LRB- f2 ; f1 ; p1 -RRB- g A5 = CHECK-IN -LRB- u1 ; f1 ; pS ; p1 -RRB- = f -LRB- A1 ; A2 -RRB- -LRB- A2 ; A3 -RRB- -LRB- A2 ; A4 -RRB- -LRB- A3 ; A5 -RRB- -LRB- A4 ; A5 -RRB- g ffl G = contents -LRB- p1 ; f1 ,1 -RRB- = contents -LRB- pS ; f1 , x +1 -RRB- ^ x +1 = last-version -LRB- pS ; F1 -RRB- ^ contents -LRB- p1 ; f1 ,1 -RRB- = c This process fragment can be used to help the programmer in deciding the conditions and command sequence for the shell script shown in figure 1 . 8 Conclusion In this paper we address one of the limitations of process programming , namely , the difficulty of a priori specifying an algorithm or plan for an essentially human process . We suggest that one way to overcome this limit is to make use of the fact that process fragments are easier to describe in hindsight rather than by foresight . We describe an adaptation of the well-known explanation based learning algorithm to synthesize a process fragment from a process history . The usefulness of the approach is demonstrated using a realistic example of co-coordinating file modifications through a version control system . The approach has certain limitations which indicate directions for future work . An obvious issue of concern is the scalability of the approach . A fundamental task in scaling up involves the need to capture a relatively complete domain theory in terms of the operators and predicates of the process programming domain . This would include the extension of the model to include negotiations between multiple agents and activities that do not necessarily involve the programming environment . The explanation-based learning algorithm generates sufficient conditions and operations for achieving a set of postconditions , and uses the input example to focus the search for an explanation . As a result , if the input sequence is not an optimal way to achieve a postcondition , the algorithm would not be able to detect this . As pointed in -LSB- 20 -RSB- , the use of an input example to focus the search for an explanation is desirable in order to formulate relevant explanations . However , we believe that a useful extension of the algorithm would be to determine an optimal explanation -LRB- using the fewest number of steps and/or fewest unsupported preconditions -RRB- that can be formed using an input history -LRB- for example in the forced-check-in process , the algorithm should be able to formulate an alternative explanation that achieves the goal state without using the CHECK-OUT operation -RRB- . Such an algorithm would also be useful in exposing bugs and hidden assumptions in a process history as well as in the underlying domain theory . 9 Acknowledgments We would like to thank the referees for their extensive comments which led to improvements in the presentation of the paper . Joe Mohan of HP Labs helped in the formulation of some early ideas . The first author would like to thank Dan Fishman , Paula Hawthorn , and Kevin Wentzel of HP Labs for creating the environment under which this work was possible . References -LSB- 1 -RSB- R. Balzer , T. E. Cheatham , and C. Green . Software technology in the 1990 's : Using a new paradigm . IEEE Computer , 16 -LRB- 11 -RRB- :39 -LCB- 45 , November 1983 . Special issue on The DoD STARS Program . -LSB- 2 -RSB- Sanjay Bhansali and Mehdi T. Harandi . Synthesis of unix programs using derivational analogy . Machine Learning , 10 -LRB- 2 -RRB- :7 -LCB- 55 , 1993 . -LSB- 3 -RSB- A. W. Biermann and R. Krishnaswamy . Constructing programs from example computations . IEEE Transac - tions on Software Engineering , 2 -LRB- 3 -RRB- :141 -LCB- 153 , September 1976 . -LSB- 4 -RSB- Brad Blumenthal . Empirical comparisons of some design replay algorithms . In Proceedings Eighth National Conference on Artificial Intelligence , pages 902 -LCB- 907 , Boston , MA , August 1990 . MIT Press . -LSB- 5 -RSB- Barry W. Boehm . A Spiral Model of Software Development and Enhancement . In Richard H. Thayer , editor , IEEE Tutorial : Software Engineering Project Management , pages 128 -LCB- 142 . IEEE Computer Society Press , 1988 . -LSB- 6 -RSB- Fredrick P. Brooks , Jr. . The mythical man-month : Essays on Software Engineering . Addison-Wesley Publishing Company , 1982 . -LSB- 7 -RSB- David Chapman . Planning for conjunctive goals . Artificial Intelligence , 32:333 -LCB- 377 , 1987 . -LSB- 8 -RSB- Bill Curtis , Herb Krasner , Vincent Shen , and Neil Iscoe . On Building Software Process Models Under the Lamppost . In Proceedings of the 9th International Conference on Software Engineering , pages 96 -LCB- 103 , April 1987 . -LSB- 9 -RSB- Gerald Dejong and Raymond Mooney . Explanationbased learning : An alternative view . Machine Learning , 1:145 -LCB- 176 , 1986 . -LSB- 10 -RSB- Edsger W. Dijkstra . A Discipline of Programming . Prentice-Hall , Inc. , Englewood Cliffs , N.J. , 1976 . -LSB- 11 -RSB- R. E. Fikes and N. J. Nilsson . STRIPS : a new approach to the application of theorem proving to problem solving . Artificial Intelligence , 2:198 -LCB- 208 , 1971 . -LSB- 12 -RSB- Pankaj K. Garg and Walt Scacchi . ISHYS : Designing an Intelligent Software Hypertext System . IEEE Expert , pages 52 -LCB- 63 , Fall 1989 . -LSB- 13 -RSB- C. Green , D. Luckam , R. Balzer , T. Cheatham , and C. Rich . Report on a Knowledge Based Software Assistant . Technical Report KES.U .83.2 , Kestrel Institute , June 1983 . -LSB- 14 -RSB- Mehdi T. Harandi and Sanjay Bhansali . Program derivation using analogy . In Proceedings of the Eleventh International Conference on Artificial Intelligence , pages 389 -LCB- 394 , Detroit , MI , August 1989 . Morgan Kaufmann . -LSB- 15 -RSB- Angela K. Hickman and Marsha C. Lovett . Partial match and search control via internal analogy . In Proceedings of the Thirteenth Annual Conference of the Cognitive Science Society , Chicago , IL , 1991 . Lawrence Erlbaum . -LSB- 16 -RSB- Karen E. Huff and Victor R. Lesser . A Plan-Based Intelligent Assistant that Supports the Software Development Process . In Peter Henderson , editor , Proceedings of the ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical Software Development Environments , pages 97 -LCB- 106 , Boston , Massachusetts , 1988 . -LSB- 17 -RSB- M.N. Huhns and R.D. Acosta . Argo : An analogical reasoning system for solving design problems . Technical Report AI / CAD-092-87 , MCC , Microelectronics and Computer Technology Corporation , Austin , TX , 1987 . -LSB- 18 -RSB- M. M. Lehman . Process Models , Process Programs , Programming Support . In Proceedings of the 9th International Conference on Software Engineering , pages 14 -LCB- 16 , April 1987 . Response to the keynote address , this conference , by Leon Osterweil . -LSB- 19 -RSB- M. M. Lehman and L. A. Belady . Program Evolution - Processes of Software Change . Academic Press , 1985 . -LSB- 20 -RSB- Tom M. Mitchell , Richard M. Keller , and Smadar T. Kedar-Cabelli . Explanation-based learning : A unifying view . Machine Learning , 1:47 -LCB- 80 , 1986 . -LSB- 21 -RSB- Jack Mostow , Michael Barley , and Timothy Weinrich . Automated reuse of design plans . International Journal for Artificial Intelligence and Engineering , 4 -LRB- 4 -RRB- :181 -LCB- 196 , October 1989 . -LSB- 22 -RSB- Jack Mostow and Greg Fisher . Replaying transformational derivations of heuristic search algorithms in DIOGENES . In Proceedings of the Case-based Reasoning Workshop , pages 94 -LCB- 99 , Pensacola Beach , Florida , May 1989 . -LSB- 23 -RSB- N. J. Nilsson . Principles of Artificial Intelligence . Tioga , Palo Alto , CA , 1980 . -LSB- 24 -RSB- Leon Osterweil . Software Processes are Software too . In Proceedings of the 9th International Conference on Software Engineering , pages 2 -LCB- 13 , April 1987 . -LSB- 25 -RSB- Alberto M. Segre . Machine Learning of Robot Assembly Plans . Kluwer Academic Publishers , Norwell , Massachusetts , 1988 . -LSB- 26 -RSB- L. I. Steinberg and T. M. Mitchell . The redesign system : a knowledge-based approach to VLSI CAD . IEEE Design & Test , 2:45 -LCB- 54 , 1985 . -LSB- 27 -RSB- R. Waldinger . Achieving several goals simultaneously . In Machine Intelligence 8 , pages 94 -LCB- 138 . Halstead and Wiley , New York , 1977 . -LSB- 28 -RSB- D. S. Wile . Program developments : formal explanations of implementations . Communications of the ACM , 26 -LRB- 11 -RRB- :902 -LCB- 911 , 1983 . -LSB- 29 -RSB- D. Wilkins , W. Clancey , and B. Buchanan . ODYSSEUS : a learning apprentice . In Proceedings of the International Machine Learning Workshop , pages 221 -LCB- 223 , Skytop , PA , 1985 . -LSB- 30 -RSB- N. Wirth . Program development by stepwise refinement . Communications of the ACM , 14 -LRB- 4 -RRB- :221 -LCB- 227 , 1971 . Contents 1 Introduction 1 2 Background 2 3 Process Programming by Hindsight : A Motivating Example 2 4 Explanation Based Generalization 4 5 Process model 5 6 The modified EBG algorithm 6 7 The forced-check-in Example Revisited 8 7.1 The example problem : : : : : : : : : : : : : 13 8 Conclusion 13 9 Acknowledgments 14

B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O B I O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

explanation-based learning
process modeling
programming environments