Organization of theory based systems5226111Abstract A method of controlling the operation of a computer database system. The method of the invention is particularly adapted for use in processing a query in a computer system which has an inference engine, query processing means, and a set of object theories and metatheories. The method includes providing a system theory to define coupling relationships between the object theories and metatheories, selecting an object theory and associated metatheories according to the system theory in dependence on parameters of a query to be processed, and processing the query by the theories so chosen. The coupling relationship may be an interpreter, an assimilator or an attribute metatheory. Claims What is claimed is: Description The present invention relates to the organization of theory-based systems and, more particularly, to the organization of a logic programming system or knowledge representation and management system based on logic programming, which incorporates a provability interface to multiple modules, databases or theories.
______________________________________
An example of the
form of statements in the system theory is shown below:
Theory
Name Theory Interpreter
Assimilator
Attribute
______________________________________
"theory"
(calc, T.sub.1,
prologInt,
prologAss,
none)
"theory"
(calc, T.sub.1,
calcInt prologAss,
none)
"theory"
(calcInt,
T.sub.2,
prologInt,
prologAss,
none)
"theory"
(calcInt,
T.sub.2,
prologInt,
calcAss,
none)
"theory"
(calcAss,
T.sub.3,
prologInt,
prologAss,
none)
"theory"
(system, T.sub.4,
prologInt,
prolog Ass,
none)
______________________________________
In each of the five place statements in the system theory, the first place is filled by a theory name. The second item in each of the "theory" statements is the object theory named in the first item. In this embodiment, the second place is filled by the theory itself, not just an address where the theory can be found. The third, fourth and fifth items are the names of the relevant interpreter, assimilator and attribute theories respectively. Where the interpreter, assimilator or attribute theory is not the basic interpreter, assimilator or attribute theory (prolog-Int, prologAss, none respectively--the built-in attribute theory is called `none` which names the empty theory), an entry for that metatheory also appears as a statement in the system theory. This enables the appropriate metatheory to be accessed. The system therefore supports arbitrary levels of interpretation to be introduced in handling a query--an interpreter is found by querying the system (that is, the system theory), and then this interpreter is interpreted by another interpreter found by querying the system and so on. Such a sequence of metatheories must of course terminate eventually. This achieved by defining a built-in set of metatheories, "prologInt", "prologAss" and "none" and ensuring that every sequence of metatheories terminates in the appropriate built-in metatheory. A sequence can of course call one or more of the built-in metatheories directly. The system theory contains other statements governing the resolution of theory names. For example, there could be two five-place statements in the system theory which have the same theory names (although the object theories will be different) and further statements in the system theory for resolving the theory names. For example, there could be two entries for a theory named "tax", each having the same set of three named metatheories, although one of the tax theories is for 1989 calculations and the other for 1990 calculations. The system theory will have other statements permitting inferencing about which tax theory to select on the basis of the parameters given in the query. Instead, or as well, information in the system attribute theory may be used for resolving theory names eg. information such as who wrote a theory and when. The system theory also contains rules governing how metatheories are selected. For example, the `calc` theory may be for calculating the prime factors of a given number and the system theory may contain a rule specifying that when the given number is greater than a certain threshold the calcInt interpreter should be used, otherwise the prologInt interpreter should be used. The present system thus provides a new and improved technique for resolving theory names and for defining metatheories for each theory allowing the selection among a plurality of theories in dependence on circumstances defined by the particular query. The system theory contains a statement for every theory in the system and therefore contains an entry for itself (shown as the last statement above). FIG. 4 depicts the way in which the system theory references the theories in the system. An example of a system theory is appended as Appendix A. Each five-place statement begins with "theory" and each actual object theory is prefaced by a hash symbol. FIG. 2 shows the main components of a system 35 according to the present invention. Hardware 40 may comprise a model from the 300, 400 or 800 series of the Hewlett-Packard HP9000 family of computers, an HP3000, 900 series or an IBM-AT compatible PC; operating system software 42 such as the UNIX operating system, the MPE/XL operating system or the OS/2 operating system, depending on the platform used; interpreter software 44 comprising a Prolog interpreter; a knowledge base management system (KBMS) 46 according to the present invention comprising a knowledge base 48; query interface software 50 for translating input queries into a form which can be processed by the system 35. The query interface software 50 may comprise a query interface theory which can convert a standard database query language into an appropriate form for querying any of the other theories in the system. The KBMS 46 comprises at least one system theory defining a knowledge base 48. It is possible for the KBMS to contain a plurality of independent system theories and/or theories which are independent of the or each system theory. Whenever a query is made in a named theory, that theory must be located via the system theory. This is achieved by querying the system, by means of a predictate interface which is standard for all theories. This interface operates in the underlying knowledge base management system (KBMS) 46 and takes a theory name and a set of goals: prove(System,TheoryName,Goals). The system theory is consulted to resolve the name of the theory and the name of its interpreter. If there is more than one interpreter for the named theory, then inference within the system is used to choose between them. The KBMS then attempts to prove that the interpreter can solve the goals (if an interpreter is required for the interpreter, recursion occurs until the built-in interpreter is reached). The use of interpreters specific to individual theories can increase the efficiency of proving goals, since the proof techniques can be matched to the specific domains of the various theories, using appropriate syntactic and semantic constraints in inference control. The implementation of a system written in Prolog will not be described in detail since this forms part of the knowledge of the average skilled person in the field of logic programming. However, an outline will be given. A prolog system can essentially be implemented using a simple stack model. The whole nature of theorem-proving using the Prolog depth-first, left-to-right, backtracking form of resolution lends itself to being realized using a stack at the centre of the implemented system. A step of inference proceeds through four basic steps: goal selection, where the next goal from the set of outstanding goals to be satisfied is selected--in Prolog this is simply the goal at the top of the goal stack; clause selection, where a clause is selected from the relevant procedure in the relevant part of the knowledge base--this clause must have a head that is (or potentially is) unifiable with the goal selected; unification, where the goal selected and head of the clause selected are unified; combination of subgoals, where all the goals in the body of the clause selected are pushed onto the top of the goal stack. Thus it would appear that a single stack is sufficient to implement a Prolog system--a control stack where the set of outstanding goals to be satisfied in the computation are kept, and where the requirements of the system treat this purely as a LIFO (last-in, first-out) stack. However, on inspection it transpires that a second stack is necessary to retain terms which are bound to variables and would be popped off the control stack if the one-stack model were used. The second stack, the copy stack, is therefore introduced to act as the store for any such terms which would otherwise be lost. A third stack is also necessary to ensure that state can be faithfully restored on the copy stack during backtracking. A fuller explanation of these stacks, and Prolog implementation in general, may be found in "Implementing Persistent Prolog", Coulomb, RM, Ellis Hardwood 1990, ISMB 0-13-453531-6. In accordance with the present invention, for all incoming queries, theory names are resolved and the appropriate metatheories are selected using the system theory before the query is processed. Since the invention is used in implementing a flexible query (provability) and assimilation (updating) interface to a logic programming system (KBMS), the invention can be implemented by means of a Prolog program fragment implementing this facility. Such a program with statements in first-order logic thus forms a detailed embodiment of the invention. (The implementation of theories within Prolog is straightforward and not described here). The following description is in the form of a particular predicate theory (the system theory) which relates theory names to theories to interpreter names, assimilator names and attribute names. The system theory contains, interalia, a 5-place predicate "theory" relating a theory name TheoryName with a theory Theory, an interpreter theory name IntName, an assimilator theory name AssName and an attribute theory name AttrName. A formal definition in first-order logic of the meaning of "prove" and "update" is as follows. Clauses defining the conditions under which particular associations apply are represented within the system theory. The system theory is used during the first stage of query and update handling and specified in the third (prove) and fifth (update) predicates.
______________________________________
prove (System, system, Goals):- interpretTheory
(Clause 1)
(System, Goals).
prove (System, prologInt, interpret (TheoryName,
(Clause 2)
Theory AttrName, Goals):-
interpretTheory (Theory, Goals).
prove(System, TheoryName, Goals):-
(Clause 3)
prove(System, system, theory(TheoryName, Theory, IntName,
AssName, AttrName).
prove(System, Intname, interpret(TheoryName, Theory,
AttrName, Goals).
update(System, TheoryName, Clauses, NewSystem, NewTheory):-
prove(System, system, theory(TheoryName, Theory, IntName,
AssName, AttrName))
prove(System, AssName, assimilate(System, Theory, AttrName,
Clauses, NewTheory), updateSystem
(System, TheoryName, Theory, New Theory, NewSystem).
______________________________________
The meaning of these predicates, variables and functions is as follows: 1) "prove(System,TheoryName,Goals)" is true if the goal (or query) "Goals" is provable in the theory named "TheoryName", where the system theory "System" defines the naming relationships (i.e. which name names which theory, interpreter, assimilator, attributes). In the case given, the clauses restrict the system theory's interpreter to being Prolog--like (the built-in interpreter). 2) "update(System,TheoryName,Clauses,NewSystem,NewTheory) is true if the clauses "Clauses" are added to the theory named "TheoryName" in the system theory "System" to produce the new theory "NewTheory" and the new version of the system containing "NewTheory", "NewSystem". "NewSystem" is created from "System" in such a way that "TheoryName" now names the new theory. 3) "IntName", "AssName" and "AttrName" represent the names of a theory's interpreter, assimilator and attributes (see above) respectively. 4) "interpret(TheoryName,Theory,AttrName,Goals)" is true if the compound goal "Goals" is provable in the theory "Theory" having name "TheoryName" and an attribute theory named "AttrName". 5) "assimilate(System,TheoryName,Theory,AttrName,Clauses, NewTheory)" is true if the clauses "Clauses" can be added to the theory "Theory" to yield a new theory "NewTheory" given "AttrName" and the system theory "System". 6) "interpretTheory(TheoryName,Goals)" is true if the goal "Goals" is provable using the Prolog-like proof procedure. 7) "updateSystem(System,TheoryName,Theory,NewTheory, NewSystem)" is true if the system theory "NewSystem" differs from the system theory "System" by having the theory "NewTheory" associated with the theory name "TheoryName" instead of the theory "OldTheory". A specific example of the operation follows. We suppose that we want to find the 8th term of the Fibonacci series, using a function "fib" by which we have defined the series.
______________________________________
The system theory comprises the following statements:
______________________________________
theory (system, Theory,
<- system(Theory) & true
prologint, prologAss, none)
theory (fib, theory-a80f8,
<- true
prologint, prologAss, none)
theory (lemma, theory-a8510,
<- true
prologint, prologAss, none)
theory (fibbattr, theory-a8638,
<- true
prologint, prologAss, none)
theory (fibl, theory-a8734,
<- true
lemma, prologAss, fibattr)
theory (myprove, theory-a8bd8,
<- true
prologint, prologAss, none)
theory (myprove, theory-a8bd8,
prologint, prologAss, none)
<- true
______________________________________
Reference numbers for the relevant theories appear in the second
places in each statement for the purpose of this description, in
actuality the whole Theory term resides in those positions.
______________________________________
The query is:
prove (System, fib, fib(8, N))
______________________________________
The steps in the prove process are shown below:
______________________________________
clause 3 (call): prove(theory-a8f84, fib, fib(8, N))
C1
clause 1 (call): prove(theory-a8f84, system, theory(fib,
C2
Theory, IntName, AssName, AttrName))
clause 1 (call): interpretTheory(theory-a8f84, theory(fib,
C3
Theory, IntName, AssName, AttrName))
clause 1 (exit): interpretTheory(theory-a8f84, theory(fib,
E3
theory-a80f8, prologint, prologAss, none))
clause 1 (exit): prove(theory-a8f84, system, theory(fib,
E2
theory-a80f8, prologint, prologAss, none))
clause 2 (call): prove(theory-a8f84, prologint, interpret(fib,
C4
theory-a80f8, none, fib(8, N))
clause 1 (call): interpretTheory(theory-a80f8, fib(8, N))
C5
clause 1 (exit): interpretTheory(theory-a80f8, fib(8, 34))
E5
clause 2 (exit): prove(theory-a8f84, prologint, interpret(fib,
E4
theory-a80f8, none, fib(8, 34))
clause 3 (exit): prove(theory-a8f84, fib, fib(8, 34))
E1
______________________________________
On the left hand side is indicated the relevant clause of the "prove" predicate and whether the clause is being called or exited (i.e. with the relevant variables instantiated). The nesting of the calls is indicated on the right hand side where C indicates call and E indicates exit. In the first call, the "prove" predicate is invoked. In the second call, "prove" is used to look for the theory which is needed to deal with the function "fib", together with the appropriate metatheories. To achieve this, a third call has to be made to satisfy "interpretTheory". This third call returns the theory for "fib" and the appropriate metatheories and these are returned in the exit from the second call. The fourth call attempts to satisfy the Fibonacci function itself. This involves the fifth call, which reaches the Fibonacci theory (identified by fib) and returns the answer to the fourth call, which then makes the final return with that answer. The answer is declared in the answer to the first call. In terms of the formal definitions given above, the second call proves the first subgoal of clause 3 and the third call proves the first clause, the fourth call proves the third clause of subgoal 2 and the fifth call proves the second clause of that subgoal. In another example, suppose we wish to update the theory fib by including the fact that the first negatively-indexed Fibonacci number is zero.
______________________________________
The system theory comprises the following statements:
______________________________________
theory(system, Theory, prologInt,
<- system(Theory) & true
prologAss, none)
theory(fib, theory-aa12c, prologInt,
<- true
prologAss, none)
theory(lemma, theory-a86bc,
<- true
prologInt, prologAss, none)
theory(fibattr, theory-a87e4,
<- true
prologInt, prologAss, none)
theory(fibl, theory-a88e0, lemma,
<- true
prologAss, fibattr)
theory(myprove, theory-a8d84,
<- true
prologInt, prologAss, none)
theory(prologAss, theory-a94d8,
<- true
prologInt, prologAss, none)
nil
______________________________________
The steps in the "update" process are shown below:
______________________________________
clause 1 (call): myupdate(theory-a96ac, fib, assert(fib(-1,
C1),
nil, S7, NT)
clause 1 (call): prove(theory-a96ac, system, theory(fib,
C2eory,
IntName, AssName, AttrName))
clause 1 (call): interprettheory(theory-a96ac, theory(fib,
C3
Theory, IntName, AssName, AttrName))
clause 1 (exit): interpretTheory(theory-a96ac, theory(fib,
E3
theory-a82a4, prologInt, prologAss, none))
clause 1 (exit): prove(theory-a96ac, system, theory(fib,
E2
theory-a82a4, prologInt, prologAss, none))
clause 3 (call): prove(theory-a96ac, prologAss, assimilate
C4
(theory-a96ac, theory-a82a4, none, assert(fib(-1, 0)),
nil, NT))
clause 1 (call): prove(theory-a96ac, system, theory(prologAss,
C5
Theory, IntName,, AssName, AttrName))
clause 1 (call): interpretTheory(theory-a96ac,
C6
theory(prologAss, Theory, IntName, AssName, AttrName))
clause 1 (exit): interpretTheory(theory-a96ac,
E6
theory(prologAss, theory-a94d8, prologInt, prologAss, none))
clause 1 (exit): prove(theory-a96ac, system, theory(prologAss,
E5
theory-a94d8, prologInt, prologAss, none)
clause 2 (call): prove(theory-a96ac, prologInt,
C7
interpret(prologAss, theory-a94d8, none,
assimilate(theory-a96ac, theory-a82a4, none,
assert(fib(-1, 0)), nil, NT))
clause 1 (exit): interpretTheory(theory-a94d8,
E8
assimilate(theory-a96ac, theory-a82a4, none,
assert(fib(-1,0)), nil, theory-aa12c))
clause 2 (exit): prove(theory-a96ac, prologInt,
E7
interpret(prologAss, theory-a94d8, none, assimilate
(theory-a96ac, theory-a82a4, none, assert(fib-1, 0)), nil,
theory-aa12c))
clause 3 (exit): prove(theory-a96ac, prologAss,
E4
assimilate(theory-a96ac, theory-a82a4, none,
assert(fib(-1, 0)), nil, theory-aa12c))
clause 1 (call): updateSystem(theory-a96ac, fib, theory-a82a4,
C9
theory-aa12c, S7)
clause 1 (exit): updateSystem(theory-a96ac, fib, theory-a82a4,
E9
theory-aa12c, theory-aa1f4)
clause 1 (exit): myupdate(theory-a96ac, fib, assert(fib(-1,
E1),
nil, theory-aa1f4, theory-aa12c)
______________________________________
Again on the left hand side is indicated the relevant clause of the "prove" or "update" predicate (the "update" predicate has only one clause) as appropriate and whether the clause is being called or returned. Again the nesting of the calls is shown on the right hand side. The overall goal to be satisfied is attempting to add the clause fib(-1,0) to the procedure fib/2 in the theory named "fib" in the system theory represented by the descriptor "theory.sub.-- a92ec". The succession of "calls" and "exits" achieve this satisfaction by the following process: 1) clause 1 of the "update" predicate is invoked (there is only one clause in this procedure). 2) clause 1 of the "prove" predicate is invoked in an attempt to locate the theory named "fib" in system theory "theory.sub.-- a92ec". 3) a subgoal (interpretTheory) of that clause of "prove" is invoked which exits with its Theory, IntName, AssName, AttrName variables all instantiated to the required terms. 4) clause 1 of the "prove" predicate exits successfully. 5) now that the assimilator of "fib" is known (prologAss) it is invoked via a call to "prove" to achieve the required update. 6) this causes the third clause of "prove" to be invoked in an attempt to find the theory associated with then name "prologAss" and then to attempt satisfaction of the required update. This clause of "prove" has two subgoals which attempt to perform these two tasks. 7) the first subgoal invokes "prove" to locate "prologAss", which in turn invokes "interpretTheory". "prologAss" is successfully found as well as the name of its interpreter. 8) "prove" is further invoked to attempt a satisfaction of the update (assimilation) by proving using "prologAss"'s interpreter (prologInt) that the assimilation is satisfiable. 9) this causes the system theory to be searched again for the theory corresponding to the name "prologInt". 10) this is a special case of "prove" since "prologInt" is the built-in interpreter. This case is trapped by the second clause of "prove". 11) the assimilation is successfully completed (the exit of clause 3 of "prove"). 12) the final stage is to update the system theory "theory.sub.-- a92ec" the one in which all the dereferencing of names has occurred. "updateSystem" is invoked which causes variable S7 to be bound to the updated system theory "theory.sub.-- a9d6c". The result of this satisfaction is that if "fib" is dereferenced in the first system theory "theory.sub.-- a92ec", then the clause "fib(-1,0)" is not part of the procedure fib/2. If it is dereferenced in "theory.sub.-- a9d6c" then fib(-1,0) is part of fib/2. The present system extends the declarative Prolog style, as used in individual theories, to the incorporation of an organisation of theory-to-theory relationships. This is in contrast to the prior systems, in which theory-to-theory relationships are implemented in a manner which is more implicit. Each of these types of relationship can be a many-to-many relationship. For example, a given theory can have more than one interpreter. (if this is the case it is necessary to perform inference within the system each time this theory is invoked to determine which interpreter is appropriate at this time--probably on the basis of the goal that has to be proved.) All these relationships are dynamic. Successive versions of a system theory can have existing relationships updated and new relationships added. The relationships do not need to be specified in the system theory as facts; they can equally well be specified in rules of arbitrary complexity. The only fixed relationship is that the system theory's interpreter is the built-in interpreter. For each theory, the system theory holds a relationship statement between that theory and other theories associated with it; that is, all relationships between theories are explicitly represented in the form of a set of logical statements by the system theory. It is convenient for the relationship statement to define various distinct forms of association or relationship, so that the types of relationship of a theory to other theories are automatically determined; in other words, there are distinct types of relationship between a theory and an interpreter theory, an assimilator theory and an attribute theory. It will however be realised that differences between the various types of relationship are only defined by the structure of the system itself to the extent that each type of relationship has a specific place (first, second, etc) in the relationship statement. The choice of which place is used to give a relationship with an interpreter theory, which with an assimilator theory and which with an attribute theory is arbitrary and to a large extent a matter of interpretation, though of course the choice, once made, must be the same for all theories. As we have seen, the ability to query the system as a theory enables selection of particular entities (such as an interpreter) on the basis of information contained in the query. It also readily supports arbitrary levels of interpretation to be introduced in handling a query--an interpreter is found by querying the system (that is, the system theory), and then this interpreter might be interpreted by another interpreter found by querying the system. The present invention also has advantages concerning the updating of theories. All operations on theories, including updating, are declarative and hence free of side-effects. Every update to a named theory produces a new theory. Since both are part of the system theory, a new system will also result. Hence access to all versions of all theories is potentially possible. The update model used in the present system is completely declarative. This means that any update to (addition to or subtraction from) a theory results in a new theory. Both the new version and the previous version are accessible as long as references to both still exist. This can be achieved with very little overhead cost in time and space by arranging for versions of a theory to share all common data. FIG. 3 depicts the updating of a theory named TN and can be summarised: Update (S.sub.1, TN, Updates, S.sub.2, T.sub.2) The corresponding statements in the system theories named S1 and S2 are shown below: theory (system, System 1, I, AS, AT) theory (TN, (T.sub.1), I, AS, AT) theory(system, System 2, I, AS, AT) theory (TN, (T.sub.2) I, AS) The manner in which the relationships between the various theories are held in the present system allows the relationships between the theories and the population of the theories to change with time. For example, it may be desired to investigate the effects of various changes of exchange rate. To this end, a financial theory (not shown) may be constructed which defines the manner in which discounts are determined. A series of queries may be directed to this financial theory and these may cause the setting up of a series of distinct discount theories (not shown), one for each possible exchange rate being considered. The system theory operates to keep track of these different discount theories, which are of course mutually inconsistent. (A simpler example is when a theory is updated; the system then includes the old theory and the new (updated) one). The system then exists in a considerable number of distinct versions, corresponding to the different possible exchange rates being considered or to successive periods of time and the appropriate version has to be selected for any particular query It will be appreciated that the present invention has been described with reference to a particular embodiment in which the system theory has clauses of a five-place predicate defining the organisation of theories in the system. It is possible for different theory organisations to be defined by the system theory in which the system theory has n-place statements defining theory relationships where n is greater than or equal to three i.e. places for the theory name, the theory itself and at least one metatheory.
APPENDIX A
__________________________________________________________________________
fib.pl loading . . .
fib.pl loaded.
lemma.pl loading . . .
lemma. pl loaded.
fibattr loading . . .
fibattr loaded.
fib.pl loading . . .
fib.pl loaded.
myprove loading. . .
myprove loaded.
prologAss.pl loading . . .
prologAss.pl loaded.
The System Theory
theory(system, Theory, prologInt, prologAss, none) <-
system(theory) & true.
theory(fib, #fib(0, 1) <- true.
fib(1, 1) <- true.
fib(N, M3) <-
N > 1 &
M is N - 1 &
M1 is N - 2 &
fib(M, FM) &
fib(M1, FM1) &
M3 is FM + FM1 & true.
nil
, prologInt, prologAss, none) <- true.
theory(lemma, #interpret(TheoryName, Theory, AttrName, Goals) <-
call(Theory, Goals) & true.
nil
, prologInt, prologAss, none) <- true.
theory(fibattr, #uniqueSoln(fib(X, .sub.-)) <-
ground(X) &
! & true.
nil
, prologInt, prologAss, none) <- true.
theory(fibl, #fib(0, 1) <- true.
fib(1, 1) <- true.
fib(N, M3) <-
N > 1 &
M is N - 1 &
M1 is N - 2 &
fib(M, FM) &
fib(M1, FM1) &
M3 is FM + FM1 & true.
nil
, lemma, prologAss, fibatttr) <- true.
theory(myprove, #myupdate(System, TheoryName, Clauses, NewSystem,
NewTheory) <-
write('clause 1 (call): ') &
write(update(System, TheoryName, Clauses, NewSystem, NewTheory)) &
nl &
myprove(System, system, theory(TheoryName, Theory, IntName, AssName,
AttrName)) &
myprove(System, AssName, assimilate(System, Theory, AttrName, Clauses,
NewTheory)) &
updatesSystem(System, TheoryName, Theory, NewTheory, NewSystem) &
write('clause 1 (exit): ') &
write(update(System, TheoryName, Clauses, NewSystem, NewTheory)) &
nl & true.
updateSystem(System, TheoryName, Theory, NewTheory, NewSystem) <-
write('clause 1 (call): ') &
write(updateSystem(System, TheoryName, Theory, NewTheory, NewSystem)) &
nl &
update(system, replace(theory(TheoryName, Theory, IntName, AssName,
AttrName) <- true,
theory(TheoryName, NewTheory, IntName, AssName, AttrName) <- true) . nil,
System, NewSystem
write('clause 1 (exit): ') &
write(updateSystem(System, TheoryName, Theory, NewTheory, NewSystem)) &
nl & true.
interpretTheory(T, G) <-
write('clause 1 (call): ') &
write(interpretTheory(T, G)) &
nl &
call(T, G) &
write('clause 1(exit): ') &
write(interpretTheory(T, G)) &
nl & true.
myprove(System, system, Goals) <-
write('clause 1 (call): ' ) &
write(prove(System, system, Goals)) &
nl &
interpretTheory(System, Goals) &
write('clause 1 (exit): ') &
write(prove(System, system, Goals)) &
nl & true.
myprove(System, prologint, interpret(TheoryName, Theory, AttrName,
Goals)) <-
write('clause 2 (call): ') &
write(prove(System, prologInt, interpret(TheoryName, Theory, AttrName,
Goals))) &
nl &
interpretTheory(Theory, Goals) &
write('clause 2 (exit): ') &
write(prove(System, prologInt, interpret(TheoryName, Theory, AttrName,
Goals))) &
nl & true.
myprove(System, TheoryName, Golas) <-
write('clause 3 (call): ') &
write(prove(System, TheoryName, Goals)) &
nl &
myprove(System, system, theory(TheoryName, Theory, IntName, AssName,
AttrName)) &
myprove(System, IntName, interpret(TheoryName, Theory, AttrName, Goals))
write('clause 3 (exit): ') &
write(prove(System, TheoryName, Goals)) &
nl & true.
nil
, prologInt, prologAss, none) <- true.
theory(prologAss, #assimilate(.sub.-, T, .sub.-, nil, T) <- true.
assimilate(S, T, .sub.-, assert(C) . Rest, NT) <-
normalize(C, NC) &
assertz(T, T1, NC) &
assimilate(S, T1, .sub.-, Rest, NT) & true.
assimilate(S, T, .sub.-, retract(C) . Rest, NT) <-
normalize(C, NC) &
retract(T, T1, NC) &
assimilate(S, T1, .sub.-, Rest, NT) & true.
nil
prologInt, prologAss, none) <- true.
SUCCESS
INTERPRET TIME: 640 ms
INFERENCE STEPS: 243
__________________________________________________________________________
|
Same subclass Same class Consider this |
||||||||||
