1st order logic overcomes these two weaknesses of propositional logic by providing a richer language. The cost of this increased expressivity is the loss of decidability for logical consequence; 1st order logic is semi-decidable. In addition, 1st order logic requires more complex mechanisms for checking for logical consequence.
Example |
---|
V = { V : V starts with uppercase } F = { geoff/0, jim/0, brother_of/1 } P = { wise/1, taller/2 } |
From the components of the language, two types of expressions are built. This is in contrast to propositional logic where only propositions exist. The first type of expression is terms. Terms are used to denote (possibly arbitrary) objects in the domain of interest. Terms thus correspond roughly to data in conventional programming. Terms are defined recursively by:
Example |
---|
geoff Person brother_of(jim) brother_of(brother_of(X)) |
Note that if there is a functor of arity greater than 0, then there is an infinite number of terms. As might be expected, ATP for 1st order logic is much easier if the number of terms is finite (in fact it reduces to ATP for propositional logic). For this reason, it is desirable to formulate ATP problems without any functors of arity greater than 0.
The second type of expression is atoms, which correspond to the propositions of propositional logic. Atoms decribe relationships between terms (objects in the domain). Atoms are defined by:
Example |
---|
wise(geoff) taller(Person,brother_of(jim)) wise(brother_of(brother_of(X))) |
If the number of terms is infinite (which occurs if there is a functor of arity greater than 0), and there is a predicate symbol of arity greater than 0, then there is an infinite number of atoms.
Connectives are used to combine atoms into the formulae of 1st order logic. The connectives include all those used in propositional logic, and two new quantifiers:
The precedence order of the above operators is ∀ ∃ ~ | & => <=>, i.e., ∀ and ∃ bind most tightly, down to <=>. This precedence ordering allows some brackets to be omitted, e.g., ∀X (clever(X) => pass(X) | lazy(X)) means ∀X (clever(X) => (pass(X) | lazy(X))). Note that the ()s round the (clever(X) => pass(X) | lazy(X)) are necessary, for otherwise the quantification would apply to only the clever(X).
Example |
---|
wise(geoff) ~taller(Person,brother_of(jim)) wise(geoff) & wise(brother_of(brother_of(Person))) ~taller(Person,brother_of(jim)) | wise(brother_of(brother_of(Person))) wise(brother_of(brother_of(Person)) => wise(geoff) wise(geoff) <=> ~taller(Person,brother_of(jim)) (wise(geoff) & wise(brother_of(brother_of(Person)))) | wise(geoff) ∀Person ~taller(Person,brother_of(jim)) ∃Person wise(brother_of(brother_of(Person)) => wise(geoff) |
Atoms and the negations of atoms are called literals.
Example |
---|
wise(brother_of(X)) ~taller(geoff,jim) |
Ground formulae are formulae that contain no variables.
Example |
---|
wise(geoff) wise(geoff) <=> ~taller(geoff,brother_of(jim)) |
The scope of a quantification is the formula which follows the
quantification, e.g., the scope of ∃Person in
∃Person wise(brother_of(brother_of(Person)) =>
wise(geoff)
is
wise(brother_of(brother_of(Person)).
A variable is bound if it occurs in a quantification or it is
within the scope of a quantification of that variable.
Otherwise a variable is free.
A formulae that has no free variables is a closed formula;
otherwise a formula is open.
Example |
---|
Person is bound in in the closed formula: ∀Person ~taller(Person,brother_of(jim))
Person is free in the open formula:
Person is bound and free in the open formula:
Person is bound in the closed formula:
|
A free variable in a expression can be instantiated with a term, thus binding the variable to that value and forming an instance of the expression.
Example |
---|
The free variable Person in: ~taller(Person,brother_of(jim))
can be instantiated with brother_of(geoff) to form the
instance: |
For ATP open formulae are not useful, because it is not possible to interpret (in the sense of giving meaning) open formulae. Open formulae can be closed by universal or existential quantification. This is done by placing either a universal or existential quantifier in front of the bracketed formula. The free standing quantifier notation is shorthand for a universal or existential quantification of every free variable in the formula.
Example |
---|
~taller(Person,brother_of(jim)) | wise(brother_of(brother_of(Person)))
can be closed either universally:
or existentially: |
In English universal quantification is usually meant if no explicit quantification is given, e.g., "Sheep are stupid" usually means "All sheep are stupid", not "There exists a sheep that is stupid".
A substitution can be applied to another substitution to form their
composition.
Let θ =
{X1/t1,...,Xn/tn}
and σ =
{Y1/s1,...,Yn/sn}
The variables Xi must be distinct from the variables
Yi, and no Xi can appear
in a si.
The composition
θσ
is formed by applying σ to
the ti, and combining the two sets.
For example, let
θ = {P1/jim,P2/brother_of(P4)}
and
σ = {P3/brother_of(P5),P4/geoff}.
Then
θσ =
{P1/jim,P2/brother_of(geoff),P3/brother_of(P5),P4/geoff}.
Example |
---|
There is a barbers' club that obeys the following three conditions:
|
V = { V : V starts with uppercase } F = { guido/0, lorenzo/0, petrucio/0, cesare/0 } P = { member/1, shaved/2, all_shaved/1 } |
|
Osama Bin Laden is a terrorist. If someone is a terrorist and is dangerous, then his leader is a terrorist and is dangerous. There are some terrorists who are their own leader. Dangerous people care about only themselves, or about no-one (not even themselves!). Everyone has one leader, but might care about many people. Prove that if Osama Bin Laden cares about George Bush then Osama Bin Laden is not dangerous.
Wolves, foxes, birds, caterpillars, and snails are animals, and there are some of each of them. Also there are some grains, and grains are plants. Every animal either likes to eat all plants or all animals much smaller than itself that like to eat some plants. Caterpillars and snails are much smaller than birds, which are much smaller than foxes, which in turn are much smaller than wolves. Wolves do not like to eat foxes or grains, while birds like to eat caterpillars but not snails. Caterpillars and snails like to eat some plants. Prove that there is an animal that likes to eat a grain eating animal.
The basic notion of set theory is membership of a set. Using a member/2 predicate, define set equality, intersection, union, power set, empty set, and diifference. For example, intersection is defined as:
! [X,A,B] : ( member(X,intersection(A,B)) <=> ( member(X,A) & member(X,B) ) )Now write conjectures for transitivity of subset, associativity of set intersection, and distribution of intersection over union.
Example |
---|
two_squared = four ∀X (zero(X) => difference(four,X) = sum(four,X)) zero(b)
|
Although the conjecture may seem like a logical consequence to humans, that's because humans "know" what equal means (even without knowing what the "maths" means). However, there are many models of the axioms that are not a models of the conjecture, e.g., simply by making even(sum(four,b)) be FALSE. Such models are possible because the axioms are missing definitions for equality. These definitions are the axioms of equality, and must be included to force equality to have its usual meaning. They are:
Some ATP systems do "know" what equal means, and for such systems it is not necessary to add in the axioms of equality.
Someone who lives in Dreadbury Mansion killed Aunt Agatha. Agatha, the butler, and Charles live in Dreadbury Mansion, and are the only people who live therein. A killer always hates his victim, and is never richer than his victim. Charles hates no one that Aunt Agatha hates. Agatha hates everyone except the butler. The butler hates everyone not richer than Aunt Agatha. The butler hates everyone Aunt Agatha hates. No one hates everyone. Agatha is not the butler. Therefore : Agatha killed herself.
An interpretation of a 1st order logic consists of three parts:
Example |
---|
One possible interpretation of the language
V = { V : V starts with uppercase } F = { geoff/0, jim/0, brother_of/1 } P = { wise/1, taller/2 }is DI = { , } FI = { geoff → , jim → , brother_of() → , brother_of() → } PI = { wise() → TRUE, wise() → TRUE, taller(,) → FALSE, taller(,) → FALSE, taller(,) → TRUE, taller(,) → FALSE } |
As with propositional logic, all the possible Rs can be presented as a truth table or a semantic tree.
Given an interpretation, the truth value of a closed formula can be determined, with respect to that interpretation. The procedure for ground formula is:
Example |
---|
Using the interpretation above, the ground formula wise(geoff) <=> ~taller(geoff,brother_of(jim)) is interpreted as follows wise(geoff) <=> ~taller(geoff,brother_of(jim)) wise() <=> ~taller(, brother_of()) wise() <=> ~taller(, ) TRUE <=> ~FALSE TRUE <=> TRUE TRUE |
Non-ground closed formulae are interpreted as follows:
Example |
---|
To interpret the universally quantified formula
∀Person (~taller(Person,jim) | wise(Person)),
the universally quantified variable Person is
instantiated to all the domain elements.
|
Example |
---|
To interpret the existentially quantified formula
∃Person wise(brother_of(brother_of(Person))) => wise(geoff))
the existentially quantified variable Person is
instantiated to find a TRUE instance of the formula.
|
If the domain of the interpretation is finite, interpretation of closed 1st order formulae is a finite process. If the domain is inifinite it is not possible to determine that a universally quantified formula is TRUE, nor is it possible to determine that an existentially quantified formula is FALSE.
For every 1st order language there is an infinite number of possible interpretations, so it is not possible to check every interpretation explicitly. It also turns out the searching for C from Ax is not as effective as searching for a contradiction from Ax U {~C}.
Suming, Yi, and Yury are students, and are the only three students. If a student works hard then they get a good grade. At least one of the students works hard. Therefore at least one student will get a good grade.
There are some students who fail. If a student fails, then either there is a lecturer who has taught the student badly, or the student is stupid. No lecturer teaches any student badly. Therefore there is some student who is stupid.
V = { V : V starts with uppercase } F = { coke/0, pepsi/0, competitor/1 } P = { fizzy/1, sells-more/2 }
V = { V : V starts with uppercase } F = { holden/0, ford/0, honda/0 main_competitor/1 } P = { fast/1, faster/2 }and the interpretation:
D = { commodore, laser, prelude } F = { holden → commodore, ford → laser, honda → prelude, main_competitor(commodore) → prelude, main_competitor(laser) → prelude, main_competitor(prelude) → commodore } R = { fast(commodore) → TRUE, fast(laser) → FALSE, fast(prelude) → TRUE, faster(commodore,commodore) → FALSE, faster(commodore,laser) → TRUE, faster(commodore,prelude) → TRUE, faster(laser,commodore) → FALSE, faster(laser,laser) → FALSE, faster(laser,prelude) → FALSE, faster(prelude,commodore) → FALSE, faster(prelude,laser) → TRUE, faster(prelude,prelude) → FALSE }Show the steps of the interpretation of: