Draw/Determine the stack and heap corresponding to the following formulae:
Say if the following are valid or not:
Prove the following triple by annotating the program:
$$ \{emp\} \\ x := cons(1,2); \\ y := cons(3,4); \\ [y+1] := [x+1]; \\ dispose\ \ x; \\ \{y \mapsto 3,2\} $$Propose a loop invariant for proving the following partial correctness triple in separation logic:
$$ \ht{(N \geq 0 \,\wedge\, X=0) \wedge Y \mapsto 0} {C} {Y \mapsto \sum_{i=1}^{N-1}{i}} $$ where $C$ is: $$ \whileloop{X \lt N}{(A := [Y]; X := X+1; [Y] := A+X)} $$