src/HOL/UNITY/Constrains.thy
author paulson
Thu, 30 Jan 2003 18:08:09 +0100
changeset 13797 baefae13ad37
parent 6823 97babc436a41
child 13798 4c1a53627500
permissions -rw-r--r--
conversion of UNITY theories to new-style
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Constrains
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     2
    ID:         $Id$
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     5
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
     6
Weak safety relations: restricted to the set of reachable states.
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     7
*)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     8
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
     9
theory Constrains = UNITY:
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    10
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    11
consts traces :: "['a set, ('a * 'a)set set] => ('a * 'a list) set"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    12
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    13
  (*Initial states and program => (final state, reversed trace to it)...
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    14
    Arguments MUST be curried in an inductive definition*)
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    15
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    16
inductive "traces init acts"  
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    17
  intros 
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    18
         (*Initial trace is empty*)
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    19
    Init:  "s: init ==> (s,[]) : traces init acts"
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    20
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    21
    Acts:  "[| act: acts;  (s,evs) : traces init acts;  (s,s'): act |]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    22
	    ==> (s', s#evs) : traces init acts"
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    23
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    24
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    25
consts reachable :: "'a program => 'a set"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    26
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    27
inductive "reachable F"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    28
  intros 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    29
    Init:  "s: Init F ==> s : reachable F"
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    30
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    31
    Acts:  "[| act: Acts F;  s : reachable F;  (s,s'): act |]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    32
	    ==> s' : reachable F"
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    33
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    34
constdefs
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    35
  Constrains :: "['a set, 'a set] => 'a program set"  (infixl "Co" 60)
6575
70d758762c50 new definitions of Co and LeadsTo
paulson
parents: 6570
diff changeset
    36
    "A Co B == {F. F : (reachable F Int A)  co  B}"
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    37
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    38
  Unless  :: "['a set, 'a set] => 'a program set"     (infixl "Unless" 60)
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    39
    "A Unless B == (A-B) Co (A Un B)"
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    40
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    41
  Stable     :: "'a set => 'a program set"
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    42
    "Stable A == A Co A"
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    43
6570
a7d7985050a9 Invariant -> Always and other tidying
paulson
parents: 6536
diff changeset
    44
  (*Always is the weak form of "invariant"*)
a7d7985050a9 Invariant -> Always and other tidying
paulson
parents: 6536
diff changeset
    45
  Always :: "'a set => 'a program set"
a7d7985050a9 Invariant -> Always and other tidying
paulson
parents: 6536
diff changeset
    46
    "Always A == {F. Init F <= A} Int Stable A"
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    47
5784
54276fba8420 the Increasing operator
paulson
parents: 5648
diff changeset
    48
  (*Polymorphic in both states and the meaning of <= *)
6705
b2662096ccd0 Increasing makes sense only for partial orderings
paulson
parents: 6575
diff changeset
    49
  Increasing :: "['a => 'b::{order}] => 'a program set"
5784
54276fba8420 the Increasing operator
paulson
parents: 5648
diff changeset
    50
    "Increasing f == INT z. Stable {s. z <= f s}"
54276fba8420 the Increasing operator
paulson
parents: 5648
diff changeset
    51
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    52
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    53
(*** traces and reachable ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    54
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    55
lemma reachable_equiv_traces:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    56
     "reachable F = {s. EX evs. (s,evs): traces (Init F) (Acts F)}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    57
apply safe
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    58
apply (erule_tac [2] traces.induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    59
apply (erule reachable.induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    60
apply (blast intro: reachable.intros traces.intros)+
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    61
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    62
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    63
lemma Init_subset_reachable: "Init F <= reachable F"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    64
by (blast intro: reachable.intros)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    65
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    66
lemma stable_reachable [intro!,simp]:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    67
     "Acts G <= Acts F ==> G : stable (reachable F)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    68
by (blast intro: stableI constrainsI reachable.intros)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    69
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    70
(*The set of all reachable states is an invariant...*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    71
lemma invariant_reachable: "F : invariant (reachable F)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    72
apply (simp add: invariant_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    73
apply (blast intro: reachable.intros)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    74
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    75
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    76
(*...in fact the strongest invariant!*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    77
lemma invariant_includes_reachable: "F : invariant A ==> reachable F <= A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    78
apply (simp add: stable_def constrains_def invariant_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    79
apply (rule subsetI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    80
apply (erule reachable.induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    81
apply (blast intro: reachable.intros)+
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    82
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    83
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    84
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    85
(*** Co ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    86
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    87
(*F : B co B' ==> F : (reachable F Int B) co (reachable F Int B')*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    88
lemmas constrains_reachable_Int =  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    89
    subset_refl [THEN stable_reachable [unfolded stable_def], 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    90
                 THEN constrains_Int, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    91
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    92
(*Resembles the previous definition of Constrains*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    93
lemma Constrains_eq_constrains: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    94
     "A Co B = {F. F : (reachable F  Int  A) co (reachable F  Int  B)}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    95
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    96
apply (blast dest: constrains_reachable_Int intro: constrains_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    97
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    98
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
    99
lemma constrains_imp_Constrains: "F : A co A' ==> F : A Co A'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   100
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   101
apply (blast intro: constrains_weaken_L)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   102
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   103
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   104
lemma stable_imp_Stable: "F : stable A ==> F : Stable A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   105
apply (unfold stable_def Stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   106
apply (erule constrains_imp_Constrains)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   107
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   108
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   109
lemma ConstrainsI: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   110
    "(!!act s s'. [| act: Acts F;  (s,s') : act;  s: A |] ==> s': A')  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   111
     ==> F : A Co A'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   112
apply (rule constrains_imp_Constrains)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   113
apply (blast intro: constrainsI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   114
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   115
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   116
lemma Constrains_empty [iff]: "F : {} Co B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   117
by (unfold Constrains_def constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   118
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   119
lemma Constrains_UNIV [iff]: "F : A Co UNIV"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   120
by (blast intro: ConstrainsI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   121
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   122
lemma Constrains_weaken_R: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   123
    "[| F : A Co A'; A'<=B' |] ==> F : A Co B'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   124
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   125
apply (blast intro: constrains_weaken_R)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   126
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   127
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   128
lemma Constrains_weaken_L: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   129
    "[| F : A Co A'; B<=A |] ==> F : B Co A'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   130
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   131
apply (blast intro: constrains_weaken_L)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   132
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   133
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   134
lemma Constrains_weaken: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   135
   "[| F : A Co A'; B<=A; A'<=B' |] ==> F : B Co B'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   136
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   137
apply (blast intro: constrains_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   138
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   139
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   140
(** Union **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   141
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   142
lemma Constrains_Un: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   143
    "[| F : A Co A'; F : B Co B' |] ==> F : (A Un B) Co (A' Un B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   144
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   145
apply (blast intro: constrains_Un [THEN constrains_weaken])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   146
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   147
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   148
lemma Constrains_UN: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   149
  assumes Co: "!!i. i:I ==> F : (A i) Co (A' i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   150
  shows "F : (UN i:I. A i) Co (UN i:I. A' i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   151
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   152
apply (rule CollectI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   153
apply (rule Co [unfolded Constrains_def, THEN CollectD, THEN constrains_UN, 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   154
                THEN constrains_weaken],   auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   155
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   156
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   157
(** Intersection **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   158
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   159
lemma Constrains_Int: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   160
    "[| F : A Co A'; F : B Co B' |] ==> F : (A Int B) Co (A' Int B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   161
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   162
apply (blast intro: constrains_Int [THEN constrains_weaken])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   163
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   164
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   165
lemma Constrains_INT: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   166
  assumes Co: "!!i. i:I ==> F : (A i) Co (A' i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   167
  shows "F : (INT i:I. A i) Co (INT i:I. A' i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   168
apply (unfold Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   169
apply (rule CollectI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   170
apply (rule Co [unfolded Constrains_def, THEN CollectD, THEN constrains_INT, 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   171
                THEN constrains_weaken],   auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   172
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   173
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   174
lemma Constrains_imp_subset: "F : A Co A' ==> reachable F Int A <= A'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   175
by (simp add: constrains_imp_subset Constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   176
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   177
lemma Constrains_trans: "[| F : A Co B; F : B Co C |] ==> F : A Co C"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   178
apply (simp add: Constrains_eq_constrains)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   179
apply (blast intro: constrains_trans constrains_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   180
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   181
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   182
lemma Constrains_cancel:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   183
     "[| F : A Co (A' Un B); F : B Co B' |] ==> F : A Co (A' Un B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   184
by (simp add: Constrains_eq_constrains constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   185
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   186
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   187
(*** Stable ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   188
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   189
(*Useful because there's no Stable_weaken.  [Tanja Vos]*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   190
lemma Stable_eq: "[| F: Stable A; A = B |] ==> F : Stable B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   191
by blast
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   192
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   193
lemma Stable_eq_stable: "(F : Stable A) = (F : stable (reachable F Int A))"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   194
by (simp add: Stable_def Constrains_eq_constrains stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   195
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   196
lemma StableI: "F : A Co A ==> F : Stable A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   197
by (unfold Stable_def, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   198
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   199
lemma StableD: "F : Stable A ==> F : A Co A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   200
by (unfold Stable_def, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   201
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   202
lemma Stable_Un: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   203
    "[| F : Stable A; F : Stable A' |] ==> F : Stable (A Un A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   204
apply (unfold Stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   205
apply (blast intro: Constrains_Un)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   206
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   207
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   208
lemma Stable_Int: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   209
    "[| F : Stable A; F : Stable A' |] ==> F : Stable (A Int A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   210
apply (unfold Stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   211
apply (blast intro: Constrains_Int)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   212
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   213
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   214
lemma Stable_Constrains_Un: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   215
    "[| F : Stable C; F : A Co (C Un A') |]    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   216
     ==> F : (C Un A) Co (C Un A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   217
apply (unfold Stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   218
apply (blast intro: Constrains_Un [THEN Constrains_weaken])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   219
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   220
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   221
lemma Stable_Constrains_Int: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   222
    "[| F : Stable C; F : (C Int A) Co A' |]    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   223
     ==> F : (C Int A) Co (C Int A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   224
apply (unfold Stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   225
apply (blast intro: Constrains_Int [THEN Constrains_weaken])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   226
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   227
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   228
lemma Stable_UN: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   229
    "(!!i. i:I ==> F : Stable (A i)) ==> F : Stable (UN i:I. A i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   230
by (simp add: Stable_def Constrains_UN) 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   231
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   232
lemma Stable_INT: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   233
    "(!!i. i:I ==> F : Stable (A i)) ==> F : Stable (INT i:I. A i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   234
by (simp add: Stable_def Constrains_INT) 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   235
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   236
lemma Stable_reachable: "F : Stable (reachable F)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   237
by (simp add: Stable_eq_stable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   238
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   239
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   240
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   241
(*** Increasing ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   242
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   243
lemma IncreasingD: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   244
     "F : Increasing f ==> F : Stable {s. x <= f s}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   245
by (unfold Increasing_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   246
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   247
lemma mono_Increasing_o: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   248
     "mono g ==> Increasing f <= Increasing (g o f)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   249
apply (simp add: Increasing_def Stable_def Constrains_def stable_def 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   250
                 constrains_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   251
apply (blast intro: monoD order_trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   252
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   253
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   254
lemma strict_IncreasingD: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   255
     "!!z::nat. F : Increasing f ==> F: Stable {s. z < f s}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   256
by (simp add: Increasing_def Suc_le_eq [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   257
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   258
lemma increasing_imp_Increasing: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   259
     "F : increasing f ==> F : Increasing f"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   260
apply (unfold increasing_def Increasing_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   261
apply (blast intro: stable_imp_Stable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   262
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   263
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   264
lemmas Increasing_constant =  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   265
    increasing_constant [THEN increasing_imp_Increasing, standard, iff]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   266
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   267
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   268
(*** The Elimination Theorem.  The "free" m has become universally quantified!
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   269
     Should the premise be !!m instead of ALL m ?  Would make it harder to use
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   270
     in forward proof. ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   271
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   272
lemma Elimination: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   273
    "[| ALL m. F : {s. s x = m} Co (B m) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   274
     ==> F : {s. s x : M} Co (UN m:M. B m)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   275
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   276
by (unfold Constrains_def constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   277
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   278
(*As above, but for the trivial case of a one-variable state, in which the
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   279
  state is identified with its one variable.*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   280
lemma Elimination_sing: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   281
    "(ALL m. F : {m} Co (B m)) ==> F : M Co (UN m:M. B m)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   282
by (unfold Constrains_def constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   283
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   284
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   285
(*** Specialized laws for handling Always ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   286
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   287
(** Natural deduction rules for "Always A" **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   288
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   289
lemma AlwaysI: "[| Init F<=A;  F : Stable A |] ==> F : Always A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   290
by (simp add: Always_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   291
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   292
lemma AlwaysD: "F : Always A ==> Init F<=A & F : Stable A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   293
by (simp add: Always_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   294
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   295
lemmas AlwaysE = AlwaysD [THEN conjE, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   296
lemmas Always_imp_Stable = AlwaysD [THEN conjunct2, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   297
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   298
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   299
(*The set of all reachable states is Always*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   300
lemma Always_includes_reachable: "F : Always A ==> reachable F <= A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   301
apply (simp add: Stable_def Constrains_def constrains_def Always_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   302
apply (rule subsetI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   303
apply (erule reachable.induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   304
apply (blast intro: reachable.intros)+
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   305
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   306
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   307
lemma invariant_imp_Always: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   308
     "F : invariant A ==> F : Always A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   309
apply (unfold Always_def invariant_def Stable_def stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   310
apply (blast intro: constrains_imp_Constrains)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   311
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   312
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   313
lemmas Always_reachable =
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   314
    invariant_reachable [THEN invariant_imp_Always, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   315
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   316
lemma Always_eq_invariant_reachable:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   317
     "Always A = {F. F : invariant (reachable F Int A)}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   318
apply (simp add: Always_def invariant_def Stable_def Constrains_eq_constrains
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   319
                 stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   320
apply (blast intro: reachable.intros)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   321
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   322
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   323
(*the RHS is the traditional definition of the "always" operator*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   324
lemma Always_eq_includes_reachable: "Always A = {F. reachable F <= A}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   325
by (auto dest: invariant_includes_reachable simp add: Int_absorb2 invariant_reachable Always_eq_invariant_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   326
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   327
lemma Always_UNIV_eq [simp]: "Always UNIV = UNIV"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   328
by (auto simp add: Always_eq_includes_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   329
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   330
lemma UNIV_AlwaysI: "UNIV <= A ==> F : Always A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   331
by (auto simp add: Always_eq_includes_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   332
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   333
lemma Always_eq_UN_invariant: "Always A = (UN I: Pow A. invariant I)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   334
apply (simp add: Always_eq_includes_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   335
apply (blast intro: invariantI Init_subset_reachable [THEN subsetD] 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   336
                    invariant_includes_reachable [THEN subsetD])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   337
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   338
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   339
lemma Always_weaken: "[| F : Always A; A <= B |] ==> F : Always B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   340
by (auto simp add: Always_eq_includes_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   341
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   342
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   343
(*** "Co" rules involving Always ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   344
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   345
lemma Always_Constrains_pre:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   346
     "F : Always INV ==> (F : (INV Int A) Co A') = (F : A Co A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   347
by (simp add: Always_includes_reachable [THEN Int_absorb2] Constrains_def 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   348
              Int_assoc [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   349
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   350
lemma Always_Constrains_post:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   351
     "F : Always INV ==> (F : A Co (INV Int A')) = (F : A Co A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   352
by (simp add: Always_includes_reachable [THEN Int_absorb2] 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   353
              Constrains_eq_constrains Int_assoc [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   354
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   355
(* [| F : Always INV;  F : (INV Int A) Co A' |] ==> F : A Co A' *)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   356
lemmas Always_ConstrainsI = Always_Constrains_pre [THEN iffD1, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   357
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   358
(* [| F : Always INV;  F : A Co A' |] ==> F : A Co (INV Int A') *)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   359
lemmas Always_ConstrainsD = Always_Constrains_post [THEN iffD2, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   360
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   361
(*The analogous proof of Always_LeadsTo_weaken doesn't terminate*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   362
lemma Always_Constrains_weaken:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   363
     "[| F : Always C;  F : A Co A';    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   364
         C Int B <= A;   C Int A' <= B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   365
      ==> F : B Co B'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   366
apply (rule Always_ConstrainsI, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   367
apply (drule Always_ConstrainsD, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   368
apply (blast intro: Constrains_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   369
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   370
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   371
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   372
(** Conjoining Always properties **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   373
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   374
lemma Always_Int_distrib: "Always (A Int B) = Always A Int Always B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   375
by (auto simp add: Always_eq_includes_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   376
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   377
lemma Always_INT_distrib: "Always (INTER I A) = (INT i:I. Always (A i))"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   378
by (auto simp add: Always_eq_includes_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   379
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   380
lemma Always_Int_I:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   381
     "[| F : Always A;  F : Always B |] ==> F : Always (A Int B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   382
by (simp add: Always_Int_distrib)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   383
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   384
(*Allows a kind of "implication introduction"*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   385
lemma Always_Compl_Un_eq:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   386
     "F : Always A ==> (F : Always (-A Un B)) = (F : Always B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   387
by (auto simp add: Always_eq_includes_reachable)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   388
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   389
(*Delete the nearest invariance assumption (which will be the second one
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   390
  used by Always_Int_I) *)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   391
lemmas Always_thin = thin_rl [of "F : Always A", standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 6823
diff changeset
   392
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
   393
end