src/ZF/UNITY/Merge.ML
author paulson
Fri, 20 Jun 2003 12:10:45 +0200
changeset 14060 c0c4af41fa3b
parent 14057 57de6d68389e
permissions -rw-r--r--
Adding the theory UNITY/AllocImpl.thy, with supporting lemmas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     1
(*  Title: ZF/UNITY/Merge
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     2
    ID:         $Id$
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     3
    Author:     Sidi O Ehmety, Cambridge University Computer Laboratory
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     4
    Copyright   2002  University of Cambridge
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     5
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     6
A multiple-client allocator from a single-client allocator:
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     7
Merge specification
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     8
*)
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
     9
Open_locale "Merge";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    10
val all_distinct_vars = thm "all_distinct_vars";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    11
val var_assumes = thm "var_assumes";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    12
val type_assumes = thm "type_assumes";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    13
val default_val_assumes  = thm "default_val_assumes";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    14
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    15
Addsimps [var_assumes, default_val_assumes,  type_assumes];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    16
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    17
Goalw [state_def]
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    18
"s \\<in> state ==> s`In(n):list(A)";
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    19
by (dres_inst_tac [("a", "In(n)")] apply_type 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    20
by Auto_tac;
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    21
qed "In_value_type";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    22
AddTCs [In_value_type];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    23
Addsimps [In_value_type];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    24
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    25
Goalw [state_def]
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    26
"s \\<in> state ==> s`Out \\<in> list(A)";
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    27
by (dres_inst_tac [("a", "Out")] apply_type 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    28
by Auto_tac;
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    29
qed "Out_value_type";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    30
AddTCs [Out_value_type];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    31
Addsimps [Out_value_type];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    32
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    33
Goalw [state_def]
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    34
"s \\<in> state ==> s`iOut \\<in> list(nat)";
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    35
by (dres_inst_tac [("a", "iOut")] apply_type 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    36
by Auto_tac;
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    37
qed "Out_value_type";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    38
AddTCs [Out_value_type];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    39
Addsimps [Out_value_type];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    40
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    41
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    42
val merge = thm "merge_spec";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    43
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    44
Goal "M \\<in> program";
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    45
by (cut_facts_tac [merge] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    46
by (auto_tac (claset() addDs [guarantees_type RS subsetD], 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    47
              simpset() addsimps [merge_spec_def, merge_increasing_def]));
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    48
qed "M_in_program";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    49
Addsimps [M_in_program];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    50
AddTCs [M_in_program];
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    51
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    52
Goal 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    53
"Allowed(M) = (preserves(lift(Out)) Int preserves(lift(iOut)))";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    54
by (cut_facts_tac [merge, inst "v"  "lift(Out)" preserves_type] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    55
by (auto_tac (claset(), simpset() addsimps 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    56
         [merge_spec_def, merge_allowed_acts_def, 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    57
          Allowed_def,  safety_prop_Acts_iff]));
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    58
qed "merge_Allowed";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    59
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    60
Goal 
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    61
"G \\<in> program ==> \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    62
\ M ok G <-> (G \\<in> preserves(lift(Out)) &  \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    63
\      G \\<in> preserves(lift(iOut)) & M \\<in> Allowed(G))";
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    64
by (cut_facts_tac [merge] 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    65
by (auto_tac (claset(), simpset() 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    66
         addsimps [merge_Allowed, ok_iff_Allowed]));  
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    67
qed "M_ok_iff";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    68
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    69
Goal
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    70
"[| G \\<in> preserves(lift(Out)); G \\<in> preserves(lift(iOut)); \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    71
\  M \\<in> Allowed(G) |] ==> \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    72
\ M Join G \\<in> Always({s \\<in> state. length(s`Out)=length(s`iOut)})";
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    73
by (ftac (preserves_type RS subsetD) 1);
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    74
by (subgoal_tac "G \\<in> program" 1);
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    75
by (assume_tac 2);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    76
by (ftac M_ok_iff 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    77
by (cut_facts_tac [merge] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    78
by (force_tac (claset() addDs [guaranteesD], 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    79
               simpset() addsimps [merge_spec_def, merge_eq_Out_def]) 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    80
qed "merge_Always_Out_eq_iOut";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    81
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    82
Goal 
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    83
"[| G \\<in> preserves(lift(iOut)); G \\<in> preserves(lift(Out)); \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    84
\   M \\<in> Allowed(G) |] ==> \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    85
\ M Join G: Always({s \\<in> state. \\<forall>elt \\<in> set_of_list(s`iOut). elt<Nclients})";
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    86
by (ftac (preserves_type RS subsetD) 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    87
by (ftac M_ok_iff 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    88
by (cut_facts_tac [merge] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    89
by (force_tac (claset() addDs [guaranteesD], 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    90
               simpset() addsimps [merge_spec_def, merge_bounded_def]) 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    91
qed "merge_Bounded";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    92
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    93
Goal 
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    94
"[| G \\<in> preserves(lift(iOut)); \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    95
\   G: preserves(lift(Out)); M \\<in> Allowed(G) |] \
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    96
\ ==> M Join G : Always \
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    97
\   ({s \\<in> state. msetsum(%i. bag_of(sublist(s`Out, \
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
    98
\     {k \\<in> nat. k < length(s`iOut) & nth(k, s`iOut)=i})), \
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
    99
\                  Nclients, A) = bag_of(s`Out)})";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   100
by (rtac ([[merge_Always_Out_eq_iOut, merge_Bounded] MRS Always_Int_I,
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   101
           state_AlwaysI RS Always_weaken] MRS (Always_Diff_Un_eq RS iffD1)) 1)
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   102
;
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   103
by Auto_tac; 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   104
by (stac (bag_of_sublist_UN_disjoint RS sym) 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   105
by (auto_tac (claset(), simpset() 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   106
              addsimps [nat_into_Finite, set_of_list_conv_nth])); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   107
by (subgoal_tac
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
   108
    "(\\<Union>i \\<in> Nclients. {k \\<in> nat. k < length(x`iOut) & nth(k, x`iOut) = i}) = length(x`iOut)" 1);
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   109
by Auto_tac;
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   110
by (resolve_tac [equalityI] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   111
by (blast_tac (claset() addDs [ltD]) 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   112
by (Clarify_tac 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   113
by (subgoal_tac "length(x ` iOut) : nat" 1);
14055
a3f592e3f4bd Further tweaks of ZF/UNITY
paulson
parents: 14053
diff changeset
   114
by (Asm_full_simp_tac 2);
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   115
by (subgoal_tac "xa : nat" 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   116
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [Ord_mem_iff_lt]))); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   117
by (blast_tac (claset() addIs [lt_trans]) 2);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   118
by (dres_inst_tac [("x", "nth(xa, x`iOut)"),("P","%elt. ?X(elt) --> elt<Nclients")] bspec 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   119
by (asm_full_simp_tac (simpset() addsimps [ltI, nat_into_Ord]) 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   120
by (blast_tac (claset() addDs [ltD]) 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   121
qed "merge_bag_Follows_lemma";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   122
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   123
Goal
14057
57de6d68389e x-symbols (mostly)
paulson
parents: 14055
diff changeset
   124
"M : (\\<Inter>n \\<in> Nclients. lift(In(n)) IncreasingWrt prefix(A)/list(A)) \
14053
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   125
\       guarantees  \
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   126
\ (%s. bag_of(s`Out)) Fols \
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   127
\ (%s. msetsum(%i. bag_of(s`In(i)),Nclients, A)) Wrt MultLe(A, r)/Mult(A)";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   128
by (cut_facts_tac [merge] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   129
by (rtac (merge_bag_Follows_lemma RS Always_Follows1 RS guaranteesI) 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   130
by (ALLGOALS(rotate_tac ~1 ));
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   131
by (ALLGOALS(asm_full_simp_tac (simpset() addsimps [M_ok_iff])));
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   132
by Auto_tac;
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   133
by (rtac Follows_state_ofD1 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   134
by (rtac Follows_msetsum_UN 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   135
by (ALLGOALS(Clarify_tac));
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   136
by (resolve_tac [conjI] 2);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   137
by (resolve_tac [inst "A" "A" bag_of_multiset RS conjunct1] 2);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   138
by (resolve_tac [conjI] 3);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   139
by (resolve_tac [inst "A" "A" bag_of_multiset RS conjunct2] 3);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   140
by (resolve_tac [conjI] 4);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   141
by (resolve_tac [inst "A" "A" bag_of_multiset RS conjunct1] 4);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   142
by (resolve_tac [inst "A" "A" bag_of_multiset RS conjunct2] 5);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   143
by (ALLGOALS(Asm_simp_tac));
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   144
by (resolve_tac [nat_into_Finite] 2);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   145
by (Asm_simp_tac 2);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   146
by (asm_full_simp_tac (simpset() addsimps [INT_iff,
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   147
                      merge_spec_def, merge_follows_def]) 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   148
by Auto_tac;
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   149
by (cut_facts_tac [merge] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   150
by (subgoal_tac "M ok G" 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   151
by (dtac guaranteesD 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   152
by (assume_tac 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   153
by (force_tac (claset() addIs[M_ok_iff RS iffD2], simpset()) 4);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   154
by (rewrite_goal_tac [merge_spec_def, merge_follows_def] 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   155
by (Blast_tac 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   156
by (Asm_simp_tac 1);
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   157
by (asm_full_simp_tac
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   158
    (simpset() addsimps [rewrite_rule [comp_def] (mono_bag_of RS subset_Follows_comp RS subsetD), 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   159
             refl_prefix, trans_on_MultLe] 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   160
            addcongs [Follows_cong]) 1); 
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   161
qed "merge_bag_Follows";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   162
Close_locale "Merge";
4daa384f4fd7 Introduction of the theories UNITY/Merge, UNITY/ClientImpl
paulson
parents:
diff changeset
   163