src/ZF/UNITY/SubstAx.ML
author obua
Sun, 09 May 2004 23:04:36 +0200
changeset 14722 8e739a6eaf11
parent 14092 68da54626309
permissions -rw-r--r--
replaced apply-style proof for instance Multiset :: plus_ac0 by recommended Isar proof style
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      ZF/UNITY/SubstAx.ML
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
     2
    ID:         $Id \\<in> SubstAx.ML,v 1.8 2003/05/27 09:39:06 paulson Exp $
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Sidi O Ehmety, Computer Laboratory
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   2001  University of Cambridge
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     5
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     6
LeadsTo relation, restricted to the set of reachable states.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     7
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     8
*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     9
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    10
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    11
(*Resembles the previous definition of LeadsTo*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    12
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    13
(* Equivalence with the HOL-like definition *)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    14
Goalw [LeadsTo_def]
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    15
"st_set(B)==> A LeadsTo B = {F \\<in> program. F:(reachable(F) Int A) leadsTo B}";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    16
by (blast_tac (claset() addDs [psp_stable2, leadsToD2, constrainsD2] 
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    17
                        addIs [leadsTo_weaken]) 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    18
qed "LeadsTo_eq";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    19
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    20
Goalw [LeadsTo_def] "A LeadsTo B <=program";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    21
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    22
qed "LeadsTo_type";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    23
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    24
(*** Specialized laws for handling invariants ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    25
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    26
(** Conjoining an Always property **)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    27
Goal "F \\<in> Always(I) ==> (F:(I Int A) LeadsTo A') <-> (F \\<in> A LeadsTo A')";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    28
by (asm_full_simp_tac
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    29
    (simpset() addsimps [LeadsTo_def, Always_eq_includes_reachable,
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    30
              Int_absorb2, Int_assoc RS sym, leadsToD2]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    31
qed "Always_LeadsTo_pre";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    32
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    33
Goalw [LeadsTo_def] "F \\<in> Always(I) ==> (F \\<in> A LeadsTo (I Int A')) <-> (F \\<in> A LeadsTo A')";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    34
by (asm_full_simp_tac (simpset() addsimps [Always_eq_includes_reachable, 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    35
          Int_absorb2, Int_assoc RS sym,leadsToD2]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    36
qed "Always_LeadsTo_post";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    37
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    38
(* Like 'Always_LeadsTo_pre RS iffD1', but with premises in the good order *)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    39
Goal "[| F \\<in> Always(C); F \\<in> (C Int A) LeadsTo A' |] ==> F \\<in> A LeadsTo A'";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    40
by (blast_tac (claset() addIs [Always_LeadsTo_pre RS iffD1]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    41
qed "Always_LeadsToI";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    42
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    43
(* Like 'Always_LeadsTo_post RS iffD2', but with premises in the good order *)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    44
Goal "[| F \\<in> Always(C);  F \\<in> A LeadsTo A' |] ==> F \\<in> A LeadsTo (C Int A')";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    45
by (blast_tac (claset() addIs [Always_LeadsTo_post RS iffD2]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    46
qed "Always_LeadsToD";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    47
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    48
(*** Introduction rules \\<in> Basis, Trans, Union ***)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    49
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    50
Goal "F \\<in> A Ensures B ==> F \\<in> A LeadsTo B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    51
by (auto_tac (claset(), simpset() addsimps 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    52
                   [Ensures_def, LeadsTo_def]));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    53
qed "LeadsTo_Basis";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    54
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    55
Goal "[| F \\<in> A LeadsTo B;  F \\<in> B LeadsTo C |] ==> F \\<in> A LeadsTo C";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    56
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    57
by (blast_tac (claset() addIs [leadsTo_Trans]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    58
qed "LeadsTo_Trans";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    59
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    60
val [major, program] = Goalw [LeadsTo_def]
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    61
"[|(!!A. A \\<in> S ==> F \\<in> A LeadsTo B); F \\<in> program|]==>F \\<in> Union(S) LeadsTo B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    62
by (cut_facts_tac [program] 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    63
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    64
by (stac Int_Union_Union2 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    65
by (rtac leadsTo_UN 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    66
by (dtac major 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    67
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    68
qed "LeadsTo_Union";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    69
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    70
(*** Derived rules ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    71
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    72
Goal "F \\<in> A leadsTo B ==> F \\<in> A LeadsTo B";
12484
7ad150f5fc10 isatool expandshort;
wenzelm
parents: 12220
diff changeset
    73
by (ftac leadsToD2 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    74
by (Clarify_tac 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    75
by (asm_simp_tac (simpset() addsimps [LeadsTo_eq]) 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    76
by (blast_tac (claset() addIs [leadsTo_weaken_L]) 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    77
qed "leadsTo_imp_LeadsTo";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    78
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    79
(*Useful with cancellation, disjunction*)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    80
Goal "F \\<in> A LeadsTo (A' Un A') ==> F \\<in> A LeadsTo A'";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    81
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    82
qed "LeadsTo_Un_duplicate";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    83
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    84
Goal "F \\<in> A LeadsTo (A' Un C Un C) ==> F \\<in> A LeadsTo (A' Un C)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    85
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    86
qed "LeadsTo_Un_duplicate2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    87
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    88
val [major, program] = Goalw [LeadsTo_def] 
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    89
"[|(!!i. i \\<in> I ==> F \\<in> A(i) LeadsTo B); F \\<in> program|]==>F:(\\<Union>i \\<in> I. A(i)) LeadsTo B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    90
by (cut_facts_tac [program] 1);
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
    91
by (asm_simp_tac (simpset() delsimps UN_simps addsimps [Int_UN_distrib]) 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    92
by (rtac leadsTo_UN 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    93
by (dtac major 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    94
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    95
qed "LeadsTo_UN";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    96
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    97
(*Binary union introduction rule*)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
    98
Goal "[| F \\<in> A LeadsTo C; F \\<in> B LeadsTo C |] ==> F \\<in> (A Un B) LeadsTo C";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    99
by (stac Un_eq_Union 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   100
by (rtac LeadsTo_Union 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   101
by (auto_tac (claset() addDs [LeadsTo_type RS subsetD], simpset()));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   102
qed "LeadsTo_Un";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   103
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   104
(*Lets us look at the starting state*)
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   105
val [major, program] = Goal 
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   106
"[|(!!s. s \\<in> A ==> F:{s} LeadsTo B); F \\<in> program|]==>F \\<in> A LeadsTo B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   107
by (cut_facts_tac [program] 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   108
by (stac (UN_singleton RS sym) 1 THEN rtac LeadsTo_UN 1);
12484
7ad150f5fc10 isatool expandshort;
wenzelm
parents: 12220
diff changeset
   109
by (ftac major 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   110
by Auto_tac;
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   111
qed "single_LeadsTo_I";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   112
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   113
Goal "[| A <= B; F \\<in> program |] ==> F \\<in> A LeadsTo B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   114
by (asm_simp_tac (simpset() addsimps [LeadsTo_def]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   115
by (blast_tac (claset() addIs [subset_imp_leadsTo]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   116
qed "subset_imp_LeadsTo";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   117
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   118
Goal "F:0 LeadsTo A <-> F \\<in> program";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   119
by (auto_tac (claset() addDs [LeadsTo_type RS subsetD]
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   120
                       addIs [empty_subsetI RS subset_imp_LeadsTo], simpset()));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   121
qed "empty_LeadsTo";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   122
AddIffs [empty_LeadsTo];
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   123
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   124
Goal "F \\<in> A LeadsTo state <-> F \\<in> program";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   125
by (auto_tac (claset() addDs [LeadsTo_type RS subsetD], 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   126
              simpset() addsimps [LeadsTo_eq]));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   127
qed "LeadsTo_state";
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   128
AddIffs [LeadsTo_state];
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   129
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   130
Goalw [LeadsTo_def]
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   131
 "[| F \\<in> A LeadsTo A';  A'<=B'|] ==> F \\<in> A LeadsTo B'";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   132
by (auto_tac (claset() addIs[leadsTo_weaken_R], simpset()));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   133
qed_spec_mp "LeadsTo_weaken_R";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   134
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   135
Goalw [LeadsTo_def] "[| F \\<in> A LeadsTo A'; B <= A |] ==> F \\<in> B LeadsTo A'";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   136
by (auto_tac (claset() addIs[leadsTo_weaken_L], simpset()));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   137
qed_spec_mp "LeadsTo_weaken_L";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   138
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   139
Goal "[| F \\<in> A LeadsTo A'; B<=A; A'<=B' |] ==> F \\<in> B LeadsTo B'";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   140
by (blast_tac (claset() addIs [LeadsTo_weaken_R, 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   141
                    LeadsTo_weaken_L, LeadsTo_Trans]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   142
qed "LeadsTo_weaken";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   143
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   144
Goal 
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   145
"[| F \\<in> Always(C);  F \\<in> A LeadsTo A'; C Int B <= A;   C Int A' <= B' |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   146
\     ==> F \\<in> B LeadsTo B'";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   147
by (blast_tac (claset() addDs [Always_LeadsToI]
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   148
                        addIs [LeadsTo_weaken, Always_LeadsToD]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   149
qed "Always_LeadsTo_weaken";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   150
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   151
(** Two theorems for "proof lattices" **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   152
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   153
Goal "F \\<in> A LeadsTo B ==> F:(A Un B) LeadsTo B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   154
by (blast_tac (claset() addDs [LeadsTo_type RS subsetD]
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   155
                         addIs [LeadsTo_Un, subset_imp_LeadsTo]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   156
qed "LeadsTo_Un_post";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   157
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   158
Goal "[| F \\<in> A LeadsTo B;  F \\<in> B LeadsTo C |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   159
\     ==> F \\<in> (A Un B) LeadsTo C";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   160
by (blast_tac (claset() addIs [LeadsTo_Un, subset_imp_LeadsTo, 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   161
                               LeadsTo_weaken_L, LeadsTo_Trans]
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   162
                        addDs [LeadsTo_type RS subsetD]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   163
qed "LeadsTo_Trans_Un";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   164
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   165
(** Distributive laws **)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   166
Goal "(F \\<in> (A Un B) LeadsTo C)  <-> (F \\<in> A LeadsTo C & F \\<in> B LeadsTo C)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   167
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken_L]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   168
qed "LeadsTo_Un_distrib";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   169
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   170
Goal "(F \\<in> (\\<Union>i \\<in> I. A(i)) LeadsTo B) <->  (\\<forall>i \\<in> I. F \\<in> A(i) LeadsTo B) & F \\<in> program";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   171
by (blast_tac (claset() addDs [LeadsTo_type RS subsetD]
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   172
                        addIs [LeadsTo_UN, LeadsTo_weaken_L]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   173
qed "LeadsTo_UN_distrib";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   174
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   175
Goal "(F \\<in> Union(S) LeadsTo B)  <->  (\\<forall>A \\<in> S. F \\<in> A LeadsTo B) & F \\<in> program";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   176
by (blast_tac (claset() addDs [LeadsTo_type RS subsetD] 
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   177
                        addIs [LeadsTo_Union, LeadsTo_weaken_L]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   178
qed "LeadsTo_Union_distrib";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   179
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   180
(** More rules using the premise "Always(I)" **)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   181
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   182
Goal "[| F:(A-B) Co (A Un B);  F \\<in> transient (A-B) |] ==> F \\<in> A Ensures B";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   183
by (asm_full_simp_tac
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   184
    (simpset() addsimps [Ensures_def, Constrains_eq_constrains]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   185
by (blast_tac (claset() addIs [ensuresI, constrains_weaken, 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   186
                               transient_strengthen]
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   187
                        addDs [constrainsD2]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   188
qed "EnsuresI";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   189
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   190
Goal "[| F \\<in> Always(I); F \\<in> (I Int (A-A')) Co (A Un A'); \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   191
\        F \\<in> transient (I Int (A-A')) |]   \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   192
\ ==> F \\<in> A LeadsTo A'";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   193
by (rtac Always_LeadsToI 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   194
by (assume_tac 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   195
by (blast_tac (claset() addIs [EnsuresI, LeadsTo_Basis,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   196
                               Always_ConstrainsD RS Constrains_weaken, 
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   197
                               transient_strengthen]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   198
qed "Always_LeadsTo_Basis";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   199
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   200
(*Set difference \\<in> maybe combine with leadsTo_weaken_L??
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   201
  This is the most useful form of the "disjunction" rule*)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   202
Goal "[| F \\<in> (A-B) LeadsTo C;  F \\<in> (A Int B) LeadsTo C |] ==> F \\<in> A LeadsTo C";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   203
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   204
qed "LeadsTo_Diff";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   205
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   206
val [major, minor] = Goal 
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   207
"[|(!!i. i \\<in> I ==> F \\<in> A(i) LeadsTo A'(i)); F \\<in> program |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   208
\     ==> F \\<in> (\\<Union>i \\<in> I. A(i)) LeadsTo (\\<Union>i \\<in> I. A'(i))";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   209
by (cut_facts_tac [minor] 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   210
by (rtac LeadsTo_Union 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   211
by (ALLGOALS(Clarify_tac));
12484
7ad150f5fc10 isatool expandshort;
wenzelm
parents: 12220
diff changeset
   212
by (ftac major 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   213
by (blast_tac (claset()  addIs [LeadsTo_weaken_R]) 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   214
qed "LeadsTo_UN_UN";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   215
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   216
(*Binary union version*)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   217
Goal "[| F \\<in> A LeadsTo A'; F \\<in> B LeadsTo B' |] ==> F:(A Un B) LeadsTo (A' Un B')";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   218
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken_R]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   219
qed "LeadsTo_Un_Un";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   220
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   221
(** The cancellation law **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   222
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   223
Goal "[| F \\<in> A LeadsTo(A' Un B); F \\<in> B LeadsTo B' |] ==> F \\<in> A LeadsTo (A' Un B')";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   224
by (blast_tac (claset() addIs [LeadsTo_Un_Un, subset_imp_LeadsTo, LeadsTo_Trans]
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   225
                        addDs [LeadsTo_type RS subsetD]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   226
qed "LeadsTo_cancel2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   227
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   228
Goal "A Un (B - A) = A Un B";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   229
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   230
qed "Un_Diff";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   231
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   232
Goal "[| F \\<in> A LeadsTo (A' Un B); F \\<in> (B-A') LeadsTo B' |] ==> F \\<in> A LeadsTo (A' Un B')";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   233
by (rtac LeadsTo_cancel2 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   234
by (assume_tac 2);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   235
by (asm_simp_tac (simpset() addsimps [Un_Diff]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   236
qed "LeadsTo_cancel_Diff2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   237
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   238
Goal "[| F \\<in> A LeadsTo (B Un A'); F \\<in> B LeadsTo B' |] ==> F \\<in> A LeadsTo (B' Un A')";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   239
by (asm_full_simp_tac (simpset() addsimps [Un_commute]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   240
by (blast_tac (claset() addSIs [LeadsTo_cancel2]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   241
qed "LeadsTo_cancel1";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   242
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   243
Goal "(B - A) Un A = B Un A";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   244
by Auto_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   245
qed "Diff_Un2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   246
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   247
Goal "[| F \\<in> A LeadsTo (B Un A'); F \\<in> (B-A') LeadsTo B' |] ==> F \\<in> A LeadsTo (B' Un A')";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   248
by (rtac LeadsTo_cancel1 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   249
by (assume_tac 2);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   250
by (asm_simp_tac (simpset() addsimps [Diff_Un2]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   251
qed "LeadsTo_cancel_Diff1";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   252
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   253
(** The impossibility law **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   254
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   255
(*The set "A" may be non-empty, but it contains no reachable states*)
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   256
Goal "F \\<in> A LeadsTo 0 ==> F \\<in> Always (state -A)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   257
by (full_simp_tac (simpset() 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   258
           addsimps [LeadsTo_def,Always_eq_includes_reachable]) 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   259
by (cut_facts_tac [reachable_type] 1);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   260
by (auto_tac (claset() addSDs [leadsTo_empty], simpset()));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   261
qed "LeadsTo_empty";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   262
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   263
(** PSP \\<in> Progress-Safety-Progress **)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   264
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   265
(*Special case of PSP \\<in> Misra's "stable conjunction"*)
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   266
Goal "[| F \\<in> A LeadsTo A';  F \\<in> Stable(B) |]==> F:(A Int B) LeadsTo (A' Int B)";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   267
by (asm_full_simp_tac (simpset() addsimps [LeadsTo_def, Stable_eq_stable]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   268
by (Clarify_tac 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   269
by (dtac psp_stable 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   270
by (REPEAT(asm_full_simp_tac (simpset() addsimps (Int_absorb::Int_ac)) 1));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   271
qed "PSP_Stable";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   272
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   273
Goal "[| F \\<in> A LeadsTo A'; F \\<in> Stable(B) |] ==> F \\<in> (B Int A) LeadsTo (B Int A')";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   274
by (asm_simp_tac (simpset() addsimps PSP_Stable::Int_ac) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   275
qed "PSP_Stable2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   276
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   277
Goal "[| F \\<in> A LeadsTo A'; F \\<in> B Co B'|]==> F \\<in> (A Int B') LeadsTo ((A' Int B) Un (B' - B))";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   278
by (full_simp_tac (simpset() addsimps [LeadsTo_def, Constrains_eq_constrains]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   279
by (blast_tac (claset() addDs [psp] addIs [leadsTo_weaken]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   280
qed "PSP";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   281
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   282
Goal "[| F \\<in> A LeadsTo A'; F \\<in> B Co B' |]==> F:(B' Int A) LeadsTo ((B Int A') Un (B' - B))";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   283
by (asm_simp_tac (simpset() addsimps PSP::Int_ac) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   284
qed "PSP2";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   285
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   286
Goal
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   287
"[| F \\<in> A LeadsTo A'; F \\<in> B Unless B'|]==> F:(A Int B) LeadsTo ((A' Int B) Un B')";
12484
7ad150f5fc10 isatool expandshort;
wenzelm
parents: 12220
diff changeset
   288
by (rewtac Unless_def);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   289
by (dtac PSP 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   290
by (assume_tac 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   291
by (blast_tac (claset() addIs [LeadsTo_Diff, LeadsTo_weaken, subset_imp_LeadsTo]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   292
qed "PSP_Unless";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   293
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   294
(*** Induction rules ***)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   295
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   296
(** Meta or object quantifier ????? **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   297
Goal "[| wf(r);     \
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   298
\        \\<forall>m \\<in> I. F \\<in> (A Int f-``{m}) LeadsTo                     \
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   299
\                           ((A Int f-``(converse(r) `` {m})) Un B); \
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   300
\        field(r)<=I; A<=f-``I; F \\<in> program |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   301
\     ==> F \\<in> A LeadsTo B";
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   302
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1);
12825
f1f7964ed05c new simprules and classical rules
paulson
parents: 12484
diff changeset
   303
by Auto_tac; 
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   304
by (eres_inst_tac [("I", "I"), ("f", "f")] leadsTo_wf_induct 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   305
by (ALLGOALS(Clarify_tac));
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   306
by (dres_inst_tac [("x", "m")] bspec 2);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   307
by Safe_tac;
12825
f1f7964ed05c new simprules and classical rules
paulson
parents: 12484
diff changeset
   308
by (res_inst_tac [("A'", 
f1f7964ed05c new simprules and classical rules
paulson
parents: 12484
diff changeset
   309
                   "reachable(F) Int (A Int f -``(converse(r)``{m}) Un B)")]
f1f7964ed05c new simprules and classical rules
paulson
parents: 12484
diff changeset
   310
    leadsTo_weaken_R 2);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   311
by (asm_simp_tac (simpset() addsimps [Int_assoc]) 2);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   312
by (asm_simp_tac (simpset() addsimps [Int_assoc]) 3);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   313
by (REPEAT(Blast_tac 1));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   314
qed "LeadsTo_wf_induct";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   315
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   316
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   317
Goal "[| \\<forall>m \\<in> nat. F:(A Int f-``{m}) LeadsTo ((A Int f-``m) Un B); \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   318
\     A<=f-``nat; F \\<in> program |] ==> F \\<in> A LeadsTo B";
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12825
diff changeset
   319
by (res_inst_tac [("A1", "nat"),("f1", "%x. x")]
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12825
diff changeset
   320
        (wf_measure RS LeadsTo_wf_induct) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   321
by (ALLGOALS(asm_full_simp_tac 
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12825
diff changeset
   322
          (simpset() addsimps [nat_measure_field])));
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12825
diff changeset
   323
by (asm_simp_tac (simpset() addsimps [ltI, Image_inverse_lessThan, symmetric vimage_def]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   324
qed "LessThan_induct";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   325
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   326
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   327
(****** 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   328
 To be ported ??? I am not sure.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   329
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   330
  integ_0_le_induct
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   331
  LessThan_bounded_induct
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   332
  GreaterThan_bounded_induct
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   333
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   334
*****)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   335
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   336
(*** Completion \\<in> Binary and General Finite versions ***)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   337
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   338
Goal "[| F \\<in> A LeadsTo (A' Un C);  F \\<in> A' Co (A' Un C); \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   339
\        F \\<in> B LeadsTo (B' Un C);  F \\<in> B' Co (B' Un C) |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   340
\     ==> F \\<in> (A Int B) LeadsTo ((A' Int B') Un C)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   341
by (full_simp_tac
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   342
    (simpset() addsimps [LeadsTo_def, Constrains_eq_constrains, 
12215
55c084921240 Modified to make the files build with the new changes in ZF
ehmety
parents: 12195
diff changeset
   343
                         Int_Un_distrib]) 1);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   344
by Safe_tac;
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   345
by (REPEAT(Blast_tac 2));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   346
by (blast_tac (claset() addIs [completion, leadsTo_weaken]) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   347
qed "Completion";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   348
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   349
Goal "[| I \\<in> Fin(X);F \\<in> program |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   350
\     ==> (\\<forall>i \\<in> I. F \\<in> (A(i)) LeadsTo (A'(i) Un C)) -->  \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   351
\         (\\<forall>i \\<in> I. F \\<in> (A'(i)) Co (A'(i) Un C)) --> \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   352
\         F \\<in> (\\<Inter>i \\<in> I. A(i)) LeadsTo ((\\<Inter>i \\<in> I. A'(i)) Un C)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   353
by (etac Fin_induct 1);
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   354
by (auto_tac (claset(), simpset() delsimps INT_simps
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   355
                                  addsimps [Inter_0]));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   356
by (rtac Completion 1);
12220
9dc4e8fec63d last-minute tidying
paulson
parents: 12215
diff changeset
   357
by (asm_simp_tac (simpset() delsimps INT_simps addsimps INT_extend_simps) 4);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   358
by (rtac Constrains_INT 4);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   359
by (REPEAT(Blast_tac 1));
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   360
val lemma = result();
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   361
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   362
val prems = Goal
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   363
     "[| I \\<in> Fin(X); !!i. i \\<in> I ==> F \\<in> A(i) LeadsTo (A'(i) Un C); \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   364
\        !!i. i \\<in> I ==> F \\<in> A'(i) Co (A'(i) Un C); \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   365
\        F \\<in> program |]   \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   366
\     ==> F \\<in> (\\<Inter>i \\<in> I. A(i)) LeadsTo ((\\<Inter>i \\<in> I. A'(i)) Un C)";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   367
by (blast_tac (claset() addIs (lemma RS mp RS mp)::prems) 1);
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   368
qed "Finite_completion";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   369
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   370
Goalw [Stable_def]
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   371
     "[| F \\<in> A LeadsTo A';  F \\<in> Stable(A');   \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   372
\        F \\<in> B LeadsTo B';  F \\<in> Stable(B') |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   373
\   ==> F \\<in> (A Int B) LeadsTo (A' Int B')";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   374
by (res_inst_tac [("C1", "0")] (Completion RS LeadsTo_weaken_R) 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   375
by (Asm_full_simp_tac 5);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   376
by (rtac subset_refl 5);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   377
by Auto_tac;
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   378
qed "Stable_completion";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   379
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   380
val prems = Goalw [Stable_def]
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   381
     "[| I \\<in> Fin(X); \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   382
\        (!!i. i \\<in> I ==> F \\<in> A(i) LeadsTo A'(i)); \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   383
\        (!!i. i \\<in> I ==>F \\<in> Stable(A'(i)));   F \\<in> program  |] \
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   384
\     ==> F \\<in> (\\<Inter>i \\<in> I. A(i)) LeadsTo (\\<Inter>i \\<in> I. A'(i))";
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   385
by (res_inst_tac [("C1", "0")] (Finite_completion RS LeadsTo_weaken_R) 1);
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   386
by (ALLGOALS(Simp_tac));
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   387
by (rtac subset_refl 5);
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   388
by (REPEAT(blast_tac (claset() addIs prems) 1));
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   389
qed "Finite_stable_completion";
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   390
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   391
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   392
(*proves "ensures/leadsTo" properties when the program is specified*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   393
fun ensures_tac sact = 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   394
    SELECT_GOAL
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   395
      (EVERY [REPEAT (Always_Int_tac 1),
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   396
              etac Always_LeadsTo_Basis 1 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   397
                  ORELSE   (*subgoal may involve LeadsTo, leadsTo or ensures*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   398
                  REPEAT (ares_tac [LeadsTo_Basis, leadsTo_Basis,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   399
                                    EnsuresI, ensuresI] 1),
14092
68da54626309 Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents: 14046
diff changeset
   400
              (*now there are two subgoals \\<in> co & transient*)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   401
              simp_tac (simpset() addsimps !program_defs_ref) 2,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   402
              res_inst_tac [("act", sact)] transientI 2,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   403
                 (*simplify the command's domain*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   404
              simp_tac (simpset() addsimps [domain_def]) 3, 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   405
              (* proving the domain part *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   406
             Clarify_tac 3, dtac swap 3, Force_tac 4,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   407
             rtac ReplaceI 3, Force_tac 3, Force_tac 4,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   408
             Asm_full_simp_tac 3, rtac conjI 3, Simp_tac 4,
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12825
diff changeset
   409
             REPEAT (rtac state_update_type 3),
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   410
             constrains_tac 1,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   411
             ALLGOALS Clarify_tac,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   412
             ALLGOALS (asm_full_simp_tac 
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   413
            (simpset() addsimps [st_set_def])),
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   414
                        ALLGOALS Clarify_tac,
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
   415
            ALLGOALS (Asm_full_simp_tac)]);
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   416