Pred Logic
Pred Logic
Quantifiers
Individual Constants
An individual constant is a name for an object. Examples: john, marie, a, b Each name is assumed to refer to a unique individual, i.e. we will not have two objects with the same name. However, each individual object may have more than one name.
Predicates
Predicates are used to express properties of objects or relations between objects. Examples: Tall, Cube, LeftOf, = Arity: the number of arguments of a predicate (E.g. Tall: 1, LeftOf: 2)
Some Ps are Qs
x (P(x) Q(x))
No Ps are Qs
x (P(x) Q(x))
Exactly One
How can we say that There is exactly one cube? Saying that there is exactly one cube is saying two things at once:
There is at least one cube: xCube(x) There is at most one cube: x y(Cube(x) Cube(y) y) x Thus: xCube(x) x y(Cube(x) Cube(y) y) x
Exactly Two
How do we say There are exactly two cubes? Similar set-up:
x y(Cube(x) Cube(y) x y z(Cube(z) z x z y)) or: x y(Cube(x) Cube(y) x y z(Cube(z) (z=x z=y))) or: x y(x y z(Cube(z) (z=x z=y)))
Rewriting Example
If x (P(x) Q(x)) (not all Ps are Qs), then x (P(x) Q(x)) (some Ps are not Qs), and vice versa:
x (P(x) Q(x)) (QN) x (P(x) Q(x)) (Impl) x (P(x) Q(x))
Quantifier Rules in F
There are 4 quantifier rules in F:
Universal Introduction and Elimination Existential Introduction and Elimination
Universal Introduction and Existential Elimination have important restrictions in that the rules cannot be applied relative to just any individual constant. The system F deals with those restrictions through the use of subproofs. Well see later how that works. Fortunately, Universal Elimination and Existential Introduction do not have any restrictions, so well start with those.
Notation
In describing the rules, the following notation is useful:
(x) is a wff with zero or more instances of x as the only free variable. (a/x) is the statement that results when substituting a for all occurrences of x that are free in (x). If it is clear which variable we are subsituting, we will simply write (a).
Elim
Universal Elimination ( Elim) allows one to conclude that any thing has a certain property if everything has that property:
x (x) (a)
Bad
x SameSize(x,x) SameSize(x,a)
All free occurrences of x should be replaced!
Bad
Intro
Existential Introduction ( Intro) allows one to conclude that something has a certain property if some thing has that property:
(a) x (x)
Bad
SameSize(a,b) x SameSize(x,x)
The same individual constant should be used!
Universal Proof
A common proof in mathematics is a universal proof. A universal proof proves something about everything (of the Universe of Discourse) by proving it to be true of some arbitrary thing. It usually starts with Let a be an arbitrary It then proves something about a Finally, since a was just an arbitrary individual, it must be true for all individuals.
Intro
Universal Introduction ( Elim) allows one to conclude that everything has a certain property if anything has that property:
a (a) x (x) a may not occur before the subproof, unless all subproofs in which it occurs have been closed. a may not occur in (x) either.
Bad
Still Good
Bad
a SameSize(a,a) x SameSize(a,x)
a occurs in SameSize(a,x)!
Existential Proof
Sometimes, we know that something has a certain property, but we dont know who or what this something is. In order to perform some reasoning, we will give this something a name, and whatever we can infer from that point on, we can infer from the original statement. Like the universal proof, the name should be an arbitrary name, but in this case it denotes a specific individual: that individual that had the relevant property.
Elim
Existential Elimination ( Elim) allows one to conclude anything that follows from some thing having a certain property, given that something has that property.
x (x) a (a) Q Q a may not occur before the subproof, unless all subproofs in which it occurs have been closed. a may not occur in Q either.
Good
Bad
Still Good
Bad
a occurs in Large(a)!
= Intro
At any point, you can assert any statement of the form a=a = Intro does not require any statements as part of its justification, and reflects the reflexivity of identity.
a=a
= Intro
= Elim
= Elim: If you have a statement of the form a=b, and a statement in which a occurs (written as P(a)), then you may infer P(b), which is the statement that results when replacing any number of occurences of a by b in the statement P(a):
P(a) m a=b P(b)
n
= Elim n,m
Running Examples
Valid Argument x (Cube(x) Small(x)) x Cube(x) x Small(x) Invalid Argument x Cube(x) x Small(x) x (Cube(x) Small(x))
Truth-Functional Expansions
Suppose that our Universe of Discourse (UD) contains only the objects a and b. Given this UD, the claim x Cube(x) is true iff Cube(a) Cube(b) is true. Similarly, the claim x Cube(x) is true iff Cube(a) Cube(b) is true. The truth-functional interpretation of the FO statements given a fixed UD is called the truthfunctional expansion of the original FO statement with regard to that UD.
T T F T F T T (Cube(a) Cube(b)) (Small(a) Small(b)) (Cube(a) Small(a)) (Cube(b) Small(b)) T F F F F F T This shows that there is a world in which the premise is true and the conclusion false. Hence, the original argument is FO invalid.
x (x) (c)
(c) c = d (or d = c) (d) (where (d) is the result of replacing any number of cs with ds in (c))
a a
Truth-Tree Example I
x Cube(x) x Small(x) x (Cube(x) Small(x)) x Cube(x) x Small(x) x (Cube(x) Small(x)) Cube(a) Small(b) (Cube(a) Small(a)) (Cube(b) Small(b)) Cube(a) Small(a) Cube(b) Small(b) Open branch, so its invalid
Truth-Tree Example II
x (Cube(x) Small(x)) ( x Cube(x) x Small(x)) Cube(a) Small(a) Cube(a) Small(a) x Cube(x) x Cube(x) x Small(x) x Small(x) Small(a) Cube(a) All branches close, so its valid
FO
is a FO consequence of = { 1, , n} iff is a logical consequence of in virtue of truth-functional, quantificational, and identity properties. Let us use the symbol FO to indicate FO consequence:
FO iff is a FO consequence of .
FO Provability
Let us define FO provability with regard to some formal deductive logic system S (e.g F) as follows: is FO provable from a set of premises { 1, , n} in the system S iff there exists a formal proof in S with 1, , n as premises and as the conclusion using the FO rules of S.
FO(S)
Let us use the symbol FO(S) to indicate FO provability in S:
FO(S) iff is FO provable from in the system S.
The subscript FO(S) indicates that we restrict our proofs to the FO rules of S.
Infinite Trees
x y Likes(x,y) y Likes(a,y) Likes(a,b) y Likes(b,y) Likes(b,c) y Likes(c,y) Likes(c,d) y Likes(d,y) Likes(d,e) This tree will never be finished, so the tree method will not give us any answer!
A Common Response
Well, given that we have a sound and complete test for FO validity, we should be able to make this into a test for FO invalidity as follows: Have the procedure test for validity. If it is valid, then eventually the procedure will say it is valid (e.g. it says Yes, its valid), and hence we will know (because the procedure is sound) that it is not invalid. If it is invalid, then the procedure will not say so (e.g. it outputs Bananas on Mars), but we can simply interpret anything other than Yes, its valid as the claim that it is invalid and, given that the procedure is complete, it should indeed be invalid, for otherwise it would say Yes, its valid. So, I would have a decision procedure for FO validity!
In the first case we know that the thing does not have the property. But, in the second case, we may not know this, as we may not know whether the test is going to finish or not! The moral: positive tests do not guarantee negative tests and vice versa.
Undecidability of FO validity
It can be proven that no such decision procedure can exist. This proof was found by Alonzo Church in 1936. This year is no accident: its the year of Turings famous paper in which he lays out the TuringMachine, Turings Thesis, The Universal Machine, and the Halting Problem. Indeed, the undecidability of FOL follows from the uncomputability of the Halting Problem. For a full proof, take Computability and Logic.
Incompleteness of FO Con
Since it is unacceptable for FO Con to never finish, we cant make FO Con into a positive test. We thus know that FO Con is incomplete with regard to FO validity as well as FO invalidity. Still, FO Con is sound, and will classify most cases of FO validity as FO valid. Moreover, FO Con will also correctly classify many cases of FO invalidity as FO invalid. What I say here about FO Con holds for ATPs in general of course.
Axiomatization
Axioms
An axiom regarding one or more predicates is a statement that expresses a (usually, very basic) truth regarding those predicates. Example: An axiom expressing a basic truth regarding the predicate Adjoins is: xy(Adjoins(x,y) Adjoins(y,x)) By adding axioms to the premises, we can prove things we couldnt before. For example, if we add the axiom x(Cube(x) Tet(x)) to our premises, then we can infer Tet(a) from Cube(a).
Axiomatizing Mathematics
Around 1900, shortly after the formulation of first-order logic was completed, mathematicians started to wonder if all of mathematics could be axiomatized. That is, is it possible to find a finite set of axioms expressing basic truths regarding mathematics (e.g. xy (x + y = y + x)) such that every mathematical theorem is a logical consequence of these axioms?
Resolution
Clauses
A clause is a set of literals. Assuming a clause to represent a disjunction of all literals that are in that clause, we can resolve two clauses as follows:
{P1 , , Pi-1 , X , Pi+1 , , Pm} {Q1 , , Qi-1 , X , Qi+1 , , Qn} {P1 , , Pi-1 , Pi+1 , , Pm , Q1 , , Qi-1 , Qi+1 , , Qn} (each of Pi and Qi are literals; X is atomic)
Resolution Example
(Elusive(a) Dangerous(a)) (Elusive(a) Rare(a)) (Rare(a) Dangerous(a)) Horned(a) Horned(a) Magical(a) Magical(a) (E D) (E R) (R D) H H M M H M Negate Conclusion and put into CNF (E D) (E R) (R D) H (R H) (D H)
(R D) H
{H}
{}
Inconsistent, so valid!
Prolog
Prolog
The programming language Prolog is based on Horn clauses. A Prolog program consists of 2 types of lines:
Facts: Statements of the form P. Rules: Statements of the form (P1 Pn) Q.
A Prolog program is run by asking whether some atomic statement Q follows from the facts and rules. In Prolog: Q? The Prolog program will answer Yes or No.
Prolog Example
Putting into Prolog: H H H E E :- H. H D D :- H. (E M) R R :- E, M. (D E) R R :- D, E. {M} {E} {H} {} Yes! Query: R? {R} {E, M} {H, M} {D, E} {H, E}