0% found this document useful (0 votes)
37 views5 pages

Pred Logic

This document discusses predicate logic and provides examples of its use. Predicate logic introduces variables, constants, predicates, functions, and quantifiers to capture richer semantics than propositional logic. Examples show encoding statements about children, brothers, and mothers using predicates like C(x), B(x,y), and functions like m(x). Natural deduction rules for predicate logic, including equality, universal and existential quantification, are presented. Exercises pose proofs in predicate logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views5 pages

Pred Logic

This document discusses predicate logic and provides examples of its use. Predicate logic introduces variables, constants, predicates, functions, and quantifiers to capture richer semantics than propositional logic. Examples show encoding statements about children, brothers, and mothers using predicates like C(x), B(x,y), and functions like m(x). Natural deduction rules for predicate logic, including equality, universal and existential quantification, are presented. Exercises pose proofs in predicate logic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

15414/614 Optional Lecture 3:

Predicate Logic
Anvesh Komuravelli

1 Why Predicate Logic?


Consider the following statements.

1. Every student is younger than some instructor.


2. Not all birds can fly.

Propositional logic cannot capture the detailed semantics of these sentences.


For the first sentence, propositional logic might help us encode it with a single
proposition but perhaps, not more than that. For the second sentence, one might
have a proposition standing for every bird can fly and say that the sentence is
the negation of this proposition. But there are hidden details (that every bird
can fly) within the proposition.
To encode a richer class of statements, predicate logic introduces the following
additional constructs (to what we already have in propositional logic).

Variables : To stand for arbitrary entities.


Constants : To stand for specific entities.
Predicates : To denote relations between entities.

Functions : To map entities to entities.


Quantifiers : To talk about universal (for all, every, etc., denoted ∀) and
existential (exists, some, etc., denoted ∃) events.

This kind of logic is called first-order logic. There are richer logics (nth -order
logics or higher-order logics) where, for e.g., predicate variables are also consid-
ered which can be quantified but we will not consider those in this treatment.
We are also interested in the special predicate, equality, denoted =. This is
the extensional equality we saw in Coq, i.e. equality in terms of computational
results and not just by defintion.

1
2 Examples
2.1 Predicates
Consider encoding the statement : Every child is younger than its brother. This
is not true in general (consider the case when the brother in question is younger
than the child). But our concern now is to encode it, not to decide whether it
is true or false. Consider the following predicates.

C(x) : x is a child.
B(x, y) : x is a brother of y.
Y (x, y) : x is younger than y.

It is not hard to see that there are multiple sources of ambiguity in the statement.

1. How many brothers does a child have? We will assume that the statement
is about every brother, for simplicity.
2. What does its mean? Does it imply the existence of at least one brother?
Not clear.

The encoding depends on how we answer the second question above. If the
answer is no, we might encode as follows.

∀x, y. (C(x) ∧ B(y, x) → Y (x, y))


If the answer is yes, however, we might encode as follows.

∀x. (C(x) → ∃y. (B(y, x) ∧ Y (x, y)))

2.2 Constants
If we want to encode the statement Andy is younger than Paul, we might use
the above predicates to get something like

Y (A, P )

where A and P are constants standing for specific entities, Andy and Paul,
respectively.

2.3 Functions
If we replace brother with mother in the previous example, we can simply replace
the predicate B(·, ·) with M (·, ·) standing for x is mother of y. But, as mothers
are unique, a more precise encoding is the following.

∀x. (C(x) → (∃y. (M (y, x) ∧ Y (x, y)) ∧ ∀y1 , y2 . (M (y1 , x) ∧ M (y2 , x) → y1 = y2 )))

2
The newly added conjunct says that if y1 and y2 are both mothers of x, then
y1 = y2 .
We can simplify the notation by introducing a function m(x) for the mother of
x. The encoding will now be simply

∀x. (C(x) → Y (x, m(x))) .

3 Natural Deduction
In addition to the rules we saw for Propositional Logic, we have the following
ones.

3.1 Equality
eq-i
t=t

t1 = t2 φ[t1 /x] t1 , t2 free for x in φ


eq-e
φ[t2 /x]

In the above rule, φ[t/x] stands for substituting t for the free occurences of x in
φ. And whenever we do such substitutions, we should remember that t should
not have any variables which are already bound in φ (usually called, t is free
for x in φ). This is exactly the side-condition of the rule above.
For example, in (∃y.(x < y))[y/x], doing a blind substitution would result in
∃y.(y < y) which is absurd. The problem arose because y was already bound
in the formula (∃y). But that’s usually not the intended purpose of the sub-
stitution. Suppose that we have a side-condition that y is free for x in the
formula. As y is already bound in the formula, it is as if the bound variable
is first changed, say to z, resulting in ∃z.(x < z) which is essentially the same
formula and then substituting y for x resulting in ∃z.(y < z) which is what we
desired!
In the rest of this note, we assume that t is free for x in such substitutions and
not specify explicitly.
The two tactics above correspond to the tactics reflexivity and rewrite,
respectively.

3.2 Universal Quantifier


x0 (fresh variable)
..
.
φ[x0 /x]
forall-i/x0
∀x.φ

3
Note that the introduction rule for ∀ corresponds exactly to how we prove
universal statements in mathematics. We let x0 be an arbitrary entity and
prove the statement in terms of x0 wherever x appears in the statement. Then
as x0 was arbitrary, we conclude that the statement holds for every such x.
That is exactly the rule above! As is the case with the rule of implication
introduction, we should remember to discharge these fresh variable assumptions
before the proof finishes. This corresponds to the tactic intro in Coq.

∀x.φ
forall-e
φ[t/x]

Here, t is any term which can be substituted for x. This implicitly assumes that
when φ is true for every x, there exists at least one x for which φ is true. This
corresponds to the tactic apply in Coq.

3.3 Existential Quantifier


φ[t/x]
exists-i
∃x.φ
This rule says that if φ is true for some value of x, we can conclude that ∃x.φ.

x0 (assumption)
∃x.φ
φ[x0 /x] → χ(χ has no free occurences of x0 )
exists-e
χ

This rule says how to use the fact that ∃x.φ. We assume that φ is true for x0 ,
a new variable. Then, if we can prove χ from φ[x0 /x] we can conclude that χ is
true. Again, we should remember to discharge the assumptions before we end
the proof. Note that, this parallels how we prove statements in mathematics.
This corresponds to the tactic destruct in Coq.

4 Exercises
1. (x + 1 = 1 + x), (x + 1 > 1 → x + 1 > 0) ` (1 + x > 1 → 1 + x > 0)
2. t1 = t2 ` t2 = t1
3. t1 = t2 , t2 = t3 ` t1 = t3

4. ∀x.(P (x) → Q(x)), ∀x.P (x) ` ∀x.Q(x)


5. P (t), ∀x.(P (x) → ¬Q(x)) ` ¬Q(t)
6. ∀x.P (x) ` ∃x.P (x)

4
7. ∀x.(P (x) → Q(x)), ∃x.P (x) ` ∃x.Q(x)
8. ∀x.(Q(x) → R(x)), ∃x.(P (x) ∧ Q(x)) ` ∃x.(P (x) ∧ R(x))
9. ¬∀x.P (x) ` ∃x.¬P (x) (not intuitionistic)
10. ∃x.¬P (x) ` ¬∀x.P (x)

11. (∀x.P (x)) ∧ Q ` ∀x.(P (x) ∧ Q) (assume that Q does not depend on x.)
12. ∃x.P (x) ∨ ∃x.Q(x) ` ∃x.(P (x) ∨ Q(x))
13. ∃x.∃y.P (x, y) ` ∃y.∃x.P (x, y)

Some of these are done in Coq which you can find on the Lectures page.

5 References
1. Logic in Computer Science: Modelling and Reasoning about Systems. Michael
Huth and Mark Ryan, Cambridge University Press.

You might also like