src/HOL/Hoare/List_Examples.ML
author nipkow
Wed, 22 Nov 1995 18:48:56 +0100
changeset 1363 7bdc4699ef4d
child 1875 54c0462f8fb2
permissions -rw-r--r--
Added List_Examples

goal thy
"{x=X} \
\ y := []; \
\ WHILE x ~= [] \
\ DO { rev(x)@y = rev(X)} \
\    y := hd x # y; x := tl x \
\ END \
\{y=rev(X)}";
by(hoare_tac 1);
by(asm_full_simp_tac (!simpset addsimps [neq_Nil_conv]) 1);
by(safe_tac HOL_cs);
by(Asm_full_simp_tac 1);
by(Asm_full_simp_tac 1);
qed "imperative_reverse";

goal thy
"{x=X & y = Y} \
\ x := rev(x); \
\ WHILE x ~= [] \
\ DO { rev(x)@y = X@Y} \
\    y := hd x # y; x := tl x \
\ END \
\{y = X@Y}";
by(hoare_tac 1);
by(asm_full_simp_tac (!simpset addsimps [neq_Nil_conv]) 1);
by(safe_tac HOL_cs);
by(Asm_full_simp_tac 1);
by(Asm_full_simp_tac 1);
qed "imperative_append";