Predicates deal with mapping variables and constants to true for false, with the rules being called predicate calculus
Operators:
Quantifiers:
∀C (rainy(C) ∧ cold(C) → snowy(C))
∀A, ∀B (takes(A, C) ∧ takes(B, C) → classmates(A, B))
Fermat’s last Theorem:
∀N ((N > 2) → ¬(∃A ∃B ∃C (A^N + B^N = C^N)))
∀, ∃ bind variables like λ in λ-calculus
There’s just a few important things I’ll go over here: first is the notion or normal form
There’s many ways to write statements, but this isn’t good for us if we want automatic provers, so we should convert things to normal form
One of these normal forms is clausal form, which we get to with the following steps
∀X (¬student(X) → (¬resident(X) ∧ ¬∃Y (takes(X, Y) ∧ class(Y))))
eliminate → and ↔:
∀X (student(X) ∨ (¬resident(X) ∧ ¬∃Y (takes(X, Y) ∧ class(Y))))
move ¬ inward (using De Morgan’s laws):
∀X (student(X) ∨ (¬resident(X) ∧ ∀Y (¬(takes(X, Y) ∧ class(Y)))))
≡
∀X (student(X) ∨ (¬resident(X) ∧ ∀Y (¬takes(X, Y) ∨ ¬class(Y))))
∀X (student(X) ∨ (¬resident(X) ∧ ∀Y (¬takes(X, Y) ∨ ¬class(Y))))
∀X ∀Y (student(X) ∨ (¬resident(X) ∧ (¬takes(X, Y) ∨ ¬class(Y))))\
student(X) ∨ (¬resident(X) ∧ (¬takes(X, Y) ∨ ¬class(Y)))
(student(X) ∨ ¬resident(X)) ∧
(student(X) ∨ ¬takes(X, Y) ∨ ¬class(Y))
(student(X) ∨ ¬resident(X)) ∧
(student(X) ∨ ¬takes(X, Y) ∨ ¬class(Y))
(resident(X) → student(X)) ∧
((takes(X, Y) ∧ class(Y)) → student(X))
≡
(student(X) ← resident(X)) ∧
(student(X) ← (takes(X, Y) ∧ class(Y)))
Now that we have a normal form, we can throw this straight into a logical language like Prolog
We obtained: (student(X) ← resident(X)) ∧ (student(X) ← (takes(X, Y) ∧ class(Y)))
which translates directly to Prolog:
student(X) :- resident(X).
student(X) :- takes(X, Y), class(Y).
:- means “if” , means “and”
Another particular case is the horn clause, where we only have one negated term
P :- Q1, Q2, ..., Qk.
for k = 0 we have a fact:
P.
The thing that we’re most concerned with here is automated proving, meaning, given a set of axioms, we want to prove that our theorems follow through negating the theorem to get a contradiction
:-
P :- Q1, Q2, ..., Qk.
means P ← Q1 ∧ Q2 ∧ ... ∧ Qk
:-
P.
means P ← true
:-
?- Q1, Q2, ..., Qk.
¬(Q1 ∧ Q2 ∧ ... ∧ Qk)
student(john).
?- student(john).
true.
Fact: student(john) ← true
Query (negated):
We obtain a contradiction (that proves the query):
The above contradiction is obvious; in general, use resolution.