equal
deleted
inserted
replaced
129 qed |
129 qed |
130 qed |
130 qed |
131 |
131 |
132 theorem correctness: "execute (compile e) env = eval e env" |
132 theorem correctness: "execute (compile e) env = eval e env" |
133 proof - |
133 proof - |
134 have "!!stack. exec (compile e) stack env = eval e env # stack" |
134 have "\<And>stack. exec (compile e) stack env = eval e env # stack" |
135 proof (induct e) |
135 proof (induct e) |
136 case Variable show ?case by simp |
136 case Variable show ?case by simp |
137 next |
137 next |
138 case Constant show ?case by simp |
138 case Constant show ?case by simp |
139 next |
139 next |
185 qed |
185 qed |
186 qed |
186 qed |
187 |
187 |
188 theorem correctness': "execute (compile e) env = eval e env" |
188 theorem correctness': "execute (compile e) env = eval e env" |
189 proof - |
189 proof - |
190 have exec_compile: |
190 have exec_compile: "\<And>stack. exec (compile e) stack env = eval e env # stack" |
191 "!!stack. exec (compile e) stack env = eval e env # stack" |
|
192 proof (induct e) |
191 proof (induct e) |
193 case (Variable adr s) |
192 case (Variable adr s) |
194 have "exec (compile (Variable adr)) s env = exec [Load adr] s env" |
193 have "exec (compile (Variable adr)) s env = exec [Load adr] s env" |
195 by simp |
194 by simp |
196 also have "... = env adr # s" by simp |
195 also have "... = env adr # s" by simp |