The Poplog Prolog compiler maintains two different forms of procedure compiled from a predicate definition. In the first form, called the static form, all the clauses in the definition are compiled into a single procedure. In the second form, the dynamic form, a separate procedure is compiled for each clause and a special "interpreting" procedure is used to execute each of these clause procedures in turn. A given predicate can be compiled in either form, but the static version will run considerably faster than its dynamic equivalent. The reason for the dynamic form is that it supports the operations of assert and retract: individual clause procedures can be added or removed from the set of clauses associated with a predicate without disruption.
Mark
--
You received this message because you are subscribed to the Google Groups "Shen" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qilang+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/qilang/355fd599-bc12-4c9e-8a63-4ecc5c01ee7dn%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Shen" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qilang/xV0AXFrckjg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qilang+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/qilang/850eb541-7a4a-4a5e-833a-2d8fd8c2d54dn%40googlegroups.com.
The FTP has the same ability as the PTTP to compile theories into code and uses similar technology wrt contrapositives except that the compiler is set up to handle sequents and not simple goals. Like the PTTP a background theory can exist in compiled form prior to SOLVE accepting a problem and this allows for fast execution. However unlike the PTTP CHAIN has to cope with assumptions thrown at it by the action of SOLVE. An analogy to the execution of functional programming will help understanding the relations involved.
A functional program is executed in a global environment which exists between computations and is permanent (unless overwritten by the user). This global environment maintains associations between symbols and the functions attached to them. In addition to the global environment there is a succession of local environments which are dynamically created by user input and which maintain temporary information concerning the association of variables with data structures.
A similar situation exists with CHAIN. The global environment is the theory compiled at compile time and the local environment is the list of props that are handed down from SOLVE as the assumptions needed to solve a goal. Indirect chaining augments these assumptions as it works backwards to solve the goals. These local assumptions are only in play for as long as it takes to solve the problem. When computation ends, the global environment still exists but the local assumptions must vanish.
The most direct way to do this in Prolog would be through assert and retract [??]. However Shen Prolog lacks these features, nor can they be plausibly added to a Prolog implementation that lacks dynamic predicates [??]. Instead the reasoning in the local assumptions was carried out by a Prolog interpreter which talks with the global compiled theory.
Mark