src/HOL/UNITY/UNITY.thy
author chaieb
Wed, 19 May 2004 11:23:59 +0200
changeset 14758 af3b71a46a1c
parent 14653 0848ab6fe5fc
child 16184 80617b8d33c5
permissions -rw-r--r--
A new implementation for presburger arithmetic following the one suggested in technical report Chaieb Amine and Tobias Nipkow. It is generic an smaller. the tactic has also changed and allows the abstaction over fuction occurences whose type is nat or int.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/UNITY
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
The basic UNITY theory (revised version, based upon the "co" operator)
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
13798
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13797
diff changeset
    11
header {*The Basic UNITY Theory*}
4c1a53627500 conversion to new-style theories and tidying
paulson
parents: 13797
diff changeset
    12
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    13
theory UNITY = Main:
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    14
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    15
typedef (Program)
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    16
  'a program = "{(init:: 'a set, acts :: ('a * 'a)set set,
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    17
		   allowed :: ('a * 'a)set set). Id \<in> acts & Id: allowed}" 
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    18
  by blast
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    19
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    20
constdefs
14653
0848ab6fe5fc constdefs: proper order;
wenzelm
parents: 14150
diff changeset
    21
  Acts :: "'a program => ('a * 'a)set set"
0848ab6fe5fc constdefs: proper order;
wenzelm
parents: 14150
diff changeset
    22
    "Acts F == (%(init, acts, allowed). acts) (Rep_Program F)"
0848ab6fe5fc constdefs: proper order;
wenzelm
parents: 14150
diff changeset
    23
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    24
  constrains :: "['a set, 'a set] => 'a program set"  (infixl "co"     60)
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    25
    "A co B == {F. \<forall>act \<in> Acts F. act``A \<subseteq> B}"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    26
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    27
  unless  :: "['a set, 'a set] => 'a program set"  (infixl "unless" 60)
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    28
    "A unless B == (A-B) co (A \<union> B)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    29
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    30
  mk_program :: "('a set * ('a * 'a)set set * ('a * 'a)set set)
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    31
		   => 'a program"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    32
    "mk_program == %(init, acts, allowed).
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    33
                      Abs_Program (init, insert Id acts, insert Id allowed)"
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    34
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    35
  Init :: "'a program => 'a set"
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    36
    "Init F == (%(init, acts, allowed). init) (Rep_Program F)"
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    37
10064
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    38
  AllowedActs :: "'a program => ('a * 'a)set set"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    39
    "AllowedActs F == (%(init, acts, allowed). allowed) (Rep_Program F)"
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    40
1a77667b21ef added compatibility relation: AllowedActs, Allowed, ok,
paulson
parents: 8948
diff changeset
    41
  Allowed :: "'a program => 'a program set"
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    42
    "Allowed F == {G. Acts G \<subseteq> AllowedActs F}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    43
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    44
  stable     :: "'a set => 'a program set"
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    45
    "stable A == A co A"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    46
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    47
  strongest_rhs :: "['a program, 'a set] => 'a set"
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    48
    "strongest_rhs F A == Inter {B. F \<in> A co B}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    49
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    50
  invariant :: "'a set => 'a program set"
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    51
    "invariant A == {F. Init F \<subseteq> A} \<inter> stable A"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    52
6713
614a76ce9bc6 increasing makes sense only for partial orderings
paulson
parents: 6536
diff changeset
    53
  increasing :: "['a => 'b::{order}] => 'a program set"
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
    54
    --{*Polymorphic in both states and the meaning of @{text "\<le>"}*}
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    55
    "increasing f == \<Inter>z. stable {s. z \<le> f s}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    56
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    57
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
    58
text{*Perhaps equalities.ML shouldn't add this in the first place!*}
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    59
declare image_Collect [simp del]
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
(*** The abstract type of programs ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    62
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    63
lemmas program_typedef =
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    64
     Rep_Program Rep_Program_inverse Abs_Program_inverse 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    65
     Program_def Init_def Acts_def AllowedActs_def mk_program_def
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    66
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    67
lemma Id_in_Acts [iff]: "Id \<in> Acts F"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    68
apply (cut_tac x = F in Rep_Program)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    69
apply (auto simp add: program_typedef) 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    70
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    71
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    72
lemma insert_Id_Acts [iff]: "insert Id (Acts F) = Acts F"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    73
by (simp add: insert_absorb Id_in_Acts)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    74
13861
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13812
diff changeset
    75
lemma Acts_nonempty [simp]: "Acts F \<noteq> {}"
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13812
diff changeset
    76
by auto
0c18f31d901a Proved the main lemma on progress sets
paulson
parents: 13812
diff changeset
    77
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
    78
lemma Id_in_AllowedActs [iff]: "Id \<in> AllowedActs F"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    79
apply (cut_tac x = F in Rep_Program)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    80
apply (auto simp add: program_typedef) 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    81
done
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
lemma insert_Id_AllowedActs [iff]: "insert Id (AllowedActs F) = AllowedActs F"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    84
by (simp add: insert_absorb Id_in_AllowedActs)
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
(** Inspectors for type "program" **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    87
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    88
lemma Init_eq [simp]: "Init (mk_program (init,acts,allowed)) = init"
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
    89
by (simp add: program_typedef)
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    90
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    91
lemma Acts_eq [simp]: "Acts (mk_program (init,acts,allowed)) = insert Id acts"
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
    92
by (simp add: program_typedef)
13797
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 AllowedActs_eq [simp]:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    95
     "AllowedActs (mk_program (init,acts,allowed)) = insert Id allowed"
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
    96
by (simp add: program_typedef)
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    97
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
    98
(** Equality for UNITY programs **)
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
lemma surjective_mk_program [simp]:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   101
     "mk_program (Init F, Acts F, AllowedActs F) = F"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   102
apply (cut_tac x = F in Rep_Program)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   103
apply (auto simp add: program_typedef)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   104
apply (drule_tac f = Abs_Program in arg_cong)+
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   105
apply (simp add: program_typedef insert_absorb)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   106
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   107
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   108
lemma program_equalityI:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   109
     "[| Init F = Init G; Acts F = Acts G; AllowedActs F = AllowedActs G |]  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   110
      ==> F = G"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   111
apply (rule_tac t = F in surjective_mk_program [THEN subst])
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   112
apply (rule_tac t = G in surjective_mk_program [THEN subst], simp)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   113
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   114
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   115
lemma program_equalityE:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   116
     "[| F = G;  
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   117
         [| Init F = Init G; Acts F = Acts G; AllowedActs F = AllowedActs G |] 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   118
         ==> P |] ==> P"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   119
by simp 
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   120
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   121
lemma program_equality_iff:
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   122
     "(F=G) =   
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   123
      (Init F = Init G & Acts F = Acts G &AllowedActs F = AllowedActs G)"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   124
by (blast intro: program_equalityI program_equalityE)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   125
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
(*** co ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   128
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   129
lemma constrainsI: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   130
    "(!!act s s'. [| act: Acts F;  (s,s') \<in> act;  s \<in> A |] ==> s': A')  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   131
     ==> F \<in> A co A'"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   132
by (simp add: constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   133
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   134
lemma constrainsD: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   135
    "[| F \<in> A co A'; act: Acts F;  (s,s'): act;  s \<in> A |] ==> s': A'"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   136
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   137
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   138
lemma constrains_empty [iff]: "F \<in> {} co B"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   139
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   140
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   141
lemma constrains_empty2 [iff]: "(F \<in> A co {}) = (A={})"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   142
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   143
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   144
lemma constrains_UNIV [iff]: "(F \<in> UNIV co B) = (B = UNIV)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   145
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   146
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   147
lemma constrains_UNIV2 [iff]: "F \<in> A co UNIV"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   148
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   149
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   150
text{*monotonic in 2nd argument*}
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   151
lemma constrains_weaken_R: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   152
    "[| F \<in> A co A'; A'<=B' |] ==> F \<in> A co B'"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   153
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   154
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   155
text{*anti-monotonic in 1st argument*}
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   156
lemma constrains_weaken_L: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   157
    "[| F \<in> A co A'; B \<subseteq> A |] ==> F \<in> B co A'"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   158
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   159
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   160
lemma constrains_weaken: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   161
   "[| F \<in> A co A'; B \<subseteq> A; A'<=B' |] ==> F \<in> B co B'"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   162
by (unfold constrains_def, blast)
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
(** Union **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   165
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   166
lemma constrains_Un: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   167
    "[| F \<in> A co A'; F \<in> B co B' |] ==> F \<in> (A \<union> B) co (A' \<union> B')"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   168
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   169
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   170
lemma constrains_UN: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   171
    "(!!i. i \<in> I ==> F \<in> (A i) co (A' i)) 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   172
     ==> F \<in> (\<Union>i \<in> I. A i) co (\<Union>i \<in> I. A' i)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   173
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   174
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   175
lemma constrains_Un_distrib: "(A \<union> B) co C = (A co C) \<inter> (B co C)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   176
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   177
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   178
lemma constrains_UN_distrib: "(\<Union>i \<in> I. A i) co B = (\<Inter>i \<in> I. A i co B)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   179
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   180
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   181
lemma constrains_Int_distrib: "C co (A \<inter> B) = (C co A) \<inter> (C co B)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   182
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   183
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   184
lemma constrains_INT_distrib: "A co (\<Inter>i \<in> I. B i) = (\<Inter>i \<in> I. A co B i)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   185
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   186
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   187
(** Intersection **)
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   188
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   189
lemma constrains_Int: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   190
    "[| F \<in> A co A'; F \<in> B co B' |] ==> F \<in> (A \<inter> B) co (A' \<inter> B')"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   191
by (unfold constrains_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
lemma constrains_INT: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   194
    "(!!i. i \<in> I ==> F \<in> (A i) co (A' i)) 
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   195
     ==> F \<in> (\<Inter>i \<in> I. A i) co (\<Inter>i \<in> I. A' i)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   196
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   197
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   198
lemma constrains_imp_subset: "F \<in> A co A' ==> A \<subseteq> A'"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   199
by (unfold constrains_def, auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   200
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   201
text{*The reasoning is by subsets since "co" refers to single actions
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   202
  only.  So this rule isn't that useful.*}
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   203
lemma constrains_trans: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   204
    "[| F \<in> A co B; F \<in> B co C |] ==> F \<in> A co C"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   205
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   206
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   207
lemma constrains_cancel: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   208
   "[| F \<in> A co (A' \<union> B); F \<in> B co B' |] ==> F \<in> A co (A' \<union> B')"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   209
by (unfold constrains_def, clarify, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   210
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   211
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   212
(*** unless ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   213
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   214
lemma unlessI: "F \<in> (A-B) co (A \<union> B) ==> F \<in> A unless B"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   215
by (unfold unless_def, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   216
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   217
lemma unlessD: "F \<in> A unless B ==> F \<in> (A-B) co (A \<union> B)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   218
by (unfold unless_def, assumption)
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
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   221
(*** stable ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   222
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   223
lemma stableI: "F \<in> A co A ==> F \<in> stable A"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   224
by (unfold stable_def, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   225
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   226
lemma stableD: "F \<in> stable A ==> F \<in> A co A"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   227
by (unfold stable_def, assumption)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   228
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   229
lemma stable_UNIV [simp]: "stable UNIV = UNIV"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   230
by (unfold stable_def constrains_def, auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   231
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   232
(** Union **)
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
lemma stable_Un: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   235
    "[| F \<in> stable A; F \<in> stable A' |] ==> F \<in> stable (A \<union> A')"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   236
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   237
apply (unfold stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   238
apply (blast intro: constrains_Un)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   239
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   240
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   241
lemma stable_UN: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   242
    "(!!i. i \<in> I ==> F \<in> stable (A i)) ==> F \<in> stable (\<Union>i \<in> I. A i)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   243
apply (unfold stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   244
apply (blast intro: constrains_UN)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   245
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   246
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   247
lemma stable_Union: 
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   248
    "(!!A. A \<in> X ==> F \<in> stable A) ==> F \<in> stable (\<Union>X)"
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   249
by (unfold stable_def constrains_def, blast)
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   250
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   251
(** Intersection **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   252
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   253
lemma stable_Int: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   254
    "[| F \<in> stable A;  F \<in> stable A' |] ==> F \<in> stable (A \<inter> A')"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   255
apply (unfold stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   256
apply (blast intro: constrains_Int)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   257
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   258
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   259
lemma stable_INT: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   260
    "(!!i. i \<in> I ==> F \<in> stable (A i)) ==> F \<in> stable (\<Inter>i \<in> I. A i)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   261
apply (unfold stable_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   262
apply (blast intro: constrains_INT)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   263
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   264
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   265
lemma stable_Inter: 
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   266
    "(!!A. A \<in> X ==> F \<in> stable A) ==> F \<in> stable (\<Inter>X)"
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   267
by (unfold stable_def constrains_def, blast)
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   268
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   269
lemma stable_constrains_Un: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   270
    "[| F \<in> stable C; F \<in> A co (C \<union> A') |] ==> F \<in> (C \<union> A) co (C \<union> A')"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   271
by (unfold stable_def constrains_def, blast)
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
lemma stable_constrains_Int: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   274
  "[| F \<in> stable C; F \<in>  (C \<inter> A) co A' |] ==> F \<in> (C \<inter> A) co (C \<inter> A')"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   275
by (unfold stable_def constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   276
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   277
(*[| F \<in> stable C; F \<in>  (C \<inter> A) co A |] ==> F \<in> stable (C \<inter> A) *)
13870
cf947d1ec5ff moved Exponent, Coset, Sylow from GroupTheory to Algebra, converting them
paulson
parents: 13861
diff changeset
   278
lemmas stable_constrains_stable = stable_constrains_Int[THEN stableI, standard]
13797
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
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   281
(*** invariant ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   282
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   283
lemma invariantI: "[| Init F \<subseteq> A;  F \<in> stable A |] ==> F \<in> invariant A"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   284
by (simp add: invariant_def)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   285
14150
9a23e4eb5eb3 A document for UNITY
paulson
parents: 13870
diff changeset
   286
text{*Could also say @{term "invariant A \<inter> invariant B \<subseteq> invariant(A \<inter> B)"}*}
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   287
lemma invariant_Int:
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   288
     "[| F \<in> invariant A;  F \<in> invariant B |] ==> F \<in> invariant (A \<inter> B)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   289
by (auto simp add: invariant_def stable_Int)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   290
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   291
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   292
(*** increasing ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   293
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   294
lemma increasingD: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   295
     "F \<in> increasing f ==> F \<in> stable {s. z \<subseteq> f s}"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   296
by (unfold increasing_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   297
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   298
lemma increasing_constant [iff]: "F \<in> increasing (%s. c)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   299
by (unfold increasing_def stable_def, auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   300
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   301
lemma mono_increasing_o: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   302
     "mono g ==> increasing f \<subseteq> increasing (g o f)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   303
apply (unfold increasing_def stable_def constrains_def, auto)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   304
apply (blast intro: monoD order_trans)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   305
done
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   306
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   307
(*Holds by the theorem (Suc m \<subseteq> n) = (m < n) *)
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   308
lemma strict_increasingD: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   309
     "!!z::nat. F \<in> increasing f ==> F \<in> stable {s. z < f s}"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   310
by (simp add: increasing_def Suc_le_eq [symmetric])
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
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   313
(** The Elimination Theorem.  The "free" m has become universally quantified!
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   314
    Should the premise be !!m instead of \<forall>m ?  Would make it harder to use
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   315
    in forward proof. **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   316
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   317
lemma elimination: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   318
    "[| \<forall>m \<in> M. F \<in> {s. s x = m} co (B m) |]  
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   319
     ==> F \<in> {s. s x \<in> M} co (\<Union>m \<in> M. B m)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   320
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   321
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   322
text{*As above, but for the trivial case of a one-variable state, in which the
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   323
  state is identified with its one variable.*}
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   324
lemma elimination_sing: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   325
    "(\<forall>m \<in> M. F \<in> {m} co (B m)) ==> F \<in> M co (\<Union>m \<in> M. B m)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   326
by (unfold constrains_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   327
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   328
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   329
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   330
(*** Theoretical Results from Section 6 ***)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   331
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   332
lemma constrains_strongest_rhs: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   333
    "F \<in> A co (strongest_rhs F A )"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   334
by (unfold constrains_def strongest_rhs_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   335
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   336
lemma strongest_rhs_is_strongest: 
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   337
    "F \<in> A co B ==> strongest_rhs F A \<subseteq> B"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   338
by (unfold constrains_def strongest_rhs_def, blast)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   339
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   340
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   341
(** Ad-hoc set-theory rules **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   342
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   343
lemma Un_Diff_Diff [simp]: "A \<union> B - (A - B) = B"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   344
by blast
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   345
13805
3786b2fd6808 some x-symbols
paulson
parents: 13798
diff changeset
   346
lemma Int_Union_Union: "Union(B) \<inter> A = Union((%C. C \<inter> A)`B)"
13797
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   347
by blast
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   348
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   349
(** Needed for WF reasoning in WFair.ML **)
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   350
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   351
lemma Image_less_than [simp]: "less_than `` {k} = greaterThan k"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   352
by blast
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   353
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   354
lemma Image_inverse_less_than [simp]: "less_than^-1 `` {k} = lessThan k"
baefae13ad37 conversion of UNITY theories to new-style
paulson
parents: 10834
diff changeset
   355
by blast
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
   356
13812
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   357
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   358
subsection{*Partial versus Total Transitions*}
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   359
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   360
constdefs
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   361
  totalize_act :: "('a * 'a)set => ('a * 'a)set"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   362
    "totalize_act act == act \<union> diag (-(Domain act))"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   363
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   364
  totalize :: "'a program => 'a program"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   365
    "totalize F == mk_program (Init F,
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   366
			       totalize_act ` Acts F,
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   367
			       AllowedActs F)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   368
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   369
  mk_total_program :: "('a set * ('a * 'a)set set * ('a * 'a)set set)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   370
		   => 'a program"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   371
    "mk_total_program args == totalize (mk_program args)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   372
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   373
  all_total :: "'a program => bool"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   374
    "all_total F == \<forall>act \<in> Acts F. Domain act = UNIV"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   375
  
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   376
lemma insert_Id_image_Acts: "f Id = Id ==> insert Id (f`Acts F) = f ` Acts F"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   377
by (blast intro: sym [THEN image_eqI])
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   378
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   379
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   380
text{*Basic properties*}
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   381
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   382
lemma totalize_act_Id [simp]: "totalize_act Id = Id"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   383
by (simp add: totalize_act_def) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   384
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   385
lemma Domain_totalize_act [simp]: "Domain (totalize_act act) = UNIV"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   386
by (auto simp add: totalize_act_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   387
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   388
lemma Init_totalize [simp]: "Init (totalize F) = Init F"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   389
by (unfold totalize_def, auto)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   390
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   391
lemma Acts_totalize [simp]: "Acts (totalize F) = (totalize_act ` Acts F)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   392
by (simp add: totalize_def insert_Id_image_Acts) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   393
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   394
lemma AllowedActs_totalize [simp]: "AllowedActs (totalize F) = AllowedActs F"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   395
by (simp add: totalize_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   396
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   397
lemma totalize_constrains_iff [simp]: "(totalize F \<in> A co B) = (F \<in> A co B)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   398
by (simp add: totalize_def totalize_act_def constrains_def, blast)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   399
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   400
lemma totalize_stable_iff [simp]: "(totalize F \<in> stable A) = (F \<in> stable A)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   401
by (simp add: stable_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   402
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   403
lemma totalize_invariant_iff [simp]:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   404
     "(totalize F \<in> invariant A) = (F \<in> invariant A)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   405
by (simp add: invariant_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   406
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   407
lemma all_total_totalize: "all_total (totalize F)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   408
by (simp add: totalize_def all_total_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   409
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   410
lemma Domain_iff_totalize_act: "(Domain act = UNIV) = (totalize_act act = act)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   411
by (force simp add: totalize_act_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   412
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   413
lemma all_total_imp_totalize: "all_total F ==> (totalize F = F)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   414
apply (simp add: all_total_def totalize_def) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   415
apply (rule program_equalityI)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   416
  apply (simp_all add: Domain_iff_totalize_act image_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   417
done
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   418
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   419
lemma all_total_iff_totalize: "all_total F = (totalize F = F)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   420
apply (rule iffI) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   421
 apply (erule all_total_imp_totalize) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   422
apply (erule subst) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   423
apply (rule all_total_totalize) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   424
done
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   425
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   426
lemma mk_total_program_constrains_iff [simp]:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   427
     "(mk_total_program args \<in> A co B) = (mk_program args \<in> A co B)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   428
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   429
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   430
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   431
subsection{*Rules for Lazy Definition Expansion*}
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   432
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   433
text{*They avoid expanding the full program, which is a large expression*}
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   434
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   435
lemma def_prg_Init:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   436
     "F == mk_total_program (init,acts,allowed) ==> Init F = init"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   437
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   438
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   439
lemma def_prg_Acts:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   440
     "F == mk_total_program (init,acts,allowed) 
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   441
      ==> Acts F = insert Id (totalize_act ` acts)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   442
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   443
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   444
lemma def_prg_AllowedActs:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   445
     "F == mk_total_program (init,acts,allowed)  
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   446
      ==> AllowedActs F = insert Id allowed"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   447
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   448
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   449
text{*An action is expanded if a pair of states is being tested against it*}
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   450
lemma def_act_simp:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   451
     "act == {(s,s'). P s s'} ==> ((s,s') \<in> act) = P s s'"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   452
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   453
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   454
text{*A set is expanded only if an element is being tested against it*}
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   455
lemma def_set_simp: "A == B ==> (x \<in> A) = (x \<in> B)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   456
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   457
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   458
(** Inspectors for type "program" **)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   459
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   460
lemma Init_total_eq [simp]:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   461
     "Init (mk_total_program (init,acts,allowed)) = init"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   462
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   463
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   464
lemma Acts_total_eq [simp]:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   465
    "Acts(mk_total_program(init,acts,allowed)) = insert Id (totalize_act`acts)"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   466
by (simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   467
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   468
lemma AllowedActs_total_eq [simp]:
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   469
     "AllowedActs (mk_total_program (init,acts,allowed)) = insert Id allowed"
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   470
by (auto simp add: mk_total_program_def)
91713a1915ee converting HOL/UNITY to use unconditional fairness
paulson
parents: 13805
diff changeset
   471
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   472
end