Download as pdf or txt
Download as pdf or txt
You are on page 1of 92

Theoretical Computer Science I:

Automata and Formal Languages

Prof. Dr. Sjouke Mauw

Slides for Chapters 5 and 6

Version 2024.1
Overview

Reg

DFA NFA
Overview

Reg

DFA NFA

RE
Overview

Reg

DFA NFA

RE
Chapter 5. Regular operations
Operations on regular languages

Let A and B be languages.


Define the regular operations union, concatenation, and star:
‚ A Y B “ tx | x P A or x P Bu

Example
For A “ tab, cdu and B “ t0, 1, 000u, we have
‚ A Y B “ tab, cd, 0, 1, 000u
Operations on regular languages

Let A and B be languages.


Define the regular operations union, concatenation, and star:
‚ A Y B “ tx | x P A or x P Bu
‚ A ˝ B “ txy | x P A and y P Bu

Example
For A “ tab, cdu and B “ t0, 1, 000u, we have
‚ A Y B “ tab, cd, 0, 1, 000u
‚ A ˝ B “ tab0, ab1, ab000, cd0, cd1, cd000u
Operations on regular languages

Let A and B be languages.


Define the regular operations union, concatenation, and star:
‚ A Y B “ tx | x P A or x P Bu
‚ A ˝ B “ txy | x P A and y P Bu
‚ A˚ “ tx1 x2 . . . xk | k ě 0 and each xi P Au
Note that ε is an element of A˚ for every language A.
Example
For A “ tab, cdu and B “ t0, 1, 000u, we have
‚ A Y B “ tab, cd, 0, 1, 000u
‚ A ˝ B “ tab0, ab1, ab000, cd0, cd1, cd000u
‚ A˚ “ tε, ab, cd, abab, abcd, cdab, cdcd, ababab, ababcd, . . .u
Closure

We say that a set S is closed under an operation d if

@x,y PS x dy PS

Example
‚ The set of natural numbers N is closed under addition and
multiplication, but not under subtraction and division.
‚ 2´3RN
‚ 1{2 R N
‚ The set of integers Z is closed under addition, multiplication
and subtraction, but not under division.
Closure properties of the set of regular languages

Theorem
The class of regular languages is closed under union, concatenation
and star.
@X ,Y PReg X Y Y , X ˝ Y , X ˚ P Reg
Closure properties of the set of regular languages

Theorem
The class of regular languages is closed under union, concatenation
and star.
@X ,Y PReg X Y Y , X ˝ Y , X ˚ P Reg

This means that if X is a regular language and Y is a regular


language, then X Y Y is also a regular language.
Closure properties of the set of regular languages

Theorem
The class of regular languages is closed under union, concatenation
and star.
@X ,Y PReg X Y Y , X ˝ Y , X ˚ P Reg

This means that if X is a regular language and Y is a regular


language, then X Y Y is also a regular language.

Phrased differently:
If M and M 1 are finite automata, which recognize languages LpMq
and LpM 1 q, then there exists a finite automaton N such that
LpNq “ LpMq Y LpM 1 q.
Proof sketch (Union)
Proof sketch (Union)

ε
Example (Union)

L “ tabc, acbu L Y L1

c c
b b
a a
c ε c
b b

ε
a a
b b

L1 “ tpabqn | n ě 0u
Formal proof construction (Union)

Let N1 “ pQ1 , Σ1 , δ1 , q1 , F1 q and N2 “ pQ2 , Σ2 , δ2 , q2 , F2 q.


Construct N “ pQ, Σ, δ, q0 , F q such that LpNq “ LpN1 q Y LpN2 q.
1 Q “ tq0 u Y Q1 Y Q2 (where q0 R Q1 Y Q2 );
2 Σ “ Σ1 Y Σ2 ;
3 δ is defined for q P Q and a P Σε by
$

’ δ1 pq, aq q P Q1
δ2 pq, aq q P Q2
&
δpq, aq “
tq , q u q “ q0 and a “ ε
% 1 2


H q “ q0 and a ‰ ε

4 q0 is the start state;


5 F “ F1 Y F2 .
Proof sketch (Concatenation)
Proof sketch (Concatenation)

ε
ε
ε
Example (Concatenation)

L “ tabc, acbu L1 “ tpabqn | n ě 0u

c
b a
a
c b
b

c
b ε a
a
ε
c b
b
L ˝ L1
Formal proof construction (Concatenation)

Let N1 “ pQ1 , Σ1 , δ1 , q1 , F1 q and N2 “ pQ2 , Σ2 , δ2 , q2 , F2 q.


Construct N “ pQ, Σ, δ, q0 , F q such that LpNq “ LpN1 q ˝ LpN2 q.
1 Q “ Q1 Y Q2 ;
2 Σ “ Σ1 Y Σ2 ;
3 δ is defined for q P Q and a P Σε by
$

’ δ1 pq, aq q P Q1 and q R F1
δ1 pq, aq q P F1 and a ‰ ε
&
δpq, aq “

’ δ 1 pq, aq Y tq 2 u q P F1 and a “ ε
δ2 pq, aq q P Q2
%

4 q0 “ q1 is the start state;


5 F “ F2 .
Proof sketch (Star)
Proof sketch (Star)

ε ε
ε
ε
Example (Star)

L “ tabc, acbu L˚

ε
c c
b b
a ε a
c c
b b
ε
Formal proof construction (Star)

Let N1 “ pQ1 , Σ1 , δ1 , q1 , F1 q.
Construct N “ pQ, Σ, δ, q0 , F q such that LpNq “ LpN1 q˚ .
1 Q “ tq0 u Y Q1 (where q0 R Q1 );
2 Σ “ Σ1 ;
3 δ is defined for q P Q and a P Σε by
$

’ δ1 pq, aq q P Q1 and q R F1
& δ1 pq, aq q P F1 and a ‰ ε


δpq, aq “ δ1 pq, aq Y tq1 u q P F1 and a “ ε
tq u q “ q0 and a “ ε

% 1



H q “ q0 and a ‰ ε

4 q0 is the new start state;


5 F “ tq0 u Y F1 .
Other closure properties

‚ Complementation If L is a regular language, then its


complement L is also regular.
Proof: Take the complement of the set of accepting states.
‚ Intersection If L1 and L2 are regular languages, then their
intersection L1 X L2 is also regular.
Proof: Use De Morgan’s law

L1 X L2 “ L1 Y L2

.
Chapter 6. Regular expressions
Examples of regular expressions

Regular expression r language Lpr q


a tau
aYb ta, bu (or tau Y tbu)
ab tabu (or tau ˝ tbu)
pa Y bqpc Y dq tac, ad, bc, bdu (or ta, bu ˝ tc, duq
a˚ tε, a, aa, aaa, aaaa, . . .u (or tau˚ )
pa Y bq˚ tε, a, b, aa, bb, ab, ba, aaa, . . .u (or ta, bu˚ )
H tu
ε tεu
Definition of Regular Expression
Definition
R is a regular expression over alphabet Σ if R is
1 a for some a P Σ;
2 ε;
3 H;
4 pR1 Y R2 q for some regular expressions R1 and R2 ;
5 pR1 ˝ R2 q for some regular expressions R1 and R2 ;
6 pR1˚ q for some regular expression R1 .
Definition of Regular Expression
Definition
R is a regular expression over alphabet Σ if R is
1 a for some a P Σ;
2 ε;
3 H;
4 pR1 Y R2 q for some regular expressions R1 and R2 ;
5 pR1 ˝ R2 q for some regular expressions R1 and R2 ;
6 pR1˚ q for some regular expression R1 .

Notation:
‚ We often don’t write ˝, so abc means a ˝ b ˝ c.
‚ We often omit parentheses.
‚ Star binds stronger than concatenation, which binds stronger
than union, so a Y b ˝ c ˚ means a Y pb ˝ pc ˚ qq.
‚ If Σ “ ta1 , a2 , . . . , an u, then we write Σ for the regular
expression a1 Y a2 Y . . . Y an .
Language generated by regular expression

Definition
The language generated by a regular expression is inductively
defined as follows:
Lpaq = tau
Lpεq = tεu
LpHq = tu
LpR1 Y R2 q = LpR1 q Y LpR2 q
LpR1 ˝ R2 q = LpR1 q ˝ LpR2 q
LpR1˚ q = LpR1 q˚
Applying the inductive definition

Consider the regular expression ab Y cd.


The language generated by this expression is

Lpab Y cdq “ Lpabq Y Lpcdq


“ pLpaq ˝ Lpbqq Y pLpcq ˝ Lpdqq
“ ptau ˝ tbuq Y ptcu ˝ tduq
“ ptabuq Y ptcduq
“ ptab, cduq
Examples
‚ 0˚ 10˚ “ tw | w contains a single 1u
‚ Σ˚ 1Σ˚ “ tw | w has at least one 1u
‚ Σ˚ 001Σ˚ “ tw | w contains the string 001 as a substringu
‚ p01` q˚ “ tw |
w does not start with 1 and every 0 is followed by at least one 1u,
where R ` “ RR ˚ (at least one element of R)
‚ pΣΣq˚ “ tw | w has even length u
‚ pΣΣΣq˚ “ tw | length of w is a multiple of 3u
‚ 0Σ˚ 0 Y 1Σ˚ 1 Y 0 Y 1 “
tw | w starts and ends with the same symbol u
‚ p0 Y εq1˚ “ 01˚ Y 1˚
‚ p0 Y εqp1 Y εq “ tε, 0, 1, 01u
‚ 1˚ H “ H
‚ H˚ “ ε
‚ ε˚ “ ε
Example
Determine a regular expression r such that

Lpr q “ tw P t0, 1u˚ | w does not have two consecutive 0’su


Example
Determine a regular expression r such that

Lpr q “ tw P t0, 1u˚ | w does not have two consecutive 0’su

Solution idea: Every 0 (except for the first one) has to be preceded
by at least one 1.
Example
Determine a regular expression r such that

Lpr q “ tw P t0, 1u˚ | w does not have two consecutive 0’su

Solution idea: Every 0 (except for the first one) has to be preceded
by at least one 1.
This gives:

loomo 11 . . . 10 looomooon
0 on looomooon 11 . . . 10 . . . 11 . . . 10 loomoon
looomooon 11 . . . 1
optional optional

where the first 0 and the last series of 1’s is optional.


Example
Determine a regular expression r such that

Lpr q “ tw P t0, 1u˚ | w does not have two consecutive 0’su

Solution idea: Every 0 (except for the first one) has to be preceded
by at least one 1.
This gives:

loomo 11 . . . 10 looomooon
0 on looomooon 11 . . . 10 . . . 11 . . . 10 loomoon
looomooon 11 . . . 1
optional optional

where the first 0 and the last series of 1’s is optional.


In regular expression:
˚ ˚ ˚ ˚
p0 Y εq lo11
loomoon omo0on lo11
omo0on . . . lo11
omo0on loo1moon

This is:
p0 Y εq p11˚ 0q˚ 1˚
Example: Vim editor uses regular expressions

‚ a for every ascii character;


‚ \(\) to denote the empty string;
‚ [] to denote the empty set;
‚ \| to denote union;
‚ Concatentation by juxtaposition;
‚ * for Kleene star.

‚ \(. . . \) for grouping.


Example: Vim editor additional operators
Expression Meaning
hello The string “hello”
[abc] One of the characters a, b, or c
[^abc] Any single character that is not a, b, or c
[a-z] One of the lower case characters
\d A digit
\s A whitespace character
. Any single character
* Zero or more of the preceding characters
\+ One or more of the preceding characters
\= Zero or one of the preceding characters
\{n,m} n to m of the preceding characters
\{n} n of the preceding characters
^hello The string ”hello” at the beginning of a line
hello$ The string ”hello” at the end of a line
\<hello The string ”hello” at the beginning of a word
hello\> The string ”hello” at the end of a word
Regular expressions define regular languages

The three operators used to construct regular expressions are


exactly sufficient to define all regular languages.

Theorem
A language is regular if and only if some regular expression
describes it.
Regular expressions define regular languages

The three operators used to construct regular expressions are


exactly sufficient to define all regular languages.

Theorem
A language is regular if and only if some regular expression
describes it.

Structure of the proof:


1 From RE to NFA.
2 From DFA to RE.
Requires the notion of Generalized NFA.
Step 1: From RE to NFA
Transform a regular expression into an NFA that recognizes the
same language.
Recall the inductive structure of regular expressions:
a, ε, H, R1 Y R2 , R1 ˝ R2 , and R1˚ .
Step 1: From RE to NFA
Transform a regular expression into an NFA that recognizes the
same language.
Recall the inductive structure of regular expressions:
a, ε, H, R1 Y R2 , R1 ˝ R2 , and R1˚ .

1 R “ a P Σ. Then LpRq “ tau. Construct the NFA:


a
Step 1: From RE to NFA
Transform a regular expression into an NFA that recognizes the
same language.
Recall the inductive structure of regular expressions:
a, ε, H, R1 Y R2 , R1 ˝ R2 , and R1˚ .

1 R “ a P Σ. Then LpRq “ tau. Construct the NFA:


a

2 R “ ε. Then LpRq “ tεu. Construct the NFA:


Step 1: From RE to NFA
Transform a regular expression into an NFA that recognizes the
same language.
Recall the inductive structure of regular expressions:
a, ε, H, R1 Y R2 , R1 ˝ R2 , and R1˚ .

1 R “ a P Σ. Then LpRq “ tau. Construct the NFA:


a

2 R “ ε. Then LpRq “ tεu. Construct the NFA:

3 R “ H. Then LpRq “ tu. Construct the NFA:


Step 1: From RE to NFA

R “ R1 Y R2 . ε

4 Use the closure construction for


Union. ε

R “ R1 ˝ R2 . ε
ε
5 Use the closure construction ε

for Concatenation.

R “ R1˚ .
ε ε
6 Use the closure construction for ε
ε
Star.
Example RE to NFA
Convert pab Y aq˚ into an equivalent NFA.
Example RE to NFA
Convert pab Y aq˚ into an equivalent NFA.
‚ Subexpression a
a
Example RE to NFA
Convert pab Y aq˚ into an equivalent NFA.
‚ Subexpression a
a

‚ Subexpression b
b
Example RE to NFA
Convert pab Y aq˚ into an equivalent NFA.
‚ Subexpression a
a

‚ Subexpression b
b

‚ Subexpression ab
a ε b
Example RE to NFA
Convert pab Y aq˚ into an equivalent NFA.
‚ Subexpression a
a

‚ Subexpression b
b

‚ Subexpression ab
a ε b

‚ Subexpression ab Y a
a ε b
ε
ε
a
Example RE to NFA
Convert pab Y aq˚ into an equivalent NFA.
‚ Subexpression ab Y a
a ε b
ε
ε
a
Example RE to NFA
Convert pab Y aq˚ into an equivalent NFA.
‚ Subexpression ab Y a
a ε b
ε
ε
a

‚ Expression pab Y aq˚ ε

a ε b
ε
ε
ε
a

ε
Example RE to NFA
‚ Expression pab Y aq˚
ε

a ε b
ε
ε
ε
a

ε
‚ Simplification
ε
b
a
ε a
ε
Example RE to NFA

‚ Simplification
ε
b
a
ε a
ε
‚ Further simplification

a
b

a
Regular expressions define regular languages

Theorem
A language is regular if and only if some regular expression
describes it.

Structure of the proof:


1 From RE to NFA. X
2 From DFA to RE.
Requires the notion of Generalized NFA.
Step 2: From DFA to RE

Transform a DFA into a regular expression that recognizes the


same language.
Step 2: From DFA to RE

Transform a DFA into a regular expression that recognizes the


same language.

Intuition:

a c
b transforms into a˚ bc ˚
Step 2: From DFA to RE

Transform a DFA into a regular expression that recognizes the


same language.

Intuition:

a c
b transforms into a˚ bc ˚

b
a c transforms into ab ˚ c
Generalised NFA

A GNFA is an NFA where:

1 Labels of the edges are regular expressions.


2 The start state has no incoming edges and is not accepting.
3 There is only one accepting state and it has no outgoing
edges.
4 For every pair of states p, q there is at most one edge from p
to q.
From DFA to GNFA (Example 1)

Consider the following DFA.


a
1
b a, b
2
We transform it into a generalized NFA as follows.

a
s ε
1
b aYb
f ε 2
From DFA to GNFA (Example 1)
a
s ε
1
b aYb
f ε 2
Next, we remove node 2.
a
s ε
1

bpa Y bq˚
f
Next, we remove node 1.
s
a˚ bpa Y bq˚
f
From DFA to GNFA: informal algorithm

1 Transform the DFA into a generalized NFA and add a new


initial and final state.
2 Repeat until only the new initial and new final state are left:
r
‚ Pick an internal node n. Assume n ÝÑ n
r
s þt
‚ For every double transition via n: x ÝÑ n ÝÑ y (possibly with
x “ y)
˚
sr t v
‚ Add an edge x ÝÑ y , or replace the existing edge x ÝÑ y by
˚
sr t Yv
x ÝÑ y .
‚ Remove node n
3 We now have a generalized NFA with only two nodes left.
The label on the edge from the start node to the final node is
the resulting regular expression.
Note: x may be equal to y .
From DFA to GNFA (Example 2)
Consider a DFA for the following language:

Lpr q “ tw P t0, 1u˚ | w does not have two consecutive 0’su.

1 0, 1
0
0
A B C
1
From DFA to GNFA (Example 2)
Consider a DFA for the following language:

Lpr q “ tw P t0, 1u˚ | w does not have two consecutive 0’su.

1 0, 1
0
0
A B C
1
Add initial and final state.
1 0, 1
0
ε 0
S A B C
1
ε ε
F
We can remove trap state C .
From DFA to GNFA (Example 2)
1
0
ε
S A B
1
ε ε
F
Remove state A.
11˚ 0
ε1˚ 0
S B

ε1˚ ε ε Y 11˚ ε
F
From DFA to GNFA (Example 2)
11˚ 0
ε1˚ 0
S B

ε1˚ ε ε Y 11˚ ε
F
Remove state B.

S ε1˚ ε Y ε1˚ 0p11˚ 0q˚ pε Y 11˚ εq

F
From DFA to GNFA (Example 2)
11˚ 0
ε1˚ 0
S B

ε1˚ ε ε Y 11˚ ε
F
Remove state B.

S ε1˚ ε Y ε1˚ 0p11˚ 0q˚ pε Y 11˚ εq

F
After simplification, this gives the regular expression:
1˚ Y 1˚ 0p11˚ 0q˚ pε Y 11˚ q
From DFA to GNFA (Example 2)
11˚ 0
ε1˚ 0
S B

ε1˚ ε ε Y 11˚ ε
F
Remove state B.

S ε1˚ ε Y ε1˚ 0p11˚ 0q˚ pε Y 11˚ εq

F
After simplification, this gives the regular expression:
1˚ Y 1˚ 0p11˚ 0q˚ pε Y 11˚ q or even 1˚ Y 1˚ 0p11˚ 0q˚ 1˚ .
From DFA to GNFA (Example 3)
b
a
1 2
a
b a
b
3
Add initial and final state.
b
a
s ε ε
1 2 f
a
b a
ε
b
3
From DFA to GNFA (Example 3)
b
a
s ε ε
1 2 f
a
b a
ε
b
3
Remove state 1.
aa Y b
s a ε
2 f
b ba Y a ab
ε
3

bb
From DFA to GNFA (Example 3)
aa Y b
s a ε
2 f
b ba Y a ab
ε
3

bb
Remove state 2.

apaa Y bq˚
s f

apaa Y bq˚ ab Y b 3 pba Y aqpaa Y bq˚ Y ε


pba Y aqpaa Y bq˚ ab Y bb
From DFA to GNFA (Example 3)
apaa Y bq˚
s f

apaa Y bq˚ ab Y b 3 pba Y aqpaa Y bq˚ Y ε


pba Y aqpaa Y bq˚ ab Y bb

Remove state 3.
` ˘
apaa Y bq˚ ab Y b ˝
` ˘˚
pba Y aqpaa Y bq˚ ab Y bb ˝
` ˘
pba Y aqpaa Y bq˚ Y ε
Y apaa Y bq˚
s f
Regular expressions define regular languages

Theorem
A language is regular if and only if some regular expression
describes it.

Structure of the proof:


1 From RE to NFA. X
2 From DFA to RE. X
Requires the notion of Generalized NFA.
Overview

Reg

DFA NFA

RE
Properties of regular expressions

We reduced
ε1˚ ε Y ε1˚ 0p11˚ 0q˚ pε Y 11˚ εq
to the expression

1˚ Y 1˚ 0p11˚ 0q˚ 1˚

Can we define an algebra to calculate with Regular Expressions?


Properties of regular expressions

Union and concatenation.

x Y py Y zq “ px Y y q Y z [associativity of Y ]
xpyzq “ pxy qz [associativity of ˝ ]
x Yy “y Yx [commutativity of Y ]
x Yx “x [idempotence of Y ]
x YH“x [H is a zero]
xH “ Hx “ H [H is a zero]
xε “ εx “ x [ε is a unit]
xpy Y zq “ xy Y xz [left-distributivity of ˝ over Y ]
px Y y qz “ xz Y yz [right-distributivity of ˝ over Y ]
Properties of regular expressions

Union and concatenation.

x Y py Y zq “ px Y y q Y z [associativity of Y ]
xpyzq “ pxy qz [associativity of ˝ ]
x Yy “y Yx [commutativity of Y ]
x Yx “x [idempotence of Y ]
x YH“x [H is a zero]
xH “ Hx “ H [H is a zero]
xε “ εx “ x [ε is a unit]
xpy Y zq “ xy Y xz [left-distributivity of ˝ over Y ]
px Y y qz “ xz Y yz [right-distributivity of ˝ over Y ]

pY, ˝q forms an idempotent semiring.


Properties of regular expressions
Star

ε Y xx ˚ “ x ˚ I
ε Y x ˚x “ x ˚ II
pxy q˚ x “ xpyxq˚ III
px ˚ y q˚ x ˚ “ px Y y q˚ IV
x ˚ pyx ˚ q˚ “ px Y y q˚ V
pε Y xq˚ “ x ˚ VI
xx ˚ “ x ˚ x VII
px ˚ q˚ “ x ˚ VIII
H˚ “ ε IX
ε˚ “ ε X
px ˚ y ˚ q˚ “ px Y y q˚ XI
px ˚ Y y q˚ “ px Y y q˚ XII
Properties of regular expressions
Star

ε Y xx ˚ “ x ˚ I
ε Y x ˚x “ x ˚ II
pxy q˚ x “ xpyxq˚ III
px ˚ y q˚ x ˚ “ px Y y q˚ IV
x ˚ pyx ˚ q˚ “ px Y y q˚ V
pε Y xq˚ “ x ˚ VI
xx ˚ “ x ˚ x VII
px ˚ q˚ “ x ˚ VIII
H˚ “ ε IX
ε˚ “ ε X
px ˚ y ˚ q˚ “ px Y y q˚ XI
px ˚ Y y q˚ “ px Y y q˚ XII
These are just some properties; pY, ˝,˚ q forms a Kleene algebra.
Example 1

Simplify
ε1˚ ε Y ε1˚ 0p11˚ 0q˚ pε Y 11˚ εq
Example 1

Simplify
ε1˚ ε Y ε1˚ 0p11˚ 0q˚ pε Y 11˚ εq

Using the fact that ε is a unit, we obtain

1˚ Y 1˚ 0p11˚ 0q˚ pε Y 11˚ q

Use star property I (ε Y xx ˚ “ x ˚ ) on the underlined part of the


expression.
1˚ Y 1˚ 0p11˚ 0q˚ 1˚
Example 2

Simplify p0˚ 1˚ Y 1˚ 0˚ q˚
Example 2

Simplify p0˚ 1˚ Y 1˚ 0˚ q˚

p0˚ 1˚ Y 1˚ 0˚ q˚ “ [property XII applied twice, backwards]


pp0˚ 1˚ q˚ Y p1˚ 0˚ q˚ q˚ “ [property XI applied twice]
pp0 Y 1q˚ Y p1 Y 0q˚ q˚ “ [commutativity]
pp0 Y 1q˚ Y p0 Y 1q˚ q˚ “ [idempotence of Y]
pp0 Y 1q˚ q˚ “ [property VIII]
p0 Y 1q˚

px ˚ q˚ “ x ˚ VIII
px ˚ y ˚ q˚ “ px Y y q˚ XI
px ˚ Y y q˚ “ px Y y q˚ XII
Example 3
The language of binary sequences that do not end in 00:
All sequences with length ă 2 plus all sequences that end in 01,
10, or 11
ε Y 0 Y 1 Y p0 Y 1q˚ p01 Y 10 Y 11q
Example 3
The language of binary sequences that do not end in 00:
All sequences with length ă 2 plus all sequences that end in 01,
10, or 11
ε Y 0 Y 1 Y p0 Y 1q˚ p01 Y 10 Y 11q

This can be simplified as follows:


ε Y 0 Y 1 Y p0 Y 1q˚ p01 Y 10 Y 11q “ [commutativity]
ε Y 0 Y 1 Y p0 Y 1q˚ p01 Y 11 Y 10q “ [associativity]
ε Y 0 Y 1 Y p0 Y 1q˚ pp01 Y 11q Y 10q “ [distributivity]
ε Y 0 Y 1 Y p0 Y 1q˚ p01 Y 11q Y p0 Y 1q˚ 10 “ [distributivity]
ε Y 0 Y 1 Y p0 Y 1q˚ p0 Y 1q1 Y p0 Y 1q˚ 10 “ [unit, distributivity]
ε Y 0 Y pε Y p0 Y 1q˚ p0 Y 1qq1 Y p0 Y 1q˚ 10 “ [using II]
ε Y 0 Y p0 Y 1q˚ 1 Y p0 Y 1q˚ 10 “ [distributivity]
ε Y 0 Y p0 Y 1q˚ p1 Y 10q
ε Y x ˚x “ x ˚ II
Example 4

Prove that property XII is derivable from the other properties.


ε Y xx ˚ “ x ˚ I
ε Y x ˚x “ x ˚ II
pxy q˚ x “ xpyxq˚ III
px ˚ y q˚ x ˚ “ px Y y q˚ IV
x ˚ pyx ˚ q˚ “ px Y y q˚ V
pε Y xq˚ “ x ˚ VI
xx ˚ “ x ˚ x VII
px ˚ q˚ “ x ˚ VIII
H˚ “ ε IX
ε˚ “ ε X
px ˚ y ˚ q˚ “ px Y y q˚ XI
px ˚ Y y q˚ “ px Y y q˚ XII
Example 4

Prove that property XII is derivable from the other properties.


ε Y xx ˚ “ x ˚ I
ε Y x ˚x “ x ˚ II
pxy q˚ x “ xpyxq˚ III
px ˚ y q˚ x ˚ “ px Y y q˚ IV
px ˚ Y y q˚ “ [XI backwards]
x ˚ pyx ˚ q˚ “ px Y y q˚ V
pε Y xq˚ “ x ˚ VI ppx ˚ q˚ y ˚ q˚ “ [VIII]
xx ˚ “ x ˚ x VII px ˚ y ˚ q˚ “ [XI]
px ˚ q˚ “ x ˚ VIII
px Y y q˚
H˚ “ ε IX
ε˚ “ ε X
px ˚ y ˚ q˚ “ px Y y q˚ XI
px ˚ Y y q˚ “ px Y y q˚ XII
Example 5
Distributivity of star over union.
Prove that px Y y q˚ “ x ˚ Y y ˚ is not a generally valid property.
Example 5
Distributivity of star over union.
Prove that px Y y q˚ “ x ˚ Y y ˚ is not a generally valid property.

Proof idea: Find values for x and y such that

Lppx Y y q˚ q ‰ Lpx ˚ Y y ˚ q
Example 5
Distributivity of star over union.
Prove that px Y y q˚ “ x ˚ Y y ˚ is not a generally valid property.

Proof idea: Find values for x and y such that

Lppx Y y q˚ q ‰ Lpx ˚ Y y ˚ q

Take x “ a and y “ b, then

Lppa Y bq˚ q “ ta, bu˚


Lpa˚ Y b ˚ q “ tau˚ Y tbu˚
Example 5
Distributivity of star over union.
Prove that px Y y q˚ “ x ˚ Y y ˚ is not a generally valid property.

Proof idea: Find values for x and y such that

Lppx Y y q˚ q ‰ Lpx ˚ Y y ˚ q

Take x “ a and y “ b, then

Lppa Y bq˚ q “ ta, bu˚ Q ab


Lpa˚ Y b ˚ q “ tau˚ Y tbu˚ S ab

So Lppa Y bq˚ q ‰ Lpa˚ Y b ˚ q,


hence px Y y q˚ “ x ˚ Y y ˚ is not valid.
Example 5
Distributivity of star over union.
Prove that px Y y q˚ “ x ˚ Y y ˚ is not a generally valid property.

Proof idea: Find values for x and y such that

Lppx Y y q˚ q ‰ Lpx ˚ Y y ˚ q

Take x “ a and y “ b, then

Lppa Y bq˚ q “ ta, bu˚ Q ab


Lpa˚ Y b ˚ q “ tau˚ Y tbu˚ S ab

So Lppa Y bq˚ q ‰ Lpa˚ Y b ˚ q,


hence px Y y q˚ “ x ˚ Y y ˚ is not valid.

Similarly we can prove that x ˝ x ˚ “ x ˚ and px ˝ y q˚ “ x ˚ ˝ y ˚ are


in general not valid.

You might also like