Today we want to finish the topic of regular language. In particular decision problems.
Last time we saw:
- [[Theorem 5|Closure Property]] under
$\cup,\cap,\neg$
Today we will see
- [[Decision Problems]] with [[Deterministic Finite State Automata|Automata]]
- [[Decision Problems]] we have already seen are: [[Satisfiability]], [[Validity]]. This were [[FO - First order logic|FO]] problems. But it is always possible to transfer a [[FO - First order logic|FO]] problem to a [[Deterministic Finite State Automata|Automaton]] The [[emptyness problem]] is the logical equivalent of the [[Satisfiability]] problem.
==input==: A [[Non Deterministic Finite State Atomata|NFA]]
What might be possible outcomes:
- example: we can create a word that the [[Deterministic Finite State Automata|Automaton]] accepts -> The language of the [[Deterministic Finite State Automata|Automaton]] is not empty
- Another example: Even though the [[Deterministic Finite State Automata|Automaton]] is huge, the final state is not reachable -> empty language
[!note] [[Lemma 11]] For every [[Non Deterministic Finite State Atomata|NFA]]
$\mathcal{A}$ the [[Language]]$L(\mathcal{A}) \neq \emptyset$ if and only if there exists a word$w$ which is an element of its alphabet$A$ is element of the language$L(\mathcal{A})$ and has less symbols than the number of states i.e.$|w|<|states|$
==Shortform:== If you can find a word
DIrection 1. if we have a short word and it is part of the language then we can find an automaton to accept it. I.e. no proof necessary -> trivial
Direction 2: If we have a non-empy [[Language]] can we find a word with less symbols than there are states.
We will proof direction two by ==proof through [[contradiction]]==!
We have a language
We also assume that for every word
Further we assume a word
So lets do a run of the imaginary word
So:
graph LR
title[<u>Run of our Automaton</u>]
start --> q1
q1((q1))--a1-->q2((q2))--a2-->dot((...))
dot--am-->qm((qm))
final-->qm
The transition function is defined as follows:
Another observation that we can do is:
Because due to our assumption that the word
What does this mean practically: We have a circle in our [[Deterministic Finite State Automata|Automaton]]. Then our Automaton must look somehow like this:
graph LR
title[<u>Run of our Automaton</u>]
start --> q1
q1((q1))--a1-->dot1((...))--al-->ql((ql))
ql--ak-->dot3((...))--ai-->ql
ql-->dot((...))--am-->qm((qm))
final-->qm
==We have a circle==
But if the word
==[[contradiction]]==
How is this usefull?
When we want to find a accepted word. We just need to check all paths through our [[Deterministic Finite State Automata|Automaton]] with length smaller or equal
[!note] [[Corollary 3]] To know wheater a language is non empty one can remove all states of an automaton
$\mathcal{A}$ that are not reachable from the initial state$q_0$ . Then one can check if a final state is remains. If there exists a final state the Language is non-empty.
One can launch a [[depth first search]]. With this algorithm we mark all states that are reachable. Then if a final state is still existing the language is non empty. This algorithm is linear time with the automaton.
[[Corollary 3]] implies that the (non)-[[emptyness problem]] of the [[Non Deterministic Finite State Atomata|NFA]] is in [[P-Time]].
- Is [[logical equivalence|logically equivalent]] to the [[Validity]] of a Formula.
In this problem we check weather the set of accepted words is equal to the entire [[Alphabet]] of the [[Deterministic Finite State Automata|Automaton]] i.e.
==input:== [[Non Deterministic Finite State Atomata|NFA]]
How do we solve such a problem similar to the [[Validity]] problem in [[FO - First order logic|FO]].
We form the [[Complementation|complement]] of the Automaton
If the [[Complementation|complemented]] Automaton does not exist we know that the original [[Deterministic Finite State Automata|Automaton]] is accepts all words.
==Complexity== With a [[Non Deterministic Finite State Atomata|NFA]] will be [[EXP-Time]] and is [[P-space complete]] With a [[Deterministic Finite State Automata|DFA]] it is [[P-Time]]
- is the logical equivalence of [[logical equivalence]] in [[FO - First order logic|FO]]
==input:== two [[Deterministic Finite State Automata|Automata]]
GIven are two [[Deterministic Finite State Automata|Automata]]
==input:== two [[Deterministic Finite State Automata|Automata]]
GIven are two [[Deterministic Finite State Automata|Automata]]
Using the [[Intersection]] we can define three ways:
The following three statements define containment using [[Intersection]], [[complement]] and [[Equivalence problem|equivalence]].
This means that you can either use the intersection of the accepted languages of the automata i.e.
1.5 What happens if we have two different [[Deterministic Finite State Automata|Automata]] one beeing [[Non Deterministic Finite State Atomata|NFA]] and the other one [[Deterministic Finite State Automata|DFA]]?
The advantage is that [[DFA]]s can easily be complemented.
When we use the formula:
We set the [[Deterministic Finite State Automata|DFA]] to be
This means that we have an ==Advantage== when we have two [[Deterministic Finite State Automata|Automata]] from different classes as we can calculate the [[Containment problem]] in [[P-Time|polynomial time]]. Previousely it had the complexity of [[P-Space]].
[!note] [[Theorem 6|Myhill-Nerode Theorem]] Let L be a Language over the Alpabet
$A^\star$ i.e.:$L \subseteq A^\star$ .$L$ is ==any== Language. Then the following conditions are equivalent:
$L$ is [[Regular Languages|regular]]- There is a [[Equivalence problem|equivalence relation]]
$\approx$ over words element of$A^\star$ that is [[finite index]] (i.e. has a finite amount of equivalence classes) and is [[right invariant]] such that$L$ is a union of [[Equivalence problem| equivalence classes]] ($\approx-classes$ ) . e.g. $L=[u_1]{\approx} \cup [u_2]\approx \cup [u_3]\approx \dots$ ($[u_1]\approx$ is the class of all words that are equivalent to the word$u_1$ )- Some particular equivalence
$\approx_l$ is [[finite index]]
$\approx_L$ is defined as:$u \approx_L v \quad \iff \quad \forall t \in A^\star \hspace{0.5em} ( u \cdot t \in L \iff v \cdot t \in L)$
==Example union of [[Equivalence problem|equivalence classes]] :== What is not a union of [[Equivalence problem|equivalence classes]]?
Lets take the language
Now we define a two equivalence classes as the length of the word modulo 2:
- class
$mod(len(w))=1$ - class
$mod(len(w))=0$
The Language L is not a union of equivalence classes because not all words with uneven/even length are prime. Some words of the language are part of the equivalence class
==Examples to [[Theorem 6|Myhill-Nerode Theorem]]:==
Now a counter example:
Now another set of examples:
To summarize: What are the [[Equivalence problem|equivalence classes]] for
-
$[\epsilon]_{\approx_L}$ =${\epsilon,ab,abab,...}$ -> in$L$ -
$[a]_{\approx_L}$ =${a,aba,ababa,...}$ -> not in$L$ but can be made to words of$L$ by some action. E.g concatenation -
$[b]_{\approx_L}$ =${b,ba,bb,bbb,...,aa,...}$ -> not in$L$ and will never be in$L$
What are other regular languages that one could come up with:
==Example 1==
==Example 2==
-
$[\epsilon]_{\approx_L}$ How do we show this? We show that$\forall u,v \hspace{0.5 em} (u\approx_L v \iff u=v$ ) Suppose$u \not= v$ we define$t = (reverse(u))$
From this observation we can see:
There is an infinite amount of equivalence classes:
And from point 3 of the [[Theorem 6|Myhill-Nerode Theorem]] we can see that
break
We will proof it in three steps.
- We will proof from statement 1 -> 2
- Then we will proof from statement 2 -> 3
- Then we proof from 3 -> 1
Suppose
We have to define some equivalence
Define
What does this mean:
If one has an [[Deterministic Finite State Automata|Automaton]] and we start in a certain state
graph LR
title[<u>equivalence visualized</u>]
start --> q1
q1((q0))--u-->dot1
q1((q0))--v-->dot2
dot1((...))-->q2((q1))
dot2((...))-->q2((q1))
[!note] repetition what is
$\delta$ Is a function taking in states and letters or words and returns States.$\delta: Q \times A ->Q$ , but extended to$\tilde{\delta}: Q \times A^\star \rightarrow Q$
Note: Why is
graph LR
title[<u>equivalence visualized</u>]
start --> q0
q0((q0))--u-->q1((q1))
q0((q0))--u2-->q2((q2))
q0((q0))--un-->qn((qn))
q0((q0))--um-->q3((q_absQ))
[!note] What is [[right invariant]]
$\forall u,v,t \qquad u \approx v \implies u \cdot t \approx v \cdot t$
By definition when
Definition of accepted words:
We can also write this with a union:
The definition via a [[Union]] is basically a [[Equivalence problem|equivalence class]]
We assume without the loss of generality that
For every
Let
Now we define the Language
Assume that
==Goal==: Proof that
$u \approx_L v \quad \iff \quad \forall t \in A^\star \hspace{0.5em} ( u \cdot t \in L \iff v \cdot t \in L)$
prove that
[!note] refine Is a feature of equality relations. Where
$\approx$ and$\approx_L$ are two equality relations.$\approx$ refines$\approx_L$ if:
$\forall u,v \qquad u \approx v \implies u \approx_L v$
Note:
Because
Visually speaking it looks like this:
![[Verification 12_image_1.png|500]]
With
Lets start with the proof of Subgoal 1:
We assume
Because
We know that
So this proves that
Completed in [[Verification 13]]