hw1

formal_language_HW1.pdf

1.a

finite_state_machineq1q1q0q0q1->q01q2q2q1->q20ss->q0startq0->q11q0->q00q2->q10q2->q21

1.b

finite_state_machineq0q0q0->q00q1q1q0->q11q1->q00q2q2q1->q21q2->q21q3q3q2->q30ss->q0startq3->q30,1

1.c

finite_state_machineq0q0q1q1q0->q11q2q2q0->q20q1->q00,1ss->q0startq2->q20,1

1.d

finite_state_machineq20q20q20->q201q21q21q20->q210qnqnq20->qn0q21->q211q22q22q21->q220q21->qn0q22->q221q22->qn0sq00q00s->q00startq10q10q00->q101q01q01q00->q010q10->q201q11q11q10->q110q02q02q01->q020q01->q111q12q12q02->q121q11->q211q11->q120q12->q221qn->qn0,1

1.e

finite_state_machineq0q0q0->q00q1q1q0->q11ss->q0startq1->q10,1

2.a

2.b

3.a

finite_state_machineq2q2q0q0q2->q00q1q1q2->q11ss->q0startq0->q00q0->q11q1->q20q1->q11

3.b

finite_state_machinesq0q0s->q0startq0->q00q1q1q0->q11q1->q11q2q2q1->q20q2->q00q3q3q2->q31q3->q20q4q4q3->q41q4->q40,1

3.c

finite_state_machinesq0q0s->q0startq3q3q3->q30q1q1q3->q11q5q5q6q6q5->q60,1q0->q1ϵq2q2q0->q2ϵq1->q31q1->q10q2->q21q4q4q2->q40q4->q50q4->q41q6->q60,1

3.d

finite_state_machineq1q1q1->q10,1q2q2q2->q20q3q3q2->q31sq0q0s->q0startq0->q11q0->q20q3->q20

3.e

finite_state_machineq0q0q2q2q0->q20q1q1q0->q11q3q3q4q4q3->q41q3->q20q4->q31q4->q20ss->q0startq1->q31q1->q20

4.a

ref

4.b

4.c

5

If is regular, then is also regular because is but remove the final state that be passing though another final state.

for example

finite_state_machineq2q2q3q3q2->q3cq4q4q3->q4dq5q5sq0q0s->q0startq1q1q0->q1aq1->q2bq1->q5c

finite_state_machineq2q2q5q5sq0q0s->q0startq1q1q0->q1aq1->q2bq1->q5c

6.a

6.b

ref

6.c

6.d

6.e

6.f

ref (Formal definition)

6.g

If is regular language then it can convert to DFA.

Divide a DFA to equeal part still are DFA which make it still regular.

6.h

6.i

6.j

not regular

7.a

7.b

7.c

7.d

8.a

8.b

finite_state_machineq0q0q1q1q0->q10,1ss->q0startq2q2q1->q20,1q2->q00,1

8.c

8.d

is DFA by definition

is base on but modify function and remove some state and final state. So it still a DFA

8.e

9.a

Each symbols need 2 state to record is even or odd state and additional one state for init state; total 2n+1 state.

finite_state_machineQ1_1Q1_1Q1_2Q1_2Q1_1->Q1_2a1Q2_1Q2_1Q2_2Q2_2Q2_1->Q2_2a2Q3_1Q3_1Q3_2Q3_2Q3_1->Q3_2a3Qn_1Qn_1Qn_2Qn_2Qn_1->Qn_2ansQ0Q0s->Q0startQ0->Q1_1a1Q0->Q2_1a2Q0->Q3_1a3Q0->Qn_1anQ1_2->Q1_1a1Q2_2->Q2_1a2Q3_2->Q3_1a3Qn_2->Qn_1an

9.b

Because DFA each state have determine result to next state by input. We need to know all symbols is even or odd in one state. So each symbols have two possible (even or odd) lead to state

9.c

10.a

prove are morphism

F-map

B-map

10.b

10.c