src/HOL/NanoJava/Equivalence.thy
author wenzelm
Mon, 23 Mar 2015 13:30:59 +0100
changeset 59780 23b67731f4f0
parent 59763 56d2c357e6b5
child 59807 22bc39064290
permissions -rw-r--r--
support 'for' fixes in rule_tac etc.;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
     1
(*  Title:      HOL/NanoJava/Equivalence.thy
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
     2
    Author:     David von Oheimb
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
     3
    Copyright   2001 Technische Universitaet Muenchen
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
     4
*)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
     5
58889
5b7a9633cfa8 modernized header uniformly as section;
wenzelm
parents: 58262
diff changeset
     6
section "Equivalence of Operational and Axiomatic Semantics"
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
     7
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 14565
diff changeset
     8
theory Equivalence imports OpSem AxSem begin
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
     9
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    10
subsection "Validity"
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    11
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
    12
definition valid :: "[assn,stmt, assn] => bool" ("|= {(1_)}/ (_)/ {(1_)}" [3,90,3] 60) where
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    13
 "|=  {P} c {Q} \<equiv> \<forall>s   t. P s --> (\<exists>n. s -c  -n\<rightarrow> t) --> Q   t"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    14
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
    15
definition evalid   :: "[assn,expr,vassn] => bool" ("|=e {(1_)}/ (_)/ {(1_)}" [3,90,3] 60) where
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    16
 "|=e {P} e {Q} \<equiv> \<forall>s v t. P s --> (\<exists>n. s -e\<succ>v-n\<rightarrow> t) --> Q v t"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    17
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
    18
definition nvalid   :: "[nat, triple    ] => bool" ("|=_: _"  [61,61] 60) where
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    19
 "|=n:  t \<equiv> let (P,c,Q) = t in \<forall>s   t. s -c  -n\<rightarrow> t --> P s --> Q   t"
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    20
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
    21
definition envalid   :: "[nat,etriple    ] => bool" ("|=_:e _" [61,61] 60) where
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
    22
 "|=n:e t \<equiv> let (P,e,Q) = t in \<forall>s v t. s -e\<succ>v-n\<rightarrow> t --> P s --> Q v t"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    23
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
    24
definition nvalids :: "[nat,       triple set] => bool" ("||=_: _" [61,61] 60) where
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    25
 "||=n: T \<equiv> \<forall>t\<in>T. |=n: t"
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    26
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
    27
definition cnvalids :: "[triple set,triple set] => bool" ("_ ||=/ _"  [61,61] 60) where
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    28
 "A ||=  C \<equiv> \<forall>n. ||=n: A --> ||=n: C"
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    29
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
    30
definition cenvalid  :: "[triple set,etriple   ] => bool" ("_ ||=e/ _" [61,61] 60) where
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    31
 "A ||=e t \<equiv> \<forall>n. ||=n: A --> |=n:e t"
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    32
35355
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    33
notation (xsymbols)
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    34
  valid  ("\<Turnstile> {(1_)}/ (_)/ {(1_)}" [3,90,3] 60) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    35
  evalid  ("\<Turnstile>\<^sub>e {(1_)}/ (_)/ {(1_)}" [3,90,3] 60) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    36
  nvalid  ("\<Turnstile>_: _" [61,61] 60) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    37
  envalid  ("\<Turnstile>_:\<^sub>e _" [61,61] 60) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    38
  nvalids  ("|\<Turnstile>_: _" [61,61] 60) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    39
  cnvalids  ("_ |\<Turnstile>/ _" [61,61] 60) and
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
    40
  cenvalid  ("_ |\<Turnstile>\<^sub>e/ _"[61,61] 60)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    41
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    42
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    43
lemma nvalid_def2: "\<Turnstile>n: (P,c,Q) \<equiv> \<forall>s t. s -c-n\<rightarrow> t \<longrightarrow> P s \<longrightarrow> Q t"
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    44
by (simp add: nvalid_def Let_def)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    45
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    46
lemma valid_def2: "\<Turnstile> {P} c {Q} = (\<forall>n. \<Turnstile>n: (P,c,Q))"
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    47
apply (simp add: valid_def nvalid_def2)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    48
apply blast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    49
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    50
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
    51
lemma envalid_def2: "\<Turnstile>n:\<^sub>e (P,e,Q) \<equiv> \<forall>s v t. s -e\<succ>v-n\<rightarrow> t \<longrightarrow> P s \<longrightarrow> Q v t"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    52
by (simp add: envalid_def Let_def)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    53
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
    54
lemma evalid_def2: "\<Turnstile>\<^sub>e {P} e {Q} = (\<forall>n. \<Turnstile>n:\<^sub>e (P,e,Q))"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    55
apply (simp add: evalid_def envalid_def2)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    56
apply blast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    57
done
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    58
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    59
lemma cenvalid_def2: 
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
    60
  "A|\<Turnstile>\<^sub>e (P,e,Q) = (\<forall>n. |\<Turnstile>n: A \<longrightarrow> (\<forall>s v t. s -e\<succ>v-n\<rightarrow> t \<longrightarrow> P s \<longrightarrow> Q v t))"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    61
by(simp add: cenvalid_def envalid_def2) 
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    62
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    63
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    64
subsection "Soundness"
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    65
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    66
declare exec_elim_cases [elim!] eval_elim_cases [elim!]
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    67
11497
0e66e0114d9a corrected initialization of locals, streamlined Impl
oheimb
parents: 11486
diff changeset
    68
lemma Impl_nvalid_0: "\<Turnstile>0: (P,Impl M,Q)"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    69
by (clarsimp simp add: nvalid_def2)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    70
11497
0e66e0114d9a corrected initialization of locals, streamlined Impl
oheimb
parents: 11486
diff changeset
    71
lemma Impl_nvalid_Suc: "\<Turnstile>n: (P,body M,Q) \<Longrightarrow> \<Turnstile>Suc n: (P,Impl M,Q)"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    72
by (clarsimp simp add: nvalid_def2)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    73
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    74
lemma nvalid_SucD: "\<And>t. \<Turnstile>Suc n:t \<Longrightarrow> \<Turnstile>n:t"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    75
by (force simp add: split_paired_all nvalid_def2 intro: exec_mono)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    76
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    77
lemma nvalids_SucD: "Ball A (nvalid (Suc n)) \<Longrightarrow>  Ball A (nvalid n)"
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    78
by (fast intro: nvalid_SucD)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    79
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    80
lemma Loop_sound_lemma [rule_format (no_asm)]: 
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    81
"\<forall>s t. s -c-n\<rightarrow> t \<longrightarrow> P s \<and> s<x> \<noteq> Null \<longrightarrow> P t \<Longrightarrow> 
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    82
  (s -c0-n0\<rightarrow> t \<longrightarrow> P s \<longrightarrow> c0 = While (x) c \<longrightarrow> n0 = n \<longrightarrow> P t \<and> t<x> = Null)"
14174
f3cafd2929d5 Methods rule_tac etc support static (Isar) contexts.
ballarin
parents: 12934
diff changeset
    83
apply (rule_tac ?P2.1="%s e v n t. True" in exec_eval.induct [THEN conjunct1])
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    84
apply clarsimp+
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    85
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    86
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    87
lemma Impl_sound_lemma: 
11497
0e66e0114d9a corrected initialization of locals, streamlined Impl
oheimb
parents: 11486
diff changeset
    88
"\<lbrakk>\<forall>z n. Ball (A \<union> B) (nvalid n) \<longrightarrow> Ball (f z ` Ms) (nvalid n); 
12742
83cd2140977d cosmetics
oheimb
parents: 12524
diff changeset
    89
  Cm\<in>Ms; Ball A (nvalid na); Ball B (nvalid na)\<rbrakk> \<Longrightarrow> nvalid na (f z Cm)"
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    90
by blast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
    91
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    92
lemma all_conjunct2: "\<forall>l. P' l \<and> P l \<Longrightarrow> \<forall>l. P l"
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    93
by fast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    94
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    95
lemma all3_conjunct2: 
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    96
  "\<forall>a p l. (P' a p l \<and> P a p l) \<Longrightarrow> \<forall>a p l. P a p l"
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    97
by fast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    98
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
    99
lemma cnvalid1_eq: 
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   100
  "A |\<Turnstile> {(P,c,Q)} \<equiv> \<forall>n. |\<Turnstile>n: A \<longrightarrow> (\<forall>s t. s -c-n\<rightarrow> t \<longrightarrow> P s \<longrightarrow> Q t)"
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   101
by(simp add: cnvalids_def nvalids_def nvalid_def2)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   102
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
   103
lemma hoare_sound_main:"\<And>t. (A |\<turnstile> C \<longrightarrow> A |\<Turnstile> C) \<and> (A |\<turnstile>\<^sub>e t \<longrightarrow> A |\<Turnstile>\<^sub>e t)"
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 37604
diff changeset
   104
apply (tactic "split_all_tac @{context} 1", rename_tac P e Q)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   105
apply (rule hoare_ehoare.induct)
12524
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   106
(*18*)
59498
50b60f501b05 proper context for resolve_tac, eresolve_tac, dresolve_tac, forward_tac etc.;
wenzelm
parents: 58963
diff changeset
   107
apply (tactic {* ALLGOALS (REPEAT o dresolve_tac @{context} [@{thm all_conjunct2}, @{thm all3_conjunct2}]) *})
59780
23b67731f4f0 support 'for' fixes in rule_tac etc.;
wenzelm
parents: 59763
diff changeset
   108
apply (tactic {* ALLGOALS (REPEAT o Rule_Insts.thin_tac @{context} "hoare ?x ?y" []) *})
23b67731f4f0 support 'for' fixes in rule_tac etc.;
wenzelm
parents: 59763
diff changeset
   109
apply (tactic {* ALLGOALS (REPEAT o Rule_Insts.thin_tac @{context} "ehoare ?x ?y" []) *})
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   110
apply (simp_all only: cnvalid1_eq cenvalid_def2)
12524
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   111
                 apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   112
                apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   113
               apply fast
58963
26bf09b95dda proper context for assume_tac (atac remains as fall-back without context);
wenzelm
parents: 58889
diff changeset
   114
              apply (clarify,tactic "smp_tac @{context} 1 1",erule(2) Loop_sound_lemma,(rule HOL.refl)+)
12524
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   115
             apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   116
            apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   117
           apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   118
          apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   119
         apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   120
        apply fast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   121
       apply (clarsimp del: Meth_elim_cases) (* Call *)
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   122
      apply (force del: Impl_elim_cases)
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   123
     defer
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   124
     prefer 4 apply blast (*  Conseq *)
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   125
    prefer 4 apply blast (* eConseq *)
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   126
   apply (simp_all (no_asm_use) only: cnvalids_def nvalids_def)
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   127
   apply blast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   128
  apply blast
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   129
 apply blast
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   130
apply (rule allI)
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   131
apply (rule_tac x=Z in spec)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   132
apply (induct_tac "n")
12524
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   133
 apply  (clarify intro!: Impl_nvalid_0)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   134
apply (clarify  intro!: Impl_nvalid_Suc)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   135
apply (drule nvalids_SucD)
37604
1840dc0265da explicit is better than implicit
haftmann
parents: 35417
diff changeset
   136
apply (simp only: HOL.all_simps)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   137
apply (erule (1) impE)
11497
0e66e0114d9a corrected initialization of locals, streamlined Impl
oheimb
parents: 11486
diff changeset
   138
apply (drule (2) Impl_sound_lemma)
12524
66eb843b1d35 mods due to mor powerful simprocs for 1-point rules (quantifier1).
nipkow
parents: 11565
diff changeset
   139
 apply  blast
11497
0e66e0114d9a corrected initialization of locals, streamlined Impl
oheimb
parents: 11486
diff changeset
   140
apply assumption
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   141
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   142
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   143
theorem hoare_sound: "{} \<turnstile> {P} c {Q} \<Longrightarrow> \<Turnstile> {P} c {Q}"
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   144
apply (simp only: valid_def2)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   145
apply (drule hoare_sound_main [THEN conjunct1, rule_format])
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   146
apply (unfold cnvalids_def nvalids_def)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   147
apply fast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   148
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   149
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
   150
theorem ehoare_sound: "{} \<turnstile>\<^sub>e {P} e {Q} \<Longrightarrow> \<Turnstile>\<^sub>e {P} e {Q}"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   151
apply (simp only: evalid_def2)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   152
apply (drule hoare_sound_main [THEN conjunct2, rule_format])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   153
apply (unfold cenvalid_def nvalids_def)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   154
apply fast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   155
done
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   156
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   157
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   158
subsection "(Relative) Completeness"
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   159
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
   160
definition MGT :: "stmt => state => triple" where
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   161
         "MGT  c Z \<equiv> (\<lambda>s. Z = s, c, \<lambda>  t. \<exists>n. Z -c-  n\<rightarrow> t)"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
   162
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
   163
definition MGTe   :: "expr => state => etriple" where
23755
1c4672d130b1 Adapted to new inductive definition package.
berghofe
parents: 16417
diff changeset
   164
         "MGTe e Z \<equiv> (\<lambda>s. Z = s, e, \<lambda>v t. \<exists>n. Z -e\<succ>v-n\<rightarrow> t)"
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 27239
diff changeset
   165
35355
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
   166
notation (xsymbols)
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
   167
  MGTe  ("MGT\<^sub>e")
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
   168
notation (HTML output)
613e133966ea modernized syntax declarations, and make them actually work with authentic syntax;
wenzelm
parents: 27239
diff changeset
   169
  MGTe  ("MGT\<^sub>e")
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   170
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   171
lemma MGF_implies_complete:
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   172
 "\<forall>Z. {} |\<turnstile> { MGT c Z} \<Longrightarrow> \<Turnstile>  {P} c {Q} \<Longrightarrow> {} \<turnstile>  {P} c {Q}"
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   173
apply (simp only: valid_def2)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   174
apply (unfold MGT_def)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   175
apply (erule hoare_ehoare.Conseq)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   176
apply (clarsimp simp add: nvalid_def2)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   177
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   178
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   179
lemma eMGF_implies_complete:
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   180
 "\<forall>Z. {} |\<turnstile>\<^sub>e MGT\<^sub>e e Z \<Longrightarrow> \<Turnstile>\<^sub>e {P} e {Q} \<Longrightarrow> {} \<turnstile>\<^sub>e {P} e {Q}"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   181
apply (simp only: evalid_def2)
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
   182
apply (unfold MGTe_def)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   183
apply (erule hoare_ehoare.eConseq)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   184
apply (clarsimp simp add: envalid_def2)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   185
done
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   186
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   187
declare exec_eval.intros[intro!]
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   188
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   189
lemma MGF_Loop: "\<forall>Z. A \<turnstile> {op = Z} c {\<lambda>t. \<exists>n. Z -c-n\<rightarrow> t} \<Longrightarrow> 
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   190
  A \<turnstile> {op = Z} While (x) c {\<lambda>t. \<exists>n. Z -While (x) c-n\<rightarrow> t}"
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   191
apply (rule_tac P' = "\<lambda>Z s. (Z,s) \<in> ({(s,t). \<exists>n. s<x> \<noteq> Null \<and> s -c-n\<rightarrow> t})^*"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   192
       in hoare_ehoare.Conseq)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   193
apply  (rule allI)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   194
apply  (rule hoare_ehoare.Loop)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   195
apply  (erule hoare_ehoare.Conseq)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   196
apply  clarsimp
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   197
apply  (blast intro:rtrancl_into_rtrancl)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   198
apply (erule thin_rl)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   199
apply clarsimp
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   200
apply (erule_tac x = Z in allE)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   201
apply clarsimp
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   202
apply (erule converse_rtrancl_induct)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   203
apply  blast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   204
apply clarsimp
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   205
apply (drule (1) exec_exec_max)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   206
apply (blast del: exec_elim_cases)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   207
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   208
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   209
lemma MGF_lemma: "\<forall>M Z. A |\<turnstile> {MGT (Impl M) Z} \<Longrightarrow> 
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   210
 (\<forall>Z. A |\<turnstile> {MGT c Z}) \<and> (\<forall>Z. A |\<turnstile>\<^sub>e MGT\<^sub>e e Z)"
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
   211
apply (simp add: MGT_def MGTe_def)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   212
apply (rule stmt_expr.induct)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   213
apply (rule_tac [!] allI)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   214
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   215
apply (rule Conseq1 [OF hoare_ehoare.Skip])
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   216
apply blast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   217
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   218
apply (rule hoare_ehoare.Comp)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   219
apply  (erule spec)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   220
apply (erule hoare_ehoare.Conseq)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   221
apply clarsimp
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   222
apply (drule (1) exec_exec_max)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   223
apply blast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   224
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   225
apply (erule thin_rl)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   226
apply (rule hoare_ehoare.Cond)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   227
apply  (erule spec)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   228
apply (rule allI)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   229
apply (simp)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   230
apply (rule conjI)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   231
apply  (rule impI, erule hoare_ehoare.Conseq, clarsimp, drule (1) eval_exec_max,
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   232
        erule thin_rl, erule thin_rl, force)+
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   233
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   234
apply (erule MGF_Loop)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   235
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   236
apply (erule hoare_ehoare.eConseq [THEN hoare_ehoare.LAss])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   237
apply fast
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   238
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   239
apply (erule thin_rl)
58262
85b13d75b2e4 rename_tac'd scrips
blanchet
parents: 51717
diff changeset
   240
apply (rename_tac expr1 u v Z, rule_tac Q = "\<lambda>a s. \<exists>n. Z -expr1\<succ>Addr a-n\<rightarrow> s" in hoare_ehoare.FAss)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   241
apply  (drule spec)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   242
apply  (erule eConseq2)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   243
apply  fast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   244
apply (rule allI)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   245
apply (erule hoare_ehoare.eConseq)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   246
apply clarsimp
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   247
apply (drule (1) eval_eval_max)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   248
apply blast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   249
11507
4b32a46ffd29 removed imname, uncurried Meth
oheimb
parents: 11497
diff changeset
   250
apply (simp only: split_paired_all)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   251
apply (rule hoare_ehoare.Meth)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   252
apply (rule allI)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   253
apply (drule spec, drule spec, erule hoare_ehoare.Conseq)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   254
apply blast
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   255
11497
0e66e0114d9a corrected initialization of locals, streamlined Impl
oheimb
parents: 11486
diff changeset
   256
apply (simp add: split_paired_all)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   257
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   258
apply (rule eConseq1 [OF hoare_ehoare.NewC])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   259
apply blast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   260
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   261
apply (erule hoare_ehoare.eConseq [THEN hoare_ehoare.Cast])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   262
apply fast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   263
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   264
apply (rule eConseq1 [OF hoare_ehoare.LAcc])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   265
apply blast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   266
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   267
apply (erule hoare_ehoare.eConseq [THEN hoare_ehoare.FAcc])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   268
apply fast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   269
58262
85b13d75b2e4 rename_tac'd scrips
blanchet
parents: 51717
diff changeset
   270
apply (rename_tac expr1 u expr2 Z)
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   271
apply (rule_tac R = "\<lambda>a v s. \<exists>n1 n2 t. Z -expr1\<succ>a-n1\<rightarrow> t \<and> t -expr2\<succ>v-n2\<rightarrow> s" in
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   272
                hoare_ehoare.Call)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   273
apply   (erule spec)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   274
apply  (rule allI)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   275
apply  (erule hoare_ehoare.eConseq)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   276
apply  clarsimp
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   277
apply  blast
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   278
apply (rule allI)+
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   279
apply (rule hoare_ehoare.Meth)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   280
apply (rule allI)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   281
apply (drule spec, drule spec, erule hoare_ehoare.Conseq)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   282
apply (erule thin_rl, erule thin_rl)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   283
apply (clarsimp del: Impl_elim_cases)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   284
apply (drule (2) eval_eval_exec_max)
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   285
apply (force del: Impl_elim_cases)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   286
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   287
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   288
lemma MGF_Impl: "{} |\<turnstile> {MGT (Impl M) Z}"
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   289
apply (unfold MGT_def)
12934
6003b4f916c0 Clarification wrt. use of polymorphic variants of Hoare logic rules
oheimb
parents: 12742
diff changeset
   290
apply (rule Impl1')
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   291
apply  (rule_tac [2] UNIV_I)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   292
apply clarsimp
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   293
apply (rule hoare_ehoare.ConjI)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   294
apply clarsimp
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   295
apply (rule ssubst [OF Impl_body_eq])
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   296
apply (fold MGT_def)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   297
apply (rule MGF_lemma [THEN conjunct1, rule_format])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   298
apply (rule hoare_ehoare.Asm)
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   299
apply force
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   300
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   301
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   302
theorem hoare_relative_complete: "\<Turnstile> {P} c {Q} \<Longrightarrow> {} \<turnstile> {P} c {Q}"
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   303
apply (rule MGF_implies_complete)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   304
apply  (erule_tac [2] asm_rl)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   305
apply (rule allI)
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   306
apply (rule MGF_lemma [THEN conjunct1, rule_format])
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   307
apply (rule MGF_Impl)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   308
done
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   309
11486
8f32860eac3a layout, subscripts
oheimb
parents: 11476
diff changeset
   310
theorem ehoare_relative_complete: "\<Turnstile>\<^sub>e {P} e {Q} \<Longrightarrow> {} \<turnstile>\<^sub>e {P} e {Q}"
11476
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   311
apply (rule eMGF_implies_complete)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   312
apply  (erule_tac [2] asm_rl)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   313
apply (rule allI)
06c1998340a8 changed to full expressions with side effects
oheimb
parents: 11376
diff changeset
   314
apply (rule MGF_lemma [THEN conjunct2, rule_format])
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   315
apply (rule MGF_Impl)
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   316
done
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   317
11565
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   318
lemma cFalse: "A \<turnstile> {\<lambda>s. False} c {Q}"
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   319
apply (rule cThin)
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   320
apply (rule hoare_relative_complete)
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   321
apply (auto simp add: valid_def)
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   322
done
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   323
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   324
lemma eFalse: "A \<turnstile>\<^sub>e {\<lambda>s. False} e {Q}"
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   325
apply (rule eThin)
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   326
apply (rule ehoare_relative_complete)
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   327
apply (auto simp add: evalid_def)
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   328
done
ab004c0ecc63 Minor improvements, added Example
oheimb
parents: 11508
diff changeset
   329
11376
bf98ad1c22c6 added NanoJava
oheimb
parents:
diff changeset
   330
end