I'm supposed to find circuits , which can solve the question of membership in a regular language A with fixed length. The depth is limited by O(log(n)) and the size by O(n). Divide and Conquer should be the way to go, but I always exceed the max size. Would really appreciate any help
-
1$\begingroup$ Welcome to Computer Science! What have you tried? Where did you get stuck? We do not want to just do your (home-)work for you; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for a relevant discussion. If you are uncertain how to improve your question, why not ask around in Computer Science Chat? You may also want to check out our reference questions. $\endgroup$– RaphaelCommented Jun 26, 2016 at 19:00
1 Answer
Let $T$ by a balanced binary tree with $n$ leaves, and label each internal node $v$ by the interval $I_v$ consisting of the leaves below $v$. For each $v$ we will calculate the a two-place relation $R_v(s,t)$ which checks whether $I_v$ causes the automaton to move from $s$ to $t$. If $a,b$ are the two children of $v$, then $$ R_v(s,t) = \bigvee_u (R_a(s,u) \land R_b(u,t)). $$ For a leaf $f$, $R_f(s,t) = [\delta(s,x_f) = t]$, where $x_f$ is the $f$th input, and $\delta$ is the transition function. If $r$ is the root of the tree then the final answer is $$ \bigvee_{q \in F} R_r(q_0,q), $$ where $q_0$ is the initial state and $F$ is the set of accepting states.
Each node of the tree uses $O(1)$ gates. Since the tree has $O(n)$ nodes, the circuit has size $O(n)$. It's also not difficult to check that it has depth $O(\log n)$. Moreover, the fan-in of each gate is constant (since the number of states is constant), and so this circuit is actually in $\mathsf{NC}^1$.
Note also that the construction works directly for NFAs.
-
1$\begingroup$ Do I get that right, you're basically checking in every step, whether the input is the set of valid elements , and split it up? $\endgroup$– ArminCommented Jun 26, 2016 at 19:19
-
$\begingroup$ I don't quite get what s and t are. Are these states in the DFA ? $\endgroup$– ArminCommented Jun 26, 2016 at 20:44
-
$\begingroup$ I'm just implementing what you suggested - divide and conquer. I'm sure you can figure out the rest from context. It's your exercise, after all. $\endgroup$ Commented Jun 26, 2016 at 22:10