patternMinor
A Markov algorithm that does unary multiplication
Viewed 0 times
multiplicationunaryalgorithmthatdoesmarkov
Problem
I am learning Markov algorithms and came across the paper Markov Algorithm by CHEN Yuanmi. I am trying to understand the following example (well, any of the examples in the paper).
Example 3: Multiplication. MA3 = $\{\Sigma, P, P_0\}$
-
$\Sigma = \{a, A, B, C, \#\}$
-
Productions in $P$:
$p_1: Ba \to aB$
$p_2: Aa \to aBA$
$p_3: a \to \epsilon $
$p_4: a\#\to \#A $
$p_5: \#a \to \#$
$p_6: \# \to \epsilon$
$p_7: B \to a$
$p_8: \epsilon \to \cdot \epsilon$
-
$ P_0 = \{p_8\}$
Remark: Given the input in form of "$\underbrace{aa...a}_x\#\underbrace{aa...a}_{y}$", the algorithm will halt with the output in the form of "$\underbrace{aa...a}_{x \times y}$".
My question is about the above example. I understand the rules should be applied in linear order. So given an input of "$aaa\#aaa$", the first rule to match would be $p_3$, which says to replace
Example 3: Multiplication. MA3 = $\{\Sigma, P, P_0\}$
-
$\Sigma = \{a, A, B, C, \#\}$
-
Productions in $P$:
$p_1: Ba \to aB$
$p_2: Aa \to aBA$
$p_3: a \to \epsilon $
$p_4: a\#\to \#A $
$p_5: \#a \to \#$
$p_6: \# \to \epsilon$
$p_7: B \to a$
$p_8: \epsilon \to \cdot \epsilon$
-
$ P_0 = \{p_8\}$
Remark: Given the input in form of "$\underbrace{aa...a}_x\#\underbrace{aa...a}_{y}$", the algorithm will halt with the output in the form of "$\underbrace{aa...a}_{x \times y}$".
My question is about the above example. I understand the rules should be applied in linear order. So given an input of "$aaa\#aaa$", the first rule to match would be $p_3$, which says to replace
a with the empty character. So the string will be consumed down to a single #, which is then also replaced with an empty character ($p_6$), then the machine halts with no output($p_8$). How does this achieve multiplication? What am I not understanding?Solution
You have demonstrated that example on multiplication cannot be correct.
Well, there is typo in that example. The substitution rule $p_3$ should have been
$$A\to\epsilon$$
Well, there is typo in that example. The substitution rule $p_3$ should have been
$$A\to\epsilon$$
Context
StackExchange Computer Science Q#156433, answer score: 2
Revisions (0)
No revisions yet.