# HG changeset patch # User kleing # Date 1311858926 -7200 # Node ID ab4d8499815c3c9d55bb73be5c37e5cdc1bcc35b # Parent 04fd92795458f1f8101a83f897e9991f6c5e2564 resolved code_pred FIXME in IMP; clearer notation for exec_n diff -r 04fd92795458 -r ab4d8499815c src/HOL/IMP/Comp_Rev.thy --- a/src/HOL/IMP/Comp_Rev.thy Thu Jul 28 11:49:03 2011 +0200 +++ b/src/HOL/IMP/Comp_Rev.thy Thu Jul 28 15:15:26 2011 +0200 @@ -9,7 +9,7 @@ text {* Execution in @{term n} steps for simpler induction *} primrec exec_n :: "instr list \ config \ nat \ config \ bool" - ("_/ \ (_ \^_/ _)" [65,0,55,55] 55) + ("_/ \ (_ \^_/ _)" [65,0,1000,55] 55) where "P \ c \^0 c' = (c'=c)" | "P \ c \^(Suc n) c'' = (\c'. (P \ c \ c') \ P \ c' \^n c'')" @@ -41,7 +41,7 @@ lemma exec_0 [intro!]: "P \ c \^0 c" by simp lemma exec_Suc [trans]: - "\ P \ c \ c'; P \ c' \^n c'' \ \ P \ c \^Suc n c''" + "\ P \ c \ c'; P \ c' \^n c'' \ \ P \ c \^(Suc n) c''" by (fastsimp simp del: split_paired_Ex) lemma exec_exec_n: diff -r 04fd92795458 -r ab4d8499815c src/HOL/IMP/Compiler.thy --- a/src/HOL/IMP/Compiler.thy Thu Jul 28 11:49:03 2011 +0200 +++ b/src/HOL/IMP/Compiler.thy Thu Jul 28 15:15:26 2011 +0200 @@ -65,22 +65,17 @@ declare iexec1.intros -(* FIXME: why does code gen not work with fun? *) -inductive - exec1 :: "instr list \ config \ config \ bool" - ("(_/ \ (_ \/ _))" [50,0,0] 50) where - "\ P!!i \i (i,s,stk) \ c'; 0 \ i; i < isize P \ \ P \ (i,s,stk) \ c'" - -code_pred exec1 . - -declare exec1.intros [intro!] - -inductive_cases exec1_elim [elim!]: "P \ c \ c'" - -lemma exec1_simp [simp]: +definition + exec1 :: "instr list \ config \ config \ bool" ("(_/ \ (_ \/ _))" [50,0,0] 50) +where "P \ c \ c' = (\i s stk. c = (i,s,stk) \ P!!i \i (i,s,stk) \ c' \ 0 \ i \ i < isize P)" - by auto + +declare exec1_def [simp] + +lemma exec1I [intro, code_pred_intro]: + "\ P!!i \i (i,s,stk) \ c'; 0 \ i; i < isize P \ \ P \ (i,s,stk) \ c'" + by simp inductive exec :: "instr list \ config \ config \ bool" ("_/ \ (_ \*/ _)" 50) where @@ -91,7 +86,7 @@ lemmas exec_induct = exec.induct[split_format(complete)] -code_pred exec . +code_pred exec by force values "{(i,map t [''x'',''y''],stk) | i t stk.