Download presentation
Presentation is loading. Please wait.
Published byCordelia Dalton Modified over 9 years ago
1
can’t be c can’t be b Could be cthis is bcould be c
4
Names Constants are used to name existing objects a, b, c, d, e, f max, claire, carl No constant can name more than one object An object can have more than one name or no name at all
5
Tiberius Sempronius Gracchus Gaius Sempronius Gracchus Examples Leonard Euler Honest Abe Lincoln
7
Predicates A (determinate) property possessed by an object Shape Size A (determinate) relationship among objects Shape relationship Size relationship Positional relationship Equality =
8
Atomic Sentences A sentence formed by a single predicate followed by one or more names Max is tall Tall(max) e is larger than b Larger(e,b) e is identical to a e = a A sentence expresses a claim that is either true or false
9
Atomic Sentences in FOL Predicate(arg 1, arg 2,…, arg n ) Predicates have names beginning with an uppercase letter or are represented by an operator symbol The number of arguments is called the predicate’s arity The order of the arguments is important Larger(e,c) – e is larger than c Larger(c,e) – c is larger than e Between(a,b,e) – a is between b and e Between(b,a,e) – b is between a and e =(a,b) a and b are identical Usually, written in infix form a = b
10
Function Symbols A function is used to express complex names (a reference to an individual without using a name) father(b) – b’s father password(c) – c’s password A function may be nested Max’s father’s father father(father(max)) A function is never a predicate Can’t nest predicates Tall(Tall(max)) A predicate forms a sentence, while a function names an individual
11
Functions in FOL function(arg 1, arg 2,…, arg n ) Function names begin with a lowercase letter or are expressed with a symbol father(max) Max’s father father(mother(max)) Max’s mother’s father youngestChild(max,ann) Max and Ann’s youngest child *(5,+(2,4)) 30 starship(son(dr_crusher)) Dr_Crusher’s son’s starship
12
Connectives Not And, Or , Material Conditional Biconditional
13
Examples Larger(e,c) Cube(b) Large(b) SameRow(e,c) BackOf(e,b) e is not larger than c b is a cube or b is large e and c are in the same row and e is in back of b
14
First Order Logic Names Predicates Functions Connectives Are there more? Atomic Sentences
15
Example FOL
16
Translation Brando is Nancy’s favorite actor. brando = favoriteActor(nancy) BetterActor(favoriteActor(nancy), favoriteActor(max)) Nancy’s favorite actor is better than Max’s favorite actor. sean = favoriteActor(sean) Sean is his own favorite actor. Brando is someone’s favorite actor. x(brando = favoriteActor(x))
17
Quantifiers and Variables For every x x There exists y y
18
First Order Logic Names Predicates Functions Connectives Quantifiers and variables Revised List
19
Translation using functions c is the front-most block in b’s column. c is in the same row as the front-most block in b’s column. The right-most block in the same row as the front-most block in b’s column is small. c = fm(b) SameRow(c,fm(b)) Small(rm(fm(b)))
20
First-order Arithmetic Names Zero 0 One 1 Predicates Equality = Less than < Functions Addition + Multiplication 1)0 and 1 are terms. 2)If t 1 and t 2 are terms then so are (t 1 + t 2 ) and (t 1 t 2 ). 3) Nothing is a term unless formed from the above rules.
21
What is an argument? A series of statements in which one (called the conclusion) is meant to follow from or be supported by the others (called the premises).
22
Fitch-style Argument P 1 P 2... P n Q premises conclusion
23
Valid Argument A valid argument is one that guarantees the truth of its conclusion on the assumption that the premises are true. A valid argument ensures the conclusion is true provided the premises are true. A valid argument does not depend on any world for its validity
24
Valid Argument Large(b) v Cube(b) Cube(b) Large(b) premisesconclusion
25
Invalid Argument Large(b) v Cube(b) Cube(b) Large(b) premisesconclusion
26
Sound Argument If an argument is valid and its premises are true, then the argument is said to be sound. The soundness or unsoundness of an argument is determined with respect to some world
27
Sound Argument
28
Argument is not sound
29
Methods of Proof Formal We will use a Fitch-style proof employed in the text and software of the same name. “Formal” proof evokes images of being rigorous. In fact, it has to do creating a proof with strict syntax rules. Informal This style of proof, used by mathematicians, is just as rigorous. It consists of sentences describing the situation at hand, the inferences being made, and the justification of each inference.
30
What constitutes a proof? A proof that sentence Q follows from the premises P 1, P 2, …, P n is a step-by-step demonstration that shows Q must be true in any circumstances in which the premises are all true.
31
Types of Proof Direct Indirect Proof by cases Proof by contradiction Proof by induction Proof by counterexample
32
Fitch-style Proof P 1 P 2 … P n S 1 S 2 … S n Q Premises Deductions & Justifications may contain sub-proofs Conclusion Fitch Bar
33
Rules/Axioms = Elimination If b = c and P(b) then P(c). = Introduction a = a Symmetry of Identity If a = b then b = a. Transitivity of Identity If a = b and b = c then a = c These follow from above
34
= Elimination P(n) n = m P(m)
35
= Introduction n = n
36
Symmetry of Identity a = b 1) 2) 3) a = a = Introduction b = a = Elimination 1, 2
38
Example Formal Proof Smaller(a,b) c = b Larger(b,a)Ana Con 1 c = c = Introduction b = c = Elim 2, 4 Larger(c,a) = Elim 5, 3 1) 2) 3) 4) 5) 6)
39
Example Informal Proof Prove: If a is smaller than b and c is identical to b then c is larger than a. Since a is smaller than b, it follows that b must be larger than a. Moreover, since c is identical to b, it follows that c must be larger than a. QED
40
Consequence Rules There are three consequence “rules” in Fitch Tautological Consequence (Taut Con) First-order Consequence (FO Con) Analytic Consequence (Ana Con) Cons rules are proof seekers that work behind the scenes. Success is indicated by the beloved blue check mark. Failure is indicated by the dreaded red x.
41
Taut Con Weakest of the three Cons “rules” Attempts to prove if the current step follows from the cited statements by virtue of the truth-functional connectives. E.g., p q can be replaced by p q.
42
FO Con More powerful than Taut Con but weaker than Ana Con Attempts to prove if the current step follows from the cited steps by virtue of the truth- functional connectives, the quantifiers, and the identity predicate. E.g., a=b b=c can be replaced by a=c.
43
Ana Con Most powerful Cons “rule” Attempts to prove if the current step follows from the cited steps by virtue of the truth- functional connectives, the quantifiers, the the identity predicate and the meanings of each predicate of Tarski’s World. E.g., Larger(a,b) can be replaced by Smaller(b,a).
44
Showing Non-consequence To show Q is not a consequence of premises P 1, P 2, …, P n, create a world where the premises are simultaneously true and the conclusion Q is false. This shows the argument below is invalid P 1 P 2 … P n Q
45
Invalid Argument SameRow(b,c) SameRow(a,d) SameRow(d,f) LeftOf(a,b) LeftOf(f,c) bcad ff
47
Boolean Connectives Negation Conjunction Disjunction It is not the case that And, but, moreover Or
48
Negation P PP TF FT
49
Negation Facts P is translated as It is not the case that P. (a = b) is equivalent to a b P is equivalent to P P PP P P TFT FTF
50
The Game Used to understand the truth value of a complex sentence Strategy: Given a sentence of the form P that you believe to be True (False) implies P is False (True) implies P is True (False) implies P is False (True)
51
Assessment is incorrect
52
Conjunction and Disjunction PQ P QP Q TTTT TFFT FTFT FFFF
53
Game Revisited If you believe P Q is true you will be asked to select the disjunct that is true. If you believe P Q is false Tarski’s World will attempt to find a disjunct that is true. If you believe P Q is true Tarski’s World will attempt to find a conjunct that is false. If you believe P Q is false you will be asked to select a conjunct that is false.
54
Translation Both A and B Either A or B Neither A nor B A B A B (A B) Both c and e are cubes. Cube(c) Cube(e) Either c or e is a cube. Cube(c) Cube(e) Neither c nor e is a cube. (Cube(c) Cube(e))
55
Avoid Ambiguity A B C(A B) C Both A or B and C A (B C) Either A or both B and C A B C(A B) C Either both A and B or C A (B C) Both A and either B or C Either both Max is at home and Claire is tall or Carl is happy. [Home(Max) Tall(Claire)] Happy(Carl)
56
Distributive Rules A (B C) is tautologically equivalent to (A B) (A C) A (B C) is tautologically equivalent to (A B) (A C)
57
Famous Equivalences DeMorgan’s Laws (A B) A B (A B) A B Idempotent A A
58
Negation Normal Form NNF A sentence S is in negation normal form if the is moved as far inside S as possible. [(A B) C] (A B) C ( A B) C ( A B) C
59
Conjunctive Normal Form CNF A sentence S of the form A 1 A 2 … A n where each A i, 1 i n is of the form B 1 B 2 … B m(i) where each B j is a literal or the negation of a literal, 1 j m(i).
60
Disjunctive Normal Form DNF A sentence S of the form A 1 A 2 … A n where each A i, 1 i n is of the form B 1 B 2 … B m(i) where each B j is a literal or the negation of a literal, 1 j m(i).
61
Example [(A B) C] (A B) C ( A B) C ( A B) C NNF, CNF ( A C) (B C) NNF, DNF
62
Reiteration P P
63
Conjunctive Elimination P Q... P Elimination Q
64
Conjunctive Introduction P... Q... P Q Introduction
65
Proof Cube(b) Tet(d) Large(d) Tet(d) Elim 1 Large(d) Reit 2 Tet(d) Large(d) Intro 3, 4 2 1 3 4
66
Disjunction Introduction P... P Q Introduction
67
A B C (B C) D 1. A B 2. C 3. 4. 5. B Elim: 1 B C Intro: 3, 2 (B C) D Intro: 4 Prove:
68
Disjunctive Elimination Proof by cases P Q... P … S Q … S S Elimination Same conclusion
69
A B B C A C 1. A B 2. B C 3. A 4. A C Intro: 3 5. B 6. C Elim: 2 7. A C Intro: 6 8. A C Elim: 1, 3-4, 5-7 Prove:
70
Tautology A sentence S is a tautology if and only if every row of its truth table assigns true to S.
71
Example
72
Logical Possibility A sentence S is a logical possibility if there is some logically possible circumstance in which S is true. A sentence S is a TW-possible if there is a world in which S is true.
73
Examples Cube(b) Large(b) b is a large cube. (Tet(c) Cube(c) Dodec(c)) It is not the case that c is a tet or a cube or a dodec. e e e is not identical to iteself. Logically possibleTW-possible Not TW-possibleLogically possible Not Logically possibleNot TW-possible
74
Spurious Rows A spurious row in a truth table is a row whose reference columns describe a situation or circumstance that is impossible to realize on logical grounds.
75
Example Reference Columns
76
Logical Necessity A sentence S is a logical necessity if and only if S is true in every logical circumstance. A sentence S is a logical necessity if and only if S is true in every non-spurious row of its truth table. Logical-Necessity TW-Necessity
77
Example Logical NecessityTW-Necessity Reference ColumnsS
78
Example Not a TW-NecessityNot a Logical Necessity Reference Columns S Can you find an example which is a TW-necessity but not a logical necessity?
79
Tet(b) Tet(b) a=a Tet(b) Cube(b) Dodec(b) Cube(a) Small(a)
80
Tautological Equivalence Two sentences S and S’ are tautologically equivalent if and only if every row of their joint truth table assigns the same values to S and S’.
81
Example Reference ColumnsSS’
82
Logical Equivalence Two sentences S and S’ are logically equivalent if and only if every non-spurious row of their joint truth table assigns the same values to S and S’.
83
Example Not Tautologically EquivalentLogically Equivalent Reference ColumnsSS’
84
Tautological Consequence Sentence Q is a tautological consequence of P 1, P 2, …, P n if and only if every row that assigns true to all of the premises also assigns true to Q.
85
Example Reference ColumnsPremisesConclusion
86
Logical Consequence Sentence Q is a logical consequence of P 1, P 2, …, P n if and only if every non-spurious row that assigns true to all of the premises also assigns true to Q.
87
Example Reference ColumnsPremisesConclusion
88
Summary Every tautological consequence of a set of premises is a logical consequence of these premises. Not every logical consequence of a set of premises is a tautological consequence of these premises.
89
Summary Every tautological equivalence is a logical equivalence. Not every logical equivalence is a tautological equivalence.
90
Summary Every tautology is a logical necessity. Not every logical necessity is a tautology.
91
Negative Elimination P... P Elimination
92
Negative Introduction Proof by contradiction P... P Introduction
93
Negative Introduction Proof by contradiction P... P Introduction
94
Bottom Elimination ... P Elimination Anything you wish follows from a contradiction
95
A B B A 1. A B 2. B 3. A 4. A 5. Intro: 4, 3 6. B 7. Intro: 6, 2 8. Elim: 1, 4-5, 6-7 9. A Intro: 3-8 10. A Elim: 9 Prove:
96
Material Conditional P Q P is called the antecedent and Q is called the consequent.
97
Definition of
98
English Translations If P then Q P implies Q P only if Q P is sufficient for Q Q provided that P Q is necessary for P Q if P P Q Large Cube
100
P Q If not P then Q Unless P, Q Q, unless P Unless Max is at home, Claire won’t get the message. b is cube, unless it is large. Home(max) GetsMessage(claire) Large(b) Cube(b)
101
Equivalencies P Q P Q Q P
102
Biconditional P Q
103
English Translations P if and only if Q P just in case Q P is a necessary and sufficient condition for Q.
104
Definition of
105
Equivalencies P Q (P Q) (Q P) (P Q) ( P Q) P and Q are sufficient and necessary for each other.
106
Well-formed Formula (wff) Any atomic sentence is a wff. If A are B are wffs then so are A A B A B A B A B
107
Elimination P Q … P … Q Elim
108
Inference Patterns Modus Tollens P Q Q P
109
Modus Tollens
110
Introduction P … Q P Q Intro
111
Example Prove this argument is valid. P (Q P)
112
Elimination P Q … P … Q Elim
113
Introduction P … Q Q … P P Q Intro
114
Example Deduce A C from A B and B C. Called Hypothetical Syllogism
115
Law of Excluded Middle P P A Tautology Weakest form of Taut Con Prove from P P (may use Law of Excluded Middle)
116
Example
117
Valid Argument P 1 P 2 … P n Q Q is a tautological (logical) consequence of P 1, P 2, …, P n (P 1 P 2 … P n ) Q is a tautology (logical necessity). Valid Argument
118
Example Show P is a tautological consequence of (P Q). Methods of attack: Boole Show P is a tautological consequence of (P Q). Show (P Q) P is a tautology. Fitch Show (P Q) is a valid argument PP
119
Tautological Consequence
120
Tautology
121
Using Fitch
122
Example Show P is not a tautological consequence of (P Q). Method of attack: Boole Show P is not a tautological consequence of (P Q). Show (P Q) P is not a tautology. Build a world Show (P Q) is an invalid argument PP
123
Not a Tautological Consequence
124
Not a Tautology
125
Build a World Let P be assigned true and Q false. (P Q) is true while P is false. premises conclusion
126
Example Show the following argument is valid. Cube(b) (Cube(c) Cube(b)) Cube(c)
127
Logical Consequence
128
Logical Necessity Every non-spurious row is true! In fact, every row is true, so we have a tautology!!
129
Fitch
130
Non-consequence Show the following argument is invalid. Cube(a) Cube(b) (Cube(c) Cube(b)) Cube(c)
131
Counterexample
132
Tautological Consequence
133
Tautology
134
Clausal Form Given a sentence S written in CNF S = ( ) ( ) ... ( ) Convert each ( ) into a clause - a set consisting of each of the literals in the disjunction ( ). Example: S = (A) ( B C D) ( A D) Clauses are: {A}, { B, C, D} and { A, D}
135
Satisfying a Set of Clauses Assigning truth-values to each of the literals so that at least one of the literals in each clause is assigned True. Example: {{A, C, D}, {C}, { A}, {A, D}} is satisfied by A = False D =True C = True
136
Empty Clause { } denoted by . The empty clause is not satisfied by any truth-assignment. Example: Consider the fallacy A A represented by a set of clauses {{A}, { A}}. No truth-assignment satisfies these clauses.
137
Resolvent A clause R is said to be a resolvent of clauses C 1 and C 2 if there is a literal in C 1 whose negation is in clause C 2 and R consists of all the remaining literals in either clause. Example: {A, B, D } is a resolvent of the clauses {A, C, D} and {B, C}.
138
Resolution Theorem For any set of clauses that are not satisfiable, it is possible to arrive at the empty clause by applying a succession of resolution operations on Z. Example: T he fallacy (A) ( A), whose set of clauses Z = {{A}, { A}} is not satisfiable since, {A} { A}
139
Example Show A (B C) ( C D) (A D) ( B D) is not satisfiable. Clauses: Z = { { A}, {B, C}, { C, D}, {A, D}, { B, D}}. { A} {A,D} {B,C} { C, D} {D} {B, D} { B, D} { D}
140
Determine Validity of Arguments using Resolution S T = S A sentence Q is a logical consequence of a set of sentences S if and only if T = S { Q} is not satisfiable. Q P1P2PnP1P2Pn S
141
Logical Truths and Resolution A sentence S, in conjunctive normal form, is a logical truth if and only if S is not satisfiable. Example: S = P P is a logical truth. S = P P = {{ P}, {P}} { P} {P} this implies S is not satisfiable
142
Example Modus Pones P Q or P Q or { P,Q} P or {P} Q negate to get { Q} Apply resolution: { P,Q} {P} {Q} { Q}
143
PROLOG Programs = facts + rules + queries B. Fact B:-A. Rule :-A. Query
144
Example Prolog Program grandfather(X,Y) :- father(X,Z), father(Z,Y). grandFather(X,Y) :- father(X,Z), mother(Z,Y). mother(ann,bill). father(carl,ed). father(nick,ann). father(ed,sam).
145
What is a Horn sentence? A positive literal is any literal that is not preceded with a . For example, Cube(b) and P are positive literals and Tet(c) and Q are negative literals. A sentence S is a Horn sentence if and only if it is in conjunctive normal form and every conjunct is composed of at most one positive literal.
146
Examples (A B C) ( A B) (A B C) (D) (A B) ( C D) Horn sentence Not Horn sentence (A C) (B C) (A D) (B D) Horn sentence
147
Why are Horn sentences important? Unlike sentences in general, Horn sentences can easily be determined to be or not to be satisfiable. Consider a sentence with 50 distinct literals. Its truth table has 2 50 rows. Attack problem with a truth table?
148
Satisfaction Algorithm for Horn sentences (1) No conjunct in S consists of a single literal (2) Some conjunct in S consists of a single literal S= L 1 L 2 … L t ( ) … ( ) (May or may not be Satisfiable!!!) Every conjunct in S has a negative literal Take one conjunct at a time, assign a negative literal the truth-value of False. Since ( False anything) is True this conjunct may be removed. Continue substituting this literal’s value into the remaining conjuncts. Repeat this process for the next conjunct. Do this until no literals are left to assign. (ALWAYS Satisfiable!!!)
149
Done = False; W=S; Repeat Assign L i ’s a truth-value of True (False) if positive (negative). Also replace their values inside ( )s. If all conjuncts in S are True Done = True; W is satisfiable Else if there exists a conjunct in S whose value is False Done = False; W is not satisfiable Else Remove any conjunct in S which has at least one True. What remains are ( )s with disjunction of unassigned literals. Call this sentence S’. If S’ is of form (1) Done = True; W is satisfiable Else W = S’ Until Done
150
Examples S = (P Q) ( P Q) ( P Q) S = (C A B) ( A B) ( C B) A S = ( A B) C B
151
Alternate Form of Horn Conjunct A 1 A 2 ... A n B (A 1 A 2 ... A n ) B (A 1 A 2 ... A n ) B Conditional Form of Horn sentence
152
Special Cases No positive literal A 1 A 2 ... A n No negative literals B (A 1 A 2 ... A n ) False True B
153
Logical Consequence Revisited SS Theorem: A sentence Q is a logical consequence of a set of sentences S if and only if S { Q} is not satisfiable.
154
CNF to PROLOG A B C = (A C) B = (A C) B or A C B B :- A, C. A. C. Query: :- B.
155
Variables Cube(b) Cube(d) The truth of this sentence is determined by the truth values of P and Q. Cube(x) Cube(d) Cube(x) is neither true nor false, since x is a placeholder for the name of an object. x is said to be free or unbound. Wff and a sentence Wff but not a sentence
156
wff If P is wff then so is P. If P 1, P 2, …, P n are wffs then so is (P 1 P 2 … P n ). If P 1, P 2, …, P n are wffs then so is (P 1 P 2 … P n ). If P and Q are wffs, so is (P Q). If P and Q are wffs, so is (P Q). If P is a wff and v is a variable, then v P is a wff. Every occurrence of v is said to be bound. If P is a wff and v is a variable, then v P is a wff. Every occurrence of v is said to be bound.
157
Sentences A sentence is a well-formed formula with no unbound (free) variables. The scope of a quantifier is defined as those variables that fall under the quantifier’s influence as indicated by the enclosing parentheses.
158
Unbounded Variables x LeftOf(x, y) x Cube(x) Large(x) x Small(x) Tet(y) x (Cube(c) SameRow(x, c))
159
Satisfaction of a wff Let S(x) be a wff with free variable x. An object b is said to satisfy S(x) if and only if S(b) is a true sentence.
160
Semantics of Quantifiers x S(x) is true if and only if there is at least one object that satisfies S(x). x S(x) is true if and only if every object satisfies S(x). The truth-value is determined with respect to a domain of discourse!
162
Aristotelian Forms All P’s are Q’s x [P(x) Q(x)] Q P
163
Aristotelian Forms Some P’s are Q’s x [P(x) Q(x)] Q P
164
Aristotelian Forms No P’s are Q’s x [P(x) Q(x)] Q P
165
Aristotelian Forms Some P’s are not Q’s x [P(x) Q(x)] Q P
166
Translation x (Tet(x) LeftOf(x, c)) x [Cube(x) BackOf(x, c)] Some Tet is to the left of c. Every cube is in back of c.
167
Quantifiers and Functions Everyone is taller than Max’s father. Someone’s father is taller than Max. x Taller(x, father(max)) x Taller(father(x), max)
168
Quantifiers and Tautology When is a sentence involving quantifiers a tautology? Example: x Cube(x) x Cube(x)
169
Truth-Functional Form Algorithm Start at the beginning of sentence S and proceed to the right. If you encounter a quantifier, underline the quantifier and the entire formula that it is applied to. If you encounter an atomic sentence simply underline it. When you come to the end of an underline assign a letter (A, B, C, …). If an underlined sentence is identical to one that occurs previously (i.e., character for character), use the same letter to label it. Determine if the sentences formed in terms of these letters is a tautology. If it is, then the original is a tautology.
170
When is a sentence a tautology? A quantified sentence S is a tautology if and only if its truth-functional form is a tautology.
171
Example x Cube(x) x Cube(x) A B Since A B is not a tautology, then neither is the sentence above.
172
Example x Cube(x) [ x Cube(x)] A A A Since A A is a tautology, then so is the sentence above.
173
Example (Tet(d) x Small(x)) ( Tet(d) y Small(y)) A B A C (A B) ( A C)
175
Tautological Valid? Is the following argument valid or invalid? x Cube(x) x Small(x) x (Cube(x) Small(x)) A B C Not tautologically valid!!! In fact, it is not valid.
176
Tautological Valid? Is the following argument valid or invalid? x Cube(x) x Small(x) x Cube(x) x Small(x) A B A B Is tautologically valid!!!
177
Tautological Valid? Is the following argument valid or invalid? x [ Cube(x) Small(x)] x Cube(x) x Small(x) A B C Is not tautologically valid. It is logically valid!
178
Propositional Logic Tautology Tautological Consequence Tautological Equivalence Based on the truth-functional Connectives
179
First-Order Logic Takes into consideration all of the truth-functional connectives ( ), the identity symbol (=), and the quantifiers ( x y). Does not take the meanings of the names, functions or any predicates into consideration (other than =) when determining whether or not a sentence is a logical truth or whether or not an argument is valid, or whether or not two sentences are equivalent.
180
First-Order Logic FO Validity is a sentence that can’t be false. FO Consequence applies to an argument whose conclusion can’t be made false, while at the same time, all of its premises are simultaneously true. FO Equivalence applies to a pair of sentences that, in all possible circumstances, are satisfied by the same objects.
181
Facts All tautologies are FO Validities. All FO Validities are logical truths. Tet(b) Tet(b) Tautologies FO Validities Logical truths x Cube(x) Cube(a) x LeftOf(x, x)
182
Using Boole spurious
183
Using Fitch to Prove
184
S is not a tautology, since A is not a tautology Even though we know that no object can be to the left of itself. Consider replacing LeftOf with a meaningless predicate say R. Then it is not obvious that x R(x,x) is still a true statement. In fact, if we let R be the = predicate, x (x = x) is false when the domain = integers. S = x LeftOf(x, x)
185
Using Fitch to Disprove
186
Facts All tautological consequences are FO Consequences. All tautological equivalencies are FO Equivalencies.
187
FO Consequence x [P(x) Q(x)] Q(b) P(b) Q P b x [Tet(x) Large(x)] Large(b) Tet(b) A B CA B C C is not a tautological consequence of A and B
188
Using Fitch
189
Not an FO Consequence x R(x,a) x R(b,x) R(c,d) R(a,b) Interpret R(x,y) as x loves y. The first line says, nobody loves a (Scrooge) including a (Scrooge). The second line says, b (Moriarty) loves nobody including b (Moriarty). The third line says, c (Romeo) loves d (Juliet). The conclusion says a (Scrooge) loves b (Moriarity). MoriartyScroogeRomeoJuliet
190
Replacement Method This method is used to determine if a sentence is an FO Validity or if an argument is an FO Consequence.
191
Replacement Method Replace all predicates in the sentence or in the argument with symbolic ones making sure that if a predicate appears more than once it is replaced with the same symbolic name.| See if you can describe a circumstance where the sentence is false, if this is impossible then the sentence is a FO Validity. See if you can describe a circumstance where the conclusion is false and the premises are all true. If this is impossible, then the conclusion is an FO Consequence of its premises.
192
DeMorgan’s Laws for Quantifiers x P(x) x [ P(x)] Nobody is P. Everyone is not P. x P(x) x [ P(x)] It is not the case that everyone is P. Somebody is not P. P PP
193
Aristotelian Forms Revisited Negate: All P’s are Q’s. x[P(x) Q(x)] x [ (P(x) Q(x)) ] x [ ( P(x) Q(x))] x [P(x) Q(x)] Some P’s are not Q’s
194
A Special Form and its Equivalent Only the Q’s are P’s All P’s are Q’s P Q x [P(x) Q(x)]
196
Other Equivalences x [P(x) Q(x)] x P(x) x Q(x) x [P(x) Q(x)] x P(x) x Q(x) x [P(x) Q(x)] x P(x) x Q(x) x [P(x) Q(x)] x P(x) x Q(x)
197
Other Equivalences x P P, where x is not free in P x P P, where x is not free in P x [P Q(x)] P x Q(x) x [P Q(x)] P x Q(x) x P(x) y P(y) x P(x) y P(y)
198
Proofs Involving Quantifiers Universal Elimination x S(x) … S(c) Elim
199
Example Prove x Cube(x) x Large(x) Large(d) Cube(d)]
201
Proofs Involving Quantifiers Universal Introduction c … S(c) x S(x) Intro Assume c is an arbitrary element in the domain of discourse.
202
Example Prove x Cube(x) x Large(x) x [Large(x) Cube(x)]
204
Proofs Involving Quantifiers Existential Introduction S(c) … x S(x) Intro
205
Example Prove Cube(e) Large(e) LeftOf(e,a) x [Cube(x) LeftOf(x,a)]
207
Proofs Involving Quantifiers Existential Elimination x S(x) c S(c) … Q Q Elim Since there exists an x such that S(x), let c designate this object. Symbol c cannot appear outside this subproof!
208
Example Prove x Large(x) x Cube(x) x [Large(x) Cube(x)]
210
General Conditional Proof Universal Introduction c P(c) … Q(c) x [P(x) Q(x)] Intro Assume c is an arbitrary element in the domain of Discourse and assume P(c)
211
Example Prove x [P(x) Q(x)] z [Q(z) R(z)] x [P(x) R(x)]
213
Order of Quantifiers vs. Meaning x y P(x,y) is logically equivalent to y x P(x,y) x y P(x,y) is logically equivalent to y x P(x,y) x y P(x,y) is not logically equivalent to y x P(x,y)
214
Careful x y[(Cube(x) Cube(y)) (LeftOf(x,y) RightOf(x,y))] x y[(Cube(x) Cube(y) x y) (LeftOf(x,y) RightOf(x,y))]
215
Translation x y P(x,y) For each x there is a y x such that P(x,y).
216
Translation x y P(x,y) There us a special x such that for all y, P(x,y).
217
Example Let Q(x,y) means x + y = x – y. Determine if y x Q(x,y) is true or false using the integers as the domain of discourse. Let y = 0 (special element). Consider the reduced sentence, x Q(x,0) or x (x = x) is obviously true. Determine if y x Q(x,y) is true or false using the integers as the domain of discourse. Let c represent an arbitrary but fixed y, i.e., y = c. Consider the reduced sentence, x Q(x,c) or x (x+c = x-c) or x (c = -c) which is false.
218
Translation All cubes are to the left of something large. x [Cube(x) x is to the left of something large] x [Cube(x) y (Large(y) LeftOf(x, y))] Some cube is to the left of everything large. x [Cube(x) x is to the left of everything large] x [Cube(x) y [Large(y) LeftOf(x,y)]]
219
Translation Worksheet Handout
220
At Least One x P(x) There exists an x such that P(x) There is at least one x such that P(x)
221
At Least Two x y [P(x) P(y) x y] There exists a pair (x,y) such that P(x) and P(y) and x is not equal to y. There are at least two objects that satisfy P(x).
222
At Least Three x y z [P(x) P(y) P(z) x y x z y z] There are at least three objects that satisfy P(x).
223
At Least n x 1 x 2 … x n [P(x 1 ) P(x 2 ) … P(x n ) x 1 x 2 x 1 x 3 … x 1 x n x 2 x 3 x 2 x 4 … x 2 x n x 3 x 4 x 3 x 5 … x 3 x n … x n-1 x n ] There are at least n objects that satisfy P(x). n existential quantifiers and Combinations(n,2) = n(n-1)/2 not equal to symbols
224
Exactly One x [P(x) y (P(y) y x)] There exists an x such that P(x) and for any y that satisfies P(y) that y must equal x. Exactly one x satisfies P(x).
225
Exactly Two x y [P(x) P(y) x y z (P(z) (z x z y)] There exists an x and a y where x y, such that P(x) and P(y) and for any z that satisfies P(z) that z must equal either x or y. Exactly two objects satisfies P(x).
226
Exactly n x 1 x 2 … x n [P(x 1 ) P(x 2 ) … P(x n ) x 1 x 2 x 1 x 3 … x 1 x n x 2 x 3 x 2 x 4 … x 2 x n x 3 x 4 x 3 x 5 … x 3 x n … x n-1 x n z (P(z) (z x 1 z x 2 … z x n ))] Exactly n objects satisfies P(x).
227
At Most One “at most one” means either none or exactly one. x P(x) says “nobody satisfies P(x)” x [P(x) y (P(y) y x)] says “exactly one” Combining gives x P(x) x [P(x) y (P(y) y x)]
228
At Most One “at most one” means (“at least two”) ( x y [P(x) P(y) x y]) x y [ P(x) P(y) x=y] x y [(P(x) P(y)) x=y] At most one objects satisfy P(x).
229
At Most Two “at most two” means (“at least three”) ( x y z [P(x) P(y) P(z) x y x z y z]) x y z [ P(x) P(y) P(z) x=y x=z y=z] x y z [(P(x) P(y) P(z)) (x=y x=z y=z)] At most two objects satisfy P(x).
230
At Most n “at most n” means (“at least n+1”) ( x 1 x 2 … x n+1 [P(x 1 ) P(x 2 ) … P(x n+1 ) x 1 x 2 x 1 x 3 … x 1 x n+1 x 2 x 3 x 2 x 4 … x 2 x n+1 x 3 x 4 x 3 x 5 … x 3 x n+1 … x n x n+1 ]) At most n objects satisfy P(x).
231
At Most n x 1 x 2 … x n+1 [ P(x 1 ) P(x 2 ) … P(x n+1 ) x 1 = x 2 x 1 = x 3 … x 1 = x n+1 x 2 = x 3 x 2 = x 4 … x 2 = x n+1 x 3 = x 4 x 3 = x 5 … x 3 = x n+1 … x n = x n+1 ])
232
At Most n x 1 x 2 … x n+1 [(P(x 1 ) P(x 2 ) … P(x n+1 )) ( x 1 = x 2 x 1 = x 3 … x 1 = x n+1 x 2 = x 3 x 2 = x 4 … x 2 = x n+1 x 3 = x 4 x 3 = x 5 … x 3 = x n+1 … x n = x n+1 )]
233
Models of Computation Function (table look-up) Finite-state Automata
234
XOR Table Combine two n-bit binary numbers using exclusive or Table size = 2 n x 2 n rows If n = 32 then table size 1.8 x 10 19
235
XOR Automata 01 00, 11 01, 10 1 1 0 1 0 0 1 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1
236
Mathematical Preliminaries Set – a group of objects represented as a unit. {a, b, c}= {a, b, c, b} = {b, c, a} Sequence – a list of objects in some order. (a, b, c) (b, c, a) (a, b, c, b) (a, b, c)
237
Mathematical Preliminaries Cartesian Product A x B = {(x,y) | x A and y B} Generalized Cartesian Product A 1 x A 2 x … x A n = {(a 1, a 2, …, a n ) | a i A i for each i}
238
Mathematical Preliminaries Function f: D R f associates each element d D with some element r R. This association is denoted f(d) = r. Example: f(x) = (x + 1) mod 3 D = {1, 2, 3, 4} R = {0, 1, 2}
239
Mathematical Preliminaries Example: f(x,y) = max(x,y) f: A x A A where A = {1, 2, 3} (1,1) 1 (1,2) 2 (1,3) 3 (2,1) 2 (2,2) 2 (2,3) 3 (3,1) 3 (3,2) 3 (3,3) 3
240
Mathematical Preliminaries Alphabet – a finite set of symbols called . A string s over is a finite sequence of symbols from . The length of s is the number of symbols it contains, designated |s|. is used to represent the empty string. Let s and t be strings over , st is the string obtained by appending string t to the end of string s.
241
Mathematical Preliminaries A language is a set of strings over . Lexicographic ordering is dictionary order of strings in which shorter strings precede longer strings. Example: { 0, 1, 00, 01, 10, 11, 000, 001} – lexicographic order { 0, 00, 000, 001, 01, 1, 10, 11} – dictionary order
242
Finite Automaton 5 - tuple M = (Q, , , q 0, F) Q is a finite set of states is an alphabet :Q x Q is the transition function q 0 Q is the starting state F Q is the set of accept states.
243
JFLAP software www.jflap.org www.jflap.org
244
Example M 1 q0q0 q1q1 q2q2 0 1 1 0 0, 1 q1q1 Q = {q 0, q 1, q 2 } = {0, 1} F = {q 1 }
245
Language Recognized A string w is accepted by M if and only if after processing each symbol of w M finds itself in a state belonging to F (otherwise, we say w is rejected by M). If A is the set of all strings accepted by M, we say A is the language of machine M, denoted by L(M) = A. M is said to recognize A.
246
More Formally Let w = w 1 w 2 …w n be a string accepted by M then there exists states r 0, r 1, …, r n in Q satisfying 1) r 0 = q 0 2) (r i, w i+1 ) = r i+1, where i = 0, …, n-1 3) r n in F
247
Regular Language A language is called a regular language if some finite automaton recognizes it.
248
Creating a Automaton Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such that L(M) = L.
249
Example 1 L 1 = {w | w is a string over ={0,1} that contains an even number of 0s and an odd number of 1s } Method: Define nodes to represent when a) both an even number of 0s and 1s have been seen in the input b) both an odd number of 0s and 1s have been seen in the input c) an even number of 0s and an odd number of 1s have been seen in the input d) an even number of 1s and an odd number of 0s have been seen in the input
250
q oe q oo q ee 1 0 1 0 0 0 1 1 q eo Example 1
252
Example 2 (complement) L 2 = {w | w is a string over ={0,1} that does not contain an even number of 0s and an odd number of 1s } = L 1
253
q eo 1 0 1 0 0 0 1 1 Example 2 q ee q oe q oo
254
Example 3 L 3 = { w | w is a string over {0, 1} such that |w| 3} = { , 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111} Starting state must be final
255
Example 3 q0q0 q1q1 q2q2 0, 1 q3q3 q4q4
256
Example 4 L 4 = { w | w is a string over ={0,1} such that w contains the substring 11 } = { w | w = x11y, where x and y are strings over ={0, 1}}
257
Example 4 q0q0 q1q1 0 1 0 1 q2q2 0, 1 f s
258
Machine M accepts string w If there exists a sequence of states r 0, r 1, …, r n in Q such that 1) r 0 = q 0 2) (r i, w i+1 ) = r i+1, for i=0,…,n-1 3) r n in F Note: w = w 1 w 2 …w n
259
Regular Languages Machine M recognizes language A if A = {w| M accepts w} A language is called regular if some finite automaton recognizes it.
260
Regular Languages Machine M recognizes language A if A = {w| M accepts w} A language is called regular if some finite automaton recognizes it.
261
Regular Operations Let A and B be languages. Union A B = { x | x in A or x in B} Concatenation A B = {xy | x in A and y in B} Star A* = {x 1 x 2 …x k | k 0 and each x j in A} Note: is always a member of A*.
262
Regular languages are closed under union Let A 1 and A 2 be regular languages. We want to show A 1 A 2 is a regular language. Since A 1 and A 2 are regular languages there exists a finite automaton M 1 and there exists a finite automaton M 2 such that M 1 recognizes A 1 and M 2 recognizes A 2. Assume M 1 = (Q 1, , 1, q 1, F 1 ) and M 2 = (Q 2, , 2, q 2, F 2 ) It suffices to create a finite automaton M that recognizes A 1 A 2.
263
Continue … Let a be a symbol in and states r 1 in Q 1 and r 2 in Q 2. Define M = (Q, , , q 0, F) where Q = Q 1 x Q 2 states ((r 1, r 2 ), a) = ( 1 (r 1, a), 2 (r 2, a)) transition function q 0 = (q 1, q 2 ) start state F = (F 1 x Q 2 ) (Q 1 x F 2 ) final states
264
Example u v 0,1 0 1 M1M1 x z 0 M2M2 y 1 1 0 M = (Q, , , q 0, F) Q = {(u,x), (v,x), (u,y), (v,y), (u,z), (v,z)} states q0 = (u, x) start state F = {(v,x), (v,y), (v,z)} {(u,z), (v,z)} = {(v,x), (v,y), (v,z), (u,z)} final states 01 (u,x) ( (u), 2 (x)) = (v,z)( (u), 2 (x)) = (v,y) (u,y) ( (u), 2 (y)) = (v,y)( (u), 2 (y)) = (v,z) (u,z) ( (u), 2 (z)) = (v,y) (v,x) ( (v), 2 (x)) = (v,z)( (v), 2 (x)) = (u,y) (v,y) ( (v), 2 (y)) = (v,y)( (v), 2 (y)) = (u,z) (v,z) ( (v), 2 (z)) = (v,y)( (v), 2 (z)) = (u,y)
265
Regular languages are closed under concatenation Let A 1 and A 2 be regular languages. We want to show A 1 A 2 is a regular language. Since A 1 and A 2 are regular languages there exists a finite automaton M 1 and there exists a finite automaton M 2 such that M 1 recognizes A 1 and M 2 recognizes A 2. Assume M 1 = (Q 1, , 1, q 1, F 1 ) and M 2 = (Q 2, , 2, q 2, F 2 ) It suffices to create a finite automaton M that recognizes A 1 A 2. There is a problem since M doesn’t know where to subdivide the input string into the part accepted by M 1 and the remaining part that will be accepted by M 2. We will return to this later.
266
Regular Expressions R is a regular expression if 1) x for some x in (note: regular expression x represents language {x}) 2) (empty string) (note: regular expression represents language { }) 3) (empty set) 4) (R 1 R 2 ) where R 1 and R 2 are regular expressions 5) (R 1 R 2 ) where R 1 and R 2 are regular expressions 6) (R 1 *) where R 1 is a regular expression If R is a regular expression then L(R) is the language of R.
267
Non-Deterministic Automaton NFAs generalize DFAs. In a DFA, each state has exactly one transition for each symbol in the alphabet. In an NFA, at any state there may be zero or more transitions for a symbol in the alphabet. In a DFA, a label on a transition arrow is a symbol in the alphabet. In an NFA, a label on a transition arrow is a symbol in the alphabet or .
268
Example q1q1 q2q2 q3q3 0, 1 1 0, 1 0, 1 q4q4
269
q1q1 q1q1 q1q1 q2q2 q1q1 q3q3 q2q2 q4q4 q3q3 q3q3 q1q1 q4q4 q4q4 q3q3 q2q2 q1q1 q3q3 q1q1 q4q4 q4q4 0 111 0 0 1 1 1 1 00 00 1 1 1 11 Input: 010110
270
Non-Deterministic Finite Automaton N = (Q, , , q 0, F) Q is a finite set of states is a finite alphabet : Q x ( { } ) (Q) F Q is a set of accept states (Q) is the power set of Q = {X| X Q}
271
Machine N accepts string w If there exists a sequence of states r 0, r 1, …, r n in Q such that 1) r 0 = q 0 2) r i+1 in (r i, w i+1 ) for i=0,…,n-1 3) r n in F Note: w = w 1 w 2 …w n (r i, w i+1 ) is a set of states
272
Are NFAs more powerful than DFAs? Every deterministic finite automaton has an equivalent non-deterministic finite automaton. (see next slide) Every non-deterministic finite automaton has an equivalent deterministic finite automaton.
273
Non-deterministic? q0q0 q1q1 0 1 0 1 q2q2 0, 1 Non-deterministic interpretationDeterministic interpretation
274
Deterministic Equivalent? 1 2 3 b a, b a a with edgeswithout edges 12 0 3 0 1 NN Next four slides color coded with respect to these examples = {0, 1} = {a, b}
275
DFA from NFA Construction Assume no edges. Let N = (Q, , , q 0, F) be an NFA that recognizes language A. We construct a DFA called M = (Q’, , ’, q 0 ’, F’) 1) Q’ = (Q) 2) For R in Q’ and a in let ’(R,a) = {q in Q| q in (r,a) for some r in R} = (r,a) r in R Q’ = {{}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} ’({1,2},b) = (1,b) (2,b) = {2} {3} = {2,3} Q’ = {{}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3}} ’({2, 3},0) = (2,0) (3,0) = {} {} =
276
Continued … 3) q 0 ’ = { q 0 } 4) F’ = {R in Q’| R contains an accept state of N} (do blue example) Assume edges, then we need these modifications. Let R be a state of M. Define E(R) = {q in Q| q can be reached from R traveling along 0 or more edges} Modify ’(R,a) = {q in Q| q in E( (r,a)) for some r in R} = E( (r,a)) transition function r in R ’({1,2},b) = E( (1,b)) E( (2,b)) = E({2}) E({3}) = {2,3} ’({3},a) = E( (3,a)) = E({1}) = {1,3} q 0 ’ = E({q 0 }) start state (do red example)
277
Find Deterministic Equivalent Deterministic Equivalent Start state q 0 ’= {1} Final states F’ = { {2,3} } without edges 12 0 3 0 1 N
278
Solution {1} { } {2,3} 0, 1 0 1 0 1 M
279
Find Deterministic Equivalent 1 2 3 b a, b a a Deterministic Equivalent Start state q 0 ’= E({1}) = {1,3} Final states F’ = { {1}, {1,2}, {1,3}, {1,2,3} } N
280
Final Solution a {1,3} {2} b {3} a { } b b {2,3} a b a, b a b a {1,2,3} b {1,2} a, b {1} a M
281
Regular languages are closed under union Let A 1 and A 2 be regular languages. We want to show A 1 A 2 is a regular language. Since A 1 and A 2 are regular languages there exists an NFA N 1 and there exists an NFA N 2 such that N 1 recognizes A 1 and N 2 recognizes A 2. Assume N 1 = (Q 1, , 1, q 1, F 1 ) and N 2 = (Q 2, , 2, q 2, F 2 ) It suffices to create a NFA N that recognizes A 1 A 2.
282
Construction of NFA N1N1 N2N2 q1q1 q2q2 q0q0 N = (Q, , , q 0, F) Q = {q 0 } Q 1 Q 2 F = F 1 F 2 1 (q,a) q in Q 1 (q,a) = 2 (q,a) q in Q 2 {q 1, q 2 } q = q 0 and a= { } q = q 0 and a N q1q1 q2q2
283
Example Union u v 0,1 0 1 M1M1 x z 0 M2M2 y 1 1 0 q0q0 See slide 260 (union) for original machines
284
Regular languages are closed under concatenation Let A 1 and A 2 be regular languages. We want to show A 1 A 2 is a regular language. Since A 1 and A 2 are regular languages there exists an NFA N 1 and there exists an NFA N 2 such that N 1 recognizes A 1 and N 2 recognizes A 2. Assume N 1 = (Q 1, , 1, q 1, F 1 ) and N 2 = (Q 2, , 2, q 2, F 2 ) It suffices to create a NFA N that recognizes A 1 A 2.
285
Construction of NFA N1N1 N2N2 N = (Q, , , q 1, F 2 ) Q = Q 1 Q 2 and q 1 (start state) and F = F 2 1 (q,a) q in Q 1 and q not in F 1 (q,a) = 2 (q,a) q in Q 2 1 (q,a) {q 2 } q in F 1 and a= (add edges to q 2 keep edges from final states in N 1 ) 1 (q,a) q in F 1 and a (keep non- edges from final states in N1) q1q1 q2q2 q1q1 q2q2 N Not
286
Example Concatenation u v 0,1 0 1 M1M1 x z 0 M2M2 y 1 1 0
287
Regular languages are closed under the star operation Let A be a regular language. We want to show A* is a regular language. Since A is regular language there exists an NFA N 1 such that N 1 recognizes A. Assume N 1 = (Q 1, , 1, q 1, F 1 ) It suffices to create a NFA N that recognizes A*.
288
Construct NFA N1N1 N N = (Q, , , q 0, F) Q = {q 0 } Q 1 F = F 1 {q 0 } and q 0 the start state 1 (q,a) q in Q 1 and q not in F 1 (q,a) = 1 (q,a) q in F 1 and a 1 (q,a) {q 1 } q in F 1 and a= {q 1 } q = q 0 and a= { } q= q 0 and a q0q0 q1q1 q1q1
289
Find Star of M 2 x z 0 0,1 M2M2 y 1 1 0 x z 0 M2*M2* y 1 1 0 q0q0
290
Regular Expressions R is a regular expression if 1) x for some x in (note: regular expression x represents language {x}) 2) (empty string) (note: regular expression represents language { }) 3) (empty set) 4) (R 1 R 2 ) where R 1 and R 2 are regular expressions 5) (R 1 R 2 ) where R 1 and R 2 are regular expressions 6) (R 1 *) where R 1 is a regular expression If R is a regular expression then L(R) is the language of R.
291
Examples 0*0 {w| w contains at least one zero} * = { } 11 00 = {11, 00} 0 *1 = {w| w begins with a 0 and ends in a 1} (01)* = { , 01, 0101, 010101, 01010101, …} 1*0 = {w| w contains any number of 1s followed by exactly one 0}
292
Using Regular Expressions
293
Beginning or End?
294
Regular Expressions vs. Regular Languages A language is regular if and only if some regular expression describes it. Part a) If a regular expression describes a language then it is regular. Part b) If a language is regular then a regular expression describes it.
295
x NFA that recognizes {x} x
296
NFA that recognizes { }
297
NFA that recognizes
298
R 1 R 2, R 1 R 2, or R 1 * Construct a machine the same way we did to show regular languages are closed under , , or *.
299
NFA to recognize (0 11)* 01 11 0 11
300
0 11 0 11
301
Part b) If a language is regular then a regular expression describes it. Properties of GNFA 1) The start state has transition arrows going to every other state but no arrows coming in from any other state. 2) There is one accept state, and it has arrows coming in from every other state but no arrows going to any other state. The start state is not the same as the final state. 3) Except for the start and accept states, one arrow goes from every state to every other state and also from each state to itself. 4) The labels on each edge is a regular expression.
302
Example GNFA start accept ab* b ab ba b* ab aa (aa)* a*
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.