src/HOL/Bali/Eval.thy
changeset 62390 842917225d56
parent 62042 6c6ccf573479
child 63648 f9f3006a5579
equal deleted inserted replaced
62380:29800666e526 62390:842917225d56
   751  7,11,9,13,14,12,22,10,28,
   751  7,11,9,13,14,12,22,10,28,
   752  29,24] @{thm eval.induct})
   752  29,24] @{thm eval.induct})
   753 \<close>
   753 \<close>
   754 
   754 
   755 
   755 
   756 declare split_if     [split del] split_if_asm     [split del] 
   756 declare if_split     [split del] if_split_asm     [split del] 
   757         option.split [split del] option.split_asm [split del]
   757         option.split [split del] option.split_asm [split del]
   758 inductive_cases halloc_elim_cases: 
   758 inductive_cases halloc_elim_cases: 
   759   "G\<turnstile>(Some xc,s) \<midarrow>halloc oi\<succ>a\<rightarrow> s'"
   759   "G\<turnstile>(Some xc,s) \<midarrow>halloc oi\<succ>a\<rightarrow> s'"
   760   "G\<turnstile>(Norm    s) \<midarrow>halloc oi\<succ>a\<rightarrow> s'"
   760   "G\<turnstile>(Norm    s) \<midarrow>halloc oi\<succ>a\<rightarrow> s'"
   761 
   761 
   817         "G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<rightarrow> (v, s')"
   817         "G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<rightarrow> (v, s')"
   818         "G\<turnstile>Norm s \<midarrow>In1r (Init C)                       \<succ>\<rightarrow> (x, s')"
   818         "G\<turnstile>Norm s \<midarrow>In1r (Init C)                       \<succ>\<rightarrow> (x, s')"
   819 declare not_None_eq [simp]  (* IntDef.Zero_def [simp] *)
   819 declare not_None_eq [simp]  (* IntDef.Zero_def [simp] *)
   820 declare split_paired_All [simp] split_paired_Ex [simp]
   820 declare split_paired_All [simp] split_paired_Ex [simp]
   821 declaration \<open>K (Simplifier.map_ss (fn ss => ss addloop ("split_all_tac", split_all_tac)))\<close>
   821 declaration \<open>K (Simplifier.map_ss (fn ss => ss addloop ("split_all_tac", split_all_tac)))\<close>
   822 declare split_if     [split] split_if_asm     [split] 
   822 declare if_split     [split] if_split_asm     [split] 
   823         option.split [split] option.split_asm [split]
   823         option.split [split] option.split_asm [split]
   824 
   824 
   825 lemma eval_Inj_elim: 
   825 lemma eval_Inj_elim: 
   826  "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w,s') 
   826  "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w,s') 
   827  \<Longrightarrow> case t of 
   827  \<Longrightarrow> case t of 
  1060 
  1060 
  1061 (*unused*)
  1061 (*unused*)
  1062 lemma init_retains_locals [rule_format (no_asm)]: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w,s') \<Longrightarrow>  
  1062 lemma init_retains_locals [rule_format (no_asm)]: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w,s') \<Longrightarrow>  
  1063   (\<forall>C. t=In1r (Init C) \<longrightarrow> locals (store s) = locals (store s'))"
  1063   (\<forall>C. t=In1r (Init C) \<longrightarrow> locals (store s) = locals (store s'))"
  1064 apply (erule eval.induct)
  1064 apply (erule eval.induct)
  1065 apply (simp (no_asm_use) split del: split_if_asm option.split_asm)+
  1065 apply (simp (no_asm_use) split del: if_split_asm option.split_asm)+
  1066 apply auto
  1066 apply auto
  1067 done
  1067 done
  1068 
  1068 
  1069 lemma halloc_xcpt [dest!]: 
  1069 lemma halloc_xcpt [dest!]: 
  1070   "\<And>s'. G\<turnstile>(Some xc,s) \<midarrow>halloc oi\<succ>a\<rightarrow> s' \<Longrightarrow> s'=(Some xc,s)"
  1070   "\<And>s'. G\<turnstile>(Some xc,s) \<midarrow>halloc oi\<succ>a\<rightarrow> s' \<Longrightarrow> s'=(Some xc,s)"
  1126 subsubsection "single valued"
  1126 subsubsection "single valued"
  1127 
  1127 
  1128 lemma unique_halloc [rule_format (no_asm)]: 
  1128 lemma unique_halloc [rule_format (no_asm)]: 
  1129   "G\<turnstile>s \<midarrow>halloc oi\<succ>a \<rightarrow> s' \<Longrightarrow> G\<turnstile>s \<midarrow>halloc oi\<succ>a' \<rightarrow> s'' \<longrightarrow> a' = a \<and> s'' = s'"
  1129   "G\<turnstile>s \<midarrow>halloc oi\<succ>a \<rightarrow> s' \<Longrightarrow> G\<turnstile>s \<midarrow>halloc oi\<succ>a' \<rightarrow> s'' \<longrightarrow> a' = a \<and> s'' = s'"
  1130 apply (erule halloc.induct)
  1130 apply (erule halloc.induct)
  1131 apply  (auto elim!: halloc_elim_cases split del: split_if split_if_asm)
  1131 apply  (auto elim!: halloc_elim_cases split del: if_split if_split_asm)
  1132 apply (drule trans [THEN sym], erule sym) 
  1132 apply (drule trans [THEN sym], erule sym) 
  1133 defer
  1133 defer
  1134 apply (drule trans [THEN sym], erule sym)
  1134 apply (drule trans [THEN sym], erule sym)
  1135 apply auto
  1135 apply auto
  1136 done
  1136 done
  1144 
  1144 
  1145 lemma unique_sxalloc [rule_format (no_asm)]: 
  1145 lemma unique_sxalloc [rule_format (no_asm)]: 
  1146   "G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s' \<Longrightarrow> G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'' \<longrightarrow> s'' = s'"
  1146   "G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s' \<Longrightarrow> G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'' \<longrightarrow> s'' = s'"
  1147 apply (erule sxalloc.induct)
  1147 apply (erule sxalloc.induct)
  1148 apply   (auto dest: unique_halloc elim!: sxalloc_elim_cases 
  1148 apply   (auto dest: unique_halloc elim!: sxalloc_elim_cases 
  1149               split del: split_if split_if_asm)
  1149               split del: if_split if_split_asm)
  1150 done
  1150 done
  1151 
  1151 
  1152 lemma single_valued_sxalloc: "single_valued {(s,s'). G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'}"
  1152 lemma single_valued_sxalloc: "single_valued {(s,s'). G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s'}"
  1153 apply (unfold single_valued_def)
  1153 apply (unfold single_valued_def)
  1154 apply (blast dest: unique_sxalloc)
  1154 apply (blast dest: unique_sxalloc)
  1164 apply (erule eval_induct)
  1164 apply (erule eval_induct)
  1165 apply (tactic \<open>ALLGOALS (EVERY'
  1165 apply (tactic \<open>ALLGOALS (EVERY'
  1166       [strip_tac @{context}, rotate_tac ~1, eresolve_tac @{context} @{thms eval_elim_cases}])\<close>)
  1166       [strip_tac @{context}, rotate_tac ~1, eresolve_tac @{context} @{thms eval_elim_cases}])\<close>)
  1167 (* 31 subgoals *)
  1167 (* 31 subgoals *)
  1168 prefer 28 (* Try *) 
  1168 prefer 28 (* Try *) 
  1169 apply (simp (no_asm_use) only: split add: split_if_asm)
  1169 apply (simp (no_asm_use) only: split add: if_split_asm)
  1170 (* 34 subgoals *)
  1170 (* 34 subgoals *)
  1171 prefer 30 (* Init *)
  1171 prefer 30 (* Init *)
  1172 apply (case_tac "inited C (globs s0)", (simp only: if_True if_False simp_thms)+)
  1172 apply (case_tac "inited C (globs s0)", (simp only: if_True if_False simp_thms)+)
  1173 prefer 26 (* While *)
  1173 prefer 26 (* While *)
  1174 apply (simp (no_asm_use) only: split add: split_if_asm, blast)
  1174 apply (simp (no_asm_use) only: split add: if_split_asm, blast)
  1175 (* 36 subgoals *)
  1175 (* 36 subgoals *)
  1176 apply (blast dest: unique_sxalloc unique_halloc split_pairD)+
  1176 apply (blast dest: unique_sxalloc unique_halloc split_pairD)+
  1177 done
  1177 done
  1178 
  1178 
  1179 (* unused *)
  1179 (* unused *)