src/HOLCF/IOA/NTP/Impl.ML
author aspinall
Fri, 30 Sep 2005 18:18:34 +0200
changeset 17740 fc385ce6187d
parent 17244 0b2ff9541727
permissions -rw-r--r--
Add icon for interface.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     1
(*  Title:      HOL/IOA/NTP/Impl.ML
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     2
    ID:         $Id$
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     3
    Author:     Tobias Nipkow & Konrad Slind
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     4
12218
wenzelm
parents: 9636
diff changeset
     5
The implementation --- Invariants.
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     6
*)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     7
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
     8
8741
61bc5ed22b62 removal of less_SucI, le_SucI from default simpset
paulson
parents: 7322
diff changeset
     9
Addsimps [Let_def, le_SucI];
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    10
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    11
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    12
val impl_ioas =
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    13
  [impl_def,
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    14
   sender_ioa_def,
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    15
   receiver_ioa_def,
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    16
   srch_ioa_thm RS eq_reflection,
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    17
   rsch_ioa_thm RS eq_reflection];
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    18
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    19
val transitions = [sender_trans_def, receiver_trans_def,
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    20
                   srch_trans_def, rsch_trans_def];
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    21
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    22
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    23
Addsimps [ioa_triple_proj, starts_of_par, trans_of_par4,
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    24
          in_sender_asig, in_receiver_asig, in_srch_asig,
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    25
          in_rsch_asig];
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    26
Addcongs [let_weak_cong];
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    27
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4833
diff changeset
    28
Goal
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    29
  "fst(x) = sen(x)            & \
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    30
\  fst(snd(x)) = rec(x)       & \
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    31
\  fst(snd(snd(x))) = srch(x) & \
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    32
\  snd(snd(snd(x))) = rsch(x)";
4423
a129b817b58a expandshort;
wenzelm
parents: 4377
diff changeset
    33
by (simp_tac (simpset() addsimps
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    34
             [sen_def,rec_def,srch_def,rsch_def]) 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    35
Addsimps [result()];
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    36
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4833
diff changeset
    37
Goal "a:actions(sender_asig)   \
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    38
\            | a:actions(receiver_asig) \
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    39
\            | a:actions(srch_asig)     \
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    40
\            | a:actions(rsch_asig)";
5192
704dd3a6d47d Adapted to new datatype package.
berghofe
parents: 5068
diff changeset
    41
  by (induct_tac "a" 1);
4423
a129b817b58a expandshort;
wenzelm
parents: 4377
diff changeset
    42
  by (ALLGOALS (Simp_tac));
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    43
Addsimps [result()];
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    44
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    45
Delsimps [split_paired_All];
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    46
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    47
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    48
(* Three Simp_sets in different sizes
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    49
----------------------------------------------
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    50
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    51
1) simpset() does not unfold the transition relations
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    52
2) ss unfolds transition relations
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    53
3) renname_ss unfolds transitions and the abstract channel *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    54
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    55
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    56
val ss = (simpset() addsimps transitions);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    57
val rename_ss = (ss addsimps unfold_renaming);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    58
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
    59
val tac     = asm_simp_tac (ss addcongs [conj_cong] addsplits [split_if]);
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
    60
val tac_ren = asm_simp_tac (rename_ss addcongs [conj_cong] addsplits [split_if]);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    61
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    62
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    63
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    64
(* INVARIANT 1 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    65
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4833
diff changeset
    66
Goalw impl_ioas "invariant impl_ioa inv1";
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    67
by (rtac invariantI 1);
4423
a129b817b58a expandshort;
wenzelm
parents: 4377
diff changeset
    68
by (asm_full_simp_tac (simpset()
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    69
   addsimps [inv1_def, hdr_sum_def, srcvd_def,
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    70
             ssent_def, rsent_def,rrcvd_def]) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    71
4423
a129b817b58a expandshort;
wenzelm
parents: 4377
diff changeset
    72
by (simp_tac (simpset() delsimps [trans_of_par4]
15408
6001135caa91 tidied; removed references to HOL theories
paulson
parents: 14981
diff changeset
    73
                addsimps [imp_conjR,inv1_def]) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    74
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    75
(* Split proof in two *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    76
by (rtac conjI 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    77
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    78
(* First half *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    79
by (asm_full_simp_tac (simpset() addsimps [thm "Impl.inv1_def"]
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
    80
                                 delsplits [split_if]) 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    81
by (rtac action.induct 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    82
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    83
by (EVERY1[tac, tac, tac, tac]);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    84
by (tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    85
by (tac_ren 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    86
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    87
(* 5 + 1 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    88
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    89
by (tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    90
by (tac_ren 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    91
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    92
(* 4 + 1 *)
4423
a129b817b58a expandshort;
wenzelm
parents: 4377
diff changeset
    93
by (EVERY1[tac, tac, tac, tac]);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    94
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    95
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
    96
(* Now the other half *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    97
by (asm_full_simp_tac (simpset() addsimps [thm "Impl.inv1_def"]
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
    98
                                 delsplits [split_if]) 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
    99
by (rtac action.induct 1);
4423
a129b817b58a expandshort;
wenzelm
parents: 4377
diff changeset
   100
by (EVERY1[tac, tac]);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   101
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   102
(* detour 1 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   103
by (tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   104
by (tac_ren 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   105
by (rtac impI 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   106
by (REPEAT (etac conjE 1));
4098
71e05eb27fb6 isatool fixclasimp;
wenzelm
parents: 3073
diff changeset
   107
by (asm_simp_tac (simpset() addsimps [hdr_sum_def, Multiset.count_def,
4377
2cba48b0f1c4 Cleaned up arithmetic mess.
nipkow
parents: 4098
diff changeset
   108
                                      Multiset.countm_nonempty_def]
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
   109
                            addsplits [split_if]) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   110
(* detour 2 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   111
by (tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   112
by (tac_ren 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   113
by (rtac impI 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   114
by (REPEAT (etac conjE 1));
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   115
by (asm_full_simp_tac (simpset() addsimps [thm "Impl.hdr_sum_def",
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   116
                                         Multiset.count_def,
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   117
                                         Multiset.countm_nonempty_def,
4377
2cba48b0f1c4 Cleaned up arithmetic mess.
nipkow
parents: 4098
diff changeset
   118
                                         Multiset.delm_nonempty_def]
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
   119
                                 addsplits [split_if]) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   120
by (rtac allI 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   121
by (rtac conjI 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   122
by (rtac impI 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   123
by (hyp_subst_tac 1);
4377
2cba48b0f1c4 Cleaned up arithmetic mess.
nipkow
parents: 4098
diff changeset
   124
by (rtac (pred_suc RS iffD1) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   125
by (dtac less_le_trans 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   126
by (cut_facts_tac [rewrite_rule[thm "Packet.hdr_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   127
                   eq_packet_imp_eq_hdr RS countm_props] 1);;
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   128
by (assume_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   129
by (assume_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   130
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   131
by (rtac (countm_done_delm RS mp RS sym) 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   132
by (rtac refl 1);
4098
71e05eb27fb6 isatool fixclasimp;
wenzelm
parents: 3073
diff changeset
   133
by (asm_simp_tac (simpset() addsimps [Multiset.count_def]) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   134
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   135
by (rtac impI 1);
4098
71e05eb27fb6 isatool fixclasimp;
wenzelm
parents: 3073
diff changeset
   136
by (asm_full_simp_tac (simpset() addsimps [neg_flip]) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   137
by (hyp_subst_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   138
by (rtac countm_spurious_delm 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   139
by (Simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   140
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   141
by (EVERY1[tac, tac, tac, tac, tac, tac]);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   142
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   143
qed "inv1";
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   144
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   145
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   146
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   147
(* INVARIANT 2 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   148
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4833
diff changeset
   149
Goal "invariant impl_ioa inv2";
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   150
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   151
  by (rtac invariantI1 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   152
  (* Base case *)
4098
71e05eb27fb6 isatool fixclasimp;
wenzelm
parents: 3073
diff changeset
   153
  by (asm_full_simp_tac (simpset() addsimps (inv2_def ::
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   154
                          (receiver_projections
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   155
                           @ sender_projections @ impl_ioas)))
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   156
      1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   157
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
   158
  by (asm_simp_tac (simpset() addsimps impl_ioas delsplits [split_if]) 1);
5192
704dd3a6d47d Adapted to new datatype package.
berghofe
parents: 5068
diff changeset
   159
  by (induct_tac "a" 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   160
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   161
  (* 10 cases. First 4 are simple, since state doesn't change *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   162
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   163
val tac2 = asm_full_simp_tac (ss addsimps [inv2_def]);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   164
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   165
  (* 10 - 7 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   166
  by (EVERY1[tac2,tac2,tac2,tac2]);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   167
  (* 6 *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   168
  by (forward_tac [rewrite_rule [thm "Impl.inv1_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   169
                               (inv1 RS invariantE) RS conjunct1] 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   170
  (* 6 - 5 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   171
  by (EVERY1[tac2,tac2]);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   172
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   173
  (* 4 *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   174
  by (forward_tac [rewrite_rule [thm "Impl.inv1_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   175
                                (inv1 RS invariantE) RS conjunct1] 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   176
  by (tac2 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   177
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   178
  (* 3 *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   179
  by (forward_tac [rewrite_rule [thm "Impl.inv1_def"] (inv1 RS invariantE)] 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   180
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   181
  by (tac2 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   182
  by (fold_tac [rewrite_rule [thm "Packet.hdr_def"] (thm "Impl.hdr_sum_def")]);
7322
d16d7ddcc842 isatool expandshort;
wenzelm
parents: 6918
diff changeset
   183
  by (arith_tac 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   184
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   185
  (* 2 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   186
  by (tac2 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   187
  by (forward_tac [rewrite_rule [thm "Impl.inv1_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   188
                               (inv1 RS invariantE) RS conjunct1] 1);
6081
aa97eb904692 Some simplifications.
nipkow
parents: 5274
diff changeset
   189
  by (strip_tac 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   190
  by (REPEAT (etac conjE 1));
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   191
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   192
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   193
  (* 1 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   194
  by (tac2 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   195
  by (forward_tac [rewrite_rule [thm "Impl.inv1_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   196
                               (inv1 RS invariantE) RS conjunct2] 1);
6081
aa97eb904692 Some simplifications.
nipkow
parents: 5274
diff changeset
   197
  by (strip_tac 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   198
  by (REPEAT (etac conjE 1));
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   199
  by (fold_tac  [rewrite_rule[thm "Packet.hdr_def"] (thm "Impl.hdr_sum_def")]);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   200
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   201
qed "inv2";
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   202
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   203
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   204
(* INVARIANT 3 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   205
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4833
diff changeset
   206
Goal "invariant impl_ioa inv3";
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   207
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   208
  by (rtac invariantI 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   209
  (* Base case *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   210
  by (asm_full_simp_tac (simpset() addsimps
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   211
                    (thm "Impl.inv3_def" :: (receiver_projections
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   212
                                       @ sender_projections @ impl_ioas))) 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   213
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
   214
  by (asm_simp_tac (simpset() addsimps impl_ioas delsplits [split_if]) 1);
5192
704dd3a6d47d Adapted to new datatype package.
berghofe
parents: 5068
diff changeset
   215
  by (induct_tac "a" 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   216
6081
aa97eb904692 Some simplifications.
nipkow
parents: 5274
diff changeset
   217
val tac3 = asm_full_simp_tac (ss addsimps [inv3_def]);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   218
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   219
  (* 10 - 8 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   220
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   221
  by (EVERY1[tac3,tac3,tac3]);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   222
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   223
  by (tac_ren 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   224
  by (strip_tac  1 THEN REPEAT (etac conjE 1));
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   225
  by (hyp_subst_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   226
  by (etac exE 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   227
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   228
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   229
  (* 7 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   230
  by (tac3 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   231
  by (tac_ren 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   232
  by (Force_tac 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   233
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   234
  (* 6 - 3 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   235
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   236
  by (EVERY1[tac3,tac3,tac3,tac3]);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   237
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   238
  (* 2 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   239
  by (asm_full_simp_tac ss 1);
4098
71e05eb27fb6 isatool fixclasimp;
wenzelm
parents: 3073
diff changeset
   240
  by (simp_tac (simpset() addsimps [inv3_def]) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   241
  by (strip_tac  1 THEN REPEAT (etac conjE 1));
15408
6001135caa91 tidied; removed references to HOL theories
paulson
parents: 14981
diff changeset
   242
  by (rtac (imp_disjL RS iffD1) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   243
  by (rtac impI 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   244
  by (forward_tac [rewrite_rule [thm "Impl.inv2_def"] (inv2 RS invariantE)] 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   245
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   246
  by (REPEAT (etac conjE 1));
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   247
  by (res_inst_tac [("j","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
   248
                    ("k","count (rsent(rec s)) (sbit(sen s))")] le_trans 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   249
  by (forward_tac [rewrite_rule [inv1_def]
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   250
                                (inv1 RS invariantE) RS conjunct2] 1);
4098
71e05eb27fb6 isatool fixclasimp;
wenzelm
parents: 3073
diff changeset
   251
  by (asm_full_simp_tac (simpset() addsimps
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   252
                         [hdr_sum_def, Multiset.count_def]) 1);
4377
2cba48b0f1c4 Cleaned up arithmetic mess.
nipkow
parents: 4098
diff changeset
   253
  by (rtac add_le_mono 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   254
  by (rtac countm_props 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   255
  by (Simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   256
  by (rtac countm_props 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   257
  by (Simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   258
  by (assume_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   259
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   260
  (* 1 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   261
  by (tac3 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   262
  by (strip_tac  1 THEN REPEAT (etac conjE 1));
15408
6001135caa91 tidied; removed references to HOL theories
paulson
parents: 14981
diff changeset
   263
  by (rtac (imp_disjL RS iffD1) 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   264
  by (rtac impI 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   265
  by (forward_tac [rewrite_rule [thm "Impl.inv2_def"] (inv2 RS invariantE)] 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   266
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   267
qed "inv3";
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   268
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   269
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   270
(* INVARIANT 4 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   271
5068
fb28eaa07e01 isatool fixgoal;
wenzelm
parents: 4833
diff changeset
   272
Goal "invariant impl_ioa inv4";
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   273
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   274
  by (rtac invariantI 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   275
  (* Base case *)
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   276
  by (asm_full_simp_tac (simpset() addsimps
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   277
                    (thm "Impl.inv4_def" :: (receiver_projections
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   278
                                       @ sender_projections @ impl_ioas))) 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   279
4833
2e53109d4bc8 Renamed expand_const -> split_const
nipkow
parents: 4731
diff changeset
   280
  by (asm_simp_tac (simpset() addsimps impl_ioas delsplits [split_if]) 1);
5192
704dd3a6d47d Adapted to new datatype package.
berghofe
parents: 5068
diff changeset
   281
  by (induct_tac "a" 1);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   282
6081
aa97eb904692 Some simplifications.
nipkow
parents: 5274
diff changeset
   283
val tac4 =  asm_full_simp_tac (ss addsimps [inv4_def]);
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   284
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   285
  (* 10 - 2 *)
6081
aa97eb904692 Some simplifications.
nipkow
parents: 5274
diff changeset
   286
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   287
  by (EVERY1[tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4,tac4]);
4731
0196377b5703 New Asm_full_simp_tac shortens proof.
nipkow
parents: 4681
diff changeset
   288
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   289
 (* 2 b *)
6081
aa97eb904692 Some simplifications.
nipkow
parents: 5274
diff changeset
   290
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   291
  by (strip_tac  1 THEN REPEAT (etac conjE 1));
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   292
  by (forward_tac [rewrite_rule [thm "Impl.inv2_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   293
                               (inv2 RS invariantE)] 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   294
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   295
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   296
  (* 1 *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   297
  by (tac4 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   298
  by (strip_tac  1 THEN REPEAT (etac conjE 1));
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   299
  by (rtac ccontr 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   300
  by (forward_tac [rewrite_rule [thm "Impl.inv2_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   301
                               (inv2 RS invariantE)] 1);
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   302
  by (forward_tac [rewrite_rule [thm "Impl.inv3_def"]
3073
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   303
                               (inv3 RS invariantE)] 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   304
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   305
  by (eres_inst_tac [("x","m")] allE 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   306
  by (Asm_full_simp_tac 1);
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   307
qed "inv4";
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   308
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   309
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   310
(* rebind them *)
88366253a09a Old NTP files now running under the IOA meta theory based on HOLCF;
mueller
parents:
diff changeset
   311
17244
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   312
val inv1 = rewrite_rule [thm "Impl.inv1_def"] (inv1 RS invariantE);
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   313
val inv2 = rewrite_rule [thm "Impl.inv2_def"] (inv2 RS invariantE);
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   314
val inv3 = rewrite_rule [thm "Impl.inv3_def"] (inv3 RS invariantE);
0b2ff9541727 converted to Isar theory format;
wenzelm
parents: 16734
diff changeset
   315
val inv4 = rewrite_rule [thm "Impl.inv4_def"] (inv4 RS invariantE);