src/HOL/UNITY/WFair.thy
author paulson
Thu, 30 Jan 2003 18:08:09 +0100
changeset 13797 baefae13ad37
parent 10834 a7897aebbffc
child 13798 4c1a53627500
permissions -rw-r--r--
conversion of 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/WFair
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
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     6
Weak Fairness versions of transient, ensures, leadsTo.
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     7
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     8
From Misra, "A Logic for Concurrent Programming", 1994
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     9
*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    10
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    11
theory WFair = UNITY:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    12
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    13
constdefs
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    14
5155
21177b8a4d7f added comments
paulson
parents: 4776
diff changeset
    15
  (*This definition specifies weak fairness.  The rest of the theory
21177b8a4d7f added comments
paulson
parents: 4776
diff changeset
    16
    is generic to all forms of fairness.*)
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5340
diff changeset
    17
  transient :: "'a set => 'a program set"
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 10797
diff changeset
    18
    "transient A == {F. EX act: Acts F. A <= Domain act & act``A <= -A}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    19
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    20
  ensures :: "['a set, 'a set] => 'a program set"       (infixl "ensures" 60)
8006
paulson
parents: 7346
diff changeset
    21
    "A ensures B == (A-B co A Un B) Int transient (A-B)"
paulson
parents: 7346
diff changeset
    22
6536
281d44905cab made many specification operators infix
paulson
parents: 5931
diff changeset
    23
281d44905cab made many specification operators infix
paulson
parents: 5931
diff changeset
    24
consts
281d44905cab made many specification operators infix
paulson
parents: 5931
diff changeset
    25
281d44905cab made many specification operators infix
paulson
parents: 5931
diff changeset
    26
  (*LEADS-TO constant for the inductive definition*)
6801
9e0037839d63 renamed the underlying relation of leadsTo from "leadsto"
paulson
parents: 6536
diff changeset
    27
  leads :: "'a program => ('a set * 'a set) set"
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5340
diff changeset
    28
6801
9e0037839d63 renamed the underlying relation of leadsTo from "leadsto"
paulson
parents: 6536
diff changeset
    29
9e0037839d63 renamed the underlying relation of leadsTo from "leadsto"
paulson
parents: 6536
diff changeset
    30
inductive "leads F"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    31
  intros 
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    32
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    33
    Basis:  "F : A ensures B ==> (A,B) : leads F"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    34
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    35
    Trans:  "[| (A,B) : leads F;  (B,C) : leads F |] ==> (A,C) : leads F"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    36
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    37
    Union:  "ALL A: S. (A,B) : leads F ==> (Union S, B) : leads F"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
5155
21177b8a4d7f added comments
paulson
parents: 4776
diff changeset
    39
8006
paulson
parents: 7346
diff changeset
    40
constdefs
6536
281d44905cab made many specification operators infix
paulson
parents: 5931
diff changeset
    41
8006
paulson
parents: 7346
diff changeset
    42
  (*visible version of the LEADS-TO relation*)
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    43
  leadsTo :: "['a set, 'a set] => 'a program set"    (infixl "leadsTo" 60)
8006
paulson
parents: 7346
diff changeset
    44
    "A leadsTo B == {F. (A,B) : leads F}"
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5340
diff changeset
    45
  
fe887910e32e specifications as sets of programs
paulson
parents: 5340
diff changeset
    46
  (*wlt F B is the largest set that leads to B*)
fe887910e32e specifications as sets of programs
paulson
parents: 5340
diff changeset
    47
  wlt :: "['a program, 'a set] => 'a set"
6536
281d44905cab made many specification operators infix
paulson
parents: 5931
diff changeset
    48
    "wlt F B == Union {A. F: A leadsTo B}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    49
9685
6d123a7e30bd xsymbols for leads-to and Join
paulson
parents: 8006
diff changeset
    50
syntax (xsymbols)
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    51
  "op leadsTo" :: "['a set, 'a set] => 'a program set" (infixl "\<longmapsto>" 60)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    52
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    53
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    54
(*** transient ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    55
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    56
lemma stable_transient_empty: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    57
    "[| F : stable A; F : transient A |] ==> A = {}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    58
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    59
by (unfold stable_def constrains_def transient_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    60
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    61
lemma transient_strengthen: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    62
    "[| F : transient A; B<=A |] ==> F : transient B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    63
apply (unfold transient_def, clarify)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    64
apply (blast intro!: rev_bexI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    65
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    66
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    67
lemma transientI: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    68
    "[| act: Acts F;  A <= Domain act;  act``A <= -A |] ==> F : transient A"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    69
by (unfold transient_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    70
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    71
lemma transientE: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    72
    "[| F : transient A;   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    73
        !!act. [| act: Acts F;  A <= Domain act;  act``A <= -A |] ==> P |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    74
     ==> P"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    75
by (unfold transient_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    76
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    77
lemma transient_UNIV [simp]: "transient UNIV = {}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    78
by (unfold transient_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    79
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    80
lemma transient_empty [simp]: "transient {} = UNIV"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    81
by (unfold transient_def, auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    82
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    83
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    84
(*** ensures ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    85
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    86
lemma ensuresI: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    87
    "[| F : (A-B) co (A Un B); F : transient (A-B) |] ==> F : A ensures B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    88
by (unfold ensures_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    89
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    90
lemma ensuresD: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    91
    "F : A ensures B ==> F : (A-B) co (A Un B) & F : transient (A-B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    92
by (unfold ensures_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    93
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    94
lemma ensures_weaken_R: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    95
    "[| F : A ensures A'; A'<=B' |] ==> F : A ensures B'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    96
apply (unfold ensures_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    97
apply (blast intro: constrains_weaken transient_strengthen)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    98
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    99
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   100
(*The L-version (precondition strengthening) fails, but we have this*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   101
lemma stable_ensures_Int: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   102
    "[| F : stable C;  F : A ensures B |]    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   103
    ==> F : (C Int A) ensures (C Int B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   104
apply (unfold ensures_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   105
apply (auto simp add: ensures_def Int_Un_distrib [symmetric] Diff_Int_distrib [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   106
prefer 2 apply (blast intro: transient_strengthen)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   107
apply (blast intro: stable_constrains_Int constrains_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   108
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   109
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   110
lemma stable_transient_ensures:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   111
     "[| F : stable A;  F : transient C;  A <= B Un C |] ==> F : A ensures B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   112
apply (simp add: ensures_def stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   113
apply (blast intro: constrains_weaken transient_strengthen)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   114
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   115
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   116
lemma ensures_eq: "(A ensures B) = (A unless B) Int transient (A-B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   117
by (simp (no_asm) add: ensures_def unless_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   118
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   119
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   120
(*** leadsTo ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   121
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   122
lemma leadsTo_Basis [intro]: "F : A ensures B ==> F : A leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   123
apply (unfold leadsTo_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   124
apply (blast intro: leads.Basis)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   125
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   126
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   127
lemma leadsTo_Trans: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   128
     "[| F : A leadsTo B;  F : B leadsTo C |] ==> F : A leadsTo C"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   129
apply (unfold leadsTo_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   130
apply (blast intro: leads.Trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   131
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   132
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   133
lemma transient_imp_leadsTo: "F : transient A ==> F : A leadsTo (-A)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   134
by (simp (no_asm_simp) add: leadsTo_Basis ensuresI Compl_partition)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   135
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   136
(*Useful with cancellation, disjunction*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   137
lemma leadsTo_Un_duplicate: "F : A leadsTo (A' Un A') ==> F : A leadsTo A'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   138
by (simp add: Un_ac)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   139
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   140
lemma leadsTo_Un_duplicate2:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   141
     "F : A leadsTo (A' Un C Un C) ==> F : A leadsTo (A' Un C)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   142
by (simp add: Un_ac)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   143
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   144
(*The Union introduction rule as we should have liked to state it*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   145
lemma leadsTo_Union: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   146
    "(!!A. A : S ==> F : A leadsTo B) ==> F : (Union S) leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   147
apply (unfold leadsTo_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   148
apply (blast intro: leads.Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   149
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   150
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   151
lemma leadsTo_Union_Int: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   152
 "(!!A. A : S ==> F : (A Int C) leadsTo B) ==> F : (Union S Int C) leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   153
apply (unfold leadsTo_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   154
apply (simp only: Int_Union_Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   155
apply (blast intro: leads.Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   156
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   157
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   158
lemma leadsTo_UN: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   159
    "(!!i. i : I ==> F : (A i) leadsTo B) ==> F : (UN i:I. A i) leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   160
apply (subst Union_image_eq [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   161
apply (blast intro: leadsTo_Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   162
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   163
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   164
(*Binary union introduction rule*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   165
lemma leadsTo_Un:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   166
     "[| F : A leadsTo C; F : B leadsTo C |] ==> F : (A Un B) leadsTo C"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   167
apply (subst Un_eq_Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   168
apply (blast intro: leadsTo_Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   169
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   170
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   171
lemma single_leadsTo_I: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   172
     "(!!x. x : A ==> F : {x} leadsTo B) ==> F : A leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   173
by (subst UN_singleton [symmetric], rule leadsTo_UN, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   174
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   175
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   176
(*The INDUCTION rule as we should have liked to state it*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   177
lemma leadsTo_induct: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   178
  "[| F : za leadsTo zb;   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   179
      !!A B. F : A ensures B ==> P A B;  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   180
      !!A B C. [| F : A leadsTo B; P A B; F : B leadsTo C; P B C |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   181
               ==> P A C;  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   182
      !!B S. ALL A:S. F : A leadsTo B & P A B ==> P (Union S) B  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   183
   |] ==> P za zb"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   184
apply (unfold leadsTo_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   185
apply (drule CollectD, erule leads.induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   186
apply (blast+)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   187
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   188
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   189
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   190
lemma subset_imp_ensures: "A<=B ==> F : A ensures B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   191
by (unfold ensures_def constrains_def transient_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   192
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   193
lemmas subset_imp_leadsTo = subset_imp_ensures [THEN leadsTo_Basis, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   194
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   195
lemmas leadsTo_refl = subset_refl [THEN subset_imp_leadsTo, standard]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   196
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   197
lemmas empty_leadsTo = empty_subsetI [THEN subset_imp_leadsTo, standard, simp]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   198
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   199
lemmas leadsTo_UNIV = subset_UNIV [THEN subset_imp_leadsTo, standard, simp]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   200
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   201
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   202
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   203
(** Variant induction rule: on the preconditions for B **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   204
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   205
(*Lemma is the weak version: can't see how to do it in one step*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   206
lemma leadsTo_induct_pre_lemma: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   207
  "[| F : za leadsTo zb;   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   208
      P zb;  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   209
      !!A B. [| F : A ensures B;  P B |] ==> P A;  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   210
      !!S. ALL A:S. P A ==> P (Union S)  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   211
   |] ==> P za"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   212
(*by induction on this formula*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   213
apply (subgoal_tac "P zb --> P za")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   214
(*now solve first subgoal: this formula is sufficient*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   215
apply (blast intro: leadsTo_refl)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   216
apply (erule leadsTo_induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   217
apply (blast+)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   218
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   219
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   220
lemma leadsTo_induct_pre: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   221
  "[| F : za leadsTo zb;   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   222
      P zb;  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   223
      !!A B. [| F : A ensures B;  F : B leadsTo zb;  P B |] ==> P A;  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   224
      !!S. ALL A:S. F : A leadsTo zb & P A ==> P (Union S)  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   225
   |] ==> P za"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   226
apply (subgoal_tac "F : za leadsTo zb & P za")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   227
apply (erule conjunct2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   228
apply (erule leadsTo_induct_pre_lemma)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   229
prefer 3 apply (blast intro: leadsTo_Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   230
prefer 2 apply (blast intro: leadsTo_Trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   231
apply (blast intro: leadsTo_refl)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   232
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   233
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   234
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   235
lemma leadsTo_weaken_R: "[| F : A leadsTo A'; A'<=B' |] ==> F : A leadsTo B'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   236
by (blast intro: subset_imp_leadsTo leadsTo_Trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   237
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   238
lemma leadsTo_weaken_L [rule_format (no_asm)]:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   239
     "[| F : A leadsTo A'; B<=A |] ==> F : B leadsTo A'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   240
by (blast intro: leadsTo_Trans subset_imp_leadsTo)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   241
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   242
(*Distributes over binary unions*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   243
lemma leadsTo_Un_distrib:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   244
     "F : (A Un B) leadsTo C  =  (F : A leadsTo C & F : B leadsTo C)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   245
by (blast intro: leadsTo_Un leadsTo_weaken_L)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   246
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   247
lemma leadsTo_UN_distrib:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   248
     "F : (UN i:I. A i) leadsTo B  =  (ALL i : I. F : (A i) leadsTo B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   249
by (blast intro: leadsTo_UN leadsTo_weaken_L)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   250
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   251
lemma leadsTo_Union_distrib:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   252
     "F : (Union S) leadsTo B  =  (ALL A : S. F : A leadsTo B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   253
by (blast intro: leadsTo_Union leadsTo_weaken_L)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   254
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   255
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   256
lemma leadsTo_weaken:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   257
     "[| F : A leadsTo A'; B<=A; A'<=B' |] ==> F : B leadsTo B'"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   258
by (blast intro: leadsTo_weaken_R leadsTo_weaken_L leadsTo_Trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   259
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   260
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   261
(*Set difference: maybe combine with leadsTo_weaken_L?*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   262
lemma leadsTo_Diff:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   263
     "[| F : (A-B) leadsTo C; F : B leadsTo C |]   ==> F : A leadsTo C"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   264
by (blast intro: leadsTo_Un leadsTo_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   265
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   266
lemma leadsTo_UN_UN:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   267
   "(!! i. i:I ==> F : (A i) leadsTo (A' i))  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   268
    ==> F : (UN i:I. A i) leadsTo (UN i:I. A' i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   269
apply (simp only: Union_image_eq [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   270
apply (blast intro: leadsTo_Union leadsTo_weaken_R)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   271
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   272
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   273
(*Binary union version*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   274
lemma leadsTo_Un_Un:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   275
     "[| F : A leadsTo A'; F : B leadsTo B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   276
      ==> F : (A Un B) leadsTo (A' Un B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   277
by (blast intro: leadsTo_Un leadsTo_weaken_R)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   278
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   279
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   280
(** The cancellation law **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   281
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   282
lemma leadsTo_cancel2:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   283
     "[| F : A leadsTo (A' Un B); F : B leadsTo B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   284
      ==> F : A leadsTo (A' Un B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   285
by (blast intro: leadsTo_Un_Un subset_imp_leadsTo leadsTo_Trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   286
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   287
lemma leadsTo_cancel_Diff2:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   288
     "[| F : A leadsTo (A' Un B); F : (B-A') leadsTo B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   289
      ==> F : A leadsTo (A' Un B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   290
apply (rule leadsTo_cancel2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   291
prefer 2 apply assumption
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   292
apply (simp_all (no_asm_simp))
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   293
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   294
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   295
lemma leadsTo_cancel1:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   296
     "[| F : A leadsTo (B Un A'); F : B leadsTo B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   297
    ==> F : A leadsTo (B' Un A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   298
apply (simp add: Un_commute)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   299
apply (blast intro!: leadsTo_cancel2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   300
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   301
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   302
lemma leadsTo_cancel_Diff1:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   303
     "[| F : A leadsTo (B Un A'); F : (B-A') leadsTo B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   304
    ==> F : A leadsTo (B' Un A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   305
apply (rule leadsTo_cancel1)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   306
prefer 2 apply assumption
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   307
apply (simp_all (no_asm_simp))
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   308
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   309
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   310
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   311
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   312
(** The impossibility law **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   313
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   314
lemma leadsTo_empty: "F : A leadsTo {} ==> A={}"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   315
apply (erule leadsTo_induct_pre)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   316
apply (simp_all add: ensures_def constrains_def transient_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   317
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   318
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   319
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   320
(** PSP: Progress-Safety-Progress **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   321
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   322
(*Special case of PSP: Misra's "stable conjunction"*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   323
lemma psp_stable: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   324
   "[| F : A leadsTo A'; F : stable B |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   325
    ==> F : (A Int B) leadsTo (A' Int B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   326
apply (unfold stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   327
apply (erule leadsTo_induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   328
prefer 3 apply (blast intro: leadsTo_Union_Int)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   329
prefer 2 apply (blast intro: leadsTo_Trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   330
apply (rule leadsTo_Basis)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   331
apply (simp add: ensures_def Diff_Int_distrib2 [symmetric] Int_Un_distrib2 [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   332
apply (blast intro: transient_strengthen constrains_Int)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   333
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   334
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   335
lemma psp_stable2: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   336
   "[| F : A leadsTo A'; F : stable B |] ==> F : (B Int A) leadsTo (B Int A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   337
by (simp add: psp_stable Int_ac)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   338
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   339
lemma psp_ensures: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   340
   "[| F : A ensures A'; F : B co B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   341
    ==> F : (A Int B') ensures ((A' Int B) Un (B' - B))"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   342
apply (unfold ensures_def constrains_def, clarify) (*speeds up the proof*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   343
apply (blast intro: transient_strengthen)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   344
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   345
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   346
lemma psp:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   347
     "[| F : A leadsTo A'; F : B co B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   348
      ==> F : (A Int B') leadsTo ((A' Int B) Un (B' - B))"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   349
apply (erule leadsTo_induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   350
  prefer 3 apply (blast intro: leadsTo_Union_Int)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   351
 txt{*Basis case*}
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   352
 apply (blast intro: psp_ensures)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   353
txt{*Transitivity case has a delicate argument involving "cancellation"*}
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   354
apply (rule leadsTo_Un_duplicate2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   355
apply (erule leadsTo_cancel_Diff1)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   356
apply (simp add: Int_Diff Diff_triv)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   357
apply (blast intro: leadsTo_weaken_L dest: constrains_imp_subset)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   358
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   359
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   360
lemma psp2:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   361
     "[| F : A leadsTo A'; F : B co B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   362
    ==> F : (B' Int A) leadsTo ((B Int A') Un (B' - B))"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   363
by (simp (no_asm_simp) add: psp Int_ac)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   364
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   365
lemma psp_unless: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   366
   "[| F : A leadsTo A';  F : B unless B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   367
    ==> F : (A Int B) leadsTo ((A' Int B) Un B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   368
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   369
apply (unfold unless_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   370
apply (drule psp, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   371
apply (blast intro: leadsTo_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   372
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   373
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   374
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   375
(*** Proving the induction rules ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   376
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   377
(** The most general rule: r is any wf relation; f is any variant function **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   378
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   379
lemma leadsTo_wf_induct_lemma:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   380
     "[| wf r;      
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   381
         ALL m. F : (A Int f-`{m}) leadsTo                      
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   382
                    ((A Int f-`(r^-1 `` {m})) Un B) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   383
      ==> F : (A Int f-`{m}) leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   384
apply (erule_tac a = m in wf_induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   385
apply (subgoal_tac "F : (A Int (f -` (r^-1 `` {x}))) leadsTo B")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   386
 apply (blast intro: leadsTo_cancel1 leadsTo_Un_duplicate)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   387
apply (subst vimage_eq_UN)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   388
apply (simp only: UN_simps [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   389
apply (blast intro: leadsTo_UN)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   390
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   391
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   392
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   393
(** Meta or object quantifier ? **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   394
lemma leadsTo_wf_induct:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   395
     "[| wf r;      
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   396
         ALL m. F : (A Int f-`{m}) leadsTo                      
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   397
                    ((A Int f-`(r^-1 `` {m})) Un B) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   398
      ==> F : A leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   399
apply (rule_tac t = A in subst)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   400
 defer 1
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   401
 apply (rule leadsTo_UN)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   402
 apply (erule leadsTo_wf_induct_lemma)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   403
 apply assumption
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   404
apply fast (*Blast_tac: Function unknown's argument not a parameter*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   405
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   406
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   407
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   408
lemma bounded_induct:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   409
     "[| wf r;      
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   410
         ALL m:I. F : (A Int f-`{m}) leadsTo                    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   411
                      ((A Int f-`(r^-1 `` {m})) Un B) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   412
      ==> F : A leadsTo ((A - (f-`I)) Un B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   413
apply (erule leadsTo_wf_induct, safe)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   414
apply (case_tac "m:I")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   415
apply (blast intro: leadsTo_weaken)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   416
apply (blast intro: subset_imp_leadsTo)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   417
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   418
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   419
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   420
(*Alternative proof is via the lemma F : (A Int f-`(lessThan m)) leadsTo B*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   421
lemma lessThan_induct: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   422
     "[| !!m::nat. F : (A Int f-`{m}) leadsTo ((A Int f-`{..m(}) Un B) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   423
      ==> F : A leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   424
apply (rule wf_less_than [THEN leadsTo_wf_induct])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   425
apply (simp (no_asm_simp))
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   426
apply blast
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   427
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   428
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   429
lemma lessThan_bounded_induct:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   430
     "!!l::nat. [| ALL m:(greaterThan l).     
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   431
            F : (A Int f-`{m}) leadsTo ((A Int f-`(lessThan m)) Un B) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   432
      ==> F : A leadsTo ((A Int (f-`(atMost l))) Un B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   433
apply (simp only: Diff_eq [symmetric] vimage_Compl Compl_greaterThan [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   434
apply (rule wf_less_than [THEN bounded_induct])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   435
apply (simp (no_asm_simp))
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   436
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   437
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   438
lemma greaterThan_bounded_induct:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   439
     "!!l::nat. [| ALL m:(lessThan l).     
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   440
            F : (A Int f-`{m}) leadsTo ((A Int f-`(greaterThan m)) Un B) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   441
      ==> F : A leadsTo ((A Int (f-`(atLeast l))) Un B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   442
apply (rule_tac f = f and f1 = "%k. l - k" 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   443
       in wf_less_than [THEN wf_inv_image, THEN leadsTo_wf_induct])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   444
apply (simp (no_asm) add: inv_image_def Image_singleton)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   445
apply clarify
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   446
apply (case_tac "m<l")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   447
prefer 2 apply (blast intro: not_leE subset_imp_leadsTo)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   448
apply (blast intro: leadsTo_weaken_R diff_less_mono2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   449
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   450
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   451
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   452
(*** wlt ****)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   453
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   454
(*Misra's property W3*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   455
lemma wlt_leadsTo: "F : (wlt F B) leadsTo B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   456
apply (unfold wlt_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   457
apply (blast intro!: leadsTo_Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   458
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   459
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   460
lemma leadsTo_subset: "F : A leadsTo B ==> A <= wlt F B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   461
apply (unfold wlt_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   462
apply (blast intro!: leadsTo_Union)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   463
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   464
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   465
(*Misra's property W2*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   466
lemma leadsTo_eq_subset_wlt: "F : A leadsTo B = (A <= wlt F B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   467
by (blast intro!: leadsTo_subset wlt_leadsTo [THEN leadsTo_weaken_L])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   468
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   469
(*Misra's property W4*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   470
lemma wlt_increasing: "B <= wlt F B"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   471
apply (simp (no_asm_simp) add: leadsTo_eq_subset_wlt [symmetric] subset_imp_leadsTo)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   472
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   473
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   474
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   475
(*Used in the Trans case below*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   476
lemma lemma1: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   477
   "[| B <= A2;   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   478
       F : (A1 - B) co (A1 Un B);  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   479
       F : (A2 - C) co (A2 Un C) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   480
    ==> F : (A1 Un A2 - C) co (A1 Un A2 Un C)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   481
by (unfold constrains_def, clarify,  blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   482
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   483
(*Lemma (1,2,3) of Misra's draft book, Chapter 4, "Progress"*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   484
lemma leadsTo_123:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   485
     "F : A leadsTo A'  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   486
      ==> EX B. A<=B & F : B leadsTo A' & F : (B-A') co (B Un A')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   487
apply (erule leadsTo_induct)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   488
(*Basis*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   489
apply (blast dest: ensuresD)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   490
(*Trans*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   491
apply clarify
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   492
apply (rule_tac x = "Ba Un Bb" in exI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   493
apply (blast intro: lemma1 leadsTo_Un_Un leadsTo_cancel1 leadsTo_Un_duplicate)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   494
(*Union*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   495
apply (clarify dest!: ball_conj_distrib [THEN iffD1] bchoice)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   496
apply (rule_tac x = "UN A:S. f A" in exI)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   497
apply (auto intro: leadsTo_UN)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   498
(*Blast_tac says PROOF FAILED*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   499
apply (rule_tac I1=S and A1="%i. f i - B" and A'1="%i. f i Un B" 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   500
       in constrains_UN [THEN constrains_weaken])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   501
apply (auto ); 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   502
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   503
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   504
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   505
(*Misra's property W5*)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   506
lemma wlt_constrains_wlt: "F : (wlt F B - B) co (wlt F B)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   507
apply (cut_tac F = F in wlt_leadsTo [THEN leadsTo_123], clarify)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   508
apply (subgoal_tac "Ba = wlt F B")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   509
prefer 2 apply (blast dest: leadsTo_eq_subset_wlt [THEN iffD1], clarify)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   510
apply (simp add: wlt_increasing Un_absorb2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   511
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   512
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   513
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   514
(*** Completion: Binary and General Finite versions ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   515
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   516
lemma completion_lemma :
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   517
     "[| W = wlt F (B' Un C);      
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   518
       F : A leadsTo (A' Un C);  F : A' co (A' Un C);    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   519
       F : B leadsTo (B' Un C);  F : B' co (B' Un C) |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   520
    ==> F : (A Int B) leadsTo ((A' Int B') Un C)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   521
apply (subgoal_tac "F : (W-C) co (W Un B' Un C) ")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   522
 prefer 2
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   523
 apply (blast intro: wlt_constrains_wlt [THEN [2] constrains_Un, 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   524
                                         THEN constrains_weaken])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   525
apply (subgoal_tac "F : (W-C) co W")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   526
 prefer 2
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   527
 apply (simp add: wlt_increasing Un_assoc Un_absorb2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   528
apply (subgoal_tac "F : (A Int W - C) leadsTo (A' Int W Un C) ")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   529
 prefer 2 apply (blast intro: wlt_leadsTo psp [THEN leadsTo_weaken])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   530
(** LEVEL 6 **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   531
apply (subgoal_tac "F : (A' Int W Un C) leadsTo (A' Int B' Un C) ")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   532
 prefer 2
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   533
 apply (rule leadsTo_Un_duplicate2)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   534
 apply (blast intro: leadsTo_Un_Un wlt_leadsTo
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   535
                         [THEN psp2, THEN leadsTo_weaken] leadsTo_refl)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   536
apply (drule leadsTo_Diff)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   537
apply (blast intro: subset_imp_leadsTo)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   538
apply (subgoal_tac "A Int B <= A Int W")
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   539
 prefer 2
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   540
 apply (blast dest!: leadsTo_subset intro!: subset_refl [THEN Int_mono])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   541
apply (blast intro: leadsTo_Trans subset_imp_leadsTo)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   542
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   543
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   544
lemmas completion = completion_lemma [OF refl]
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   545
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   546
lemma finite_completion_lemma:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   547
     "finite I ==> (ALL i:I. F : (A i) leadsTo (A' i Un C)) -->   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   548
                   (ALL i:I. F : (A' i) co (A' i Un C)) -->  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   549
                   F : (INT i:I. A i) leadsTo ((INT i:I. A' i) Un C)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   550
apply (erule finite_induct, auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   551
apply (rule completion)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   552
   prefer 4
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   553
   apply (simp only: INT_simps [symmetric])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   554
   apply (rule constrains_INT, auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   555
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   556
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   557
lemma finite_completion: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   558
     "[| finite I;   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   559
         !!i. i:I ==> F : (A i) leadsTo (A' i Un C);  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   560
         !!i. i:I ==> F : (A' i) co (A' i Un C) |]    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   561
      ==> F : (INT i:I. A i) leadsTo ((INT i:I. A' i) Un C)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   562
by (blast intro: finite_completion_lemma [THEN mp, THEN mp])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   563
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   564
lemma stable_completion: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   565
     "[| F : A leadsTo A';  F : stable A';    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   566
         F : B leadsTo B';  F : stable B' |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   567
    ==> F : (A Int B) leadsTo (A' Int B')"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   568
apply (unfold stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   569
apply (rule_tac C1 = "{}" in completion [THEN leadsTo_weaken_R])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   570
apply (force+)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   571
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   572
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   573
lemma finite_stable_completion: 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   574
     "[| finite I;   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   575
         !!i. i:I ==> F : (A i) leadsTo (A' i);  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   576
         !!i. i:I ==> F : stable (A' i) |]    
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   577
      ==> F : (INT i:I. A i) leadsTo (INT i:I. A' i)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   578
apply (unfold stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   579
apply (rule_tac C1 = "{}" in finite_completion [THEN leadsTo_weaken_R])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   580
apply (simp_all (no_asm_simp))
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   581
apply blast+
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   582
done
9685
6d123a7e30bd xsymbols for leads-to and Join
paulson
parents: 8006
diff changeset
   583
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   584
end