src/HOL/UNITY/SubstAx.thy
author paulson
Thu, 30 Jan 2003 10:35:56 +0100
changeset 13796 19f50fa807ae
parent 9685 6d123a7e30bd
child 13798 4c1a53627500
permissions -rw-r--r--
converting more UNITY theories to new-style
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/SubstAx
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     5
6536
281d44905cab made many specification operators infix
paulson
parents: 5648
diff changeset
     6
Weak LeadsTo relation (restricted to the set of reachable states)
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     7
*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     8
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
     9
theory SubstAx = WFair + Constrains:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    10
8041
e3237d8c18d6 working version with new theory ELT
paulson
parents: 6575
diff changeset
    11
constdefs
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    12
   Ensures :: "['a set, 'a set] => 'a program set"    (infixl "Ensures" 60)
8122
b43ad07660b9 working version, with Alloc now working on the same state space as the whole
paulson
parents: 8041
diff changeset
    13
    "A Ensures B == {F. F : (reachable F Int A) ensures B}"
b43ad07660b9 working version, with Alloc now working on the same state space as the whole
paulson
parents: 8041
diff changeset
    14
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    15
   LeadsTo :: "['a set, 'a set] => 'a program set"    (infixl "LeadsTo" 60)
8041
e3237d8c18d6 working version with new theory ELT
paulson
parents: 6575
diff changeset
    16
    "A LeadsTo B == {F. F : (reachable F Int A) leadsTo B}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    17
9685
6d123a7e30bd xsymbols for leads-to and Join
paulson
parents: 8122
diff changeset
    18
syntax (xsymbols)
13796
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    19
  "op LeadsTo" :: "['a set, 'a set] => 'a program set" (infixl " \<longmapsto>w " 60)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    20
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    21
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    22
(*Resembles the previous definition of LeadsTo*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    23
lemma LeadsTo_eq_leadsTo: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    24
     "A LeadsTo B = {F. F : (reachable F Int A) leadsTo (reachable F Int B)}"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    25
apply (unfold LeadsTo_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    26
apply (blast dest: psp_stable2 intro: leadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    27
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    28
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    29
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    30
(*** Specialized laws for handling invariants ***)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    31
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    32
(** Conjoining an Always property **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    33
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    34
lemma Always_LeadsTo_pre:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    35
     "F : Always INV ==> (F : (INV Int A) LeadsTo A') = (F : A LeadsTo A')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    36
by (simp add: LeadsTo_def Always_eq_includes_reachable Int_absorb2 Int_assoc [symmetric])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    37
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    38
lemma Always_LeadsTo_post:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    39
     "F : Always INV ==> (F : A LeadsTo (INV Int A')) = (F : A LeadsTo A')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    40
by (simp add: LeadsTo_eq_leadsTo Always_eq_includes_reachable Int_absorb2 Int_assoc [symmetric])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    41
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    42
(* [| F : Always C;  F : (C Int A) LeadsTo A' |] ==> F : A LeadsTo A' *)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    43
lemmas Always_LeadsToI = Always_LeadsTo_pre [THEN iffD1, standard]
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    44
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    45
(* [| F : Always INV;  F : A LeadsTo A' |] ==> F : A LeadsTo (INV Int A') *)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    46
lemmas Always_LeadsToD = Always_LeadsTo_post [THEN iffD2, standard]
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    47
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    48
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    49
(*** Introduction rules: Basis, Trans, Union ***)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    50
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    51
lemma leadsTo_imp_LeadsTo: "F : A leadsTo B ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    52
apply (simp add: LeadsTo_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    53
apply (blast intro: leadsTo_weaken_L)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    54
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    55
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    56
lemma LeadsTo_Trans:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    57
     "[| F : A LeadsTo B;  F : B LeadsTo C |] ==> F : A LeadsTo C"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    58
apply (simp add: LeadsTo_eq_leadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    59
apply (blast intro: leadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    60
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    61
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    62
lemma LeadsTo_Union: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    63
     "(!!A. A : S ==> F : A LeadsTo B) ==> F : (Union S) LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    64
apply (simp add: LeadsTo_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    65
apply (subst Int_Union)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    66
apply (blast intro: leadsTo_UN)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    67
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    68
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    69
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    70
(*** Derived rules ***)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    71
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    72
lemma LeadsTo_UNIV [simp]: "F : A LeadsTo UNIV"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    73
by (simp add: LeadsTo_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    74
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    75
(*Useful with cancellation, disjunction*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    76
lemma LeadsTo_Un_duplicate:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    77
     "F : A LeadsTo (A' Un A') ==> F : A LeadsTo A'"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    78
by (simp add: Un_ac)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    79
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    80
lemma LeadsTo_Un_duplicate2:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    81
     "F : A LeadsTo (A' Un C Un C) ==> F : A LeadsTo (A' Un C)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    82
by (simp add: Un_ac)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    83
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    84
lemma LeadsTo_UN: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    85
     "(!!i. i : I ==> F : (A i) LeadsTo B) ==> F : (UN i:I. A i) LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    86
apply (simp only: Union_image_eq [symmetric])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    87
apply (blast intro: LeadsTo_Union)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    88
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    89
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    90
(*Binary union introduction rule*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    91
lemma LeadsTo_Un:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    92
     "[| F : A LeadsTo C; F : B LeadsTo C |] ==> F : (A Un B) LeadsTo C"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    93
apply (subst Un_eq_Union)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    94
apply (blast intro: LeadsTo_Union)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    95
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    96
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    97
(*Lets us look at the starting state*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    98
lemma single_LeadsTo_I:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
    99
     "(!!s. s : A ==> F : {s} LeadsTo B) ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   100
by (subst UN_singleton [symmetric], rule LeadsTo_UN, blast)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   101
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   102
lemma subset_imp_LeadsTo: "A <= B ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   103
apply (simp add: LeadsTo_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   104
apply (blast intro: subset_imp_leadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   105
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   106
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   107
lemmas empty_LeadsTo = empty_subsetI [THEN subset_imp_LeadsTo, standard, simp]
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   108
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   109
lemma LeadsTo_weaken_R [rule_format]:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   110
     "[| F : A LeadsTo A';  A' <= B' |] ==> F : A LeadsTo B'"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   111
apply (simp (no_asm_use) add: LeadsTo_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   112
apply (blast intro: leadsTo_weaken_R)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   113
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   114
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   115
lemma LeadsTo_weaken_L [rule_format]:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   116
     "[| F : A LeadsTo A';  B <= A |]   
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   117
      ==> F : B LeadsTo A'"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   118
apply (simp (no_asm_use) add: LeadsTo_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   119
apply (blast intro: leadsTo_weaken_L)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   120
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   121
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   122
lemma LeadsTo_weaken:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   123
     "[| F : A LeadsTo A';    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   124
         B  <= A;   A' <= B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   125
      ==> F : B LeadsTo B'"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   126
by (blast intro: LeadsTo_weaken_R LeadsTo_weaken_L LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   127
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   128
lemma Always_LeadsTo_weaken:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   129
     "[| F : Always C;  F : A LeadsTo A';    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   130
         C Int B <= A;   C Int A' <= B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   131
      ==> F : B LeadsTo B'"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   132
by (blast dest: Always_LeadsToI intro: LeadsTo_weaken intro: Always_LeadsToD)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   133
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   134
(** Two theorems for "proof lattices" **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   135
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   136
lemma LeadsTo_Un_post: "F : A LeadsTo B ==> F : (A Un B) LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   137
by (blast intro: LeadsTo_Un subset_imp_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   138
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   139
lemma LeadsTo_Trans_Un:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   140
     "[| F : A LeadsTo B;  F : B LeadsTo C |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   141
      ==> F : (A Un B) LeadsTo C"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   142
by (blast intro: LeadsTo_Un subset_imp_LeadsTo LeadsTo_weaken_L LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   143
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   144
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   145
(** Distributive laws **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   146
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   147
lemma LeadsTo_Un_distrib:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   148
     "(F : (A Un B) LeadsTo C)  = (F : A LeadsTo C & F : B LeadsTo C)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   149
by (blast intro: LeadsTo_Un LeadsTo_weaken_L)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   150
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   151
lemma LeadsTo_UN_distrib:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   152
     "(F : (UN i:I. A i) LeadsTo B)  =  (ALL i : I. F : (A i) LeadsTo B)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   153
by (blast intro: LeadsTo_UN LeadsTo_weaken_L)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   154
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   155
lemma LeadsTo_Union_distrib:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   156
     "(F : (Union S) LeadsTo B)  =  (ALL A : S. F : A LeadsTo B)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   157
by (blast intro: LeadsTo_Union LeadsTo_weaken_L)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   158
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   159
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   160
(** More rules using the premise "Always INV" **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   161
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   162
lemma LeadsTo_Basis: "F : A Ensures B ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   163
by (simp add: Ensures_def LeadsTo_def leadsTo_Basis)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   164
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   165
lemma EnsuresI:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   166
     "[| F : (A-B) Co (A Un B);  F : transient (A-B) |]    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   167
      ==> F : A Ensures B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   168
apply (simp add: Ensures_def Constrains_eq_constrains)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   169
apply (blast intro: ensuresI constrains_weaken transient_strengthen)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   170
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   171
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   172
lemma Always_LeadsTo_Basis:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   173
     "[| F : Always INV;       
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   174
         F : (INV Int (A-A')) Co (A Un A');  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   175
         F : transient (INV Int (A-A')) |]    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   176
  ==> F : A LeadsTo A'"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   177
apply (rule Always_LeadsToI, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   178
apply (blast intro: EnsuresI LeadsTo_Basis Always_ConstrainsD [THEN Constrains_weaken] transient_strengthen)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   179
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   180
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   181
(*Set difference: maybe combine with leadsTo_weaken_L??
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   182
  This is the most useful form of the "disjunction" rule*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   183
lemma LeadsTo_Diff:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   184
     "[| F : (A-B) LeadsTo C;  F : (A Int B) LeadsTo C |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   185
      ==> F : A LeadsTo C"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   186
by (blast intro: LeadsTo_Un LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   187
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   188
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   189
lemma LeadsTo_UN_UN: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   190
     "(!! i. i:I ==> F : (A i) LeadsTo (A' i))  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   191
      ==> F : (UN i:I. A i) LeadsTo (UN i:I. A' i)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   192
apply (simp only: Union_image_eq [symmetric])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   193
apply (blast intro: LeadsTo_Union LeadsTo_weaken_R)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   194
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   195
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   196
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   197
(*Version with no index set*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   198
lemma LeadsTo_UN_UN_noindex: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   199
     "(!! i. F : (A i) LeadsTo (A' i))  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   200
      ==> F : (UN i. A i) LeadsTo (UN i. A' i)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   201
by (blast intro: LeadsTo_UN_UN)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   202
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   203
(*Version with no index set*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   204
lemma all_LeadsTo_UN_UN:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   205
     "ALL i. F : (A i) LeadsTo (A' i)  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   206
      ==> F : (UN i. A i) LeadsTo (UN i. A' i)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   207
by (blast intro: LeadsTo_UN_UN)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   208
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   209
(*Binary union version*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   210
lemma LeadsTo_Un_Un:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   211
     "[| F : A LeadsTo A'; F : B LeadsTo B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   212
            ==> F : (A Un B) LeadsTo (A' Un B')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   213
by (blast intro: LeadsTo_Un LeadsTo_weaken_R)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   214
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   215
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   216
(** The cancellation law **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   217
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   218
lemma LeadsTo_cancel2:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   219
     "[| F : A LeadsTo (A' Un B); F : B LeadsTo B' |]     
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   220
      ==> F : A LeadsTo (A' Un B')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   221
by (blast intro: LeadsTo_Un_Un subset_imp_LeadsTo LeadsTo_Trans)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   222
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   223
lemma LeadsTo_cancel_Diff2:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   224
     "[| F : A LeadsTo (A' Un B); F : (B-A') LeadsTo B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   225
      ==> F : A LeadsTo (A' Un B')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   226
apply (rule LeadsTo_cancel2)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   227
prefer 2 apply assumption
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   228
apply (simp_all (no_asm_simp))
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   229
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   230
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   231
lemma LeadsTo_cancel1:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   232
     "[| F : A LeadsTo (B Un A'); F : B LeadsTo B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   233
      ==> F : A LeadsTo (B' Un A')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   234
apply (simp add: Un_commute)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   235
apply (blast intro!: LeadsTo_cancel2)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   236
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   237
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   238
lemma LeadsTo_cancel_Diff1:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   239
     "[| F : A LeadsTo (B Un A'); F : (B-A') LeadsTo B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   240
      ==> F : A LeadsTo (B' Un A')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   241
apply (rule LeadsTo_cancel1)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   242
prefer 2 apply assumption
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   243
apply (simp_all (no_asm_simp))
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   244
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   245
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   246
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   247
(** The impossibility law **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   248
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   249
(*The set "A" may be non-empty, but it contains no reachable states*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   250
lemma LeadsTo_empty: "F : A LeadsTo {} ==> F : Always (-A)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   251
apply (simp (no_asm_use) add: LeadsTo_def Always_eq_includes_reachable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   252
apply (drule leadsTo_empty, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   253
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   254
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   255
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   256
(** PSP: Progress-Safety-Progress **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   257
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   258
(*Special case of PSP: Misra's "stable conjunction"*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   259
lemma PSP_Stable:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   260
     "[| F : A LeadsTo A';  F : Stable B |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   261
      ==> F : (A Int B) LeadsTo (A' Int B)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   262
apply (simp (no_asm_use) add: LeadsTo_eq_leadsTo Stable_eq_stable)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   263
apply (drule psp_stable, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   264
apply (simp add: Int_ac)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   265
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   266
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   267
lemma PSP_Stable2:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   268
     "[| F : A LeadsTo A'; F : Stable B |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   269
      ==> F : (B Int A) LeadsTo (B Int A')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   270
by (simp add: PSP_Stable Int_ac)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   271
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   272
lemma PSP:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   273
     "[| F : A LeadsTo A'; F : B Co B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   274
      ==> F : (A Int B') LeadsTo ((A' Int B) Un (B' - B))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   275
apply (simp (no_asm_use) add: LeadsTo_def Constrains_eq_constrains)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   276
apply (blast dest: psp intro: leadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   277
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   278
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   279
lemma PSP2:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   280
     "[| F : A LeadsTo A'; F : B Co B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   281
      ==> F : (B' Int A) LeadsTo ((B Int A') Un (B' - B))"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   282
by (simp add: PSP Int_ac)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   283
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   284
lemma PSP_Unless: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   285
     "[| F : A LeadsTo A'; F : B Unless B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   286
      ==> F : (A Int B) LeadsTo ((A' Int B) Un B')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   287
apply (unfold Unless_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   288
apply (drule PSP, assumption)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   289
apply (blast intro: LeadsTo_Diff LeadsTo_weaken subset_imp_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   290
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   291
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   292
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   293
lemma Stable_transient_Always_LeadsTo:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   294
     "[| F : Stable A;  F : transient C;   
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   295
         F : Always (-A Un B Un C) |] ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   296
apply (erule Always_LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   297
apply (rule LeadsTo_Diff)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   298
   prefer 2
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   299
   apply (erule
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   300
          transient_imp_leadsTo [THEN leadsTo_imp_LeadsTo, THEN PSP_Stable2])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   301
   apply (blast intro: subset_imp_LeadsTo)+
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   302
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   303
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   304
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   305
(*** Induction rules ***)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   306
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   307
(** Meta or object quantifier ????? **)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   308
lemma LeadsTo_wf_induct:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   309
     "[| wf r;      
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   310
         ALL m. F : (A Int f-`{m}) LeadsTo                      
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   311
                            ((A Int f-`(r^-1 `` {m})) Un B) |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   312
      ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   313
apply (simp (no_asm_use) add: LeadsTo_eq_leadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   314
apply (erule leadsTo_wf_induct)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   315
apply (blast intro: leadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   316
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   317
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   318
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   319
lemma Bounded_induct:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   320
     "[| wf r;      
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   321
         ALL m:I. F : (A Int f-`{m}) LeadsTo                    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   322
                              ((A Int f-`(r^-1 `` {m})) Un B) |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   323
      ==> F : A LeadsTo ((A - (f-`I)) Un B)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   324
apply (erule LeadsTo_wf_induct, safe)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   325
apply (case_tac "m:I")
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   326
apply (blast intro: LeadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   327
apply (blast intro: subset_imp_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   328
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   329
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   330
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   331
lemma LessThan_induct:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   332
     "(!!m::nat. F : (A Int f-`{m}) LeadsTo ((A Int f-`(lessThan m)) Un B))  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   333
      ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   334
apply (rule wf_less_than [THEN LeadsTo_wf_induct], auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   335
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   336
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   337
(*Integer version.  Could generalize from 0 to any lower bound*)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   338
lemma integ_0_le_induct:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   339
     "[| F : Always {s. (0::int) <= f s};   
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   340
         !! z. F : (A Int {s. f s = z}) LeadsTo                      
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   341
                            ((A Int {s. f s < z}) Un B) |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   342
      ==> F : A LeadsTo B"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   343
apply (rule_tac f = "nat o f" in LessThan_induct)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   344
apply (simp add: vimage_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   345
apply (rule Always_LeadsTo_weaken, assumption+)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   346
apply (auto simp add: nat_eq_iff nat_less_iff)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   347
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   348
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   349
lemma LessThan_bounded_induct:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   350
     "!!l::nat. [| ALL m:(greaterThan l). F : (A Int f-`{m}) LeadsTo    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   351
                                         ((A Int f-`(lessThan m)) Un B) |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   352
            ==> F : A LeadsTo ((A Int (f-`(atMost l))) Un B)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   353
apply (simp only: Diff_eq [symmetric] vimage_Compl Compl_greaterThan [symmetric])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   354
apply (rule wf_less_than [THEN Bounded_induct])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   355
apply (simp (no_asm_simp))
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   356
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   357
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   358
lemma GreaterThan_bounded_induct:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   359
     "!!l::nat. [| ALL m:(lessThan l). F : (A Int f-`{m}) LeadsTo    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   360
                               ((A Int f-`(greaterThan m)) Un B) |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   361
      ==> F : A LeadsTo ((A Int (f-`(atLeast l))) Un B)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   362
apply (rule_tac f = f and f1 = "%k. l - k" 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   363
       in wf_less_than [THEN wf_inv_image, THEN LeadsTo_wf_induct])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   364
apply (simp add: inv_image_def Image_singleton, clarify)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   365
apply (case_tac "m<l")
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   366
 prefer 2 apply (blast intro: not_leE subset_imp_LeadsTo)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   367
apply (blast intro: LeadsTo_weaken_R diff_less_mono2)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   368
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   369
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   370
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   371
(*** Completion: Binary and General Finite versions ***)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   372
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   373
lemma Completion:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   374
     "[| F : A LeadsTo (A' Un C);  F : A' Co (A' Un C);  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   375
         F : B LeadsTo (B' Un C);  F : B' Co (B' Un C) |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   376
      ==> F : (A Int B) LeadsTo ((A' Int B') Un C)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   377
apply (simp (no_asm_use) add: LeadsTo_eq_leadsTo Constrains_eq_constrains Int_Un_distrib)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   378
apply (blast intro: completion leadsTo_weaken)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   379
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   380
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   381
lemma Finite_completion_lemma:
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   382
     "finite I  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   383
      ==> (ALL i:I. F : (A i) LeadsTo (A' i Un C)) -->   
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   384
          (ALL i:I. F : (A' i) Co (A' i Un C)) -->  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   385
          F : (INT i:I. A i) LeadsTo ((INT i:I. A' i) Un C)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   386
apply (erule finite_induct, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   387
apply (rule Completion)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   388
   prefer 4
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   389
   apply (simp only: INT_simps [symmetric])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   390
   apply (rule Constrains_INT, auto)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   391
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   392
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   393
lemma Finite_completion: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   394
     "[| finite I;   
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   395
         !!i. i:I ==> F : (A i) LeadsTo (A' i Un C);  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   396
         !!i. i:I ==> F : (A' i) Co (A' i Un C) |]    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   397
      ==> F : (INT i:I. A i) LeadsTo ((INT i:I. A' i) Un C)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   398
by (blast intro: Finite_completion_lemma [THEN mp, THEN mp])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   399
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   400
lemma Stable_completion: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   401
     "[| F : A LeadsTo A';  F : Stable A';    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   402
         F : B LeadsTo B';  F : Stable B' |]  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   403
      ==> F : (A Int B) LeadsTo (A' Int B')"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   404
apply (unfold Stable_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   405
apply (rule_tac C1 = "{}" in Completion [THEN LeadsTo_weaken_R])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   406
apply (force+)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   407
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   408
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   409
lemma Finite_stable_completion: 
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   410
     "[| finite I;   
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   411
         !!i. i:I ==> F : (A i) LeadsTo (A' i);  
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   412
         !!i. i:I ==> F : Stable (A' i) |]    
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   413
      ==> F : (INT i:I. A i) LeadsTo (INT i:I. A' i)"
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   414
apply (unfold Stable_def)
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   415
apply (rule_tac C1 = "{}" in Finite_completion [THEN LeadsTo_weaken_R])
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   416
apply (simp_all (no_asm_simp))
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   417
apply blast+
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   418
done
19f50fa807ae converting more UNITY theories to new-style
paulson
parents: 9685
diff changeset
   419
9685
6d123a7e30bd xsymbols for leads-to and Join
paulson
parents: 8122
diff changeset
   420
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   421
end