can’t be c can’t be b could be cthis is bcould be c
TRANSCRIPT
![Page 1: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/1.jpg)
can’t be ccan’t be b
Could be c
this is b
could be c
![Page 2: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/2.jpg)
![Page 3: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/3.jpg)
![Page 4: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/4.jpg)
Names
Constants are used to name existing objectsa, b, c, d, e, fmax, claire, carl
No constant can name more than one object An object can have more than one name or
no name at all
![Page 5: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/5.jpg)
Tiberius Sempronius GracchusGaius Sempronius Gracchus
Examples
Leonard EulerHonest Abe Lincoln
![Page 6: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/6.jpg)
![Page 7: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/7.jpg)
Predicates
A (determinate) property possessed by an object Shape Size
A (determinate) relationship among objects Shape relationship Size relationship Positional relationship Equality =
![Page 8: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/8.jpg)
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
![Page 9: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/9.jpg)
Atomic Sentences in FOL
Predicate(arg1, arg2,…, argn) 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 cLarger(c,e) – c is larger than eBetween(a,b,e) – a is between b and eBetween(b,a,e) – b is between a and e
=(a,b) a and b are identical Usually, written in infix form a = b
![Page 10: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/10.jpg)
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
![Page 11: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/11.jpg)
Functions in FOL
function(arg1, arg2,…, argn)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
![Page 12: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/12.jpg)
Connectives
Not And, Or , Material Conditional Biconditional
![Page 13: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/13.jpg)
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
![Page 14: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/14.jpg)
First Order Logic
Names Predicates Functions Connectives
Are there more?
Atomic Sentences
![Page 15: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/15.jpg)
Example FOL
English FOLNames Brando brando
Nancy nancySean sean
Predicates x is identical to y x = yx is a better actor than y BetterActor(x,y)
Functions x's favorite actor favoriteActor(x)
![Page 16: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/16.jpg)
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))
![Page 17: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/17.jpg)
Quantifiers and Variables
For every x x There exists y y
![Page 18: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/18.jpg)
First Order Logic
Names Predicates Functions Connectives Quantifiers and variables
Revised List
![Page 19: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/19.jpg)
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)))
![Page 20: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/20.jpg)
First-order Arithmetic
Names Zero 0 One 1
Predicates Equality = Less than <
Functions Addition + Multiplication
1) 0 and 1 are terms.2) If t1 and t2 are terms then so are (t1 + t2) and
(t1 t2).3) Nothing is a term unless formed from the
above rules.
![Page 21: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/21.jpg)
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).
![Page 22: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/22.jpg)
Fitch-style Argument
P1 P2
... Pn
Q
premises
conclusion
![Page 23: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/23.jpg)
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
![Page 24: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/24.jpg)
Valid Argument
Large(b) v Cube(b) Cube(b) Large(b)
Large(b) Cube(b) Large(b) v Cube(b) Cube(b) Large(b)T T T F TT F T T TF T T F FF F F T F
premises conclusion
![Page 25: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/25.jpg)
Invalid Argument
Large(b) v Cube(b) Cube(b) Large(b)
Large(b) Cube(b) Large(b) v Cube(b) Cube(b) Large(b)T T T T TT F T F TF T T T FF F F F F
premises conclusion
![Page 26: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/26.jpg)
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
![Page 27: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/27.jpg)
Sound Argument
![Page 28: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/28.jpg)
Argument is not sound
![Page 29: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/29.jpg)
Methods of Proof
FormalWe 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.
InformalThis 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.
![Page 30: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/30.jpg)
What constitutes a proof?
A proof that sentence Q follows from the premises P1, P2, …, Pn is a step-by-step demonstration that shows Q must be true in any circumstances in which the premises are all true.
![Page 31: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/31.jpg)
Types of Proof
Direct Indirect Proof by cases Proof by contradiction Proof by induction Proof by counterexample
![Page 32: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/32.jpg)
Fitch-style Proof
P1
P2
… Pn
S1
S2
… Sn
Q
Premises
Deductions & Justificationsmay contain sub-proofs
Conclusion
Fitch Bar
![Page 33: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/33.jpg)
Rules/Axioms
= EliminationIf b = c and P(b) then P(c).
= Introductiona = a
Symmetry of IdentityIf a = b then b = a.
Transitivity of IdentityIf a = b and b = c then a = c
These follow from above
![Page 34: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/34.jpg)
= Elimination
P(n)
n = m
P(m)
![Page 35: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/35.jpg)
= Introduction
n = n
![Page 36: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/36.jpg)
Symmetry of Identity
a = b
1)
2)
3)
a = a = Introduction
b = a = Elimination 1, 2
![Page 37: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/37.jpg)
![Page 38: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/38.jpg)
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)
![Page 39: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/39.jpg)
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
![Page 40: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/40.jpg)
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.
![Page 41: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/41.jpg)
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.
![Page 42: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/42.jpg)
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.
![Page 43: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/43.jpg)
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).
![Page 44: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/44.jpg)
Showing Non-consequence
To show Q is not a consequence of premises P1, P2, …, Pn, create a world where the premises are simultaneously true and the conclusion Q is false.
This shows the argument below is invalid P1
P2
… Pn
Q
![Page 45: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/45.jpg)
Invalid Argument
SameRow(b,c) SameRow(a,d) SameRow(d,f) LeftOf(a,b)
LeftOf(f,c)
b c
a df f
![Page 46: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/46.jpg)
![Page 47: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/47.jpg)
Boolean Connectives
Negation Conjunction Disjunction
It is not the case that
And, but, moreover
Or
![Page 48: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/48.jpg)
Negation
P P
T F
F T
![Page 49: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/49.jpg)
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 P P
T F T
F T F
![Page 50: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/50.jpg)
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)
![Page 51: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/51.jpg)
Assessment is incorrect
![Page 52: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/52.jpg)
Conjunction and Disjunction
P Q P Q P Q
T T T T
T F F T
F T F T
F F F F
![Page 53: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/53.jpg)
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.
![Page 54: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/54.jpg)
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))
![Page 55: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/55.jpg)
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)
![Page 56: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/56.jpg)
Distributive Rules
A (B C) is tautologically equivalent to (A B) (A C)
A (B C) is tautologically equivalent to (A B) (A C)
![Page 57: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/57.jpg)
Famous Equivalences
DeMorgan’s Laws (A B) A B(A B) A B
Idempotent A A
![Page 58: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/58.jpg)
Negation Normal FormNNF
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
![Page 59: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/59.jpg)
Conjunctive Normal FormCNF
A sentence S of the form
A1 A2 … An where each Ai, 1 i nis of the form
B1 B2 … Bm(i) where each Bj is a literal or the negation of a literal, 1 j m(i).
![Page 60: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/60.jpg)
Disjunctive Normal FormDNF
A sentence S of the form
A1 A2 … An where each Ai, 1 i nis of the form
B1 B2 … Bm(i) where each Bj is a literal or the negation of a literal, 1 j m(i).
![Page 61: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/61.jpg)
Example
[(A B) C] (A B) C ( A B) C( A B) C NNF, CNF( A C) (B C) NNF, DNF
![Page 62: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/62.jpg)
Reiteration
P
P
![Page 63: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/63.jpg)
Conjunctive Elimination
PQ
. . . P EliminationQ
![Page 64: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/64.jpg)
Conjunctive Introduction
P . . .
Q . . .
P Q Introduction
![Page 65: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/65.jpg)
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
![Page 66: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/66.jpg)
Disjunction Introduction
P
. . .
P Q Introduction
![Page 67: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/67.jpg)
ABC(B C) D
1. AB2. C3. 4. 5.
B Elim: 1B C Intro: 3, 2(B C) D Intro: 4
Prove:
![Page 68: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/68.jpg)
Disjunctive EliminationProof by cases
P Q . . . P … S Q … SS
Elimination
Same conclusion
![Page 69: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/69.jpg)
A BB CA C
1. A B2. 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:
![Page 70: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/70.jpg)
Tautology
A sentence S is a tautology if and only if every row of its truth table assigns true to S.
![Page 71: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/71.jpg)
Example
![Page 72: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/72.jpg)
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.
![Page 73: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/73.jpg)
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 possible TW-possible
Not TW-possibleLogically possible
Not Logically possible Not TW-possible
![Page 74: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/74.jpg)
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.
![Page 75: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/75.jpg)
Example
P Q RT T TT T FT F TT F FF T TF T FF F TF F F
Cube(a) a=b Cube(b)T T TT T F SpuriousT F TT F FF T T SpuriousF T FF F TF F F
Reference Columns
![Page 76: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/76.jpg)
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
![Page 77: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/77.jpg)
Example
a=b b=b a=b v b=bT T TT F T spuriousF T TF F F spurious
Logical Necessity TW-Necessity
Reference Columns S
![Page 78: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/78.jpg)
Example
Larger(a,b) Smaller(a,b) Larger(a,b) v Smaller(a,b)T T T spuriousT F TF T TF F F
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?
![Page 79: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/79.jpg)
Sentence Hierarchy
Tautologies
Logical Necessities
TW Necessities
Tet(b) Tet(b)
a=a
Tet(b) Cube(b) Dodec(b)
Cube(a) Small(a)
![Page 80: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/80.jpg)
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’.
![Page 81: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/81.jpg)
Example
P Q P --> Q ~P v QT T T TT F F FF T T TF F T T
Reference Columns S S’
![Page 82: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/82.jpg)
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’.
![Page 83: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/83.jpg)
Example
a=b Cube(a) Cube(b) a=b ̂Cube(a) a=b ̂Cube(b)T T T T TT T F T F SpuriousT F T F T SpuriousT F F F FF T T F FF T F F FF F T F FF F F F F
Not Tautologically Equivalent Logically Equivalent
Reference Columns S S’
![Page 84: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/84.jpg)
Tautological Consequence
Sentence Q is a tautological consequence of P1, P2, …, Pn if and only if every row that assigns true to all of the premises also assigns true to Q.
![Page 85: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/85.jpg)
Example
P Q P v Q Q PT T T F TT F T T TF T T F FF F F T F
Reference Columns Premises Conclusion
![Page 86: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/86.jpg)
Logical Consequence
Sentence Q is a logical consequence of P1, P2, …, Pn if and only if every non-spurious row that assigns true to all of the premises also assigns true to Q.
![Page 87: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/87.jpg)
Example
a=b b=c a=c a=b ̂b=c a=cT T T T TT T F T F SpuriousT F T F T SpuriousT F F F FF T T F T SpuriousF T F F FF F T F TF F F F F
Reference Columns Premises Conclusion
![Page 88: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/88.jpg)
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.
![Page 89: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/89.jpg)
Summary
Every tautological equivalence is a logical equivalence.
Not every logical equivalence is a tautological equivalence.
![Page 90: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/90.jpg)
Summary
Every tautology is a logical necessity. Not every logical necessity is a tautology.
![Page 91: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/91.jpg)
Negative Elimination
P
. . .
P Elimination
![Page 92: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/92.jpg)
Negative IntroductionProof by contradiction
P
. . .
P Introduction
![Page 93: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/93.jpg)
Negative IntroductionProof by contradiction
P
. . .
P Introduction
![Page 94: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/94.jpg)
Bottom Elimination
. . .
P Elimination
Anything you wish follows
from a contradiction
![Page 95: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/95.jpg)
A BBA
1. A B2. B 3. A 4. A 5. Intro: 4, 3
6. B 7. Intro: 6, 2 8. Elim: 1, 4-5, 6-79. A Intro: 3-810. A Elim: 9
Prove:
![Page 96: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/96.jpg)
Material Conditional
PQ
P is called the antecedent and Q is called the consequent.
![Page 97: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/97.jpg)
Definition of
P Q P Q
T T T
T F F
F T T
F F T
![Page 98: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/98.jpg)
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
![Page 99: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/99.jpg)
![Page 100: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/100.jpg)
P Q
If not P then QUnless P, QQ, 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)
![Page 101: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/101.jpg)
Equivalencies
P Q
P Q
Q P
![Page 102: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/102.jpg)
Biconditional
P Q
![Page 103: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/103.jpg)
English Translations
P if and only if Q P just in case Q P is a necessary and sufficient condition for
Q.
![Page 104: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/104.jpg)
Definition of
P Q PQ
T T T
T F F
F T F
F F T
![Page 105: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/105.jpg)
Equivalencies
PQ
(P Q) (Q P)
(P Q) (P Q)
P and Q are sufficient and necessary for each other.
![Page 106: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/106.jpg)
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
![Page 107: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/107.jpg)
Elimination
P Q …
P … Q Elim
![Page 108: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/108.jpg)
Inference Patterns
Modus Tollens P Q Q P
![Page 109: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/109.jpg)
Modus Tollens
![Page 110: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/110.jpg)
Introduction
P …
Q P Q Intro
![Page 111: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/111.jpg)
Example
Prove this argument is valid.
P (Q P)
![Page 112: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/112.jpg)
Elimination
P Q …
P … Q Elim
![Page 113: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/113.jpg)
Introduction
P … Q
Q … P P Q
Intro
![Page 114: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/114.jpg)
Example
Deduce A C from A B and B C.
Called Hypothetical
Syllogism
![Page 115: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/115.jpg)
Law of Excluded Middle
P P
A TautologyWeakest
form of Taut Con
Prove from P P (may use Law of Excluded Middle)
![Page 116: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/116.jpg)
Example
![Page 117: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/117.jpg)
Valid Argument
P1
P2
… Pn
Q
Q is a tautological (logical) consequence of P1, P2, …, Pn
(P1 P2 … Pn) Q is a tautology (logical necessity).
Valid Argument
![Page 118: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/118.jpg)
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
P
![Page 119: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/119.jpg)
Tautological Consequence
![Page 120: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/120.jpg)
Tautology
![Page 121: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/121.jpg)
Using Fitch
![Page 122: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/122.jpg)
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
P
![Page 123: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/123.jpg)
Not a Tautological Consequence
![Page 124: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/124.jpg)
Not a Tautology
![Page 125: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/125.jpg)
Build a World
Let P be assigned true and Q false. (P Q) is true while P is false.
premises conclusion
![Page 126: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/126.jpg)
Example
Show the following argument is valid.
Cube(b) (Cube(c) Cube(b)) Cube(c)
![Page 127: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/127.jpg)
Logical Consequence
Cube(b) Cube(c) Cube(b) ~(Cube(b) ̂Cube(c )) ~Cube(c) is spurious?T T T F F noT F T T T noF T F T F noF F F T T no
![Page 128: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/128.jpg)
Logical Necessity
Cube(b) Cube(c) Cube(b) ~(Cube(b) ̂Cube(c) ~Cube(c) (Cube(b) ̂~(Cube(b) ̂Cube(c))) -> ~Cube(c)T T T F F TT F T T T TF T F T F TF F F T T T
Every non-spurious row is true! In fact, every row is true, so we have a tautology!!
![Page 129: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/129.jpg)
Fitch
![Page 130: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/130.jpg)
Non-consequence
Show the following argument is invalid.
Cube(a) Cube(b) (Cube(c) Cube(b)) Cube(c)
![Page 131: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/131.jpg)
Counterexample
![Page 132: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/132.jpg)
Tautological Consequence
![Page 133: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/133.jpg)
Tautology
![Page 134: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/134.jpg)
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}
![Page 135: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/135.jpg)
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}} issatisfied by A = False D =True C = True
![Page 136: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/136.jpg)
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.
![Page 137: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/137.jpg)
Resolvent
A clause R is said to be a resolvent of clauses C1 and C2 if there is a literal in C1 whose negation is in clause C2 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}.
![Page 138: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/138.jpg)
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: The fallacy (A) (A), whose set of clauses Z = {{A}, { A}} is not satisfiable since, {A} {A} �
![Page 139: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/139.jpg)
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}
�
![Page 140: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/140.jpg)
Determine Validity of Argumentsusing Resolution
A sentence Q is a logical consequence of a set of sentences SS if and only if T = T =SS {Q} is not satisfiable.
Q
P1
P2
Pn
SS
![Page 141: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/141.jpg)
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
![Page 142: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/142.jpg)
Example
Modus PonesPQ or PQ or { P,Q}
P or {P}
Q negate to get {Q}
Apply resolution: {P,Q} {P} {Q} {Q}
![Page 143: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/143.jpg)
PROLOG
Programs = facts + rules + queries
B. FactB:-A. Rule:-A. Query
![Page 144: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/144.jpg)
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).
![Page 145: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/145.jpg)
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.
![Page 146: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/146.jpg)
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
![Page 147: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/147.jpg)
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 250 rows.
Attack problem with a truth table?
![Page 148: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/148.jpg)
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= L1 L2 … Lt ( ) … ( ) (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 processfor the next conjunct. Do this until no literals are left to assign. (ALWAYS Satisfiable!!!)
![Page 149: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/149.jpg)
Done = False; W=S;
Repeat Assign Li’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
![Page 150: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/150.jpg)
Examples
S = (P Q) (P Q) (P Q)
S = (C A B) (A B) (C B) A
S = (A B) C B
![Page 151: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/151.jpg)
Alternate Form of Horn Conjunct
A1 A2... An B
(A1 A2 ... An) B
(A1 A2 ... An) B Conditional Formof
Horn sentence
![Page 152: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/152.jpg)
Special Cases
No positive literalA1 A2... An
No negative literalsB
(A1 A2 ... An) False
True B
![Page 153: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/153.jpg)
Logical Consequence Revisited
Theorem:A sentence Q is a logical consequence of a set of sentences SS if and only if S S {Q} is not satisfiable.
![Page 154: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/154.jpg)
CNF to PROLOG
A B C = (AC) B = (A C)B or
AC B
B :- A, C.A.C.
Query: :- B.
![Page 155: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/155.jpg)
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.
Wffand a
sentence
Wffbut not asentence
![Page 156: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/156.jpg)
wff
If P is wff then so is P. If P1, P2, … , Pn are wffs then so is (P1 P2 … Pn).
If P1, P2, … , Pn are wffs then so is (P1 P2 … Pn).
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.
![Page 157: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/157.jpg)
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.
![Page 158: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/158.jpg)
Unbounded Variables
x LeftOf(x, y)
x Cube(x) Large(x)
x Small(x) Tet(y)
x (Cube(c) SameRow(x, c))
![Page 159: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/159.jpg)
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.
![Page 160: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/160.jpg)
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 withrespect to a domain of discourse!
![Page 161: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/161.jpg)
![Page 162: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/162.jpg)
Aristotelian Forms
All P’s are Q’s
x [P(x) Q(x)]
Q
P
![Page 163: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/163.jpg)
Aristotelian Forms
Some P’s are Q’s
x [P(x) Q(x)]
Q P
![Page 164: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/164.jpg)
Aristotelian Forms
No P’s are Q’s
x [P(x) Q(x)]
Q
P
![Page 165: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/165.jpg)
Aristotelian Forms
Some P’s are not Q’s
x [P(x) Q(x)]
Q P
![Page 166: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/166.jpg)
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.
![Page 167: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/167.jpg)
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)
![Page 168: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/168.jpg)
Quantifiers and Tautology
When is a sentence involving quantifiers a tautology?
Example: x Cube(x) x Cube(x)
![Page 169: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/169.jpg)
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.
![Page 170: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/170.jpg)
When is a sentence a tautology?
A quantified sentence S is a tautology if and only if its truth-functional form is a tautology.
![Page 171: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/171.jpg)
Example
x Cube(x) x Cube(x)
A B
Since A B is not a tautology, then neither is the sentence above.
![Page 172: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/172.jpg)
Example
x Cube(x) [x Cube(x)]
A A
Since A A is a tautology, then so is the sentence above.
![Page 173: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/173.jpg)
Example
(Tet(d) x Small(x)) (Tet(d) y Small(y))
A B A C
(A B) (A C)
![Page 174: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/174.jpg)
![Page 175: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/175.jpg)
Tautological Valid?
Is the following argument valid or invalid?
x Cube(x)x Small(x)x (Cube(x) Small(x))
ABC
Not tautologically valid!!!In fact, it is not valid.
![Page 176: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/176.jpg)
Tautological Valid?
Is the following argument valid or invalid?
x Cube(x) x Small(x) x Cube(x) x Small(x)
A BAB
Is tautologically valid!!!
![Page 177: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/177.jpg)
Tautological Valid?
Is the following argument valid or invalid?
x [Cube(x) Small(x)]x Cube(x) x Small(x)
A BC
Is not tautologically valid.It is logically valid!
![Page 178: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/178.jpg)
Propositional Logic
Tautology Tautological Consequence Tautological Equivalence
Based on thetruth-functional
Connectives
![Page 179: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/179.jpg)
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.
![Page 180: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/180.jpg)
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.
![Page 181: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/181.jpg)
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)
![Page 182: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/182.jpg)
Using Boole
spurious
![Page 183: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/183.jpg)
Using Fitch to Prove
![Page 184: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/184.jpg)
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)
![Page 185: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/185.jpg)
Using Fitch to Disprove
![Page 186: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/186.jpg)
Facts
All tautological consequences are FO Consequences.
All tautological equivalencies are FO Equivalencies.
![Page 187: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/187.jpg)
FO Consequence
x [P(x) Q(x)] Q(b)
P(b)
QP
b
x [Tet(x) Large(x)] Large(b)
Tet(b)
A B
C
C is not a tautological consequence of A and B
![Page 188: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/188.jpg)
Using Fitch
![Page 189: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/189.jpg)
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).
Moriarty Scrooge Romeo Juliet
![Page 190: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/190.jpg)
Replacement Method
This method is used to determine if a sentence is an FO Validity or if an argument is an FO Consequence.
![Page 191: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/191.jpg)
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.
![Page 192: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/192.jpg)
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
P
![Page 193: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/193.jpg)
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
![Page 194: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/194.jpg)
A Special Form and its Equivalent
Only the Q’s are P’s
All P’s are Q’s
P
Qx [P(x) Q(x)]
x [P(x) Q(x)]
![Page 195: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/195.jpg)
![Page 196: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/196.jpg)
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)
![Page 197: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/197.jpg)
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)
![Page 198: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/198.jpg)
Proofs Involving Quantifiers
Universal Elimination
x S(x) …
S(c) Elim
![Page 199: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/199.jpg)
Example
Prove
x Cube(x) x Large(x)
Large(d) Cube(d)]
![Page 200: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/200.jpg)
![Page 201: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/201.jpg)
Proofs Involving Quantifiers
Universal Introduction c
…
S(c)
x S(x) Intro
Assume c is anarbitrary elementin the domain ofdiscourse.
![Page 202: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/202.jpg)
Example
Prove
x Cube(x) x Large(x)
x [Large(x) Cube(x)]
![Page 203: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/203.jpg)
![Page 204: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/204.jpg)
Proofs Involving Quantifiers
Existential Introduction
S(c) …
x S(x) Intro
![Page 205: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/205.jpg)
Example
Prove
Cube(e) Large(e) LeftOf(e,a) x [Cube(x) LeftOf(x,a)]
![Page 206: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/206.jpg)
![Page 207: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/207.jpg)
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!
![Page 208: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/208.jpg)
Example
Prove
x Large(x) x Cube(x)
x [Large(x) Cube(x)]
![Page 209: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/209.jpg)
![Page 210: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/210.jpg)
General Conditional Proof
Universal Introduction c P(c)
…
Q(c)
x [P(x) Q(x)] Intro
Assume c is anarbitrary elementin the domain ofDiscourse and assume P(c)
![Page 211: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/211.jpg)
Example
Prove
x [P(x) Q(x)] z [Q(z) R(z)]
x [P(x) R(x)]
![Page 212: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/212.jpg)
![Page 213: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/213.jpg)
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)
![Page 214: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/214.jpg)
Careful
x y[(Cube(x) Cube(y)) (LeftOf(x,y) RightOf(x,y))]
x y[(Cube(x) Cube(y) xy) (LeftOf(x,y) RightOf(x,y))]
![Page 215: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/215.jpg)
Translation
x y P(x,y) For each x there is a yx such that P(x,y).
![Page 216: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/216.jpg)
Translation
x y P(x,y) There us a special x such that for all y, P(x,y).
![Page 217: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/217.jpg)
Example
Let Q(x,y) means x + y = x – y.
Determine if yx 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 yx 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.
![Page 218: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/218.jpg)
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)]]
![Page 219: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/219.jpg)
Translation Worksheet Handout
![Page 220: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/220.jpg)
At Least One
x P(x)
There exists an x such that P(x)
There is at least one x such that P(x)
![Page 221: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/221.jpg)
At Least Two
x y [P(x) P(y) xy]
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).
![Page 222: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/222.jpg)
At Least Three
x y z [P(x) P(y) P(z) xy xz yz]
There are at least three objects that satisfy P(x).
![Page 223: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/223.jpg)
At Least n
x1 x2…xn [P(x1) P(x2) … P(xn) x1 x2 x1 x3 … x1 xn
x2 x3 x2 x4 … x2 xn x3 x4 x3 x5 … x3 xn … xn-1 xn ]
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
![Page 224: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/224.jpg)
Exactly One
x [P(x) y (P(y) yx)]
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).
![Page 225: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/225.jpg)
Exactly Two
x y [P(x) P(y) xy z (P(z) (zx zy)]
There exists an x and a y where xy , 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).
![Page 226: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/226.jpg)
Exactly n
x1 x2…xn [P(x1) P(x2) … P(xn) x1 x2 x1 x3 … x1 xn
x2 x3 x2 x4 … x2 xn x3 x4 x3 x5 … x3 xn … xn-1 xn
z (P(z) (zx1 zx2 … zxn))]
Exactly n objects satisfies P(x).
![Page 227: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/227.jpg)
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) yx)] says “exactly one”
Combining gives x P(x) x [P(x) y (P(y) yx)]
![Page 228: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/228.jpg)
At Most One
“at most one” means (“at least two”)
(x y [P(x) P(y) xy])x y [P(x) P(y) x=y]
x y [(P(x) P(y)) x=y]
At most one objects satisfy P(x).
![Page 229: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/229.jpg)
At Most Two
“at most two” means (“at least three”)
(x y z [P(x) P(y) P(z) xy xz yz]) 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).
![Page 230: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/230.jpg)
At Most n
“at most n” means (“at least n+1”)
(x1x2 …xn+1[P(x1) P(x2) … P(xn+1) x1 x2 x1 x3 … x1 xn+1
x2 x3 x2 x4 … x2 xn+1 x3 x4 x3 x5 … x3 xn+1 … xn xn+1 ]) At most n objects satisfy P(x).
![Page 231: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/231.jpg)
At Most n
x1 x2 … xn+1[P(x1) P(x2) … P(xn+1) x1= x2 x1= x3 … x1= xn+1
x2 = x3 x2 = x4 … x2 = xn+1
x3 = x4 x3 = x5 … x3 = xn+1 …
xn = xn+1 ])
![Page 232: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/232.jpg)
At Most n
x1 x2 … xn+1[(P(x1) P(x2) … P(xn+1)) (x1= x2 x1= x3 … x1= xn+1
x2 = x3 x2 = x4 … x2 = xn+1
x3 = x4 x3 = x5 … x3 = xn+1 …
xn = xn+1 )]
![Page 233: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/233.jpg)
Models of Computation
Function (table look-up) Finite-state Automata
![Page 234: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/234.jpg)
XOR Table
Combine two n-bit binary numbers using exclusive or
Table size = 2n x 2n rows
If n = 32 then table size 1.8 x 1019
![Page 235: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/235.jpg)
XOR Automata
0 1
00, 11
00, 11
01, 10
01, 10
1 1 0 1 0 0 1 1 01 0 0 1 1 0 0 1 10 1 0 0 1 0 1 0 1
![Page 236: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/236.jpg)
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)
![Page 237: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/237.jpg)
Mathematical Preliminaries
Cartesian Product A x B =
{(x,y) | x A and y B}
Generalized Cartesian ProductA1 x A2 x … x An =
{(a1, a2, …, an) | ai Ai for each i}
![Page 238: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/238.jpg)
Mathematical Preliminaries
Function f: D Rf associates each element d D with some element r R. This association is denoted f(d) = r.
Example: f(x) = (x + 1) mod 3D = {1, 2, 3, 4} R = {0, 1, 2}
![Page 239: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/239.jpg)
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
![Page 240: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/240.jpg)
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.
![Page 241: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/241.jpg)
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
![Page 242: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/242.jpg)
Finite Automaton
5 - tuple M = (Q, , , q0, F)
Q is a finite set of states
is an alphabet :Q x Q is the transition function q0 Q is the starting state F Q is the set of accept states.
![Page 243: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/243.jpg)
JFLAP software
www.jflap.org
![Page 244: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/244.jpg)
Example M1
q0 q1 q2
0
11
0
0, 1
q1
Q = {q0 , q1 , q2}
= {0, 1} F = {q1}
![Page 245: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/245.jpg)
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.
![Page 246: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/246.jpg)
More Formally
Let w = w1w2…wn be a string accepted by M then there exists states r0, r1, …, rn in Q satisfying
1) r0 = q0
2) (ri, wi+1) = ri+1, where i = 0, …, n-13) rn in F
![Page 247: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/247.jpg)
Regular Language
A language is called a regular language if some finite automaton recognizes it.
![Page 248: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/248.jpg)
Creating a Automaton
Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such that L(M) = L.
![Page 249: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/249.jpg)
Example 1
L1 = {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
![Page 250: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/250.jpg)
qoe qoo
qee
1
01
0 00
1
1
qeo
Example 1
![Page 251: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/251.jpg)
![Page 252: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/252.jpg)
Example 2 (complement)
L2 = {w | w is a string over ={0,1} that does not contain an even number of 0s and an odd number of 1s } = L1
![Page 253: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/253.jpg)
qeo
1
01
0 00
1
1
Example 2
qee
qoeqoo
![Page 254: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/254.jpg)
Example 3
L3 = { 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
![Page 255: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/255.jpg)
Example 3
q0 q1q2
0, 1 0, 1q3
0, 1
0, 1
q4
0, 1
![Page 256: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/256.jpg)
Example 4
L4 = {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}}
![Page 257: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/257.jpg)
Example 4
q0 q1
0
1
0
1q2
0, 1
0 1q0 q0 q1q1 q0 q2q2 q2 q2f
s
![Page 258: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/258.jpg)
Machine M accepts string w
If there exists a sequence of states r0, r1, …, rn in Q such that 1) r0 = q0 2) (ri , wi+1) = ri+1, for i=0,…,n-1 3) rn in F
Note: w = w1w2…wn
![Page 259: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/259.jpg)
Regular Languages
Machine M recognizes language A if A = {w| M accepts w}
A language is called regular if some finite automaton recognizes it.
![Page 260: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/260.jpg)
Regular Languages
Machine M recognizes language A if A = {w| M accepts w}
A language is called regular if some finite automaton recognizes it.
![Page 261: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/261.jpg)
Regular Operations
Let A and B be languages. Union
A B = { x | x in A or x in B}
ConcatenationA B = {xy | x in A and y in B}
StarA* = {x1x2…xk | k 0 and each xj in A}
Note: is always a member of A*.
![Page 262: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/262.jpg)
Regular languages are closed under union
Let A1 and A2 be regular languages. We want to show A1A2 is a regular language. Since A1 and A2 are regular languages there exists a finite automaton M1 and there exists a finite automaton M2 such that M1 recognizes A1 and M2 recognizes A2.
Assume M1 = (Q1, , 1, q1, F1) and M2 = (Q2, , 2, q2, F2) It suffices to create a finite automaton M that recognizes A1A2.
![Page 263: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/263.jpg)
Continue …
Let a be a symbol in and states r1 in Q1 and r2 in Q2. Define M = (Q, , , q0, F) where
Q = Q1 x Q2 states
((r1, r2), a) = (1(r1, a), 2(r2, a)) transition function
q0 = (q1, q2) start state
F = (F1 x Q2) (Q1 x F2) final states
![Page 264: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/264.jpg)
Example
u v
0,1
01
M1
x z
0
0,1
M2
y1
10M = (Q, , , q0, F) Q = {(u,x), (v,x), (u,y), (v,y), (u,z), (v,z)} statesq0 = (u, x) start stateF = {(v,x), (v,y), (v,z)} {(u,z), (v,z)} = {(v,x), (v,y), (v,z), (u,z)} final states 0 1
(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) ((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)
![Page 265: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/265.jpg)
Regular languages are closed under concatenation
Let A1 and A2 be regular languages. We want to show
A1 A2 is a regular language. Since A1 and A2 are regular languages there exists a finite automaton M1 and there exists a finite automaton M2 such that M1 recognizes A1 and M2 recognizes A2.
Assume M1 = (Q1, , 1, q1, F1) and M2 = (Q2, , 2, q2, F2) It suffices to create a finite automaton M that recognizes
A1 A2. There is a problem since M doesn’t know where to subdivide the input string into the part accepted by M1 and the remaining part that will be accepted by M2. We will return to this later.
![Page 266: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/266.jpg)
Regular Expressions
R is a regular expression if1) x for some x in (note: regular expression x represents language {x})
2) (empty string) (note: regular expression represents language {}) 3) (empty set)4) (R1 R2) where R1 and R2 are regular expressions5) (R1 R2) where R1 and R2 are regular expressions6) (R1*) where R1 is a regular expression
If R is a regular expression then L(R) is the language of R.
![Page 267: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/267.jpg)
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 .
![Page 268: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/268.jpg)
Example
q1 q2 q3
0, 1
1 0, 1
0, 1
q4
![Page 269: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/269.jpg)
q1
q1
q1
q2
q1
q3
q2 q4q3
q3q1
q4q4q3q2q1
q3q1 q4 q4
0
1 11
00
11
1 1
0 0 0 0
1 1 1 1 1
Input:010110
![Page 270: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/270.jpg)
Non-Deterministic Finite Automaton
N = (Q, , , q0, 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 powerset of Q =
{X| X Q}
![Page 271: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/271.jpg)
Machine N accepts string w
If there exists a sequence of states r0, r1, …, rn in Q such that 1) r0 = q0 2) ri+1 in (ri , wi+1) for i=0,…,n-1 3) rn in F
Note: w = w1w2…wn (ri , wi+1) is a set of states
![Page 272: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/272.jpg)
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.
![Page 273: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/273.jpg)
Non-deterministic?
q0 q1
0
1
0
1q2
0, 1
0 1q0 q0 q1q1 q0 q2q2 q2 q2
0 1{q0} {q0} {q1}{q1} {q0} {q2}{q2} {q2} {q2}
Non-deterministic interpretationDeterministic interpretation
![Page 274: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/274.jpg)
Deterministic Equivalent?
1
2 3
b
a, b
a
a
with edges without edges
1 20
3
01
NN
Next four slides color coded with respect to these examples
= {0, 1} = {a, b}
![Page 275: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/275.jpg)
DFA from NFA Construction
Assume no edges.Let N = (Q, , , q0, F)be an NFA that recognizes language A. We construct a DFA called M = (Q’, , ’, q0’, 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) = {} {} =
![Page 276: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/276.jpg)
Continued …
3) q0’ = { q0} 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}
q0’ = E({q0}) start state (do red example)
![Page 277: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/277.jpg)
Find Deterministic Equivalent
0 1{ } { } { }{1} { 2,3} { }
{2,3} { } {1}
Deterministic Equivalent
Start state q0’= {1}Final states F’ = { {2,3} }
without edges
1 20
3
01
N
![Page 278: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/278.jpg)
Solution
{1}
{ }
{2,3}
0, 1
0
1 0
1M
![Page 279: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/279.jpg)
Find Deterministic Equivalent
1
2 3
b
a, b
a
a
a b{ } { } { }{1} { } {2}{2} {2,3} {3}{3} {1,3} { }
{1,2} {2,3} {2,3}{1,3} {1,3} {2}{2,3} {1,2,3} {3}
{1,2,3} {1,2,3} {2,3}
Deterministic Equivalent
Start state q0’= E({1}) = {1,3}Final states F’ = { {1}, {1,2}, {1,3}, {1,2,3} }
N
![Page 280: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/280.jpg)
Final Solutiona
{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
![Page 281: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/281.jpg)
Regular languages are closed under union
Let A1 and A2 be regular languages. We want to show A1A2 is a regular language. Since A1 and A2 are regular languages there exists an NFA N1 and there exists an NFA N2 such that N1 recognizes A1 and N2 recognizes A2.
Assume N1 = (Q1, , 1, q1, F1) and N2 = (Q2, , 2, q2, F2) It suffices to create a NFA N that recognizes A1A2.
![Page 282: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/282.jpg)
Construction of NFA
N1
N2
q1
q2
q0
N = (Q, , , q0, F)Q = {q0} Q1 Q2
F = F1 F2
1 (q,a) q in Q1 (q,a) = 2 (q,a) q in Q2 {q1, q2} q = q0 and a= { } q = q0 and a
Nq1
q2
![Page 283: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/283.jpg)
Example Union
u v
0,1
01
M1
x z
0
0,1
M2
y1
10
q0
See slide 260 (union) for original machines
![Page 284: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/284.jpg)
Regular languages are closed under concatenation
Let A1 and A2 be regular languages. We want to show
A1 A2 is a regular language. Since A1 and A2 are regular languages there exists an NFA N1 and there exists an NFA N2 such that N1 recognizes A1 and N2 recognizes A2.
Assume N1 = (Q1, , 1, q1, F1) and N2 = (Q2, , 2, q2, F2)
It suffices to create a NFA N that recognizes A1 A2.
![Page 285: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/285.jpg)
Construction of NFA
N1
N2
N = (Q, , , q1, F2)Q = Q1 Q2 and q1 (start state) and F = F2
1 (q,a) q in Q1 and q not in F1 (q,a) = 2 (q,a) q in Q2
1 (q,a) {q2} q in F1 and a= (add edges to q2 keep edges from final states in N1)
1 (q,a) q in F1 and a (keep non- edges from final states in N1)
q1
q2
q1q2
N
Not
Not
![Page 286: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/286.jpg)
Example Concatenation
u v
0,1
01
M1
x z
0
0,1
M2
y1
10
![Page 287: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/287.jpg)
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 N1 such that N1 recognizes A.
Assume N1 = (Q1, , 1, q1, F1) It suffices to create a NFA N that recognizes A*.
![Page 288: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/288.jpg)
Construct NFA
N1
N
N = (Q, , , q0, F)Q = {q0} Q1 F = F1 {q0} and q0 the start state
1 (q,a) q in Q1 and q not in F1
(q,a) = 1 (q,a) q in F1 and a 1 (q,a) {q1} q in F1 and a= {q1} q = q0 and a= { } q= q0 and a
q0
q1
q1
![Page 289: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/289.jpg)
Find Star of M2
x z
0
0,1
M2
y1
10
x z
0
0,1
M2*
y1
10q0
![Page 290: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/290.jpg)
Regular Expressions
R is a regular expression if1) x for some x in (note: regular expression x represents language {x})
2) (empty string) (note: regular expression represents language {}) 3) (empty set)4) (R1 R2) where R1 and R2 are regular expressions5) (R1 R2) where R1 and R2 are regular expressions6) (R1*) where R1 is a regular expression
If R is a regular expression then L(R) is the language of R.
![Page 291: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/291.jpg)
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}
![Page 292: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/292.jpg)
Using Regular Expressions
![Page 293: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/293.jpg)
Beginning or End?
![Page 294: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/294.jpg)
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.
![Page 295: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/295.jpg)
x
NFA that recognizes {x}
x
![Page 296: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/296.jpg)
NFA that recognizes {}
![Page 297: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/297.jpg)
NFA that recognizes
![Page 298: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/298.jpg)
R1 R2, R1 R2, or R1*
Construct a machine the same way we did to show regular languages are closed under , , or *.
![Page 299: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/299.jpg)
NFA to recognize (0 11)*
0 1
11
0
11
![Page 300: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/300.jpg)
NFA to recognize (0 11)*
0
11
0
11
![Page 301: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/301.jpg)
Part b) If a language is regular then a regular expression describes it.
Properties of GNFA1) 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.
![Page 302: Can’t be c can’t be b Could be cthis is bcould be c](https://reader037.vdocuments.site/reader037/viewer/2022110405/56649edc5503460f94bec001/html5/thumbnails/302.jpg)
Example GNFA
start accept
ab*
b
ab ba
b*
ab
aa
(aa)*a*