src/HOL/UNITY/Lift_prog.ML
author wenzelm
Wed, 02 Aug 2000 19:40:14 +0200
changeset 9502 50ec59aff389
parent 9403 aad13b59b8d9
child 10064 1a77667b21ef
permissions -rw-r--r--
adapted deriv;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Lift_prog.ML
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     2
    ID:         $Id$
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
7482
7badd511844d working snapshot
paulson
parents: 7399
diff changeset
     5
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
     6
Arrays of processes. 
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     7
*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     8
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
     9
Addsimps [insert_map_def, delete_map_def];
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    10
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    11
Goal "delete_map i (insert_map i x f) = f";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    12
by (rtac ext 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    13
by (Simp_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    14
qed "insert_map_inverse";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    15
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    16
Goal "(insert_map i x (delete_map i g)) = g(i:=x)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    17
by (rtac ext 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    18
by (auto_tac (claset(), simpset() addsplits [nat_diff_split]));
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    19
qed "insert_map_delete_map_eq";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    20
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    21
(*** Injectiveness proof ***)
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    22
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    23
Goal "(insert_map i x f) = (insert_map i y g) ==> x=y";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    24
by (dres_inst_tac [("x","i")] fun_cong 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    25
by (Full_simp_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    26
qed "insert_map_inject1";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    27
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    28
Goal "(insert_map i x f) = (insert_map i y g) ==> f=g";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    29
by (dres_inst_tac [("f", "delete_map i")] arg_cong 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    30
by (full_simp_tac (simpset() addsimps [insert_map_inverse]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    31
qed "insert_map_inject2";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    32
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    33
Goal "(insert_map i x f) = (insert_map i y g) ==> x=y & f=g";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    34
by (blast_tac (claset() addDs [insert_map_inject1, insert_map_inject2]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    35
bind_thm ("insert_map_inject", result() RS conjE);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    36
AddSEs [insert_map_inject];
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    37
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    38
(*The general case: we don't assume i=i'*)
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    39
Goalw [lift_map_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    40
     "(lift_map i (s,(f,uu)) = lift_map i' (s',(f',uu'))) \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    41
\     = (uu = uu' & insert_map i s f = insert_map i' s' f')"; 
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
    42
by Auto_tac;
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    43
qed "lift_map_eq_iff";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    44
AddIffs [lift_map_eq_iff];
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    45
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    46
Goalw [lift_map_def, drop_map_def] "!!s. drop_map i (lift_map i s) = s";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    47
by (force_tac (claset() addIs [insert_map_inverse], simpset()) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    48
qed "drop_map_lift_map_eq";
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
    49
Addsimps [drop_map_lift_map_eq];
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    50
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    51
Goalw [lift_map_def] "inj (lift_map i)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    52
by (rtac injI 1);
7688
d106cad8f515 most results now refer to those for "extend"
paulson
parents: 7547
diff changeset
    53
by Auto_tac;
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    54
qed "inj_lift_map";
7688
d106cad8f515 most results now refer to those for "extend"
paulson
parents: 7547
diff changeset
    55
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    56
(*** Surjectiveness proof ***)
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    57
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    58
Goalw [lift_map_def, drop_map_def] "!!s. lift_map i (drop_map i s) = s";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    59
by (force_tac (claset(), simpset() addsimps [insert_map_delete_map_eq]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    60
qed "lift_map_drop_map_eq";
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
    61
Addsimps [lift_map_drop_map_eq];
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    62
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    63
Goal "(drop_map i s) = (drop_map i s') ==> s=s'";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    64
by (dres_inst_tac [("f", "lift_map i")] arg_cong 1);
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
    65
by (Full_simp_tac 1);
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    66
qed "drop_map_inject";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    67
AddSDs [drop_map_inject];
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    68
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    69
Goal "surj (lift_map i)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    70
by (rtac surjI 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    71
by (rtac lift_map_drop_map_eq 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    72
qed "surj_lift_map";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    73
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    74
Goal "bij (lift_map i)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    75
by (simp_tac (simpset() addsimps [bij_def, inj_lift_map, surj_lift_map]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    76
qed "bij_lift_map";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    77
AddIffs [bij_lift_map];
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    78
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    79
Goal "inv (lift_map i) = drop_map i";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    80
by (rtac inv_equality 1);
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
    81
by Auto_tac;  
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    82
qed "inv_lift_map_eq";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
    83
Addsimps [inv_lift_map_eq];
7688
d106cad8f515 most results now refer to those for "extend"
paulson
parents: 7547
diff changeset
    84
8311
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    85
Goal "inv (drop_map i) = lift_map i";
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    86
by (rtac inv_equality 1);
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
    87
by Auto_tac;  
8311
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    88
qed "inv_drop_map_eq";
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    89
Addsimps [inv_drop_map_eq];
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    90
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    91
Goal "bij (drop_map i)";
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    92
by (simp_tac (simpset() delsimps [inv_lift_map_eq]
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    93
                        addsimps [inv_lift_map_eq RS sym, bij_imp_bij_inv]) 1);
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    94
qed "bij_drop_map";
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    95
AddIffs [bij_drop_map];
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
    96
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
    97
(*sub's main property!*)
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7915
diff changeset
    98
Goal "sub i f = f i";
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7915
diff changeset
    99
by (simp_tac (simpset() addsimps [sub_def]) 1);
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7915
diff changeset
   100
qed "sub_apply";
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7915
diff changeset
   101
Addsimps [sub_apply];
7688
d106cad8f515 most results now refer to those for "extend"
paulson
parents: 7547
diff changeset
   102
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   103
(*** lift_set ***)
7688
d106cad8f515 most results now refer to those for "extend"
paulson
parents: 7547
diff changeset
   104
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   105
Goalw [lift_set_def] "lift_set i {} = {}";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   106
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   107
qed "lift_set_empty";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   108
Addsimps [lift_set_empty];
7688
d106cad8f515 most results now refer to those for "extend"
paulson
parents: 7547
diff changeset
   109
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   110
Goalw [lift_set_def] "(lift_map i x : lift_set i A) = (x : A)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   111
by (rtac (inj_lift_map RS inj_image_mem_iff) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   112
qed "lift_set_iff";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   113
8311
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
   114
(*Do we really need both this one and its predecessor?*)
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   115
Goal "((f,uu) : lift_set i A) = ((f i, (delete_map i f, uu)) : A)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   116
by (asm_simp_tac (simpset() addsimps [lift_set_def, 
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   117
				      mem_rename_set_iff, drop_map_def]) 1);
8311
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
   118
qed "lift_set_iff2";
6218522253e7 new mostly working version; Alloc nearly converted to "Rename"
paulson
parents: 8251
diff changeset
   119
AddIffs [lift_set_iff2];
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   120
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   121
Goalw [lift_set_def] "A<=B ==> lift_set i A <= lift_set i B";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   122
by (etac image_mono 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   123
qed "lift_set_mono";
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   124
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   125
Goalw [lift_set_def] "lift_set i (A Un B) = lift_set i A Un lift_set i B";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   126
by (asm_simp_tac (simpset() addsimps [image_Un]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   127
qed "lift_set_Un_distrib";
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   128
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   129
Goalw [lift_set_def] "lift_set i (A-B) = lift_set i A - lift_set i B";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   130
by (rtac (inj_lift_map RS image_set_diff) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   131
qed "lift_set_Diff_distrib";
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   132
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   133
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   134
(*** the lattice operations ***)
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   135
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   136
Goalw [lift_def] "lift i SKIP = SKIP";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   137
by (Asm_simp_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   138
qed "lift_SKIP";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   139
Addsimps [lift_SKIP];
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   140
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   141
Goalw [lift_def] "lift i (F Join G) = lift i F Join lift i G";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   142
by (Asm_simp_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   143
qed "lift_Join";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   144
Addsimps [lift_Join];
7688
d106cad8f515 most results now refer to those for "extend"
paulson
parents: 7547
diff changeset
   145
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   146
Goalw [lift_def] "lift j (JOIN I F) = (JN i:I. lift j (F i))";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   147
by (Asm_simp_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   148
qed "lift_JN";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   149
Addsimps [lift_JN];
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   150
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   151
(*** Safety: co, stable, invariant ***)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   152
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   153
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   154
     "(lift i F : (lift_set i A) co (lift_set i B)) = (F : A co B)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   155
by (asm_simp_tac (simpset() addsimps [rename_constrains]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   156
qed "lift_constrains";
7826
c6a8b73b6c2a working shapshot with "projecting" and "extending"
paulson
parents: 7688
diff changeset
   157
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   158
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   159
     "(lift i F : stable (lift_set i A)) = (F : stable A)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   160
by (asm_simp_tac (simpset() addsimps [rename_stable]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   161
qed "lift_stable";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   162
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   163
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   164
     "(lift i F : invariant (lift_set i A)) = (F : invariant A)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   165
by (asm_simp_tac (simpset() addsimps [rename_invariant]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   166
qed "lift_invariant";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   167
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   168
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   169
     "(lift i F : (lift_set i A) Co (lift_set i B)) = (F : A Co B)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   170
by (asm_simp_tac (simpset() addsimps [rename_Constrains]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   171
qed "lift_Constrains";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   172
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   173
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   174
     "(lift i F : Stable (lift_set i A)) = (F : Stable A)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   175
by (asm_simp_tac (simpset() addsimps [rename_Stable]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   176
qed "lift_Stable";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   177
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   178
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   179
     "(lift i F : Always (lift_set i A)) = (F : Always A)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   180
by (asm_simp_tac (simpset() addsimps [rename_Always]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   181
qed "lift_Always";
7361
477e1bdf230f changed "guar" back to "guarantees" (sorry)
paulson
parents: 7343
diff changeset
   182
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   183
(*** Progress: transient, ensures ***)
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   184
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   185
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   186
     "(lift i F : transient (lift_set i A)) = (F : transient A)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   187
by (asm_simp_tac (simpset() addsimps [rename_transient]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   188
qed "lift_transient";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   189
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   190
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   191
     "(lift i F : (lift_set i A) ensures (lift_set i B)) = \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   192
\     (F : A ensures B)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   193
by (asm_simp_tac (simpset() addsimps [rename_ensures]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   194
qed "lift_ensures";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   195
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   196
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   197
     "(lift i F : (lift_set i A) leadsTo (lift_set i B)) = \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   198
\     (F : A leadsTo B)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   199
by (asm_simp_tac (simpset() addsimps [rename_leadsTo]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   200
qed "lift_leadsTo";
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   201
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   202
Goalw [lift_def, lift_set_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   203
     "(lift i F : (lift_set i A) LeadsTo (lift_set i B)) =  \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   204
\     (F : A LeadsTo B)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   205
by (asm_simp_tac (simpset() addsimps [rename_LeadsTo]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   206
qed "lift_LeadsTo";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   207
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   208
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   209
(** guarantees **)
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   210
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   211
Goalw [lift_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   212
     "(lift i F : (lift i `` X) guarantees[v o drop_map i] (lift i `` Y)) = \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   213
\     (F : X guarantees[v] Y)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   214
by (stac (bij_lift_map RS rename_rename_guarantees_eq RS sym) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   215
by (asm_simp_tac (simpset() addsimps [o_def]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   216
qed "lift_lift_guarantees_eq";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   217
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   218
Goal "(lift i F : X guarantees[v] Y) = \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   219
\     (F : (rename (drop_map i) `` X) guarantees[v o lift_map i] \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   220
\          (rename (drop_map i) `` Y))";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   221
by (asm_simp_tac 
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   222
    (simpset() addsimps [bij_lift_map RS rename_guarantees_eq_rename_inv,
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   223
			 lift_def]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   224
qed "lift_guarantees_eq_lift_inv";
7525
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   225
2a75abcf30e0 more rational theorem names (?)
paulson
parents: 7499
diff changeset
   226
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   227
(*** We devote an ENORMOUS effort to proving lift_transient_eq_disj, 
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   228
     which is used only in TimerArray and perhaps isn't even essential
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   229
     there!
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   230
***)
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   231
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   232
(*To preserve snd means that the second component is there just to allow
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   233
  guarantees properties to be stated.  Converse fails, for lift i F can 
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   234
  change function components other than i*)
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   235
Goal "F : preserves snd ==> lift i F : preserves snd";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   236
by (dres_inst_tac [("w1", "snd")] (impOfSubs subset_preserves_o) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   237
by (asm_simp_tac (simpset() addsimps [lift_def, rename_preserves]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   238
by (full_simp_tac (simpset() addsimps [lift_map_def, o_def, split_def]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   239
qed "lift_preserves_snd_I";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   240
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   241
Goal "(delete_map i g) = (delete_map i g') ==> EX x. g = g'(i:=x)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   242
by (dres_inst_tac [("f", "insert_map i (g i)")] arg_cong 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   243
by (full_simp_tac (simpset() addsimps [insert_map_delete_map_eq]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   244
by (etac exI 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   245
bind_thm ("delete_map_eqE", result() RS exE);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   246
AddSEs [delete_map_eqE];
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   247
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   248
Goal "[| delete_map j g = delete_map j g';  i~=j |] ==> g i = g' i";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   249
by (Force_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   250
qed "delete_map_neq_apply";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   251
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   252
(*A set of the form (A <*> UNIV) ignores the second (dummy) state component*)
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   253
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   254
Goal "(f o fst) -`` A = (f-``A) <*> UNIV";
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   255
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   256
qed "vimage_o_fst_eq";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   257
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   258
Goal "(sub i -``A) <*> UNIV = lift_set i (A <*> UNIV)";
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   259
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   260
qed "vimage_sub_eq_lift_set";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   261
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   262
Addsimps [vimage_o_fst_eq, vimage_sub_eq_lift_set];
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   263
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   264
Goalw [extend_act_def]
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   265
     "((s,s') : extend_act (%(x,u::unit). lift_map i x) act) = \
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   266
\     ((drop_map i s, drop_map i s') : act)";
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   267
by Auto_tac;  
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   268
by (rtac bexI 1);
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   269
by Auto_tac;  
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   270
qed "mem_lift_act_iff";
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   271
AddIffs [mem_lift_act_iff];
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   272
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   273
Goal "[| F : preserves snd;  i~=j |] \
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   274
\     ==> lift j F : stable (lift_set i (A <*> UNIV))";
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   275
by (auto_tac (claset(),
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   276
	      simpset() addsimps [lift_def, lift_set_def, 
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   277
				  stable_def, constrains_def, rename_def,
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   278
                                  extend_def, mem_rename_set_iff]));
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   279
by (auto_tac (claset() addSDs [preserves_imp_eq],
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   280
	      simpset() addsimps [lift_map_def, drop_map_def]));
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   281
by (dres_inst_tac [("x", "i")] fun_cong 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   282
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   283
qed "preserves_snd_lift_stable";
8065
658e0d4e4ed9 first working version to Alloc/System_Client_Progress;
paulson
parents: 8055
diff changeset
   284
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   285
(*If i~=j then lift j F  does nothing to lift_set i, and the 
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   286
  premise ensures A<=B.*)
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   287
Goal "[| F i : (A <*> UNIV) co (B <*> UNIV);  \
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   288
\        F j : preserves snd |]  \
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   289
\  ==> lift j (F j) : (lift_set i (A <*> UNIV)) co (lift_set i (B <*> UNIV))";
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   290
by (case_tac "i=j" 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   291
by (asm_full_simp_tac (simpset() addsimps [lift_def, lift_set_def, 
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   292
					   rename_constrains]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   293
by (etac (preserves_snd_lift_stable RS stableD RS constrains_weaken_R) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   294
by (assume_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   295
by (etac (constrains_imp_subset RS lift_set_mono) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   296
qed "constrains_imp_lift_constrains";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   297
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   298
(** Lemmas for the transient theorem **)
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   299
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   300
Goal "(insert_map i t f)(i := s) = insert_map i s f";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   301
by (rtac ext 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   302
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   303
qed "insert_map_upd_same";
8055
bb15396278fb abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents: 8041
diff changeset
   304
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   305
Goal "(insert_map j t f)(i := s) = \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   306
\     (if i=j then insert_map i s f \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   307
\      else if i<j then insert_map j t (f(i:=s)) \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   308
\      else insert_map j t (f(i-1:=s)))";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   309
by (rtac ext 1);
8866
paulson
parents: 8703
diff changeset
   310
by (auto_tac (claset(), simpset() addsplits [nat_diff_split]));
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   311
by (ALLGOALS arith_tac);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   312
qed "insert_map_upd";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   313
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   314
Goal "[| insert_map i s f = insert_map j t g;  i~=j |] \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   315
\     ==> EX g'. insert_map i s' f = insert_map j t g'";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   316
by (stac (insert_map_upd_same RS sym) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   317
by (etac ssubst 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   318
by (asm_simp_tac (HOL_ss addsimps [insert_map_upd]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   319
by (Blast_tac 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   320
qed "insert_map_eq_diff";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   321
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   322
Goalw [lift_map_def]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   323
     "[| lift_map i (s,(f,uu)) = lift_map j (t,(g,vv));  i~=j |] \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   324
\     ==> EX g'. lift_map i (s',(f,uu)) = lift_map j (t,(g',vv))";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   325
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   326
by (blast_tac (claset() addDs [insert_map_eq_diff]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   327
qed "lift_map_eq_diff";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   328
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   329
Goal "F : preserves snd \
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   330
\     ==> (lift i F : transient (lift_set j (A <*> UNIV))) = \
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   331
\         (i=j & F : transient (A <*> UNIV) | A={})";
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   332
by (case_tac "i=j" 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   333
by (auto_tac (claset(), simpset() addsimps [lift_transient]));
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   334
by (auto_tac (claset(),
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   335
	      simpset() addsimps [lift_set_def, lift_def, transient_def, 
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   336
                              rename_def, extend_def, Domain_extend_act]));
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   337
by (dtac subsetD 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   338
by (Blast_tac 1);
8122
b43ad07660b9 working version, with Alloc now working on the same state space as the whole
paulson
parents: 8065
diff changeset
   339
by Auto_tac;
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   340
ren "s f uu s' f' uu'" 1;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   341
by (subgoal_tac "f'=f & uu'=uu" 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   342
by (force_tac (claset() addSDs [preserves_imp_eq], simpset()) 2);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   343
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   344
by (dtac sym 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   345
by (dtac subsetD 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   346
by (rtac ImageI 1);
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   347
by (etac 
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   348
    (bij_lift_map RS good_map_bij RS export (mem_extend_act_iff RS iffD2)) 1);
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   349
by (Force_tac 1);
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   350
by (etac (lift_map_eq_diff RS exE) 1);
9403
aad13b59b8d9 much tidying in connection with the 2nd UNITY paper
paulson
parents: 8948
diff changeset
   351
by Auto_tac;  
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   352
qed "lift_transient_eq_disj";
8041
e3237d8c18d6 working version with new theory ELT
paulson
parents: 7947
diff changeset
   353
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   354
(*USELESS??*)
8703
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   355
Goal "lift_map i `` (A <*> UNIV) = \
816d8f6513be Times -> <*>
nipkow
parents: 8442
diff changeset
   356
\     (UN s:A. UN f. {insert_map i s f}) <*> UNIV";
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   357
by (auto_tac (claset() addSIs [bexI, image_eqI],
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   358
              simpset() addsimps [lift_map_def]));
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   359
by (rtac (split RS sym) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   360
qed "lift_map_image_Times";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   361
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   362
Goal "(lift i F : preserves v) = (F : preserves (v o lift_map i))";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   363
by (simp_tac (simpset() addsimps [lift_def, rename_preserves]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   364
qed "lift_preserves_eq";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   365
8327
108fcc85a767 polished version of the Allocator using Rename
paulson
parents: 8314
diff changeset
   366
(*A useful rewrite.  If o, sub have been rewritten out already then can also
108fcc85a767 polished version of the Allocator using Rename
paulson
parents: 8314
diff changeset
   367
  use it as   rewrite_rule [sub_def, o_def] lift_preserves_sub*)
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   368
Goal "F : preserves snd \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   369
\     ==> lift i F : preserves (v o sub j o fst) = \
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   370
\         (if i=j then F : preserves (v o fst) else True)";
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   371
by (dtac (impOfSubs subset_preserves_o) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   372
by (full_simp_tac (simpset() addsimps [lift_preserves_eq, o_def,
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   373
				       drop_map_lift_map_eq]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   374
by (asm_simp_tac (simpset() delcongs [if_weak_cong]
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   375
			    addsimps [lift_map_def, 
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   376
				      eq_commute, split_def, o_def]) 1);
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   377
by Auto_tac;
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8216
diff changeset
   378
qed "lift_preserves_sub";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   379
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   380
8314
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   381
(*** Lemmas to handle function composition (o) more consistently ***)
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   382
8314
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   383
(*Lets us prove one version of a theorem and store others*)
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   384
Goal "f o g = h ==> f' o f o g = f' o h";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   385
by (asm_full_simp_tac (simpset() addsimps [expand_fun_eq, o_def]) 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   386
qed "o_equiv_assoc";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   387
8314
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   388
Goal "f o g = h ==> ALL x. f(g x) = h x";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   389
by (asm_full_simp_tac (simpset() addsimps [expand_fun_eq, o_def]) 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   390
qed "o_equiv_apply";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   391
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   392
fun make_o_equivs th = 
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   393
    [th, 
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   394
     th RS o_equiv_assoc |> simplify (HOL_ss addsimps [o_assoc]), 
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   395
     th RS o_equiv_apply |> simplify (HOL_ss addsimps [o_def, sub_def])];
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   396
8314
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   397
Addsimps (make_o_equivs fst_o_funPair @ make_o_equivs snd_o_funPair);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   398
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   399
Goal "sub i o fst o lift_map i = fst";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   400
by (rtac ext 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   401
by (auto_tac (claset(), simpset() addsimps [o_def, lift_map_def, sub_def]));
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   402
qed "fst_o_lift_map";
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
   403
8314
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   404
Goal "snd o lift_map i = snd o snd";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   405
by (rtac ext 1);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   406
by (auto_tac (claset(), simpset() addsimps [o_def, lift_map_def]));
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   407
qed "snd_o_lift_map";
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   408
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   409
Addsimps (make_o_equivs fst_o_lift_map @ make_o_equivs snd_o_lift_map);
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   410
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   411
463f63a9a7f2 even Alloc works again, using "rename"
paulson
parents: 8311
diff changeset
   412