• edited by
2,517 views
16 16 votes

Consider the following computation rules. Parallel-outermost rule: Replace all the outermost occurrences of F (i.e., all occurrences of F which do not occur as arguments of other F's) simultaneously. Parallel - innermost rule: Replace all the innermost occurrences of F (i.e.,all occurrences of F with all arguments free of F's) simultaneously. Now consider the evaluations of the recursive program over the integers.  

F(x, y) <== if x = 0 then 0 else   
            [ F(x + 1, F(x, y)) * F(x - 1, F(x, y))] 

 where the multiplication functions * is extended as follows:  

0 * w & w * 0 are 0
a * w & w * a are w (for any non-zero integer a)
w * w is w  

We say that $F(x, y) =$ w when the evaluation of $F(x, y)$ does not terminate. Computing $F(1, 0)$ using the parallel - innermost and parallel - outermost rule yields

  1. $w$ and $0$ respectively
  2. $0$ and $0$ respectively
  3. $w$ and $w$ respectively
  4. $w$ and $1$ respectively
  5. none of the above
     

2 Answers

17 17 votes

Decoding the question :-

Parallel-outermost rule :-Replace all the outermost occurrences of F.Now what does outermost occurrence mean? it means those occurrences of F which are not appeared inside F as argument.

$F(1,0)$ it's outermost occurrence as didn't appear inside any $F$.So replace it.See out recurrence relation this will be replaced by ${\color{Red} F(2,F(1,0))} *{\color{Blue} F(0,F(1,0))}$ Now here again Red color $F$ and blue color $F$ are outmost occurrences for each other as they are not occurred as argument of some other $F$.(other $F$ which are uncolored are not included as 'outermost occurrence' as they are appeared as argument in some $F$)

So now replace only outermost occurrences(simultaneously). We don't have to replace other occurrences (uncolored) of $F$.

So overall it will become

$[F(3,F(2,F(1,0)))*F(1,F(2,F(1,0)))] *0$          //$F(0,F(1,0))$ will become $0$

Now we can observe some part will never terminate and some part will become $0$ so overall we can say it would be something like $W*0$ and which would result into $0$. So i think Applying parallel-outermost rule will result into $0$ .


Parallel-innermost rule:- Replace all the innermost occurrences of $F$. Here innermost occurrences mean those whose arguments are free from $F$.

Like in $F(1,0)$ argument of $F$ are $1,0$ which are free from $F$ so replace it by recurrence relation and hence it would become

$F(2,{\color{Red} F(1,0)})*F(0,{\color{Blue} F(1,0)})$ Here i colored another innermost occurrences of $F$ which we have to replace again.uncolored $F$ are not innermost occurrences as they contain such arguments which are not themselves function of $F$.

So overall it would become

$F(2,[F(2,F(1,0))*F(0,F(1,0))]) * F(0,[F(2,F(1,0))*F(0,F(1,0))])$

Here we can observe this that everytime we have to expand only function $F(1,0)$ because that's the only function whose arguments are free from any $F$ So in that way , overall it would become $W*W$ type which would result into $W$.

So option A is the correct answer.

4 4 votes

Answer is A) $w$ and $0$

If we solve using parallel innermost rule 

$F(1,0) = F(2,F(1,0)) * F(0,F(1,0))$

$=F(2, F(2,F(1,0)) * F(0,F(1,0))  ) * F(0,  F(2,F(1,0)) * F(0,F(1,0)) )$

Since computation of $F(1,0)$ goes on

We assign $F(1,0)$ to $w$.

So, $F(1,0)= w$

Using parallel outermost rule:

$F(1,0)= F(2,F(1,0)) * F(0,F(1,0))$

$ = F(2,F(1,0)) * 0$

$= 0$

• edited by
Answer:
Position:
Show:

Related questions

25 25 votes
4 answers 4 answers
5.7k
5.7k views
Misbah Ghaya asked Oct 10, 2015
5,705 views
Consider the program where $a, b$ are integers with $b 0$.x:=a; y:=b; z:=0; while y 0 do if odd (x) then z:= z + x; y:= y - 1; else y:= y % 2; x:= 2 * x; fiInvariant of...
17 17 votes
2 answers 2 answers
4.5k
4.5k views
Misbah Ghaya asked Oct 8, 2015
4,477 views
Consider the following program for summing the entries of the array $b$: array $[0 .. N-1]$ of integers, where $N$ is a positive integer. (The symbol '$<>$' denotes 'not ...
39 39 votes
6 answers 6 answers
10.4k
10.4k views
Misbah Ghaya asked Oct 10, 2015
10,445 views
In a directed graph, every vertex has exactly seven edges coming in. What can one always say about the number of edges going out of its vertices?Exactly seven edges leave...
15 15 votes
2 answers 2 answers
2.5k
2.5k views
Misbah Ghaya asked Oct 10, 2015
2,515 views
Consider the following languages over the alphabet $\{0, 1\}$. $L1=\left \{ x.x^{R}\mid x\in \left \{ 0, 1 \right \}^* \right \}$ $L2=\left \{ x.x\mid x\in ...