Upload
daquan-west
View
41
Download
0
Tags:
Embed Size (px)
DESCRIPTION
can’t be b. this is b. can’t be c. Could be c. could be c. Names. Constants are used to name existing objects a, b, c, d, e, f max, claire, carl No constant can name more than one object An object can have more than one name or no name at all. Leonard Euler. - PowerPoint PPT Presentation
Citation preview
can’t be ccan’t be b
Could be c
this is b
could be c
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
Tiberius Sempronius GracchusGaius Sempronius Gracchus
Examples
Leonard EulerHonest Abe Lincoln
Predicates
A (determinate) property possessed by an object Shape Size
A (determinate) relationship among objects Shape relationship Size relationship Positional relationship Equality =
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
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
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
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
Connectives
Not And, Or , Material Conditional Biconditional
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
First Order Logic
Names Predicates Functions Connectives
Are there more?
Atomic Sentences
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)
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))
Quantifiers and Variables
For every x x There exists y y
First Order Logic
Names Predicates Functions Connectives Quantifiers and variables
Revised List
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)))
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.
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).
Fitch-style Argument
P1 P2
... Pn
Q
premises
conclusion
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
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
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
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
Sound Argument
Argument is not sound
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.
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.
Types of Proof
Direct Indirect Proof by cases Proof by contradiction Proof by induction Proof by counterexample
Fitch-style Proof
P1
P2
… Pn
S1
S2
… Sn
Q
Premises
Deductions & Justificationsmay contain sub-proofs
Conclusion
Fitch Bar
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
= Elimination
P(n)
n = m
P(m)
= Introduction
n = n
Symmetry of Identity
a = b
1)
2)
3)
a = a = Introduction
b = a = Elimination 1, 2
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)
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
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.
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.
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.
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).
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
Invalid Argument
SameRow(b,c) SameRow(a,d) SameRow(d,f) LeftOf(a,b)
LeftOf(f,c)
b c
a df f
Boolean Connectives
Negation Conjunction Disjunction
It is not the case that
And, but, moreover
Or
Negation
P P
T F
F T
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
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)
Assessment is incorrect
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
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.
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))
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)
Distributive Rules
A (B C) is tautologically equivalent to (A B) (A C)
A (B C) is tautologically equivalent to (A B) (A C)
Famous Equivalences
DeMorgan’s Laws (A B) A B(A B) A B
Idempotent A A
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
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).
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).
Example
[(A B) C] (A B) C ( A B) C( A B) C NNF, CNF( A C) (B C) NNF, DNF
Reiteration
P
P
Conjunctive Elimination
PQ
. . . P EliminationQ
Conjunctive Introduction
P . . .
Q . . .
P Q Introduction
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
Disjunction Introduction
P
. . .
P Q Introduction
ABC(B C) D
1. AB2. C3. 4. 5.
B Elim: 1B C Intro: 3, 2(B C) D Intro: 4
Prove:
Disjunctive EliminationProof by cases
P Q . . . P … S Q … SS
Elimination
Same conclusion
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:
Tautology
A sentence S is a tautology if and only if every row of its truth table assigns true to S.
Example
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.
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
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.
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
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
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
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?
Sentence Hierarchy
Tautologies
Logical Necessities
TW Necessities
Tet(b) Tet(b)
a=a
Tet(b) Cube(b) Dodec(b)
Cube(a) Small(a)
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’.
Example
P Q P --> Q ~P v QT T T TT F F FF T T TF F T T
Reference Columns S S’
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’.
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’
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.
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
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.
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
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.
Summary
Every tautological equivalence is a logical equivalence.
Not every logical equivalence is a tautological equivalence.
Summary
Every tautology is a logical necessity. Not every logical necessity is a tautology.
Negative Elimination
P
. . .
P Elimination
Negative IntroductionProof by contradiction
P
. . .
P Introduction
Negative IntroductionProof by contradiction
P
. . .
P Introduction
Bottom Elimination
. . .
P Elimination
Anything you wish follows
from a contradiction
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:
Material Conditional
PQ
P is called the antecedent and Q is called the consequent.
Definition of
P Q P Q
T T T
T F F
F T T
F F T
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
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)
Equivalencies
P Q
P Q
Q P
Biconditional
P Q
English Translations
P if and only if Q P just in case Q P is a necessary and sufficient condition for
Q.
Definition of
P Q PQ
T T T
T F F
F T F
F F T
Equivalencies
PQ
(P Q) (Q P)
(P Q) (P Q)
P and Q are sufficient and necessary for each other.
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
Elimination
P Q …
P … Q Elim
Inference Patterns
Modus Tollens P Q Q P
Modus Tollens
Introduction
P …
Q P Q Intro
Example
Prove this argument is valid.
P (Q P)
Elimination
P Q …
P … Q Elim
Introduction
P … Q
Q … P P Q
Intro
Example
Deduce A C from A B and B C.
Called Hypothetical
Syllogism
Law of Excluded Middle
P P
A TautologyWeakest
form of Taut Con
Prove from P P (may use Law of Excluded Middle)
Example
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
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
Tautological Consequence
Tautology
Using Fitch
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
Not a Tautological Consequence
Not a Tautology
Build a World
Let P be assigned true and Q false. (P Q) is true while P is false.
premises conclusion
Example
Show the following argument is valid.
Cube(b) (Cube(c) Cube(b)) Cube(c)
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
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!!
Fitch
Non-consequence
Show the following argument is invalid.
Cube(a) Cube(b) (Cube(c) Cube(b)) Cube(c)
Counterexample
Tautological Consequence
Tautology
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}
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
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.
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}.
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} �
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}
�
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
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
Example
Modus PonesPQ or PQ or { P,Q}
P or {P}
Q negate to get {Q}
Apply resolution: {P,Q} {P} {Q} {Q}
PROLOG
Programs = facts + rules + queries
B. FactB:-A. Rule:-A. Query
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).
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.
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
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?
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!!!)
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
Examples
S = (P Q) (P Q) (P Q)
S = (C A B) (A B) (C B) A
S = (A B) C B
Alternate Form of Horn Conjunct
A1 A2... An B
(A1 A2 ... An) B
(A1 A2 ... An) B Conditional Formof
Horn sentence
Special Cases
No positive literalA1 A2... An
No negative literalsB
(A1 A2 ... An) False
True B
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.
CNF to PROLOG
A B C = (AC) B = (A C)B or
AC B
B :- A, C.A.C.
Query: :- B.
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
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.
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.
Unbounded Variables
x LeftOf(x, y)
x Cube(x) Large(x)
x Small(x) Tet(y)
x (Cube(c) SameRow(x, c))
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.
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!
Aristotelian Forms
All P’s are Q’s
x [P(x) Q(x)]
Q
P
Aristotelian Forms
Some P’s are Q’s
x [P(x) Q(x)]
Q P
Aristotelian Forms
No P’s are Q’s
x [P(x) Q(x)]
Q
P
Aristotelian Forms
Some P’s are not Q’s
x [P(x) Q(x)]
Q P
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.
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)
Quantifiers and Tautology
When is a sentence involving quantifiers a tautology?
Example: x Cube(x) x Cube(x)
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.
When is a sentence a tautology?
A quantified sentence S is a tautology if and only if its truth-functional form is a tautology.
Example
x Cube(x) x Cube(x)
A B
Since A B is not a tautology, then neither is the sentence above.
Example
x Cube(x) [x Cube(x)]
A A
Since A A is a tautology, then so is the sentence above.
Example
(Tet(d) x Small(x)) (Tet(d) y Small(y))
A B A C
(A B) (A C)
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.
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!!!
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!
Propositional Logic
Tautology Tautological Consequence Tautological Equivalence
Based on thetruth-functional
Connectives
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.
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.
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)
Using Boole
spurious
Using Fitch to Prove
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)
Using Fitch to Disprove
Facts
All tautological consequences are FO Consequences.
All tautological equivalencies are FO Equivalencies.
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
Using Fitch
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
Replacement Method
This method is used to determine if a sentence is an FO Validity or if an argument is an FO Consequence.
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.
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
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
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)]
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)
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)
Proofs Involving Quantifiers
Universal Elimination
x S(x) …
S(c) Elim
Example
Prove
x Cube(x) x Large(x)
Large(d) Cube(d)]
Proofs Involving Quantifiers
Universal Introduction c
…
S(c)
x S(x) Intro
Assume c is anarbitrary elementin the domain ofdiscourse.
Example
Prove
x Cube(x) x Large(x)
x [Large(x) Cube(x)]
Proofs Involving Quantifiers
Existential Introduction
S(c) …
x S(x) Intro
Example
Prove
Cube(e) Large(e) LeftOf(e,a) x [Cube(x) LeftOf(x,a)]
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!
Example
Prove
x Large(x) x Cube(x)
x [Large(x) Cube(x)]
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)
Example
Prove
x [P(x) Q(x)] z [Q(z) R(z)]
x [P(x) R(x)]
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)
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))]
Translation
x y P(x,y) For each x there is a yx such that P(x,y).
Translation
x y P(x,y) There us a special x such that for all y, P(x,y).
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.
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)]]
Translation Worksheet Handout
At Least One
x P(x)
There exists an x such that P(x)
There is at least one x such that P(x)
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).
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).
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
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).
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).
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).
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)]
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).
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).
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).
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 ])
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 )]
Models of Computation
Function (table look-up) Finite-state Automata
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
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
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)
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}
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}
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
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.
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
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.
JFLAP software
www.jflap.org
Example M1
q0 q1 q2
0
11
0
0, 1
q1
Q = {q0 , q1 , q2}
= {0, 1} F = {q1}
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.
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
Regular Language
A language is called a regular language if some finite automaton recognizes it.
Creating a Automaton
Given a language L over an alphabet , design a deterministic finite automaton (DFA) M such that L(M) = L.
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
qoe qoo
qee
1
01
0 00
1
1
qeo
Example 1
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
qeo
1
01
0 00
1
1
Example 2
qee
qoeqoo
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
Example 3
q0 q1q2
0, 1 0, 1q3
0, 1
0, 1
q4
0, 1
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}}
Example 4
q0 q1
0
1
0
1q2
0, 1
0 1q0 q0 q1q1 q0 q2q2 q2 q2f
s
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
Regular Languages
Machine M recognizes language A if A = {w| M accepts w}
A language is called regular if some finite automaton recognizes it.
Regular Languages
Machine M recognizes language A if A = {w| M accepts w}
A language is called regular if some finite automaton recognizes it.
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*.
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.
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
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)
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.
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.
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 .
Example
q1 q2 q3
0, 1
1 0, 1
0, 1
q4
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
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}
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
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.
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
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}
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) = {} {} =
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)
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
Solution
{1}
{ }
{2,3}
0, 1
0
1 0
1M
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
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
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.
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
Example Union
u v
0,1
01
M1
x z
0
0,1
M2
y1
10
q0
See slide 260 (union) for original machines
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.
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
Example Concatenation
u v
0,1
01
M1
x z
0
0,1
M2
y1
10
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*.
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
Find Star of M2
x z
0
0,1
M2
y1
10
x z
0
0,1
M2*
y1
10q0
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.
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}
Using Regular Expressions
Beginning or End?
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.
x
NFA that recognizes {x}
x
NFA that recognizes {}
NFA that recognizes
R1 R2, R1 R2, or R1*
Construct a machine the same way we did to show regular languages are closed under , , or *.
NFA to recognize (0 11)*
0 1
11
0
11
NFA to recognize (0 11)*
0
11
0
11
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.
Example GNFA
start accept
ab*
b
ab ba
b*
ab
aa
(aa)*a*