TD: Abstract Machines

Exercise 1

1. |ρ|sea2=|ρ|sub+|H|

At each sea2 transition, the size of the heap is incremented by one, thus so is |ρ|sub+|H|. And the only way to decrease |H|, is to execute a sub transition: |H| is decremented by one iff one sub transition is performed.

That is, once |H| has been increased, |ρ|sub+|H| remains constant until another sea2 transition is executed.

More concisely: sea2 is the only transition incrementing |H|, and sub is the only one decrementing it, so |H|=|ρ|sea2|ρ|sub holds.

2. |E|+|H||ρ|β

Every entry in the environment and/or the heap is an explicit substitution. But explicit substitutions can only be created by β transitions (one β transition ⟹ creation of one explicit substitution).

3. |ρ|sea2|ρ|β,sub

|ρ|sea2=|ρ|sub+|H||ρ|sub+|ρ|β|E||ρ|β,sub

4.

The code is increased in size only by sea2. All subterms of the code, stack, heap and the environment are subterms of the initial term t0.

So if we have sea1k, then k|t0|

Any sequence is of the form:

sea1|t0|¬sea1sea1|t0|¬sea1

So

|ρsea1||t0||ρ¬sea1|=|ρ|β+|ρ|sub+|ρ|sea2|t0|(2|ρ|β,sub)

Other possibility: the only way to increase the code size is the perform sea2, and between two sea2, there can be at most |t0| sea1.

Exercise 2

1.

sub can be followed only by β and sub.

Same thing for sub.

2.

sub|ρ|β,sub

3.

The effect of sub is to turn a white substitution inside H into a black one in E (that will remain black), and white substitutions are created by β’s. So

|ρ|sub|ρ|β

4.

|ρsub,sub|3|ρ|β

Note that we have

subsubβ

So:

sub|ρ|β+1

Difference between the two machines: the second one avoids detours of putting used substitutions back into the heap.

Leave a comment