src/HOLCF/ex/Hoare.ML
author paulson
Mon, 04 Oct 2004 15:25:28 +0200
changeset 15227 804ecdc08cf2
parent 13454 01e2496dee05
child 16218 ea49a9c7ff7c
permissions -rw-r--r--
PDF_VIEWER suggestion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1274
diff changeset
     1
(*  Title:      HOLCF/ex/hoare.ML
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     2
    ID:         $Id$
1461
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1274
diff changeset
     3
    Author:     Franz Regensburger
6bcb44e4d6e5 expanded tabs
clasohm
parents: 1274
diff changeset
     4
    Copyright   1993 Technische Universitaet Muenchen
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     5
*)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     6
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     7
(* --------- pure HOLCF logic, some little lemmas ------ *)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
     8
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
     9
Goal "b~=TT ==> b=FF | b=UU";
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    10
by (rtac (Exh_tr RS disjE) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    11
by (fast_tac HOL_cs 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    12
by (etac disjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    13
by (contr_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    14
by (fast_tac HOL_cs 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    15
qed "hoare_lemma2";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    16
10835
nipkow
parents: 9265
diff changeset
    17
Goal " (ALL k. b1$(iterate k g x) = TT) | (EX k. b1$(iterate k g x)~=TT)";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    18
by (fast_tac HOL_cs 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    19
qed "hoare_lemma3";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    20
10835
nipkow
parents: 9265
diff changeset
    21
Goal "(EX k. b1$(iterate k g x) ~= TT) ==> \
nipkow
parents: 9265
diff changeset
    22
\ EX k. b1$(iterate k g x) = FF | b1$(iterate k g x) = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    23
by (etac exE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    24
by (rtac exI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    25
by (rtac hoare_lemma2 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    26
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    27
qed "hoare_lemma4";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    28
10835
nipkow
parents: 9265
diff changeset
    29
Goal "[|(EX k. b1$(iterate k g x) ~= TT);\
nipkow
parents: 9265
diff changeset
    30
\   k=Least(%n. b1$(iterate n g x) ~= TT)|] ==> \
nipkow
parents: 9265
diff changeset
    31
\ b1$(iterate k g x)=FF | b1$(iterate k g x)=UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    32
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    33
by (rtac hoare_lemma2 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    34
by (etac exE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    35
by (etac LeastI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    36
qed "hoare_lemma5";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    37
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    38
Goal "b=UU ==> b~=TT";
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    39
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    40
by (resolve_tac dist_eq_tr 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    41
qed "hoare_lemma6";
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    42
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    43
Goal "b=FF ==> b~=TT";
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    44
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    45
by (resolve_tac dist_eq_tr 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    46
qed "hoare_lemma7";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    47
10835
nipkow
parents: 9265
diff changeset
    48
Goal "[|(EX k. b1$(iterate k g x) ~= TT);\
nipkow
parents: 9265
diff changeset
    49
\   k=Least(%n. b1$(iterate n g x) ~= TT)|] ==> \
nipkow
parents: 9265
diff changeset
    50
\ ALL m. m < k --> b1$(iterate m g x)=TT";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    51
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    52
by (etac exE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    53
by (strip_tac 1);
10835
nipkow
parents: 9265
diff changeset
    54
by (res_inst_tac [("p","b1$(iterate m g x)")] trE 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    55
by (atac 2);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    56
by (rtac (le_less_trans RS less_irrefl) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    57
by (atac 2);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    58
by (rtac Least_le 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    59
by (etac hoare_lemma6 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    60
by (rtac (le_less_trans RS less_irrefl) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    61
by (atac 2);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    62
by (rtac Least_le 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    63
by (etac hoare_lemma7 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    64
qed "hoare_lemma8";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    65
1168
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 1043
diff changeset
    66
10835
nipkow
parents: 9265
diff changeset
    67
Goal "f$(y::'a)=(UU::tr) ==> f$UU = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    68
by (etac (flat_codom RS disjE) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    69
by Auto_tac;  
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    70
qed "hoare_lemma28";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    71
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    72
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    73
(* ----- access to definitions ----- *)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    74
10835
nipkow
parents: 9265
diff changeset
    75
Goal "p$x = If b1$x then p$(g$x) else x fi";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    76
by (fix_tac3 p_def 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    77
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    78
qed "p_def3";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    79
10835
nipkow
parents: 9265
diff changeset
    80
Goal "q$x = If b1$x orelse b2$x then q$(g$x) else x fi";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    81
by (fix_tac3 q_def 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    82
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    83
qed "q_def3";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    84
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    85
(** --------- proves about iterations of p and q ---------- **)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
    86
10835
nipkow
parents: 9265
diff changeset
    87
Goal "(ALL m. m< Suc k --> b1$(iterate m g x)=TT) -->\
nipkow
parents: 9265
diff changeset
    88
\  p$(iterate k g x)=p$x";
13454
01e2496dee05 Replaced nat_ind_tac by induct_tac.
berghofe
parents: 10835
diff changeset
    89
by (induct_tac "k" 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    90
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    91
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    92
by (strip_tac 1);
13454
01e2496dee05 Replaced nat_ind_tac by induct_tac.
berghofe
parents: 10835
diff changeset
    93
by (res_inst_tac [("s","p$(iterate n g x)")] trans 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    94
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    95
by (rtac (p_def3 RS sym) 2);
13454
01e2496dee05 Replaced nat_ind_tac by induct_tac.
berghofe
parents: 10835
diff changeset
    96
by (res_inst_tac [("s","TT"),("t","b1$(iterate n g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    97
by (rtac mp 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    98
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
    99
by (simp_tac (simpset() addsimps [less_Suc_eq]) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   100
by (simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   101
by (etac mp 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   102
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   103
by (rtac mp 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   104
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   105
by (etac less_trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   106
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   107
qed "hoare_lemma9";
3044
3e3087aa69e7 Updates because nat_ind_tac no longer appends "1" to the ind.var.
nipkow
parents: 2642
diff changeset
   108
10835
nipkow
parents: 9265
diff changeset
   109
Goal "(ALL m. m< Suc k --> b1$(iterate m g x)=TT) --> \
nipkow
parents: 9265
diff changeset
   110
\ q$(iterate k g x)=q$x";
13454
01e2496dee05 Replaced nat_ind_tac by induct_tac.
berghofe
parents: 10835
diff changeset
   111
by (induct_tac "k" 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   112
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   113
by (simp_tac (simpset() addsimps [less_Suc_eq]) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   114
by (strip_tac 1);
13454
01e2496dee05 Replaced nat_ind_tac by induct_tac.
berghofe
parents: 10835
diff changeset
   115
by (res_inst_tac [("s","q$(iterate n g x)")] trans 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   116
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   117
by (rtac (q_def3 RS sym) 2);
13454
01e2496dee05 Replaced nat_ind_tac by induct_tac.
berghofe
parents: 10835
diff changeset
   118
by (res_inst_tac [("s","TT"),("t","b1$(iterate n g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   119
by (fast_tac HOL_cs 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   120
by (simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   121
by (etac mp 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   122
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   123
by (fast_tac (HOL_cs addSDs [less_Suc_eq RS iffD1]) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   124
qed "hoare_lemma24";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   125
10835
nipkow
parents: 9265
diff changeset
   126
(* -------- results about p for case (EX k. b1$(iterate k g x)~=TT) ------- *)
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   127
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   128
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   129
val hoare_lemma10 = (hoare_lemma8 RS (hoare_lemma9 RS mp));
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   130
(* 
10835
nipkow
parents: 9265
diff changeset
   131
val hoare_lemma10 = "[| EX k. b1$(iterate k g ?x1) ~= TT;
nipkow
parents: 9265
diff changeset
   132
    Suc ?k3 = Least(%n. b1$(iterate n g ?x1) ~= TT) |] ==>
nipkow
parents: 9265
diff changeset
   133
 p$(iterate ?k3 g ?x1) = p$?x1" : thm
1168
74be52691d62 The curried version of HOLCF is now just called HOLCF. The old
regensbu
parents: 1043
diff changeset
   134
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   135
*)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   136
10835
nipkow
parents: 9265
diff changeset
   137
Goal "(EX n. b1$(iterate n g x) ~= TT) ==>\
nipkow
parents: 9265
diff changeset
   138
\ k=(LEAST n. b1$(iterate n g x) ~= TT) & b1$(iterate k g x)=FF \
nipkow
parents: 9265
diff changeset
   139
\ --> p$x = iterate k g x";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   140
by (case_tac "k" 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   141
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   142
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   143
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   144
by (etac conjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   145
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   146
by (rtac p_def3 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   147
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   148
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   149
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   150
by (etac conjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   151
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   152
by (etac (hoare_lemma10 RS sym) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   153
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   154
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   155
by (rtac p_def3 1);
10835
nipkow
parents: 9265
diff changeset
   156
by (res_inst_tac [("s","TT"),("t","b1$(iterate nat g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   157
by (rtac (hoare_lemma8 RS spec RS mp) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   158
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   159
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   160
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   161
by (simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   162
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   163
by (rtac p_def3 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   164
by (simp_tac (simpset() delsimps [iterate_Suc] addsimps [iterate_Suc RS sym]) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   165
by (eres_inst_tac [("s","FF")] ssubst 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   166
by (simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   167
qed "hoare_lemma11";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   168
10835
nipkow
parents: 9265
diff changeset
   169
Goal "(EX n. b1$(iterate n g x) ~= TT) ==>\
nipkow
parents: 9265
diff changeset
   170
\ k=Least(%n. b1$(iterate n g x)~=TT) & b1$(iterate k g x)=UU \
nipkow
parents: 9265
diff changeset
   171
\ --> p$x = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   172
by (case_tac "k" 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   173
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   174
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   175
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   176
by (etac conjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   177
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   178
by (rtac p_def3 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   179
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   180
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   181
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   182
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   183
by (etac conjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   184
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   185
by (rtac (hoare_lemma10 RS sym) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   186
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   187
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   188
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   189
by (rtac p_def3 1);
10835
nipkow
parents: 9265
diff changeset
   190
by (res_inst_tac [("s","TT"),("t","b1$(iterate nat g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   191
by (rtac (hoare_lemma8 RS spec RS mp) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   192
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   193
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   194
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   195
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   196
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   197
by (rtac p_def3 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   198
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   199
qed "hoare_lemma12";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   200
10835
nipkow
parents: 9265
diff changeset
   201
(* -------- results about p for case  (ALL k. b1$(iterate k g x)=TT) ------- *)
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   202
10835
nipkow
parents: 9265
diff changeset
   203
Goal "(ALL k. b1$(iterate k g x)=TT) ==> ALL k. p$(iterate k g x) = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   204
by (rtac (p_def RS def_fix_ind) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   205
by (rtac adm_all 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   206
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   207
by (rtac adm_eq 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   208
by (cont_tacR 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   209
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   210
by (stac strict_Rep_CFun1 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   211
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   212
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   213
by (rtac allI 1);
10835
nipkow
parents: 9265
diff changeset
   214
by (res_inst_tac [("s","TT"),("t","b1$(iterate k g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   215
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   216
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   217
by (rtac (iterate_Suc RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   218
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   219
qed "fernpass_lemma";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   220
10835
nipkow
parents: 9265
diff changeset
   221
Goal "(ALL k. b1$(iterate k g x)=TT) ==> p$x = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   222
by (res_inst_tac [("F1","g"),("t","x")] (iterate_0 RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   223
by (etac (fernpass_lemma RS spec) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   224
qed "hoare_lemma16";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   225
10835
nipkow
parents: 9265
diff changeset
   226
(* -------- results about q for case  (ALL k. b1$(iterate k g x)=TT) ------- *)
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   227
10835
nipkow
parents: 9265
diff changeset
   228
Goal "(ALL k. b1$(iterate k g x)=TT) ==> ALL k. q$(iterate k g x) = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   229
by (rtac (q_def RS def_fix_ind) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   230
by (rtac adm_all 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   231
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   232
by (rtac adm_eq 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   233
by (cont_tacR 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   234
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   235
by (stac strict_Rep_CFun1 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   236
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   237
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   238
by (Simp_tac 1);
10835
nipkow
parents: 9265
diff changeset
   239
by (res_inst_tac [("s","TT"),("t","b1$(iterate k g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   240
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   241
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   242
by (rtac (iterate_Suc RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   243
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   244
qed "hoare_lemma17";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   245
10835
nipkow
parents: 9265
diff changeset
   246
Goal "(ALL k. b1$(iterate k g x)=TT) ==> q$x = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   247
by (res_inst_tac [("F1","g"),("t","x")] (iterate_0 RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   248
by (etac (hoare_lemma17 RS spec) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   249
qed "hoare_lemma18";
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   250
10835
nipkow
parents: 9265
diff changeset
   251
Goal "(ALL k. (b1::'a->tr)$(iterate k g x)=TT) ==> b1$(UU::'a) = UU | (ALL y. b1$(y::'a)=TT)";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   252
by (rtac (flat_codom) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   253
by (res_inst_tac [("t","x1")] (iterate_0 RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   254
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   255
qed "hoare_lemma19";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   256
10835
nipkow
parents: 9265
diff changeset
   257
Goal "(ALL y. b1$(y::'a)=TT) ==> ALL k. q$(iterate k g (x::'a)) = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   258
by (rtac (q_def RS def_fix_ind) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   259
by (rtac adm_all 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   260
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   261
by (rtac adm_eq 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   262
by (cont_tacR 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   263
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   264
by (stac strict_Rep_CFun1 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   265
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   266
by (rtac allI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   267
by (Simp_tac 1);
10835
nipkow
parents: 9265
diff changeset
   268
by (res_inst_tac [("s","TT"),("t","b1$(iterate k g (x::'a))")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   269
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   270
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   271
by (rtac (iterate_Suc RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   272
by (etac spec 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   273
qed "hoare_lemma20";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   274
10835
nipkow
parents: 9265
diff changeset
   275
Goal "(ALL y. b1$(y::'a)=TT) ==> q$(x::'a) = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   276
by (res_inst_tac [("F1","g"),("t","x")] (iterate_0 RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   277
by (etac (hoare_lemma20 RS spec) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   278
qed "hoare_lemma21";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   279
10835
nipkow
parents: 9265
diff changeset
   280
Goal "b1$(UU::'a)=UU ==> q$(UU::'a) = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   281
by (stac q_def3 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   282
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   283
qed "hoare_lemma22";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   284
10835
nipkow
parents: 9265
diff changeset
   285
(* -------- results about q for case (EX k. b1$(iterate k g x) ~= TT) ------- *)
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   286
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   287
val hoare_lemma25 = (hoare_lemma8 RS (hoare_lemma24 RS mp) );
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   288
(* 
10835
nipkow
parents: 9265
diff changeset
   289
val hoare_lemma25 = "[| EX k. b1$(iterate k g ?x1) ~= TT;
nipkow
parents: 9265
diff changeset
   290
    Suc ?k3 = Least(%n. b1$(iterate n g ?x1) ~= TT) |] ==>
nipkow
parents: 9265
diff changeset
   291
 q$(iterate ?k3 g ?x1) = q$?x1" : thm
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   292
*)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   293
10835
nipkow
parents: 9265
diff changeset
   294
Goal "(EX n. b1$(iterate n g x)~=TT) ==>\
nipkow
parents: 9265
diff changeset
   295
\ k=Least(%n. b1$(iterate n g x) ~= TT) & b1$(iterate k g x) =FF \
nipkow
parents: 9265
diff changeset
   296
\ --> q$x = q$(iterate k g x)";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   297
by (case_tac "k" 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   298
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   299
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   300
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   301
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   302
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   303
by (etac conjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   304
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   305
by (rtac (hoare_lemma25 RS sym) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   306
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   307
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   308
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   309
by (rtac q_def3 1);
10835
nipkow
parents: 9265
diff changeset
   310
by (res_inst_tac [("s","TT"),("t","b1$(iterate nat g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   311
by (rtac (hoare_lemma8 RS spec RS mp) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   312
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   313
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   314
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   315
by (simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   316
qed "hoare_lemma26";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   317
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   318
10835
nipkow
parents: 9265
diff changeset
   319
Goal "(EX n. b1$(iterate n g x) ~= TT) ==>\
nipkow
parents: 9265
diff changeset
   320
\ k=Least(%n. b1$(iterate n g x)~=TT) & b1$(iterate k g x)=UU \
nipkow
parents: 9265
diff changeset
   321
\ --> q$x = UU";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   322
by (case_tac "k" 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   323
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   324
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   325
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   326
by (etac conjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   327
by (stac q_def3 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   328
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   329
by (hyp_subst_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   330
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   331
by (strip_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   332
by (etac conjE 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   333
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   334
by (rtac (hoare_lemma25 RS sym) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   335
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   336
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   337
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   338
by (rtac q_def3 1);
10835
nipkow
parents: 9265
diff changeset
   339
by (res_inst_tac [("s","TT"),("t","b1$(iterate nat g x)")] ssubst 1);
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   340
by (rtac (hoare_lemma8 RS spec RS mp) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   341
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   342
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   343
by (Simp_tac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   344
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   345
by (rtac trans 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   346
by (rtac q_def3 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   347
by (asm_simp_tac HOLCF_ss 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   348
qed "hoare_lemma27";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   349
10835
nipkow
parents: 9265
diff changeset
   350
(* ------- (ALL k. b1$(iterate k g x)=TT) ==> q o p = q   ----- *)
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   351
10835
nipkow
parents: 9265
diff changeset
   352
Goal "(ALL k. b1$(iterate k g x)=TT) ==> q$(p$x) = q$x";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   353
by (stac hoare_lemma16 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   354
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   355
by (rtac (hoare_lemma19 RS disjE) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   356
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   357
by (stac hoare_lemma18 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   358
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   359
by (stac hoare_lemma22 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   360
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   361
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   362
by (stac hoare_lemma21 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   363
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   364
by (stac hoare_lemma21 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   365
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   366
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   367
qed "hoare_lemma23";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   368
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   369
(* ------------  EX k. b1~(iterate k g x) ~= TT ==> q o p = q   ----- *)
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   370
10835
nipkow
parents: 9265
diff changeset
   371
Goal "EX k. b1$(iterate k g x) ~= TT ==> q$(p$x) = q$x";
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   372
by (rtac (hoare_lemma5 RS disjE) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   373
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   374
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   375
by (stac (hoare_lemma11 RS mp) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   376
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   377
by (rtac conjI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   378
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   379
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   380
by (rtac (hoare_lemma26 RS mp RS subst) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   381
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   382
by (rtac conjI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   383
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   384
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   385
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   386
by (stac (hoare_lemma12 RS mp) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   387
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   388
by (rtac conjI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   389
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   390
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   391
by (stac hoare_lemma22 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   392
by (stac hoare_lemma28 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   393
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   394
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   395
by (rtac sym 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   396
by (stac (hoare_lemma27 RS mp) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   397
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   398
by (rtac conjI 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   399
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   400
by (atac 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   401
by (rtac refl 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   402
qed "hoare_lemma29";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   403
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   404
(* ------ the main prove q o p = q ------ *)
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   405
9265
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   406
Goal "q oo p = q";
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   407
by (rtac ext_cfun 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   408
by (stac cfcomp2 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   409
by (rtac (hoare_lemma3 RS disjE) 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   410
by (etac hoare_lemma23 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   411
by (etac hoare_lemma29 1);
35aab1c9c08c removal of batch style, and tidying
paulson
parents: 8439
diff changeset
   412
qed "hoare_main";
244
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   413
929fc2c63bd0 HOLCF examples
nipkow
parents:
diff changeset
   414