intuitive introduction to predicate logic 1
TRANSCRIPT
Introduction • Lecture Notes (1) and (2) provide an OVERVIEW of a
standard intuitive formalization and introduction to Predicate Logic.
• I wrote them for you to review it and use it to solve some of the Take –home Practice Final problems.
• It covers material that I assume is KNOWN to all students;
• The formal definitions are in Chapter 13, 14 and we will cover it later.
Predicate Logic Language
Symbols: 1. P, Q, R… predicates symbols, denote relations in “real life”, must
be a non empty set. It can be finite or countably infinite . 2. x,y,z…. variables, a countably infinite set 3. c1, c2, … constants, a finite or countably infinite set 4. f, g, h … functional symbols, denote functions in “real life”, may
be empty, finite, or countably infinite set
5. Propositional connectives: ∨, ∧ , ⇒, ¬, ⇔ 6. Symbols for quantifiers ∀x – universal quantifier reads: For all x… ∃ x – existential quantifier reads: There is x…
Formulas of Predicate Logic
We use symbols 1 - 6 to build formulas of predicate logic as follows
1. P(x), Q(x,y), R(x)… R(c1), Q(x, c3), P(c), … are called atomic formulas for any variables x, y,… and
constants c, c1, c2, … 2. All atomic formulas are formulas ; 3. If A,B are formulas then (like in propositional logic): (A ∨ B) , (A ∧ B), (A ⇒ B), (A ⇔ B), ¬A are formulas 4. ∀x A, ∃ y A are formulas, for any variables x, y 5. The set F of all formulas is the smallest set that fulfills the
conditions 1 -4.
Examples
For example: let P(y), Q(x,c), R(z), P1(x, y, z) be atomic formulas, i.e. P(x), Q(x,c), R(z), P1(x, y, z) ∈ F
Then we form some other formulas out of them as follows:
(P(y) ∨ ¬Q( x, c) )∈ F
It is a formula with two free variables x, y. ∃x (P(y) ∨ ¬Q( x, c) ) ∈ F
∀y (P(y) ∨ ¬Q( x, c) ) ∈ F ∀y ∃x(P(y) ∨ ¬Q( x, c) ) ∈ F
etc
Free and Bound Variables
Quantifiers bound variables within formulas
For example: A is a formula:
∃x (P(x) ⇒ ¬ Q(x, y))
all x’s in A are bounded by ∃x
y is a free variable in A that can be bounded by a quantifier, for example
∀y ∃x (P(x) ⇒ ¬ Q(x, y))
y got bounded and there are no free variables in A now.
A formula without free variables is called a sentence.
Logic and Mathematical Formulas
We often use logic symbols while writing mathematical statements in a more symbolic way
Example of a Mathematical Statement: ∀x ∈ N (x > 0 ∧ ∃y ∈ N (y = 1)) 1. Quantifier ∀x ∈ N is a quantifier with restricted domain 2. Logic uses only ∀x , ∃y 3. x > 0 and y =1 are mathematical statement about a real
relation ” >” 4. Logic uses symbols P, Q, R… for example
R(y, c1) for y =1 and P(x, c2) for x > 0 where c1 and c2 are constants representing numbers 1 and 0, respectively.
Translation of Mathematical Statements to Logic
Consider a Mathematical Statement: ∀x ∈ N (x > 0 ∧ ∃y ∈ N (y = 1)) x ∈ N – we translate it as one argument predicate Q(x) x > 0 – as two argument predicate P(x, c1) , y = 1 – as another two
argument predicate R(y, c2) and get ∀Q(x) (P(x, c1) ∧ ∃Q(y) R(y, c2) ) ↑ Logic formula with restricted domain quantifiers But this is not yet a proper logic formula since we cannot have
quantifiers ∀Q(x) , ∃Q(y) but only ∀x, ∃x. ∀Q(x), ∃Q(y) are called quantifiers with restricted domain
Logic Formula Corresponding to our Mathematical Statement
We need to “get rid” of quantifiers with restricted domain i.e. to translate them into logic quantifiers: ∀ x, ∃x
∃x ∈ N, ∃y ∈ N
↑ certain predicate P(x)
General: restricted domain quantifiers are :
∀P(x), ∃Q(x)
Restricted Domain Existential Quantifier
∃P(x) Q(x) ≡ ∃x(P(x) ∧ Q(x)) ↑ restricted ↑logic, not restricted
Example (mathematical formulas): ∃ x≠1 (x>0 ⇒ x + y > 5) - restricted ∃x ((x≠1 ) ∧ (x > 0 ⇒ x + y > 5)) - not restricted ↑ P(x, y, c) English statement: Some students are good. Logic Translation (restricted domain):
∃S(x) G(x) Predicates are : S(x) – x is a student G(x) – x is good TRANSLATION:
∃x(S(X) ∧ G(x))
Restricted Quantifiers and Quantifiers
Translation for universal quantifier
Restricted Logic (Non-restricted)
∀P(x) Q(x) Ξ ∀x (P(x) ⇒ Q(x))
Example (mathematical)
∀x ∈ N (x= 1 ∨ x< 0) restricted domain
Ξ ∀x (x ∈ N ⇒ ( x= 1 ∨ x< 0) ) – non-restricted
Translation of Mathematic statements to Logic formulas
Mathematical statement:
∀x (∀x ∈ N ⇒ ( x= 1 ∨ x< 0) )
x ∈ N – translates to a predicate N(x)
x > 0 – translates to a predicate P(x, c1)
x=1 - translates to a predicate Q(x, c2)
Corresponding logic formula:
∀x (N(x) ⇒ (Q(x, c2) ∨ P(x, c1)) )
Remark
Mathematical statement: x + y = 5 To follow LOGIC formalization we re-write it as = ( + (x, y), 5) and “translate it” to Predicate Language as P(f(x,y), c) Given x = 2, x = 1, we get +(2,1) = 3 and the statement: = (3,5) is FALSE (F) Predicates always returns logical value F or T We really need also function symbols (like +, etc..) to translate
mathematical statements to logic, even if we could use only relations as functions are special relations
This is why in formal definition of the predicate language we often we have 2 sets of symbols
1. Predicate symbols which can be true or false in proper domains 2. Functions symbols ( formally called terms)
Translations to Logic
Rules: 1. Identify the domain: always as et X ≠ φ 2. Identify predicates (simple: atomic) 3. Identify functions (if needed)
4. Identify the connectives ∨, ∧ , ⇒, ¬, ⇔ 5. Identify the quantifiers ∀x, ∃ x Write a formula using only symbols for 2 ,3, 4 6. Use restricted domain quantifier translation
rules, where needed
Translations Examples
Translate: For every bird there are some birds that are white Predicates: B(x) – x is a bird W(x) – x is white Restricted: ∀B(x) ∃B(x) W(x) Logic ∀x(B(x) ⇒ ∃x (B(x) ∧ W(x))) OR (re-name variables) ∀x(B(x) ⇒∃y(B(y) ∧W(y))) (by laws of Quantifiers , don’t do this step yet!! We will study the laws later ) This is logically equivalent to ∀x∃y (B(x) ⇒ (B(y) ∧ W(y)))
Example
For every student there is a student that is an elephant
B(x)- x is a student
W(x) – x is an elephant
∀B(x) ∃B(x) W(x)
∀B(x) ∃x(B(x) ∧ W(x))
∀x(B(x) ⇒ ∃x(B(x) ∧ W(x))) (logic formula)
Translations Example
Translate: Some patients like all doctors Predicates: P(x) – x is a patient D(x) – x is a doctor L( x,y) – x likes y ∃P(x) ∀D(y) L( x,y) There is a patient(x), such that for all doctors(y), x likes y ∃x(P(x) ∧ ∀y(D(y) ⇒ L( x,y))) (by law of quantifiers to be studied later we can “pull
out ∀y”) ∃x∀y(P(x) ∧(D(y) ⇒L( x,y)))