zeus). Define CLAUSES (“X is true if Y and Z are true”). ancestor(A, B) :- parent(A, B). ancestor(A, C) :- parent(A, B), ancestor(B, C). “facts” = clauses with no conditions. ?- ancestor(P, athena). P = zeus. P = chronos. P = rhea. Use CLAUSES to solve GOALS (or QUERIES):
| G or G | exists<T> { G } D ::= A | A :- G | D and D | forall<T> { D } (zeus) An “atom” A (zeus). A clause D ::= A (X) :- (X). A clause D ::= forall<X> { … }
or G | exists<T> { G } Prove an atom A using clauses given by the user. Proving these other goals is “built in”. (D, {(G1 and G2)}, Θ) (D, {G1, G2}, Θ) (D, {(G1 or G2)}, Θ) (D, {G1}, Θ) (D, {G2}, Θ) Same as when proving an atom against many program clauses.
or G | exists<T> { G } (D, {exists<T> { G }}, Θ) (D, {[T -> X] G}, Θ) “Replace T with some fresh variable X” …exists<G> { (G) }… …(Y)… Same as a “forall” clause like forall<G> { (G) :- (G) }
| G or G | exists<T> { G } D ::= A | A :- G | D and D | forall<T> { D } “What about me?” => Can’t have a clause that says “either Foo or Bar is true but I don’t know which”.
facts/rules We’d like to able to add hypotheses if (C) { G } ?- forall<G> { if ((G)) { (G) } } “For any god G… …assuming they have lightning… are they scary?” “If we assume C is true, is G provable?”
A): Check each program clauses from the user, as before Also check the hypotheses D G ::= A | G and G | G or G | exists<T> { G } | forall<T> { G } | if(D) { G } D ::= A | A :- G | D and D | forall<T> { D } G => D D => G
!U] G}, Θ) “Replace T with !U with the next universe U” …forall<G> { (G) }… …(!U1)… (zeus). (G) :- (G). “!U1 is not zeus” But G can be any name, even U1
forall<B> { E = B } }} G={forall<A> { E = A } and forall<B> { E = B }} L=() L=(E: U0) G={forall<A> { E = A }, forall<B> { E = B }} L=(E: U0) G={E = !U1, forall<B> { E = B }} L=(E: U0) !U1 and !U2 are siblings — never directly interact