0% found this document useful (0 votes)
49 views3 pages

TOC Tut

The document contains 6 problems related to formal languages and automata theory: 1. Prove using induction that the concatenation of strings x and y (x.y) has length equal to the sum of the lengths of x and y. 2. Formally define an operation #(a,s) that returns the number of occurrences of symbol a in string s. 3. Define a language L such that the complement of L contains strings with no substrings ab or ba. 4. Use the language L from problem 3 to design a deterministic finite automaton (DFA). 5. Design a DFA to accept all strings over the alphabet {0,1} except for strings "

Uploaded by

Gurmehak kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

TOC Tut

The document contains 6 problems related to formal languages and automata theory: 1. Prove using induction that the concatenation of strings x and y (x.y) has length equal to the sum of the lengths of x and y. 2. Formally define an operation #(a,s) that returns the number of occurrences of symbol a in string s. 3. Define a language L such that the complement of L contains strings with no substrings ab or ba. 4. Use the language L from problem 3 to design a deterministic finite automaton (DFA). 5. Design a DFA to accept all strings over the alphabet {0,1} except for strings "

Uploaded by

Gurmehak kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1. Prove using induction that |x.y| = |x| + |y| where . indicates the concatenation operator.

From <https://classroom.google.com/u/1/c/NDU1ODQ4NjY2Nzk5/m/NDU3NjExNTY5MTM1/details>

We already know, x.e = x

IH: for a y of length n, assume |x.y| = |x| + |y|

For a y of length -> n+1

Let y = a.z, where z is a string of length n

Using HI -> |x.y| = |x.(a.(z))| = |a.(x.(y))| = |z.(y)| + 1

1 + |z| + |x| => as 1 + |z| is |y| => |x| + |y| = RHS

2. Formally define the #(a,s) operation where a is a symbol, s is a string and the operation returns
the number of occurrences of a in s.

From <https://classroom.google.com/u/1/c/NDU1ODQ4NjY2Nzk5/m/NDU3NjExNTY5MTM1/details>

Sol -> If length of s is zero then our ans will be zero.


S = (b,y) then if b = a, ans = 1 + #(a,y)

If b != a, ans = #(a,y)
4. Define a languge L such that complement of L is { w : w contains neither the substrings ab nor ba }.

From <https://classroom.google.com/u/1/c/NDU1ODQ4NjY2Nzk5/m/NDU3NjExNTY5MTM1/details>

Sol ->

Base case: (e.a.b.e) and (e.b.a.e)

(x.a.b.y) and (x.b.a.y)

Here, x and y are any random strings.

5. Use (4) to design a DFA for L.

From <https://classroom.google.com/u/1/c/NDU1ODQ4NjY2Nzk5/m/NDU3NjExNTY5MTM1/details>

C -> A'
D -> B'

M -> {a,b}' and L -> {x, x belongs to (sigma)} are Loops


6*. Design a DFA for { w : w is any string except 11 and 111} over the alphabet {0,1}.

From <https://classroom.google.com/u/1/c/NDU1ODQ4NjY2Nzk5/m/NDU3NjExNTY5MTM1/details>

You might also like