src/HOL/HOLCF/IOA/NTP/Impl.thy
author wenzelm
Wed, 30 Dec 2015 21:57:52 +0100
changeset 62002 f1599e98c4d0
parent 61999 89291b5d0ede
child 62116 bc178c0fe1a1
permissions -rw-r--r--
isabelle update_cartouches -c -t;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42151
4da4fc77664b tuned headers;
wenzelm
parents: 41476
diff changeset
     1
(*  Title:      HOL/HOLCF/IOA/NTP/Impl.thy
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     2
    Author:     Tobias Nipkow & Konrad Slind
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     3
*)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     4
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
     5
section \<open>The implementation\<close>
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     6
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
     7
theory Impl
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
     8
imports Sender Receiver Abschannel
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
     9
begin
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    10
41476
0fa9629aa399 types -> type_synonym
huffman
parents: 40774
diff changeset
    11
type_synonym 'm impl_state
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    12
  = "'m sender_state * 'm receiver_state * 'm packet multiset * bool multiset"
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    13
  (*  sender_state   *  receiver_state   *    srch_state      * rsch_state *)
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    14
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    15
27361
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    16
definition
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    17
  impl_ioa :: "('m action, 'm impl_state)ioa" where
61999
89291b5d0ede more symbols;
wenzelm
parents: 59498
diff changeset
    18
  impl_def: "impl_ioa == (sender_ioa \<parallel> receiver_ioa \<parallel> srch_ioa \<parallel> rsch_ioa)"
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    19
27361
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    20
definition sen :: "'m impl_state => 'm sender_state" where "sen = fst"
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    21
definition rec :: "'m impl_state => 'm receiver_state" where "rec = fst o snd"
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    22
definition srch :: "'m impl_state => 'm packet multiset" where "srch = fst o snd o snd"
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    23
definition rsch :: "'m impl_state => bool multiset" where "rsch = snd o snd o snd"
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    24
27361
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    25
definition
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    26
  hdr_sum :: "'m packet multiset => bool => nat" where
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    27
  "hdr_sum M b == countm M (%pkt. hdr(pkt) = b)"
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    28
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    29
(* Lemma 5.1 *)
27361
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    30
definition
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    31
  "inv1(s) ==
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    32
     (!b. count (rsent(rec s)) b = count (srcvd(sen s)) b + count (rsch s) b)
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    33
   & (!b. count (ssent(sen s)) b
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    34
          = hdr_sum (rrcvd(rec s)) b + hdr_sum (srch s) b)"
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    35
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    36
(* Lemma 5.2 *)
27361
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    37
definition
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    38
  "inv2(s) ==
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    39
  (rbit(rec(s)) = sbit(sen(s)) &
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    40
   ssending(sen(s)) &
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    41
   count (rsent(rec s)) (~sbit(sen s)) <= count (ssent(sen s)) (~sbit(sen s)) &
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    42
   count (ssent(sen s)) (~sbit(sen s)) <= count (rsent(rec s)) (sbit(sen s)))
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    43
   |
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    44
  (rbit(rec(s)) = (~sbit(sen(s))) &
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    45
   rsending(rec(s)) &
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    46
   count (ssent(sen s)) (~sbit(sen s)) <= count (rsent(rec s)) (sbit(sen s)) &
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    47
   count (rsent(rec s)) (sbit(sen s)) <= count (ssent(sen s)) (sbit(sen s)))"
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    48
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    49
(* Lemma 5.3 *)
27361
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    50
definition
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    51
  "inv3(s) ==
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    52
   rbit(rec(s)) = sbit(sen(s))
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    53
   --> (!m. sq(sen(s))=[] | m ~= hd(sq(sen(s)))
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    54
        -->  count (rrcvd(rec s)) (sbit(sen(s)),m)
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    55
             + count (srch s) (sbit(sen(s)),m)
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    56
            <= count (rsent(rec s)) (~sbit(sen s)))"
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    57
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    58
(* Lemma 5.4 *)
27361
24ec32bee347 modernized specifications;
wenzelm
parents: 27355
diff changeset
    59
definition "inv4(s) == rbit(rec(s)) = (~sbit(sen(s))) --> sq(sen(s)) ~= []"
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 14981
diff changeset
    60
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    61
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
    62
subsection \<open>Invariants\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    63
35215
a03462cbf86f get rid of warnings about duplicate simp rules in all HOLCF theories
huffman
parents: 35174
diff changeset
    64
declare le_SucI [simp]
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    65
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    66
lemmas impl_ioas =
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    67
  impl_def sender_ioa_def receiver_ioa_def srch_ioa_thm [THEN eq_reflection]
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    68
  rsch_ioa_thm [THEN eq_reflection]
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    69
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    70
lemmas "transitions" =
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    71
  sender_trans_def receiver_trans_def srch_trans_def rsch_trans_def
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    72
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    73
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    74
lemmas [simp] =
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    75
  ioa_triple_proj starts_of_par trans_of_par4 in_sender_asig
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    76
  in_receiver_asig in_srch_asig in_rsch_asig
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    77
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    78
declare let_weak_cong [cong]
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    79
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    80
lemma [simp]:
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    81
  "fst(x) = sen(x)"
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    82
  "fst(snd(x)) = rec(x)"
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    83
  "fst(snd(snd(x))) = srch(x)"
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    84
  "snd(snd(snd(x))) = rsch(x)"
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    85
  by (simp_all add: sen_def rec_def srch_def rsch_def)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    86
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    87
lemma [simp]:
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    88
  "a:actions(sender_asig)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    89
  | a:actions(receiver_asig)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    90
  | a:actions(srch_asig)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    91
  | a:actions(rsch_asig)"
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    92
  by (induct a) simp_all
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    93
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    94
declare split_paired_All [simp del]
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    95
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    96
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    97
(* Three Simp_sets in different sizes
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    98
----------------------------------------------
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
    99
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   100
1) simpset() does not unfold the transition relations
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   101
2) ss unfolds transition relations
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   102
3) renname_ss unfolds transitions and the abstract channel *)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   103
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   104
ML \<open>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   105
val ss = simpset_of (@{context} addsimps @{thms "transitions"});
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   106
val rename_ss = simpset_of (put_simpset ss @{context} addsimps @{thms unfold_renaming});
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   107
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   108
fun tac ctxt =
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   109
  asm_simp_tac (put_simpset ss ctxt
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   110
    |> Simplifier.add_cong @{thm conj_cong} |> Splitter.add_split @{thm split_if})
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   111
fun tac_ren ctxt =
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   112
  asm_simp_tac (put_simpset rename_ss ctxt
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   113
    |> Simplifier.add_cong @{thm conj_cong} |> Splitter.add_split @{thm split_if})
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   114
\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   115
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   116
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   117
subsubsection \<open>Invariant 1\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   118
26305
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   119
lemma raw_inv1: "invariant impl_ioa inv1"
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   120
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   121
apply (unfold impl_ioas)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   122
apply (rule invariantI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   123
apply (simp add: inv1_def hdr_sum_def srcvd_def ssent_def rsent_def rrcvd_def)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   124
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   125
apply (simp (no_asm) del: trans_of_par4 add: imp_conjR inv1_def)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   126
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   127
txt \<open>Split proof in two\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   128
apply (rule conjI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   129
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   130
(* First half *)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   131
apply (simp add: Impl.inv1_def split del: split_if)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   132
apply (induct_tac a)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   133
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   134
apply (tactic "EVERY1[tac @{context}, tac @{context}, tac @{context}, tac @{context}]")
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   135
apply (tactic "tac @{context} 1")
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   136
apply (tactic "tac_ren @{context} 1")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   137
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   138
txt \<open>5 + 1\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   139
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   140
apply (tactic "tac @{context} 1")
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   141
apply (tactic "tac_ren @{context} 1")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   142
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   143
txt \<open>4 + 1\<close>
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   144
apply (tactic \<open>EVERY1[tac @{context}, tac @{context}, tac @{context}, tac @{context}]\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   145
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   146
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   147
txt \<open>Now the other half\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   148
apply (simp add: Impl.inv1_def split del: split_if)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   149
apply (induct_tac a)
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   150
apply (tactic "EVERY1 [tac @{context}, tac @{context}]")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   151
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   152
txt \<open>detour 1\<close>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   153
apply (tactic "tac @{context} 1")
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   154
apply (tactic "tac_ren @{context} 1")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   155
apply (rule impI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   156
apply (erule conjE)+
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   157
apply (simp (no_asm_simp) add: hdr_sum_def Multiset.count_def Multiset.countm_nonempty_def
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   158
  split add: split_if)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   159
txt \<open>detour 2\<close>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   160
apply (tactic "tac @{context} 1")
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   161
apply (tactic "tac_ren @{context} 1")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   162
apply (rule impI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   163
apply (erule conjE)+
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   164
apply (simp add: Impl.hdr_sum_def Multiset.count_def Multiset.countm_nonempty_def
25161
aa8474398030 changed back from ~=0 to >0
nipkow
parents: 25113
diff changeset
   165
  Multiset.delm_nonempty_def split add: split_if)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   166
apply (rule allI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   167
apply (rule conjI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   168
apply (rule impI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   169
apply hypsubst
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   170
apply (rule pred_suc [THEN iffD1])
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   171
apply (drule less_le_trans)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   172
apply (cut_tac eq_packet_imp_eq_hdr [unfolded Packet.hdr_def, THEN countm_props])
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   173
apply assumption
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   174
apply assumption
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   175
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   176
apply (rule countm_done_delm [THEN mp, symmetric])
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   177
apply (rule refl)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   178
apply (simp (no_asm_simp) add: Multiset.count_def)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   179
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   180
apply (rule impI)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   181
apply (simp add: neg_flip)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   182
apply hypsubst
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   183
apply (rule countm_spurious_delm)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   184
apply (simp (no_asm))
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   185
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   186
apply (tactic "EVERY1 [tac @{context}, tac @{context}, tac @{context},
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   187
  tac @{context}, tac @{context}, tac @{context}]")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   188
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   189
done
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   190
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   191
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   192
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   193
subsubsection \<open>INVARIANT 2\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   194
26305
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   195
lemma raw_inv2: "invariant impl_ioa inv2"
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   196
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   197
  apply (rule invariantI1)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   198
  txt \<open>Base case\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   199
  apply (simp add: inv2_def receiver_projections sender_projections impl_ioas)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   200
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   201
  apply (simp (no_asm_simp) add: impl_ioas split del: split_if)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   202
  apply (induct_tac "a")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   203
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   204
  txt \<open>10 cases. First 4 are simple, since state doesn't change\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   205
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   206
  ML_prf \<open>val tac2 = asm_full_simp_tac (put_simpset ss @{context} addsimps [@{thm inv2_def}])\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   207
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   208
  txt \<open>10 - 7\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   209
  apply (tactic "EVERY1 [tac2,tac2,tac2,tac2]")
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   210
  txt \<open>6\<close>
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   211
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   212
                               (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct1] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   213
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   214
  txt \<open>6 - 5\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   215
  apply (tactic "EVERY1 [tac2,tac2]")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   216
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   217
  txt \<open>4\<close>
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   218
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   219
                                (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct1] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   220
  apply (tactic "tac2 1")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   221
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   222
  txt \<open>3\<close>
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   223
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   224
    (@{thm raw_inv1} RS @{thm invariantE})] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   225
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   226
  apply (tactic "tac2 1")
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   227
  apply (tactic \<open>fold_goals_tac @{context} [rewrite_rule @{context} [@{thm Packet.hdr_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   228
    (@{thm Impl.hdr_sum_def})]\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   229
  apply arith
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   230
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   231
  txt \<open>2\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   232
  apply (tactic "tac2 1")
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   233
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   234
                               (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct1] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   235
  apply (intro strip)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   236
  apply (erule conjE)+
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   237
  apply simp
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   238
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   239
  txt \<open>1\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   240
  apply (tactic "tac2 1")
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   241
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv1_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   242
                               (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct2] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   243
  apply (intro strip)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   244
  apply (erule conjE)+
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   245
  apply (tactic \<open>fold_goals_tac @{context}
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   246
    [rewrite_rule @{context} [@{thm Packet.hdr_def}] (@{thm Impl.hdr_sum_def})]\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   247
  apply simp
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   248
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   249
  done
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   250
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   251
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   252
subsubsection \<open>INVARIANT 3\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   253
26305
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   254
lemma raw_inv3: "invariant impl_ioa inv3"
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   255
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   256
  apply (rule invariantI)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   257
  txt \<open>Base case\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   258
  apply (simp add: Impl.inv3_def receiver_projections sender_projections impl_ioas)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   259
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   260
  apply (simp (no_asm_simp) add: impl_ioas split del: split_if)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   261
  apply (induct_tac "a")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   262
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   263
  ML_prf \<open>val tac3 = asm_full_simp_tac (put_simpset ss @{context} addsimps [@{thm inv3_def}])\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   264
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   265
  txt \<open>10 - 8\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   266
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   267
  apply (tactic "EVERY1[tac3,tac3,tac3]")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   268
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   269
  apply (tactic "tac_ren @{context} 1")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   270
  apply (intro strip, (erule conjE)+)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   271
  apply hypsubst
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   272
  apply (erule exE)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   273
  apply simp
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   274
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   275
  txt \<open>7\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   276
  apply (tactic "tac3 1")
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   277
  apply (tactic "tac_ren @{context} 1")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   278
  apply force
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   279
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   280
  txt \<open>6 - 3\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   281
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   282
  apply (tactic "EVERY1[tac3,tac3,tac3,tac3]")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   283
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   284
  txt \<open>2\<close>
51717
9e7d1c139569 simplifier uses proper Proof.context instead of historic type simpset;
wenzelm
parents: 45620
diff changeset
   285
  apply (tactic "asm_full_simp_tac (put_simpset ss @{context}) 1")
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   286
  apply (simp (no_asm) add: inv3_def)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   287
  apply (intro strip, (erule conjE)+)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   288
  apply (rule imp_disjL [THEN iffD1])
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   289
  apply (rule impI)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   290
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   291
    (@{thm raw_inv2} RS @{thm invariantE})] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   292
  apply simp
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   293
  apply (erule conjE)+
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   294
  apply (rule_tac j = "count (ssent (sen s)) (~sbit (sen s))" and
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   295
    k = "count (rsent (rec s)) (sbit (sen s))" in le_trans)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   296
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm inv1_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   297
                                (@{thm raw_inv1} RS @{thm invariantE}) RS conjunct2] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   298
  apply (simp add: hdr_sum_def Multiset.count_def)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   299
  apply (rule add_le_mono)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   300
  apply (rule countm_props)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   301
  apply (simp (no_asm))
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   302
  apply (rule countm_props)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   303
  apply (simp (no_asm))
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   304
  apply assumption
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   305
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   306
  txt \<open>1\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   307
  apply (tactic "tac3 1")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   308
  apply (intro strip, (erule conjE)+)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   309
  apply (rule imp_disjL [THEN iffD1])
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   310
  apply (rule impI)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   311
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   312
    (@{thm raw_inv2} RS @{thm invariantE})] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   313
  apply simp
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   314
  done
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   315
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   316
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   317
subsubsection \<open>INVARIANT 4\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   318
26305
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   319
lemma raw_inv4: "invariant impl_ioa inv4"
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   320
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   321
  apply (rule invariantI)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   322
  txt \<open>Base case\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   323
  apply (simp add: Impl.inv4_def receiver_projections sender_projections impl_ioas)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   324
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   325
  apply (simp (no_asm_simp) add: impl_ioas split del: split_if)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   326
  apply (induct_tac "a")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   327
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   328
  ML_prf \<open>val tac4 =  asm_full_simp_tac (put_simpset ss @{context} addsimps [@{thm inv4_def}])\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   329
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   330
  txt \<open>10 - 2\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   331
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   332
  apply (tactic "EVERY1[tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4]")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   333
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   334
  txt \<open>2 b\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   335
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   336
  apply (intro strip, (erule conjE)+)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   337
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   338
                               (@{thm raw_inv2} RS @{thm invariantE})] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   339
  apply simp
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   340
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   341
  txt \<open>1\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   342
  apply (tactic "tac4 1")
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   343
  apply (intro strip, (erule conjE)+)
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   344
  apply (rule ccontr)
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   345
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv2_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   346
                               (@{thm raw_inv2} RS @{thm invariantE})] 1\<close>)
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   347
  apply (tactic \<open>forward_tac @{context} [rewrite_rule @{context} [@{thm Impl.inv3_def}]
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   348
                               (@{thm raw_inv3} RS @{thm invariantE})] 1\<close>)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   349
  apply simp
58270
16648edf16e3 more porting to new datatypes
blanchet
parents: 54742
diff changeset
   350
  apply (rename_tac m, erule_tac x = "m" in allE)
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   351
  apply simp
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   352
  done
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   353
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   354
62002
f1599e98c4d0 isabelle update_cartouches -c -t;
wenzelm
parents: 61999
diff changeset
   355
text \<open>rebind them\<close>
19739
c58ef2aa5430 removed legacy ML scripts;
wenzelm
parents: 17244
diff changeset
   356
26305
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   357
lemmas inv1 = raw_inv1 [THEN invariantE, unfolded inv1_def]
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   358
  and inv2 = raw_inv2 [THEN invariantE, unfolded inv2_def]
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   359
  and inv3 = raw_inv3 [THEN invariantE, unfolded inv3_def]
651371f29e00 avoid rebinding of existing facts;
wenzelm
parents: 25161
diff changeset
   360
  and inv4 = raw_inv4 [THEN invariantE, unfolded inv4_def]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   361
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   362
end