src/HOL/Bali/AxCompl.thy
author wenzelm
Mon Jan 28 18:50:23 2002 +0100 (2002-01-28)
changeset 12857 a4386cc9b1c3
parent 12854 00d4a435777f
child 12859 f63315dfffd4
permissions -rw-r--r--
tuned header;
wenzelm@12857
     1
(*  Title:      HOL/Bali/AxCompl.thy
schirmer@12854
     2
    ID:         $Id$
schirmer@12854
     3
    Author:     David von Oheimb
schirmer@12854
     4
    Copyright   1999 Technische Universitaet Muenchen
schirmer@12854
     5
*)
schirmer@12854
     6
schirmer@12854
     7
header {*
schirmer@12854
     8
Completeness proof for Axiomatic semantics of Java expressions and statements
schirmer@12854
     9
*}
schirmer@12854
    10
schirmer@12854
    11
theory AxCompl = AxSem:
schirmer@12854
    12
schirmer@12854
    13
text {*
schirmer@12854
    14
design issues:
schirmer@12854
    15
\begin{itemize}
schirmer@12854
    16
\item proof structured by Most General Formulas (-> Thomas Kleymann)
schirmer@12854
    17
\end{itemize}
schirmer@12854
    18
*}
schirmer@12854
    19
section "set of not yet initialzed classes"
schirmer@12854
    20
schirmer@12854
    21
constdefs
schirmer@12854
    22
schirmer@12854
    23
  nyinitcls :: "prog \<Rightarrow> state \<Rightarrow> qtname set"
schirmer@12854
    24
 "nyinitcls G s \<equiv> {C. is_class G C \<and> \<not> initd C s}"
schirmer@12854
    25
schirmer@12854
    26
lemma nyinitcls_subset_class: "nyinitcls G s \<subseteq> {C. is_class G C}"
schirmer@12854
    27
apply (unfold nyinitcls_def)
schirmer@12854
    28
apply fast
schirmer@12854
    29
done
schirmer@12854
    30
schirmer@12854
    31
lemmas finite_nyinitcls [simp] =
schirmer@12854
    32
   finite_is_class [THEN nyinitcls_subset_class [THEN finite_subset], standard]
schirmer@12854
    33
schirmer@12854
    34
lemma card_nyinitcls_bound: "card (nyinitcls G s) \<le> card {C. is_class G C}"
schirmer@12854
    35
apply (rule nyinitcls_subset_class [THEN finite_is_class [THEN card_mono]])
schirmer@12854
    36
done
schirmer@12854
    37
schirmer@12854
    38
lemma nyinitcls_set_locals_cong [simp]: 
schirmer@12854
    39
  "nyinitcls G (x,set_locals l s) = nyinitcls G (x,s)"
schirmer@12854
    40
apply (unfold nyinitcls_def)
schirmer@12854
    41
apply (simp (no_asm))
schirmer@12854
    42
done
schirmer@12854
    43
schirmer@12854
    44
lemma nyinitcls_abrupt_cong [simp]: "nyinitcls G (f x, y) = nyinitcls G (x, y)"
schirmer@12854
    45
apply (unfold nyinitcls_def)
schirmer@12854
    46
apply (simp (no_asm))
schirmer@12854
    47
done
schirmer@12854
    48
schirmer@12854
    49
lemma nyinitcls_abupd_cong [simp]:"!!s. nyinitcls G (abupd f s) = nyinitcls G s"
schirmer@12854
    50
apply (unfold nyinitcls_def)
schirmer@12854
    51
apply (simp (no_asm_simp) only: split_tupled_all)
schirmer@12854
    52
apply (simp (no_asm))
schirmer@12854
    53
done
schirmer@12854
    54
schirmer@12854
    55
lemma card_nyinitcls_abrupt_congE [elim!]: 
schirmer@12854
    56
        "card (nyinitcls G (x, s)) \<le> n \<Longrightarrow> card (nyinitcls G (y, s)) \<le> n"
schirmer@12854
    57
apply (unfold nyinitcls_def)
schirmer@12854
    58
apply auto
schirmer@12854
    59
done
schirmer@12854
    60
schirmer@12854
    61
lemma nyinitcls_new_xcpt_var [simp]: 
schirmer@12854
    62
"nyinitcls G (new_xcpt_var vn s) = nyinitcls G s"
schirmer@12854
    63
apply (unfold nyinitcls_def)
schirmer@12854
    64
apply (induct_tac "s")
schirmer@12854
    65
apply (simp (no_asm))
schirmer@12854
    66
done
schirmer@12854
    67
schirmer@12854
    68
lemma nyinitcls_init_lvars [simp]: 
schirmer@12854
    69
  "nyinitcls G ((init_lvars G C sig mode a' pvs) s) = nyinitcls G s"
schirmer@12854
    70
apply (induct_tac "s")
schirmer@12854
    71
apply (simp (no_asm) add: init_lvars_def2 split add: split_if)
schirmer@12854
    72
done
schirmer@12854
    73
schirmer@12854
    74
lemma nyinitcls_emptyD: "\<lbrakk>nyinitcls G s = {}; is_class G C\<rbrakk> \<Longrightarrow> initd C s"
schirmer@12854
    75
apply (unfold nyinitcls_def)
schirmer@12854
    76
apply fast
schirmer@12854
    77
done
schirmer@12854
    78
schirmer@12854
    79
lemma card_Suc_lemma: "\<lbrakk>card (insert a A) \<le> Suc n; a\<notin>A; finite A\<rbrakk> \<Longrightarrow> card A \<le> n"
schirmer@12854
    80
apply (rotate_tac 1)
schirmer@12854
    81
apply clarsimp
schirmer@12854
    82
done
schirmer@12854
    83
schirmer@12854
    84
lemma nyinitcls_le_SucD: 
schirmer@12854
    85
"\<lbrakk>card (nyinitcls G (x,s)) \<le> Suc n; \<not>inited C (globs s); class G C=Some y\<rbrakk> \<Longrightarrow> 
schirmer@12854
    86
  card (nyinitcls G (x,init_class_obj G C s)) \<le> n"
schirmer@12854
    87
apply (subgoal_tac 
schirmer@12854
    88
        "nyinitcls G (x,s) = insert C (nyinitcls G (x,init_class_obj G C s))")
schirmer@12854
    89
apply  clarsimp
schirmer@12854
    90
apply  (erule thin_rl)
schirmer@12854
    91
apply  (rule card_Suc_lemma [OF _ _ finite_nyinitcls])
schirmer@12854
    92
apply   (auto dest!: not_initedD elim!: 
schirmer@12854
    93
              simp add: nyinitcls_def inited_def split add: split_if_asm)
schirmer@12854
    94
done
schirmer@12854
    95
schirmer@12854
    96
ML {* bind_thm("inited_gext'",permute_prems 0 1 (thm "inited_gext")) *}
schirmer@12854
    97
schirmer@12854
    98
lemma nyinitcls_gext: "snd s\<le>|snd s' \<Longrightarrow> nyinitcls G s' \<subseteq> nyinitcls G s"
schirmer@12854
    99
apply (unfold nyinitcls_def)
schirmer@12854
   100
apply (force dest!: inited_gext')
schirmer@12854
   101
done
schirmer@12854
   102
schirmer@12854
   103
lemma card_nyinitcls_gext: 
schirmer@12854
   104
  "\<lbrakk>snd s\<le>|snd s'; card (nyinitcls G s) \<le> n\<rbrakk>\<Longrightarrow> card (nyinitcls G s') \<le> n"
schirmer@12854
   105
apply (rule le_trans)
schirmer@12854
   106
apply  (rule card_mono)
schirmer@12854
   107
apply   (rule finite_nyinitcls)
schirmer@12854
   108
apply  (erule nyinitcls_gext)
schirmer@12854
   109
apply assumption
schirmer@12854
   110
done
schirmer@12854
   111
schirmer@12854
   112
schirmer@12854
   113
section "init-le"
schirmer@12854
   114
schirmer@12854
   115
constdefs
schirmer@12854
   116
  init_le :: "prog \<Rightarrow> nat \<Rightarrow> state \<Rightarrow> bool"            ("_\<turnstile>init\<le>_"  [51,51] 50)
schirmer@12854
   117
 "G\<turnstile>init\<le>n \<equiv> \<lambda>s. card (nyinitcls G s) \<le> n"
schirmer@12854
   118
  
schirmer@12854
   119
lemma init_le_def2 [simp]: "(G\<turnstile>init\<le>n) s = (card (nyinitcls G s)\<le>n)"
schirmer@12854
   120
apply (unfold init_le_def)
schirmer@12854
   121
apply auto
schirmer@12854
   122
done
schirmer@12854
   123
schirmer@12854
   124
lemma All_init_leD: "\<forall>n::nat. G,A\<turnstile>{P \<and>. G\<turnstile>init\<le>n} t\<succ> {Q} \<Longrightarrow> G,A\<turnstile>{P} t\<succ> {Q}"
schirmer@12854
   125
apply (drule spec)
schirmer@12854
   126
apply (erule conseq1)
schirmer@12854
   127
apply clarsimp
schirmer@12854
   128
apply (rule card_nyinitcls_bound)
schirmer@12854
   129
done
schirmer@12854
   130
schirmer@12854
   131
section "Most General Triples and Formulas"
schirmer@12854
   132
schirmer@12854
   133
constdefs
schirmer@12854
   134
schirmer@12854
   135
  remember_init_state :: "state assn"                ("\<doteq>")
schirmer@12854
   136
  "\<doteq> \<equiv> \<lambda>Y s Z. s = Z"
schirmer@12854
   137
schirmer@12854
   138
lemma remember_init_state_def2 [simp]: "\<doteq> Y = op ="
schirmer@12854
   139
apply (unfold remember_init_state_def)
schirmer@12854
   140
apply (simp (no_asm))
schirmer@12854
   141
done
schirmer@12854
   142
schirmer@12854
   143
consts
schirmer@12854
   144
  
schirmer@12854
   145
  MGF ::"[state assn, term, prog] \<Rightarrow> state triple"   ("{_} _\<succ> {_\<rightarrow>}"[3,65,3]62)
schirmer@12854
   146
  MGFn::"[nat       , term, prog] \<Rightarrow> state triple" ("{=:_} _\<succ> {_\<rightarrow>}"[3,65,3]62)
schirmer@12854
   147
schirmer@12854
   148
defs
schirmer@12854
   149
  
schirmer@12854
   150
schirmer@12854
   151
  MGF_def:
schirmer@12854
   152
  "{P} t\<succ> {G\<rightarrow>} \<equiv> {P} t\<succ> {\<lambda>Y s' s. G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (Y,s')}"
schirmer@12854
   153
schirmer@12854
   154
  MGFn_def:
schirmer@12854
   155
  "{=:n} t\<succ> {G\<rightarrow>} \<equiv> {\<doteq> \<and>. G\<turnstile>init\<le>n} t\<succ> {G\<rightarrow>}"
schirmer@12854
   156
schirmer@12854
   157
(* unused *)
schirmer@12854
   158
lemma MGF_valid: "G,{}\<Turnstile>{\<doteq>} t\<succ> {G\<rightarrow>}"
schirmer@12854
   159
apply (unfold MGF_def)
schirmer@12854
   160
apply (force dest!: evaln_eval simp add: ax_valids_def triple_valid_def2)
schirmer@12854
   161
done
schirmer@12854
   162
schirmer@12854
   163
lemma MGF_res_eq_lemma [simp]: 
schirmer@12854
   164
  "(\<forall>Y' Y s. Y = Y' \<and> P s \<longrightarrow> Q s) = (\<forall>s. P s \<longrightarrow> Q s)"
schirmer@12854
   165
apply auto
schirmer@12854
   166
done
schirmer@12854
   167
schirmer@12854
   168
lemma MGFn_def2: 
schirmer@12854
   169
"G,A\<turnstile>{=:n} t\<succ> {G\<rightarrow>} = G,A\<turnstile>{\<doteq> \<and>. G\<turnstile>init\<le>n} 
schirmer@12854
   170
                    t\<succ> {\<lambda>Y s' s. G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (Y,s')}"
schirmer@12854
   171
apply (unfold MGFn_def MGF_def)
schirmer@12854
   172
apply fast
schirmer@12854
   173
done
schirmer@12854
   174
schirmer@12854
   175
lemma MGF_MGFn_iff: "G,A\<turnstile>{\<doteq>} t\<succ> {G\<rightarrow>} = (\<forall>n. G,A\<turnstile>{=:n} t\<succ> {G\<rightarrow>})"
schirmer@12854
   176
apply (simp (no_asm_use) add: MGFn_def2 MGF_def)
schirmer@12854
   177
apply safe
schirmer@12854
   178
apply  (erule_tac [2] All_init_leD)
schirmer@12854
   179
apply (erule conseq1)
schirmer@12854
   180
apply clarsimp
schirmer@12854
   181
done
schirmer@12854
   182
schirmer@12854
   183
lemma MGFnD: 
schirmer@12854
   184
"G,A\<turnstile>{=:n} t\<succ> {G\<rightarrow>} \<Longrightarrow>  
schirmer@12854
   185
 G,A\<turnstile>{(\<lambda>Y' s' s. s' = s           \<and> P s) \<and>. G\<turnstile>init\<le>n}  
schirmer@12854
   186
 t\<succ>  {(\<lambda>Y' s' s. G\<turnstile>s\<midarrow>t\<succ>\<rightarrow>(Y',s') \<and> P s) \<and>. G\<turnstile>init\<le>n}"
schirmer@12854
   187
apply (unfold init_le_def)
schirmer@12854
   188
apply (simp (no_asm_use) add: MGFn_def2)
schirmer@12854
   189
apply (erule conseq12)
schirmer@12854
   190
apply clarsimp
schirmer@12854
   191
apply (erule (1) eval_gext [THEN card_nyinitcls_gext])
schirmer@12854
   192
done
schirmer@12854
   193
lemmas MGFnD' = MGFnD [of _ _ _ _ "\<lambda>x. True"] 
schirmer@12854
   194
schirmer@12854
   195
lemma MGFNormalI: "G,A\<turnstile>{Normal \<doteq>} t\<succ> {G\<rightarrow>} \<Longrightarrow>  
schirmer@12854
   196
  G,(A::state triple set)\<turnstile>{\<doteq>::state assn} t\<succ> {G\<rightarrow>}"
schirmer@12854
   197
apply (unfold MGF_def)
schirmer@12854
   198
apply (rule ax_Normal_cases)
schirmer@12854
   199
apply  (erule conseq1)
schirmer@12854
   200
apply  clarsimp
schirmer@12854
   201
apply (rule ax_derivs.Abrupt [THEN conseq1])
schirmer@12854
   202
apply (clarsimp simp add: Let_def)
schirmer@12854
   203
done
schirmer@12854
   204
schirmer@12854
   205
lemma MGFNormalD: "G,A\<turnstile>{\<doteq>} t\<succ> {G\<rightarrow>} \<Longrightarrow> G,A\<turnstile>{Normal \<doteq>} t\<succ> {G\<rightarrow>}"
schirmer@12854
   206
apply (unfold MGF_def)
schirmer@12854
   207
apply (erule conseq1)
schirmer@12854
   208
apply clarsimp
schirmer@12854
   209
done
schirmer@12854
   210
schirmer@12854
   211
lemma MGFn_NormalI: 
schirmer@12854
   212
"G,(A::state triple set)\<turnstile>{Normal((\<lambda>Y' s' s. s'=s \<and> normal s) \<and>. G\<turnstile>init\<le>n)}t\<succ> 
schirmer@12854
   213
 {\<lambda>Y s' s. G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (Y,s')} \<Longrightarrow> G,A\<turnstile>{=:n}t\<succ>{G\<rightarrow>}"
schirmer@12854
   214
apply (simp (no_asm_use) add: MGFn_def2)
schirmer@12854
   215
apply (rule ax_Normal_cases)
schirmer@12854
   216
apply  (erule conseq1)
schirmer@12854
   217
apply  clarsimp
schirmer@12854
   218
apply (rule ax_derivs.Abrupt [THEN conseq1])
schirmer@12854
   219
apply (clarsimp simp add: Let_def)
schirmer@12854
   220
done
schirmer@12854
   221
schirmer@12854
   222
lemma MGFn_free_wt: 
schirmer@12854
   223
  "(\<exists>T L C. \<lparr>prg=G,cls=C,lcl=L\<rparr>\<turnstile>t\<Colon>T) 
schirmer@12854
   224
    \<longrightarrow> G,(A::state triple set)\<turnstile>{=:n} t\<succ> {G\<rightarrow>} 
schirmer@12854
   225
   \<Longrightarrow> G,A\<turnstile>{=:n} t\<succ> {G\<rightarrow>}"
schirmer@12854
   226
apply (rule MGFn_NormalI)
schirmer@12854
   227
apply (rule ax_free_wt)
schirmer@12854
   228
apply (auto elim: conseq12 simp add: MGFn_def MGF_def)
schirmer@12854
   229
done
schirmer@12854
   230
schirmer@12854
   231
schirmer@12854
   232
section "main lemmas"
schirmer@12854
   233
schirmer@12854
   234
declare fun_upd_apply [simp del]
schirmer@12854
   235
declare splitI2 [rule del] (*prevents ugly renaming of state variables*)
schirmer@12854
   236
schirmer@12854
   237
ML_setup {* 
schirmer@12854
   238
Delsimprocs [eval_expr_proc, eval_var_proc, eval_exprs_proc, eval_stmt_proc]
schirmer@12854
   239
*} (*prevents modifying rhs of MGF*)
schirmer@12854
   240
ML {*
schirmer@12854
   241
val eval_css = (claset() delrules [thm "eval.Abrupt"] addSIs (thms "eval.intros") 
schirmer@12854
   242
                delrules[thm "eval.Expr", thm "eval.Init", thm "eval.Try"] 
schirmer@12854
   243
                addIs   [thm "eval.Expr", thm "eval.Init"]
schirmer@12854
   244
                addSEs[thm "eval.Try"] delrules[equalityCE],
schirmer@12854
   245
                simpset() addsimps [split_paired_all,Let_def]
schirmer@12854
   246
 addsimprocs [eval_expr_proc,eval_var_proc,eval_exprs_proc,eval_stmt_proc]);
schirmer@12854
   247
val eval_Force_tac = force_tac eval_css;
schirmer@12854
   248
schirmer@12854
   249
val wt_prepare_tac = EVERY'[
schirmer@12854
   250
    rtac (thm "MGFn_free_wt"),
schirmer@12854
   251
    clarsimp_tac (claset() addSEs (thms "wt_elim_cases"), simpset())]
schirmer@12854
   252
val compl_prepare_tac = EVERY'[rtac (thm "MGFn_NormalI"), Simp_tac]
schirmer@12854
   253
val forw_hyp_tac = EVERY'[etac (thm "MGFnD'" RS thm "conseq12"), Clarsimp_tac]
schirmer@12854
   254
val forw_hyp_eval_Force_tac = 
schirmer@12854
   255
         EVERY'[TRY o rtac allI, forw_hyp_tac, eval_Force_tac]
schirmer@12854
   256
*}
schirmer@12854
   257
schirmer@12854
   258
lemma MGFn_Init: "\<forall>m. Suc m\<le>n \<longrightarrow> (\<forall>t. G,A\<turnstile>{=:m} t\<succ> {G\<rightarrow>}) \<Longrightarrow>  
schirmer@12854
   259
  G,(A::state triple set)\<turnstile>{=:n} In1r (Init C)\<succ> {G\<rightarrow>}"
schirmer@12854
   260
apply (tactic "wt_prepare_tac 1")
schirmer@12854
   261
(* requires is_class G C two times for nyinitcls *)
schirmer@12854
   262
apply (tactic "compl_prepare_tac 1")
schirmer@12854
   263
apply (rule_tac C = "initd C" in ax_cases)
schirmer@12854
   264
apply  (rule ax_derivs.Done [THEN conseq1])
schirmer@12854
   265
apply  (clarsimp intro!: init_done)
schirmer@12854
   266
apply (rule_tac y = n in nat.exhaust, clarsimp)
schirmer@12854
   267
apply  (rule ax_impossible [THEN conseq1])
schirmer@12854
   268
apply  (force dest!: nyinitcls_emptyD)
schirmer@12854
   269
apply clarsimp
schirmer@12854
   270
apply (drule_tac x = "nat" in spec)
schirmer@12854
   271
apply clarsimp
schirmer@12854
   272
apply (rule_tac Q = " (\<lambda>Y s' (x,s) . G\<turnstile> (x,init_class_obj G C s) \<midarrow> (if C=Object then Skip else Init (super (the (class G C))))\<rightarrow> s' \<and> x=None \<and> \<not>inited C (globs s)) \<and>. G\<turnstile>init\<le>nat" in ax_derivs.Init)
schirmer@12854
   273
apply   simp
schirmer@12854
   274
apply  (rule_tac P' = "Normal ((\<lambda>Y s' s. s' = supd (init_class_obj G C) s \<and> normal s \<and> \<not> initd C s) \<and>. G\<turnstile>init\<le>nat) " in conseq1)
schirmer@12854
   275
prefer 2
schirmer@12854
   276
apply   (force elim!: nyinitcls_le_SucD)
schirmer@12854
   277
apply  (simp split add: split_if, rule conjI, clarify)
schirmer@12854
   278
apply   (rule ax_derivs.Skip [THEN conseq1], tactic "eval_Force_tac 1")
schirmer@12854
   279
apply  clarify
schirmer@12854
   280
apply  (drule spec)
schirmer@12854
   281
apply  (erule MGFnD' [THEN conseq12])
schirmer@12854
   282
apply  (tactic "force_tac (claset(), simpset() addsimprocs[eval_stmt_proc]) 1")
schirmer@12854
   283
apply (rule allI)
schirmer@12854
   284
apply (drule spec)
schirmer@12854
   285
apply (erule MGFnD' [THEN conseq12])
schirmer@12854
   286
apply clarsimp
schirmer@12854
   287
apply (tactic {* pair_tac "sa" 1 *})
schirmer@12854
   288
apply (tactic"clarsimp_tac (claset(), simpset() addsimprocs[eval_stmt_proc]) 1")
schirmer@12854
   289
apply (rule eval_Init, force+)
schirmer@12854
   290
done
schirmer@12854
   291
lemmas MGFn_InitD = MGFn_Init [THEN MGFnD, THEN ax_NormalD]
schirmer@12854
   292
schirmer@12854
   293
lemma MGFn_Call: 
schirmer@12854
   294
"\<lbrakk>\<forall>C sig. G,(A::state triple set)\<turnstile>{=:n} In1l (Methd C sig)\<succ> {G\<rightarrow>};  
schirmer@12854
   295
  G,A\<turnstile>{=:n} In1l e\<succ> {G\<rightarrow>}; G,A\<turnstile>{=:n} In3 ps\<succ> {G\<rightarrow>}\<rbrakk> \<Longrightarrow>  
schirmer@12854
   296
  G,A\<turnstile>{=:n} In1l ({statT,mode}e\<cdot>mn({pTs'}ps))\<succ> {G\<rightarrow>}"
schirmer@12854
   297
apply (tactic "wt_prepare_tac 1") (* required for equating mode = invmode m e *)
schirmer@12854
   298
apply (tactic "compl_prepare_tac 1")
schirmer@12854
   299
apply (rule_tac R = "\<lambda>a'. (\<lambda>Y (x2,s2) (x,s) . x = None \<and> (\<exists>s1 pvs. G\<turnstile>Norm s \<midarrow>e-\<succ>a'\<rightarrow> s1 \<and> Y = In3 pvs \<and> G\<turnstile>s1 \<midarrow>ps\<doteq>\<succ>pvs\<rightarrow> (x2,s2))) \<and>. G\<turnstile>init\<le>n" in ax_derivs.Call)
schirmer@12854
   300
apply  (erule MGFnD [THEN ax_NormalD])
schirmer@12854
   301
apply safe
schirmer@12854
   302
apply  (erule_tac V = "All ?P" in thin_rl, tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   303
apply (drule spec, drule spec)
schirmer@12854
   304
apply (erule MGFnD' [THEN conseq12])
schirmer@12854
   305
apply (tactic "clarsimp_tac eval_css 1")
schirmer@12854
   306
apply (erule (1) eval_Call)
schirmer@12854
   307
apply   (rule HOL.refl)
schirmer@12854
   308
apply  (simp (no_asm_simp))+
schirmer@12854
   309
done
schirmer@12854
   310
schirmer@12854
   311
lemma MGF_altern: "G,A\<turnstile>{Normal (\<doteq> \<and>. p)} t\<succ> {G\<rightarrow>} =  
schirmer@12854
   312
 G,A\<turnstile>{Normal ((\<lambda>Y s Z. \<forall>w s'. G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (w,s') \<longrightarrow> (w,s') = Z) \<and>. p)} 
schirmer@12854
   313
  t\<succ> {\<lambda>Y s Z. (Y,s) = Z}"
schirmer@12854
   314
apply (unfold MGF_def)
schirmer@12854
   315
apply (auto del: conjI elim!: conseq12)
schirmer@12854
   316
apply (case_tac "\<exists>w s. G\<turnstile>Norm sa \<midarrow>t\<succ>\<rightarrow> (w,s) ")
schirmer@12854
   317
apply  (fast dest: unique_eval)
schirmer@12854
   318
apply clarsimp
schirmer@12854
   319
apply (erule thin_rl)
schirmer@12854
   320
apply (erule thin_rl)
schirmer@12854
   321
apply (drule split_paired_All [THEN subst])
schirmer@12854
   322
apply (clarsimp elim!: state_not_single)
schirmer@12854
   323
done
schirmer@12854
   324
schirmer@12854
   325
schirmer@12854
   326
lemma MGFn_Loop: 
schirmer@12854
   327
"\<lbrakk>G,(A::state triple set)\<turnstile>{=:n} In1l expr\<succ> {G\<rightarrow>};G,A\<turnstile>{=:n} In1r stmnt\<succ> {G\<rightarrow>} \<rbrakk> 
schirmer@12854
   328
\<Longrightarrow> 
schirmer@12854
   329
  G,A\<turnstile>{=:n} In1r (l\<bullet> While(expr) stmnt)\<succ> {G\<rightarrow>}"
schirmer@12854
   330
apply (rule MGFn_NormalI, simp)
schirmer@12854
   331
apply (rule_tac p2 = "\<lambda>s. card (nyinitcls G s) \<le> n" in 
schirmer@12854
   332
          MGF_altern [unfolded MGF_def, THEN iffD2, THEN conseq1])
schirmer@12854
   333
prefer 2
schirmer@12854
   334
apply  clarsimp
schirmer@12854
   335
apply (rule_tac P' = 
schirmer@12854
   336
"((\<lambda>Y s Z. \<forall>w s'. G\<turnstile>s \<midarrow>In1r (l\<bullet>  While(expr) stmnt) \<succ>\<rightarrow> (w,s') \<longrightarrow> (w,s') = Z) 
schirmer@12854
   337
  \<and>. (\<lambda>s. card (nyinitcls G s) \<le> n))" in conseq12)
schirmer@12854
   338
prefer 2
schirmer@12854
   339
apply  clarsimp
schirmer@12854
   340
apply  (tactic "smp_tac 1 1", erule_tac V = "All ?P" in thin_rl)
schirmer@12854
   341
apply  (rule_tac [2] P' = " (\<lambda>b s (Y',s') . (\<exists>s0. G\<turnstile>s0 \<midarrow>In1l expr\<succ>\<rightarrow> (b,s)) \<and> (if normal s \<and> the_Bool (the_In1 b) then (\<forall>s'' w s0. G\<turnstile>s \<midarrow>stmnt\<rightarrow> s'' \<and> G\<turnstile>(abupd (absorb (Cont l)) s'') \<midarrow>In1r (l\<bullet> While(expr) stmnt) \<succ>\<rightarrow> (w,s0) \<longrightarrow> (w,s0) = (Y',s')) else (\<diamondsuit>,s) = (Y',s'))) \<and>. G\<turnstile>init\<le>n" in polymorphic_Loop)
schirmer@12854
   342
apply   (force dest!: eval.Loop split add: split_if_asm)
schirmer@12854
   343
prefer 2
schirmer@12854
   344
apply  (erule MGFnD' [THEN conseq12])
schirmer@12854
   345
apply  clarsimp
schirmer@12854
   346
apply  (erule_tac V = "card (nyinitcls G s') \<le> n" in thin_rl)
schirmer@12854
   347
apply  (tactic "eval_Force_tac 1")
schirmer@12854
   348
apply (erule MGFnD' [THEN conseq12] , clarsimp)
schirmer@12854
   349
apply (rule conjI, erule exI)
schirmer@12854
   350
apply (tactic "clarsimp_tac eval_css 1")
schirmer@12854
   351
apply (case_tac "a")
schirmer@12854
   352
prefer 2
schirmer@12854
   353
apply  (clarsimp)
schirmer@12854
   354
apply (clarsimp split add: split_if)
schirmer@12854
   355
apply (rule conjI, (tactic {* force_tac (claset() addSDs [thm "eval.Loop"],
schirmer@12854
   356
  simpset() addsimps [split_paired_all] addsimprocs [eval_stmt_proc]) 1*})+)
schirmer@12854
   357
done
schirmer@12854
   358
schirmer@12854
   359
lemma MGFn_lemma [rule_format (no_asm)]: 
schirmer@12854
   360
 "\<forall>n C sig. G,(A::state triple set)\<turnstile>{=:n} In1l (Methd C sig)\<succ> {G\<rightarrow>} \<Longrightarrow>  
schirmer@12854
   361
  \<forall>t. G,A\<turnstile>{=:n} t\<succ> {G\<rightarrow>}"
schirmer@12854
   362
apply (rule full_nat_induct)
schirmer@12854
   363
apply (rule allI)
schirmer@12854
   364
apply (drule_tac x = n in spec)
schirmer@12854
   365
apply (drule_tac psi = "All ?P" in asm_rl)
schirmer@12854
   366
apply (subgoal_tac "\<forall>v e c es. G,A\<turnstile>{=:n} In2 v\<succ> {G\<rightarrow>} \<and> G,A\<turnstile>{=:n} In1l e\<succ> {G\<rightarrow>} \<and> G,A\<turnstile>{=:n} In1r c\<succ> {G\<rightarrow>} \<and> G,A\<turnstile>{=:n} In3 es\<succ> {G\<rightarrow>}")
schirmer@12854
   367
apply  (tactic "Clarify_tac 2")
schirmer@12854
   368
apply  (induct_tac "t")
schirmer@12854
   369
apply    (induct_tac "a")
schirmer@12854
   370
apply     fast+
schirmer@12854
   371
apply (rule var_expr_stmt.induct)
schirmer@12854
   372
(* 28 subgoals *)
schirmer@12854
   373
prefer 14 apply fast (* Methd *)
schirmer@12854
   374
prefer 13 apply (erule (2) MGFn_Call)
schirmer@12854
   375
apply (erule_tac [!] V = "All ?P" in thin_rl) (* assumptions on Methd *)
schirmer@12854
   376
apply (erule_tac [24] MGFn_Init)
schirmer@12854
   377
prefer 19 apply (erule (1) MGFn_Loop)
schirmer@12854
   378
apply (tactic "ALLGOALS compl_prepare_tac")
schirmer@12854
   379
schirmer@12854
   380
apply (rule ax_derivs.LVar [THEN conseq1], tactic "eval_Force_tac 1")
schirmer@12854
   381
schirmer@12854
   382
apply (rule ax_derivs.FVar)
schirmer@12854
   383
apply  (erule MGFn_InitD)
schirmer@12854
   384
apply (tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   385
schirmer@12854
   386
apply (rule ax_derivs.AVar)
schirmer@12854
   387
apply  (erule MGFnD [THEN ax_NormalD])
schirmer@12854
   388
apply (tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   389
schirmer@12854
   390
apply (rule ax_derivs.NewC)
schirmer@12854
   391
apply (erule MGFn_InitD [THEN conseq2])
schirmer@12854
   392
apply (tactic "eval_Force_tac 1")
schirmer@12854
   393
schirmer@12854
   394
apply (rule_tac Q = "(\<lambda>Y' s' s. normal s \<and> G\<turnstile>s \<midarrow>In1r (init_comp_ty ty) \<succ>\<rightarrow> (Y',s')) \<and>. G\<turnstile>init\<le>n" in ax_derivs.NewA)
schirmer@12854
   395
apply  (simp add: init_comp_ty_def split add: split_if)
schirmer@12854
   396
apply   (rule conjI, clarsimp)
schirmer@12854
   397
apply   (erule MGFn_InitD [THEN conseq2])
schirmer@12854
   398
apply   (tactic "clarsimp_tac eval_css 1")
schirmer@12854
   399
apply  clarsimp
schirmer@12854
   400
apply  (rule ax_derivs.Skip [THEN conseq1], tactic "eval_Force_tac 1")
schirmer@12854
   401
apply (tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   402
schirmer@12854
   403
apply (erule MGFnD'[THEN conseq12,THEN ax_derivs.Cast],tactic"eval_Force_tac 1")
schirmer@12854
   404
schirmer@12854
   405
apply (erule MGFnD'[THEN conseq12,THEN ax_derivs.Inst],tactic"eval_Force_tac 1")
schirmer@12854
   406
apply (rule ax_derivs.Lit [THEN conseq1], tactic "eval_Force_tac 1")
schirmer@12854
   407
apply (rule ax_derivs.Super [THEN conseq1], tactic "eval_Force_tac 1")
schirmer@12854
   408
apply (erule MGFnD'[THEN conseq12,THEN ax_derivs.Acc],tactic"eval_Force_tac 1")
schirmer@12854
   409
schirmer@12854
   410
apply (rule ax_derivs.Ass)
schirmer@12854
   411
apply  (erule MGFnD [THEN ax_NormalD])
schirmer@12854
   412
apply (tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   413
schirmer@12854
   414
apply (rule ax_derivs.Cond)
schirmer@12854
   415
apply  (erule MGFnD [THEN ax_NormalD])
schirmer@12854
   416
apply (rule allI)
schirmer@12854
   417
apply (rule ax_Normal_cases)
schirmer@12854
   418
prefer 2
schirmer@12854
   419
apply  (rule ax_derivs.Abrupt [THEN conseq1], clarsimp simp add: Let_def)
schirmer@12854
   420
apply  (tactic "eval_Force_tac 1")
schirmer@12854
   421
apply (case_tac "b")
schirmer@12854
   422
apply  (simp, tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   423
apply (simp, tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   424
schirmer@12854
   425
apply (rule_tac Q = " (\<lambda>Y' s' s. normal s \<and> G\<turnstile>s \<midarrow>Init pid_field_type\<rightarrow> s') \<and>. G\<turnstile>init\<le>n" in ax_derivs.Body)
schirmer@12854
   426
 apply (erule MGFn_InitD [THEN conseq2])
schirmer@12854
   427
 apply (tactic "eval_Force_tac 1")
schirmer@12854
   428
apply (tactic "forw_hyp_tac 1")
schirmer@12854
   429
apply (tactic {* clarsimp_tac (eval_css delsimps2 [split_paired_all]) 1 *})
schirmer@12854
   430
apply (erule (1) eval.Body)
schirmer@12854
   431
schirmer@12854
   432
apply (rule ax_derivs.Skip [THEN conseq1], tactic "eval_Force_tac 1")
schirmer@12854
   433
schirmer@12854
   434
apply (erule MGFnD'[THEN conseq12,THEN ax_derivs.Expr],tactic"eval_Force_tac 1")
schirmer@12854
   435
schirmer@12854
   436
apply (erule MGFnD' [THEN conseq12, THEN ax_derivs.Lab])
schirmer@12854
   437
apply (tactic "clarsimp_tac eval_css 1")
schirmer@12854
   438
schirmer@12854
   439
apply (rule ax_derivs.Comp)
schirmer@12854
   440
apply  (erule MGFnD [THEN ax_NormalD])
schirmer@12854
   441
apply (tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   442
schirmer@12854
   443
apply (rule ax_derivs.If)
schirmer@12854
   444
apply  (erule MGFnD [THEN ax_NormalD])
schirmer@12854
   445
apply (rule allI)
schirmer@12854
   446
apply (rule ax_Normal_cases)
schirmer@12854
   447
prefer 2
schirmer@12854
   448
apply  (rule ax_derivs.Abrupt [THEN conseq1], clarsimp simp add: Let_def)
schirmer@12854
   449
apply  (tactic "eval_Force_tac 1")
schirmer@12854
   450
apply (case_tac "b")
schirmer@12854
   451
apply  (simp, tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   452
apply (simp, tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   453
schirmer@12854
   454
apply (rule ax_derivs.Do [THEN conseq1])
schirmer@12854
   455
apply (tactic {* force_tac (eval_css addsimps2 [thm "abupd_def2"]) 1 *})
schirmer@12854
   456
schirmer@12854
   457
apply (erule MGFnD' [THEN conseq12, THEN ax_derivs.Throw])
schirmer@12854
   458
apply (tactic "clarsimp_tac eval_css 1")
schirmer@12854
   459
schirmer@12854
   460
apply (rule_tac Q = " (\<lambda>Y' s' s. normal s \<and> (\<exists>s''. G\<turnstile>s \<midarrow>In1r stmt1\<succ>\<rightarrow> (Y',s'') \<and> G\<turnstile>s'' \<midarrow>sxalloc\<rightarrow> s')) \<and>. G\<turnstile>init\<le>n" in ax_derivs.Try)
schirmer@12854
   461
apply   (tactic "eval_Force_tac 3")
schirmer@12854
   462
apply  (tactic "forw_hyp_eval_Force_tac 2")
schirmer@12854
   463
apply (erule MGFnD [THEN ax_NormalD, THEN conseq2])
schirmer@12854
   464
apply (tactic "clarsimp_tac eval_css 1")
schirmer@12854
   465
apply (force elim: sxalloc_gext [THEN card_nyinitcls_gext])
schirmer@12854
   466
schirmer@12854
   467
apply (rule_tac Q = " (\<lambda>Y' s' s. normal s \<and> G\<turnstile>s \<midarrow>stmt1\<rightarrow> s') \<and>. G\<turnstile>init\<le>n" in ax_derivs.Fin)
schirmer@12854
   468
apply  (tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   469
apply (rule allI)
schirmer@12854
   470
apply (tactic "forw_hyp_tac 1")
schirmer@12854
   471
apply (tactic {* pair_tac "sb" 1 *})
schirmer@12854
   472
apply (tactic"clarsimp_tac (claset(),simpset() addsimprocs [eval_stmt_proc]) 1")
schirmer@12854
   473
apply (drule (1) eval.Fin)
schirmer@12854
   474
apply clarsimp
schirmer@12854
   475
schirmer@12854
   476
apply (rule ax_derivs.Nil [THEN conseq1], tactic "eval_Force_tac 1")
schirmer@12854
   477
schirmer@12854
   478
apply (rule ax_derivs.Cons)
schirmer@12854
   479
apply  (erule MGFnD [THEN ax_NormalD])
schirmer@12854
   480
apply (tactic "forw_hyp_eval_Force_tac 1")
schirmer@12854
   481
done
schirmer@12854
   482
schirmer@12854
   483
lemma MGF_asm: "\<forall>C sig. is_methd G C sig \<longrightarrow> G,A\<turnstile>{\<doteq>} In1l (Methd C sig)\<succ> {G\<rightarrow>} \<Longrightarrow>
schirmer@12854
   484
  G,(A::state triple set)\<turnstile>{\<doteq>} t\<succ> {G\<rightarrow>}"
schirmer@12854
   485
apply (simp (no_asm_use) add: MGF_MGFn_iff)
schirmer@12854
   486
apply (rule allI)
schirmer@12854
   487
apply (rule MGFn_lemma)
schirmer@12854
   488
apply (intro strip)
schirmer@12854
   489
apply (rule MGFn_free_wt)
schirmer@12854
   490
apply (force dest: wt_Methd_is_methd)
schirmer@12854
   491
done
schirmer@12854
   492
schirmer@12854
   493
declare splitI2 [intro!]
schirmer@12854
   494
ML_setup {*
schirmer@12854
   495
Addsimprocs [ eval_expr_proc, eval_var_proc, eval_exprs_proc, eval_stmt_proc]
schirmer@12854
   496
*}
schirmer@12854
   497
schirmer@12854
   498
schirmer@12854
   499
section "nested version"
schirmer@12854
   500
schirmer@12854
   501
lemma nesting_lemma' [rule_format (no_asm)]: "[| !!A ts. ts <= A ==> P A ts; 
schirmer@12854
   502
  !!A pn. !b:bdy pn. P (insert (mgf_call pn) A) {mgf b} ==> P A {mgf_call pn}; 
schirmer@12854
   503
  !!A t. !pn:U. P A {mgf_call pn} ==> P A {mgf t};  
schirmer@12854
   504
          finite U; uA = mgf_call`U |] ==>  
schirmer@12854
   505
  !A. A <= uA --> n <= card uA --> card A = card uA - n --> (!t. P A {mgf t})"
schirmer@12854
   506
proof -
schirmer@12854
   507
  assume ax_derivs_asm:    "!!A ts. ts <= A ==> P A ts"
schirmer@12854
   508
  assume MGF_nested_Methd: "!!A pn. !b:bdy pn. P (insert (mgf_call pn) A) 
schirmer@12854
   509
                                                  {mgf b} ==> P A {mgf_call pn}"
schirmer@12854
   510
  assume MGF_asm:          "!!A t. !pn:U. P A {mgf_call pn} ==> P A {mgf t}"
schirmer@12854
   511
  assume "finite U" "uA = mgf_call`U"
schirmer@12854
   512
  then show ?thesis
schirmer@12854
   513
    apply -
schirmer@12854
   514
    apply (induct_tac "n")
schirmer@12854
   515
    apply  (tactic "ALLGOALS Clarsimp_tac")
schirmer@12854
   516
    apply  (tactic "dtac (permute_prems 0 1 card_seteq) 1")
schirmer@12854
   517
    apply    simp
schirmer@12854
   518
    apply   (erule finite_imageI)
schirmer@12854
   519
    apply  (simp add: MGF_asm ax_derivs_asm)
schirmer@12854
   520
    apply (rule MGF_asm)
schirmer@12854
   521
    apply (rule ballI)
schirmer@12854
   522
    apply (case_tac "mgf_call pn : A")
schirmer@12854
   523
    apply  (fast intro: ax_derivs_asm)
schirmer@12854
   524
    apply (rule MGF_nested_Methd)
schirmer@12854
   525
    apply (rule ballI)
schirmer@12854
   526
    apply (drule spec, erule impE, erule_tac [2] impE, erule_tac [3] impE, 
schirmer@12854
   527
           erule_tac [4] spec)
schirmer@12854
   528
    apply   fast
schirmer@12854
   529
    apply  (erule Suc_leD)
schirmer@12854
   530
    apply (drule finite_subset)
schirmer@12854
   531
    apply (erule finite_imageI)
schirmer@12854
   532
    apply auto
schirmer@12854
   533
    apply arith
schirmer@12854
   534
  done
schirmer@12854
   535
qed
schirmer@12854
   536
schirmer@12854
   537
lemma nesting_lemma [rule_format (no_asm)]: "[| !!A ts. ts <= A ==> P A ts; 
schirmer@12854
   538
  !!A pn. !b:bdy pn. P (insert (mgf (f pn)) A) {mgf b} ==> P A {mgf (f pn)}; 
schirmer@12854
   539
          !!A t. !pn:U. P A {mgf (f pn)} ==> P A {mgf t}; 
schirmer@12854
   540
          finite U |] ==> P {} {mgf t}"
schirmer@12854
   541
proof -
schirmer@12854
   542
  assume 2: "!!A pn. !b:bdy pn. P (insert (mgf (f pn)) A) {mgf b} ==> P A {mgf (f pn)}"
schirmer@12854
   543
  assume 3: "!!A t. !pn:U. P A {mgf (f pn)} ==> P A {mgf t}"
schirmer@12854
   544
  assume "!!A ts. ts <= A ==> P A ts" "finite U"
schirmer@12854
   545
  then show ?thesis
schirmer@12854
   546
    apply -
schirmer@12854
   547
    apply (rule_tac mgf = "mgf" in nesting_lemma')
schirmer@12854
   548
    apply (erule_tac [2] 2)
schirmer@12854
   549
    apply (rule_tac [2] 3)
schirmer@12854
   550
    apply (rule_tac [6] le_refl)
schirmer@12854
   551
    apply auto
schirmer@12854
   552
  done
schirmer@12854
   553
qed
schirmer@12854
   554
schirmer@12854
   555
lemma MGF_nested_Methd: "\<lbrakk>  
schirmer@12854
   556
  G,insert ({Normal \<doteq>} In1l (Methd  C sig) \<succ>{G\<rightarrow>}) A\<turnstile>  
schirmer@12854
   557
            {Normal \<doteq>} In1l (body G C sig) \<succ>{G\<rightarrow>}  
schirmer@12854
   558
 \<rbrakk> \<Longrightarrow>  G,A\<turnstile>{Normal \<doteq>} In1l (Methd  C sig) \<succ>{G\<rightarrow>}"
schirmer@12854
   559
apply (unfold MGF_def)
schirmer@12854
   560
apply (rule ax_MethdN)
schirmer@12854
   561
apply (erule conseq2)
schirmer@12854
   562
apply clarsimp
schirmer@12854
   563
apply (erule MethdI)
schirmer@12854
   564
done
schirmer@12854
   565
schirmer@12854
   566
lemma MGF_deriv: "ws_prog G \<Longrightarrow> G,({}::state triple set)\<turnstile>{\<doteq>} t\<succ> {G\<rightarrow>}"
schirmer@12854
   567
apply (rule MGFNormalI)
schirmer@12854
   568
apply (rule_tac mgf = "\<lambda>t. {Normal \<doteq>} t\<succ> {G\<rightarrow>}" and 
schirmer@12854
   569
                bdy = "\<lambda> (C,sig) .{In1l (body G C sig) }" and 
schirmer@12854
   570
                f = "\<lambda> (C,sig) . In1l (Methd C sig) " in nesting_lemma)
schirmer@12854
   571
apply    (erule ax_derivs.asm)
schirmer@12854
   572
apply   (clarsimp simp add: split_tupled_all)
schirmer@12854
   573
apply   (erule MGF_nested_Methd)
schirmer@12854
   574
apply  (erule_tac [2] finite_is_methd)
schirmer@12854
   575
apply (rule MGF_asm [THEN MGFNormalD])
schirmer@12854
   576
apply clarify
schirmer@12854
   577
apply (rule MGFNormalI)
schirmer@12854
   578
apply force
schirmer@12854
   579
done
schirmer@12854
   580
schirmer@12854
   581
schirmer@12854
   582
section "simultaneous version"
schirmer@12854
   583
schirmer@12854
   584
lemma MGF_simult_Methd_lemma: "finite ms \<Longrightarrow>  
schirmer@12854
   585
  G,A\<union> (\<lambda>(C,sig). {Normal \<doteq>} In1l (Methd  C sig)\<succ> {G\<rightarrow>}) ` ms  
schirmer@12854
   586
     |\<turnstile>(\<lambda>(C,sig). {Normal \<doteq>} In1l (body G C sig)\<succ> {G\<rightarrow>}) ` ms \<Longrightarrow>  
schirmer@12854
   587
  G,A|\<turnstile>(\<lambda>(C,sig). {Normal \<doteq>} In1l (Methd  C sig)\<succ> {G\<rightarrow>}) ` ms"
schirmer@12854
   588
apply (unfold MGF_def)
schirmer@12854
   589
apply (rule ax_derivs.Methd [unfolded mtriples_def])
schirmer@12854
   590
apply (erule ax_finite_pointwise)
schirmer@12854
   591
prefer 2
schirmer@12854
   592
apply  (rule ax_derivs.asm)
schirmer@12854
   593
apply  fast
schirmer@12854
   594
apply clarsimp
schirmer@12854
   595
apply (rule conseq2)
schirmer@12854
   596
apply  (erule (1) ax_methods_spec)
schirmer@12854
   597
apply clarsimp
schirmer@12854
   598
apply (erule eval_Methd)
schirmer@12854
   599
done
schirmer@12854
   600
schirmer@12854
   601
lemma MGF_simult_Methd: "ws_prog G \<Longrightarrow> 
schirmer@12854
   602
   G,({}::state triple set)|\<turnstile>(\<lambda>(C,sig). {Normal \<doteq>} In1l (Methd C sig)\<succ> {G\<rightarrow>}) 
schirmer@12854
   603
   ` Collect (split (is_methd G)) "
schirmer@12854
   604
apply (frule finite_is_methd)
schirmer@12854
   605
apply (rule MGF_simult_Methd_lemma)
schirmer@12854
   606
apply  assumption
schirmer@12854
   607
apply (erule ax_finite_pointwise)
schirmer@12854
   608
prefer 2
schirmer@12854
   609
apply  (rule ax_derivs.asm)
schirmer@12854
   610
apply  blast
schirmer@12854
   611
apply clarsimp
schirmer@12854
   612
apply (rule MGF_asm [THEN MGFNormalD])
schirmer@12854
   613
apply clarify
schirmer@12854
   614
apply (rule MGFNormalI)
schirmer@12854
   615
apply force
schirmer@12854
   616
done
schirmer@12854
   617
schirmer@12854
   618
lemma MGF_deriv: "ws_prog G \<Longrightarrow> G,({}::state triple set)\<turnstile>{\<doteq>} t\<succ> {G\<rightarrow>}"
schirmer@12854
   619
apply (rule MGF_asm)
schirmer@12854
   620
apply (intro strip)
schirmer@12854
   621
apply (rule MGFNormalI)
schirmer@12854
   622
apply (rule ax_derivs.weaken)
schirmer@12854
   623
apply  (erule MGF_simult_Methd)
schirmer@12854
   624
apply force
schirmer@12854
   625
done
schirmer@12854
   626
schirmer@12854
   627
schirmer@12854
   628
section "corollaries"
schirmer@12854
   629
schirmer@12854
   630
lemma MGF_complete: "G,{}\<Turnstile>{P} t\<succ> {Q} \<Longrightarrow> G,({}::state triple set)\<turnstile>{\<doteq>} t\<succ> {G\<rightarrow>} \<Longrightarrow>
schirmer@12854
   631
  G,({}::state triple set)\<turnstile>{P::state assn} t\<succ> {Q}"
schirmer@12854
   632
apply (rule ax_no_hazard)
schirmer@12854
   633
apply (unfold MGF_def)
schirmer@12854
   634
apply (erule conseq12)
schirmer@12854
   635
apply (simp (no_asm_use) add: ax_valids_def triple_valid_def)
schirmer@12854
   636
apply (fast dest!: eval_evaln)
schirmer@12854
   637
done
schirmer@12854
   638
schirmer@12854
   639
theorem ax_complete: "ws_prog G \<Longrightarrow>  
schirmer@12854
   640
  G,{}\<Turnstile>{P::state assn} t\<succ> {Q} \<Longrightarrow> G,({}::state triple set)\<turnstile>{P} t\<succ> {Q}"
schirmer@12854
   641
apply (erule MGF_complete)
schirmer@12854
   642
apply (erule MGF_deriv)
schirmer@12854
   643
done
schirmer@12854
   644
schirmer@12854
   645
end