Gkc defines a function and three predicates on distinct symbols:
Why the negation and contradiction? This is just a convenient way to simplifythe problem. Here we really want to prove a & b => a. This is trueif and only if -(a & b => a) is false. Now, the last formula is equivalent to a & b & -a. Thus the input facts and rules stay as they are, and we only negate the conclusion to be proved.To summarize, givinga goal to be proved from axioms (i.e. known facts / rules) as a negated statement is just a convenient way to organize proof search and there is nothing reallyspecial about it.
Notice that each statement in the input file is terminated with a period sign.The list of statements is assumed to be a conjunction (and) of all statements. Minus sign - means negation. Thus -father(john,pete) means john is NOT the father of pete.
The order of statements is not really important, although it may cause minorand essentially unpredictable differences in search behaviour. Essentially, gkccreates and tries out its own search strategies, like SQL databases. It does notfollow a pre-determined predictable search strategy like PROLOG.
The [mp, 1, 2] (not exactly present in this proof) means that this fact / rule was derived by modus ponens (i.e. the resolution rule)from previous steps 1 and 2. More concretely, the first literals of both were cut off andthe rest were glued together.
The Resolution (logic) wiki page is a good short intro to the general principles of the derivation rules with the course materials of Geoff Sutcliffe being a suitable continuation towards deeper understanding. However, the following examples are understandable without in-depth theoretical background.
Although the task is trivial, gkc does not attempt to be clever and tries out a large numberof search strategies: this is why it takes a second to terminate. You can try running gkcwith the optional switch producing more information to see the whole process: clickon the Advanced button and select a higher print level or set the Show derivedto on
We are using a variable here: any word starting with a capital letter is consideredto be a variable. X is a variable in our example. You could also use, say Somethingas a variable: it also starts with a capital letter. All the words starting witha non-capital letter are constants, functions or predicates.
The [mp, 1.2, 2, fromaxiom] means that the 2th (numeration 0,1,2,...) literal in the clause at proof step 1 was cut off with the first (0th) literal of the clause at proof step 2. In case the first literal is cut off,the N.0 is simplified to N, as in the previous examples.
father(john)=pete means, as expected, that pete is the fatherof john and there can be no other fathers. If you also gavefather(john)=lucas this would make gkc to conclude thatpete and lucas are the same object, i.e. pete=lucas.
Importantly, two different constants are not considered inequalby default (think of the constants as labels on objects: there couldbe several different labels on one object):a=b does not give a contradiction.
See that gkc was happily answering father(mark) although we havenot said who the father of mark actually is! The functions like father do not have to be defined on all the possible objects, they can be partiallyknown and partially unknown.
The "strategy": ["negative_pref"] indicates that one specificstrategy (here a conventional negative-preference ordered binary resolution)is to be used for proof search, without any parallel or sequential attemptswith different search strategies.
The proof uses given equalities to derive several new equalities.The = rule basically replaces parts of one premiss matching (unifying)one side of the second premiss equality with the other side of the equality.
It is a good idea to click on the Advanced button and enter a sensibletime limit to the Seconds box.p(a).-p(X) p(f(X)). Example with a hard problemAs an example of a small but a really hard problem for gkc which isnevertheless actually provable, try the problem LCL876+1from the TPTP collection.It will probably run until the browser complains badly or time given by the automatic strategy selection runs out.
The goal is to find a sequence of robot arm movements to producea required configuration of blocks: for example, a tower. The commentsin the problem text explain the initial situation and the arm movementrules.
You can put whitespace or any symbol (single quotes inside quotedsymbols must be prefixed by a backslash) into symbols by surrounding the symbol with single quote symbols like this: 'John \'Smith\'!' which is treated as a constant, despite thatit starts with a capital letter inside the quotes.Any symbol containing a character except an ascii letter, digit, underscore _,or dollar $ will be printed out by surrounding it with single quotes.As an exception in gkc, equality = and conveniece infix forms ofarithmetic expressions +, *, -, /, will not be surrounded by quotes.
Double quotes like "John Smith" indicate thata symbol is distinct, i.e. unequal to any other distinct symbol,number or a typed object. Double quotes inside double quoted symbols mustbe prefixed by a backslash. More about distinct symbols in the later examples.
Additionally gkc allows to make a symbol variable by prefixing it with a questionmark like this: ?smth. Any symbol starting with a capital letter or a question mark is assumed to be a variable, and the rest are not.
Thus, for gkc in fof formulas a capital-letter-starting symbol is a free variable even ifit is not explicitly quantified: since this could be confusing, itmay be better to avoid such symbols unless they are explicitly quantified.
This example is a classic "Schubert's Steamroller" puzzle taken fromTPTP and written in fof syntax with connectives like implication as =>, quantifiers for all as ! [X] ..,, exists as ? [X] ... etc. The full list of infix binary connectives follows the TPTP language:
Gkc will first convert the complex formulas to a simple clause form (properly calledclause normal form) used in the previous examples. The statements we had in theseexamples are called clauses.
where the statement name will be used in the proof, the statement role indicates whetherit is an axiom, an assumption or hypothesis, or a goal to be proved from these: the latter is eitherconjecture (which has to be negated) or negated_conjecture (negated already).
The first formula in the example is universally quantified (! symbol)and will be converted by gkc to a clause -wolf(X) animal(X)..The second statement is existentially quantified (? symbol) and will be converted by gkc to a clause wolf($sk7).where $sk7 is a new constant invented by gkc which should not occur in any other formula in the problem:this procedure is called Skolemization.Gkc always uses the $sk prefix for such constants and functions, using a new number Nfor each new one. The original formula is assumed not to contain $skN form symbols.
c80f0f1006