I know there is this paper but I wanted to do a special case proof for just IMP for fun. So the theorem is:
$$ \langle P , \sigma \rangle \to_{Big} \langle \{ \} , \sigma' \rangle \iff \exists N \in \mathbf N: \langle P , \sigma \rangle \to^N_{Small} \langle \{ \} , \sigma' \rangle $$
in words; the program P in state $\sigma$ evaluates to the empty block IFF there exists a certain number of small step steps inference steps that arrives us to the same configuration, the empty program in state $\sigma'$. Note $\langle P, \sigma \rangle$ stands for a program configuration with state $\sigma$. I am assuming both small step and big step have the same sort of configuration, which might be a big assumption and hard to formalize in real code...
I am happy with just an outline/sketch since a rigurous proof might be too much work probably and I'd rather get something than nothing.
I want to focus on $\Rightarrow$ (big to small). I think one of my main difficulties is finding such an $N$ that works. But conceptually to me I think I would break the proof by induction on the program P. The program has 6 constructors/cases:
- Empty Block {}
- Block B which is just $\{ S \}$
- Assignments $x = AExp ;$
- Sequences $S_1 ; S_2$ where $S_i$ is a statement.
- while statements $ While \ (BExp) \ do \ S $.
- ifElse statements $If \ (BExp) \ do \ S_1 \ Else \ S_2 $.
for the first case 1) its simple we have $\langle \{ \} , \sigma' \rangle$ on the RHS for big step and on the LHS $\langle \{ \} , \sigma' \rangle$ for small step, which are the same configuration. Done.
3) For the case assignment case we have to show that the AExp expressed uin the semantics, say big step or small step evaluates to the same as the "aeval" function that recursively just evaluates a real arithmetic expression. Not sure how I can make this more rigorous but at least it is a start.
Things with Boolean expression in them also need the same beval equivalence with boolean evaluation equivalence in their corresponding semantics.
However when things involve statements I am honestly not sure what one would need to argue to show they are equivalent. Do we do induction again on each statement and then proceed by apply the inference rules as many times as possible and show they evaluate to the same final state and empty block? Or what does one need to do? Then especially, how does one find the $N$?
The inference rules I had in mind are just any standard IMP semantics:
- http://fsl.cs.illinois.edu/images/b/b3/CS522-Spring-2011-PL-book-bigstep.pdf
- http://fsl.cs.illinois.edu/images/6/65/CS422-Spring-2015-02c-SmallStep.pdf
- https://softwarefoundations.cis.upenn.edu/plf-current/Smallstep.html
- http://www.cs.cornell.edu/courses/cs6110/2009sp/lectures/lec05-fa07.pdf
- http://web.cse.ohio-state.edu/~bond.213/6341/Operational-6.pdf
- https://www.seas.harvard.edu/courses/cs152/2010sp/lectures/lec03.pdf