src/ZF/UNITY/UNITY.thy
author wenzelm
Mon, 07 Dec 2015 10:23:50 +0100
changeset 61798 27f3c10b0b50
parent 61392 331be2820f90
child 67443 3abf6a722518
permissions -rw-r--r--
isabelle update_cartouches -c -t;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      ZF/UNITY/UNITY.thy
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     2
    Author:     Sidi O Ehmety, Computer Laboratory
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     3
    Copyright   2001  University of Cambridge
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     4
*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     5
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
     6
section \<open>The Basic UNITY Theory\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
     7
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 16183
diff changeset
     8
theory UNITY imports State begin
16183
052d9aba392d renamed "constrains" to "safety" to avoid keyword clash
paulson
parents: 14077
diff changeset
     9
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    10
text\<open>The basic UNITY theory (revised version, based upon the "co" operator)
16183
052d9aba392d renamed "constrains" to "safety" to avoid keyword clash
paulson
parents: 14077
diff changeset
    11
From Misra, "A Logic for Concurrent Programming", 1994.
052d9aba392d renamed "constrains" to "safety" to avoid keyword clash
paulson
parents: 14077
diff changeset
    12
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    13
This ZF theory was ported from its HOL equivalent.\<close>
16183
052d9aba392d renamed "constrains" to "safety" to avoid keyword clash
paulson
parents: 14077
diff changeset
    14
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    15
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    16
  program  :: i  where
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    17
  "program == {<init, acts, allowed>:
32960
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 24893
diff changeset
    18
               Pow(state) * Pow(Pow(state*state)) * Pow(Pow(state*state)).
69916a850301 eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents: 24893
diff changeset
    19
               id(state) \<in> acts & id(state) \<in> allowed}"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    20
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    21
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    22
  mk_program :: "[i,i,i]=>i"  where
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61392
diff changeset
    23
  \<comment>\<open>The definition yields a program thanks to the coercions
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
    24
       init \<inter> state, acts \<inter> Pow(state*state), etc.\<close>
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    25
  "mk_program(init, acts, allowed) ==
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    26
    <init \<inter> state, cons(id(state), acts \<inter> Pow(state*state)),
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    27
              cons(id(state), allowed \<inter> Pow(state*state))>"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    28
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    29
definition
61392
331be2820f90 tuned syntax -- more symbols;
wenzelm
parents: 61083
diff changeset
    30
  SKIP :: i  ("\<bottom>") where
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    31
  "SKIP == mk_program(state, 0, Pow(state*state))"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    32
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    33
  (* Coercion from anything to program *)
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    34
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    35
  programify :: "i=>i"  where
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    36
  "programify(F) == if F \<in> program then F else SKIP"
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    37
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    38
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    39
  RawInit :: "i=>i"  where
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    40
  "RawInit(F) == fst(F)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    41
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    42
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    43
  Init :: "i=>i"  where
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    44
  "Init(F) == RawInit(programify(F))"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    45
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    46
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    47
  RawActs :: "i=>i"  where
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    48
  "RawActs(F) == cons(id(state), fst(snd(F)))"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    49
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    50
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    51
  Acts :: "i=>i"  where
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    52
  "Acts(F) == RawActs(programify(F))"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    53
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    54
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    55
  RawAllowedActs :: "i=>i"  where
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    56
  "RawAllowedActs(F) == cons(id(state), snd(snd(F)))"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    57
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    58
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    59
  AllowedActs :: "i=>i"  where
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    60
  "AllowedActs(F) == RawAllowedActs(programify(F))"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    61
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    62
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    63
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    64
  Allowed :: "i =>i"  where
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    65
  "Allowed(F) == {G \<in> program. Acts(G) \<subseteq> AllowedActs(F)}"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    66
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    67
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    68
  initially :: "i=>i"  where
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    69
  "initially(A) == {F \<in> program. Init(F)\<subseteq>A}"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    70
61083
896989117ce0 eliminated old 'defs';
wenzelm
parents: 60770
diff changeset
    71
definition "constrains" :: "[i, i] => i"  (infixl "co" 60)  where
896989117ce0 eliminated old 'defs';
wenzelm
parents: 60770
diff changeset
    72
  "A co B == {F \<in> program. (\<forall>act \<in> Acts(F). act``A\<subseteq>B) & st_set(A)}"
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61392
diff changeset
    73
    \<comment>\<open>the condition @{term "st_set(A)"} makes the definition slightly
61083
896989117ce0 eliminated old 'defs';
wenzelm
parents: 60770
diff changeset
    74
         stronger than the HOL one\<close>
896989117ce0 eliminated old 'defs';
wenzelm
parents: 60770
diff changeset
    75
896989117ce0 eliminated old 'defs';
wenzelm
parents: 60770
diff changeset
    76
definition unless :: "[i, i] => i"  (infixl "unless" 60)  where
896989117ce0 eliminated old 'defs';
wenzelm
parents: 60770
diff changeset
    77
  "A unless B == (A - B) co (A \<union> B)"
896989117ce0 eliminated old 'defs';
wenzelm
parents: 60770
diff changeset
    78
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    79
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    80
  stable     :: "i=>i"  where
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    81
   "stable(A) == A co A"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    82
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    83
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    84
  strongest_rhs :: "[i, i] => i"  where
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
    85
  "strongest_rhs(F, A) == \<Inter>({B \<in> Pow(state). F \<in> A co B})"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    86
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    87
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    88
  invariant :: "i => i"  where
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    89
  "invariant(A) == initially(A) \<inter> stable(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    90
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12195
diff changeset
    91
  (* meta-function composition *)
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    92
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    93
  metacomp :: "[i=>i, i=>i] => (i=>i)" (infixl "comp" 65)  where
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12195
diff changeset
    94
  "f comp g == %x. f(g(x))"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    95
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    96
definition
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
    97
  pg_compl :: "i=>i"  where
14046
6616e6c53d48 updating ZF-UNITY with Sidi's new material
paulson
parents: 12195
diff changeset
    98
  "pg_compl(X)== program - X"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
    99
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   100
text\<open>SKIP\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   101
lemma SKIP_in_program [iff,TC]: "SKIP \<in> program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   102
by (force simp add: SKIP_def program_def mk_program_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   103
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   104
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   105
subsection\<open>The function @{term programify}, the coercion from anything to
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   106
 program\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   107
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   108
lemma programify_program [simp]: "F \<in> program ==> programify(F)=F"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   109
by (force simp add: programify_def) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   110
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   111
lemma programify_in_program [iff,TC]: "programify(F) \<in> program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   112
by (force simp add: programify_def) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   113
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   114
text\<open>Collapsing rules: to remove programify from expressions\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   115
lemma programify_idem [simp]: "programify(programify(F))=programify(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   116
by (force simp add: programify_def) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   117
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   118
lemma Init_programify [simp]: "Init(programify(F)) = Init(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   119
by (simp add: Init_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   120
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   121
lemma Acts_programify [simp]: "Acts(programify(F)) = Acts(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   122
by (simp add: Acts_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   123
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   124
lemma AllowedActs_programify [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   125
     "AllowedActs(programify(F)) = AllowedActs(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   126
by (simp add: AllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   127
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   128
subsection\<open>The Inspectors for Programs\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   129
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   130
lemma id_in_RawActs: "F \<in> program ==>id(state) \<in> RawActs(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   131
by (auto simp add: program_def RawActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   132
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   133
lemma id_in_Acts [iff,TC]: "id(state) \<in> Acts(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   134
by (simp add: id_in_RawActs Acts_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   135
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   136
lemma id_in_RawAllowedActs: "F \<in> program ==>id(state) \<in> RawAllowedActs(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   137
by (auto simp add: program_def RawAllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   138
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   139
lemma id_in_AllowedActs [iff,TC]: "id(state) \<in> AllowedActs(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   140
by (simp add: id_in_RawAllowedActs AllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   141
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   142
lemma cons_id_Acts [simp]: "cons(id(state), Acts(F)) = Acts(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   143
by (simp add: cons_absorb)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   144
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   145
lemma cons_id_AllowedActs [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   146
     "cons(id(state), AllowedActs(F)) = AllowedActs(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   147
by (simp add: cons_absorb)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   148
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   149
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   150
subsection\<open>Types of the Inspectors\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   151
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   152
lemma RawInit_type: "F \<in> program ==> RawInit(F)\<subseteq>state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   153
by (auto simp add: program_def RawInit_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   154
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   155
lemma RawActs_type: "F \<in> program ==> RawActs(F)\<subseteq>Pow(state*state)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   156
by (auto simp add: program_def RawActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   157
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   158
lemma RawAllowedActs_type:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   159
     "F \<in> program ==> RawAllowedActs(F)\<subseteq>Pow(state*state)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   160
by (auto simp add: program_def RawAllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   161
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   162
lemma Init_type: "Init(F)\<subseteq>state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   163
by (simp add: RawInit_type Init_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   164
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 32960
diff changeset
   165
lemmas InitD = Init_type [THEN subsetD]
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   166
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   167
lemma st_set_Init [iff]: "st_set(Init(F))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   168
apply (unfold st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   169
apply (rule Init_type)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   170
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   171
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   172
lemma Acts_type: "Acts(F)\<subseteq>Pow(state*state)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   173
by (simp add: RawActs_type Acts_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   174
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   175
lemma AllowedActs_type: "AllowedActs(F) \<subseteq> Pow(state*state)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   176
by (simp add: RawAllowedActs_type AllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   177
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   178
text\<open>Needed in Behaviors\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   179
lemma ActsD: "[| act \<in> Acts(F); <s,s'> \<in> act |] ==> s \<in> state & s' \<in> state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   180
by (blast dest: Acts_type [THEN subsetD])
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   181
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   182
lemma AllowedActsD:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   183
     "[| act \<in> AllowedActs(F); <s,s'> \<in> act |] ==> s \<in> state & s' \<in> state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   184
by (blast dest: AllowedActs_type [THEN subsetD])
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   185
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   186
subsection\<open>Simplification rules involving @{term state}, @{term Init}, 
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   187
  @{term Acts}, and @{term AllowedActs}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   188
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   189
text\<open>But are they really needed?\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   190
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   191
lemma state_subset_is_Init_iff [iff]: "state \<subseteq> Init(F) \<longleftrightarrow> Init(F)=state"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   192
by (cut_tac F = F in Init_type, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   193
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   194
lemma Pow_state_times_state_is_subset_Acts_iff [iff]:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   195
     "Pow(state*state) \<subseteq> Acts(F) \<longleftrightarrow> Acts(F)=Pow(state*state)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   196
by (cut_tac F = F in Acts_type, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   197
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   198
lemma Pow_state_times_state_is_subset_AllowedActs_iff [iff]:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   199
     "Pow(state*state) \<subseteq> AllowedActs(F) \<longleftrightarrow> AllowedActs(F)=Pow(state*state)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   200
by (cut_tac F = F in AllowedActs_type, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   201
61798
27f3c10b0b50 isabelle update_cartouches -c -t;
wenzelm
parents: 61392
diff changeset
   202
subsubsection\<open>Eliminating \<open>\<inter> state\<close> from expressions\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   203
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   204
lemma Init_Int_state [simp]: "Init(F) \<inter> state = Init(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   205
by (cut_tac F = F in Init_type, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   206
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   207
lemma state_Int_Init [simp]: "state \<inter> Init(F) = Init(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   208
by (cut_tac F = F in Init_type, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   209
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   210
lemma Acts_Int_Pow_state_times_state [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   211
     "Acts(F) \<inter> Pow(state*state) = Acts(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   212
by (cut_tac F = F in Acts_type, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   213
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   214
lemma state_times_state_Int_Acts [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   215
     "Pow(state*state) \<inter> Acts(F) = Acts(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   216
by (cut_tac F = F in Acts_type, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   217
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   218
lemma AllowedActs_Int_Pow_state_times_state [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   219
     "AllowedActs(F) \<inter> Pow(state*state) = AllowedActs(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   220
by (cut_tac F = F in AllowedActs_type, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   221
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   222
lemma state_times_state_Int_AllowedActs [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   223
     "Pow(state*state) \<inter> AllowedActs(F) = AllowedActs(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   224
by (cut_tac F = F in AllowedActs_type, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   225
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   226
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   227
subsubsection\<open>The Operator @{term mk_program}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   228
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   229
lemma mk_program_in_program [iff,TC]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   230
     "mk_program(init, acts, allowed) \<in> program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   231
by (auto simp add: mk_program_def program_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   232
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   233
lemma RawInit_eq [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   234
     "RawInit(mk_program(init, acts, allowed)) = init \<inter> state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   235
by (auto simp add: mk_program_def RawInit_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   236
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   237
lemma RawActs_eq [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   238
     "RawActs(mk_program(init, acts, allowed)) = 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   239
      cons(id(state), acts \<inter> Pow(state*state))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   240
by (auto simp add: mk_program_def RawActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   241
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   242
lemma RawAllowedActs_eq [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   243
     "RawAllowedActs(mk_program(init, acts, allowed)) =
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   244
      cons(id(state), allowed \<inter> Pow(state*state))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   245
by (auto simp add: mk_program_def RawAllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   246
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   247
lemma Init_eq [simp]: "Init(mk_program(init, acts, allowed)) = init \<inter> state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   248
by (simp add: Init_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   249
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   250
lemma Acts_eq [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   251
     "Acts(mk_program(init, acts, allowed)) = 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   252
      cons(id(state), acts  \<inter> Pow(state*state))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   253
by (simp add: Acts_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   254
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   255
lemma AllowedActs_eq [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   256
     "AllowedActs(mk_program(init, acts, allowed))=
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   257
      cons(id(state), allowed \<inter> Pow(state*state))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   258
by (simp add: AllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   259
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   260
text\<open>Init, Acts, and AlowedActs  of SKIP\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   261
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   262
lemma RawInit_SKIP [simp]: "RawInit(SKIP) = state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   263
by (simp add: SKIP_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   264
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   265
lemma RawAllowedActs_SKIP [simp]: "RawAllowedActs(SKIP) = Pow(state*state)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   266
by (force simp add: SKIP_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   267
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   268
lemma RawActs_SKIP [simp]: "RawActs(SKIP) = {id(state)}"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   269
by (force simp add: SKIP_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   270
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   271
lemma Init_SKIP [simp]: "Init(SKIP) = state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   272
by (force simp add: SKIP_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   273
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   274
lemma Acts_SKIP [simp]: "Acts(SKIP) = {id(state)}"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   275
by (force simp add: SKIP_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   276
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   277
lemma AllowedActs_SKIP [simp]: "AllowedActs(SKIP) = Pow(state*state)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   278
by (force simp add: SKIP_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   279
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   280
text\<open>Equality of UNITY programs\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   281
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   282
lemma raw_surjective_mk_program:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   283
     "F \<in> program ==> mk_program(RawInit(F), RawActs(F), RawAllowedActs(F))=F"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   284
apply (auto simp add: program_def mk_program_def RawInit_def RawActs_def
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   285
            RawAllowedActs_def, blast+)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   286
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   287
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   288
lemma surjective_mk_program [simp]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   289
  "mk_program(Init(F), Acts(F), AllowedActs(F)) = programify(F)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   290
by (auto simp add: raw_surjective_mk_program Init_def Acts_def AllowedActs_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   291
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   292
lemma program_equalityI:                             
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   293
    "[|Init(F) = Init(G); Acts(F) = Acts(G);
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   294
       AllowedActs(F) = AllowedActs(G); F \<in> program; G \<in> program |] ==> F = G"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   295
apply (subgoal_tac "programify(F) = programify(G)") 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   296
apply simp 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   297
apply (simp only: surjective_mk_program [symmetric]) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   298
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   299
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   300
lemma program_equalityE:                             
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   301
 "[|F = G;
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   302
    [|Init(F) = Init(G); Acts(F) = Acts(G); AllowedActs(F) = AllowedActs(G) |]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   303
    ==> P |] 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   304
  ==> P"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   305
by force
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   306
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   307
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   308
lemma program_equality_iff:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   309
    "[| F \<in> program; G \<in> program |] ==>(F=G)  \<longleftrightarrow>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   310
     (Init(F) = Init(G) & Acts(F) = Acts(G) & AllowedActs(F) = AllowedActs(G))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   311
by (blast intro: program_equalityI program_equalityE)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   312
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   313
subsection\<open>These rules allow "lazy" definition expansion\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   314
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   315
lemma def_prg_Init:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   316
     "F == mk_program (init,acts,allowed) ==> Init(F) = init \<inter> state"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   317
by auto
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   318
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   319
lemma def_prg_Acts:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   320
     "F == mk_program (init,acts,allowed)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   321
      ==> Acts(F) = cons(id(state), acts \<inter> Pow(state*state))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   322
by auto
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   323
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   324
lemma def_prg_AllowedActs:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   325
     "F == mk_program (init,acts,allowed)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   326
      ==> AllowedActs(F) = cons(id(state), allowed \<inter> Pow(state*state))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   327
by auto
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   328
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   329
lemma def_prg_simps:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   330
    "[| F == mk_program (init,acts,allowed) |]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   331
     ==> Init(F) = init \<inter> state & 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   332
         Acts(F) = cons(id(state), acts \<inter> Pow(state*state)) &
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   333
         AllowedActs(F) = cons(id(state), allowed \<inter> Pow(state*state))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   334
by auto
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   335
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   336
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   337
text\<open>An action is expanded only if a pair of states is being tested against it\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   338
lemma def_act_simp:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   339
     "[| act == {<s,s'> \<in> A*B. P(s, s')} |]
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   340
      ==> (<s,s'> \<in> act) \<longleftrightarrow> (<s,s'> \<in> A*B & P(s, s'))"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   341
by auto
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   342
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   343
text\<open>A set is expanded only if an element is being tested against it\<close>
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   344
lemma def_set_simp: "A == B ==> (x \<in> A) \<longleftrightarrow> (x \<in> B)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   345
by auto
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   346
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   347
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   348
subsection\<open>The Constrains Operator\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   349
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   350
lemma constrains_type: "A co B \<subseteq> program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   351
by (force simp add: constrains_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   352
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   353
lemma constrainsI:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   354
    "[|(!!act s s'. [| act: Acts(F);  <s,s'> \<in> act; s \<in> A|] ==> s' \<in> A');
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   355
        F \<in> program; st_set(A) |]  ==> F \<in> A co A'"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   356
by (force simp add: constrains_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   357
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   358
lemma constrainsD:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   359
   "F \<in> A co B ==> \<forall>act \<in> Acts(F). act``A\<subseteq>B"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   360
by (force simp add: constrains_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   361
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   362
lemma constrainsD2: "F \<in> A co B ==> F \<in> program & st_set(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   363
by (force simp add: constrains_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   364
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   365
lemma constrains_empty [iff]: "F \<in> 0 co B \<longleftrightarrow> F \<in> program"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   366
by (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   367
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   368
lemma constrains_empty2 [iff]: "(F \<in> A co 0) \<longleftrightarrow> (A=0 & F \<in> program)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   369
by (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   370
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   371
lemma constrains_state [iff]: "(F \<in> state co B) \<longleftrightarrow> (state\<subseteq>B & F \<in> program)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   372
apply (cut_tac F = F in Acts_type)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   373
apply (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   374
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   375
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   376
lemma constrains_state2 [iff]: "F \<in> A co state \<longleftrightarrow> (F \<in> program & st_set(A))"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   377
apply (cut_tac F = F in Acts_type)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   378
apply (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   379
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   380
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   381
text\<open>monotonic in 2nd argument\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   382
lemma constrains_weaken_R:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   383
    "[| F \<in> A co A'; A'\<subseteq>B' |] ==> F \<in> A co B'"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   384
apply (unfold constrains_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   385
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   386
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   387
text\<open>anti-monotonic in 1st argument\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   388
lemma constrains_weaken_L:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   389
    "[| F \<in> A co A'; B\<subseteq>A |] ==> F \<in> B co A'"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   390
apply (unfold constrains_def st_set_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   391
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   392
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   393
lemma constrains_weaken:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   394
   "[| F \<in> A co A'; B\<subseteq>A; A'\<subseteq>B' |] ==> F \<in> B co B'"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   395
apply (drule constrains_weaken_R)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   396
apply (drule_tac [2] constrains_weaken_L, blast+)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   397
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   398
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   399
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   400
subsection\<open>Constrains and Union\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   401
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   402
lemma constrains_Un:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   403
    "[| F \<in> A co A'; F \<in> B co B' |] ==> F \<in> (A \<union> B) co (A' \<union> B')"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   404
by (auto simp add: constrains_def st_set_def, force)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   405
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   406
lemma constrains_UN:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   407
     "[|!!i. i \<in> I ==> F \<in> A(i) co A'(i); F \<in> program |]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   408
      ==> F \<in> (\<Union>i \<in> I. A(i)) co (\<Union>i \<in> I. A'(i))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   409
by (force simp add: constrains_def st_set_def) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   410
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   411
lemma constrains_Un_distrib:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   412
     "(A \<union> B) co C = (A co C) \<inter> (B co C)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   413
by (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   414
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   415
lemma constrains_UN_distrib:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   416
   "i \<in> I ==> (\<Union>i \<in> I. A(i)) co B = (\<Inter>i \<in> I. A(i) co B)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   417
by (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   418
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   419
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   420
subsection\<open>Constrains and Intersection\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   421
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   422
lemma constrains_Int_distrib: "C co (A \<inter> B) = (C co A) \<inter> (C co B)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   423
by (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   424
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   425
lemma constrains_INT_distrib:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   426
     "x \<in> I ==> A co (\<Inter>i \<in> I. B(i)) = (\<Inter>i \<in> I. A co B(i))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   427
by (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   428
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   429
lemma constrains_Int:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   430
    "[| F \<in> A co A'; F \<in> B co B' |] ==> F \<in> (A \<inter> B) co (A' \<inter> B')"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   431
by (force simp add: constrains_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   432
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   433
lemma constrains_INT [rule_format]:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   434
     "[| \<forall>i \<in> I. F \<in> A(i) co A'(i); F \<in> program|]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   435
      ==> F \<in> (\<Inter>i \<in> I. A(i)) co (\<Inter>i \<in> I. A'(i))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   436
apply (case_tac "I=0")
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   437
 apply (simp add: Inter_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   438
apply (erule not_emptyE)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   439
apply (auto simp add: constrains_def st_set_def, blast) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   440
apply (drule bspec, assumption, force) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   441
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   442
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   443
(* The rule below simulates the HOL's one for (\<Inter>z. A i) co (\<Inter>z. B i) *)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   444
lemma constrains_All:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   445
"[| \<forall>z. F:{s \<in> state. P(s, z)} co {s \<in> state. Q(s, z)}; F \<in> program |]==>
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   446
    F:{s \<in> state. \<forall>z. P(s, z)} co {s \<in> state. \<forall>z. Q(s, z)}"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   447
by (unfold constrains_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   448
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   449
lemma constrains_imp_subset:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   450
  "[| F \<in> A co A' |] ==> A \<subseteq> A'"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   451
by (unfold constrains_def st_set_def, force)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   452
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   453
text\<open>The reasoning is by subsets since "co" refers to single actions
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   454
  only.  So this rule isn't that useful.\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   455
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   456
lemma constrains_trans: "[| F \<in> A co B; F \<in> B co C |] ==> F \<in> A co C"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   457
by (unfold constrains_def st_set_def, auto, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   458
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   459
lemma constrains_cancel:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   460
"[| F \<in> A co (A' \<union> B); F \<in> B co B' |] ==> F \<in> A co (A' \<union> B')"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   461
apply (drule_tac A = B in constrains_imp_subset)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   462
apply (blast intro: constrains_weaken_R)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   463
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   464
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   465
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   466
subsection\<open>The Unless Operator\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   467
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   468
lemma unless_type: "A unless B \<subseteq> program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   469
by (force simp add: unless_def constrains_def) 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   470
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   471
lemma unlessI: "[| F \<in> (A-B) co (A \<union> B) |] ==> F \<in> A unless B"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   472
apply (unfold unless_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   473
apply (blast dest: constrainsD2)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   474
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   475
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   476
lemma unlessD: "F :A unless B ==> F \<in> (A-B) co (A \<union> B)"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   477
by (unfold unless_def, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   478
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   479
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   480
subsection\<open>The Operator @{term initially}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   481
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   482
lemma initially_type: "initially(A) \<subseteq> program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   483
by (unfold initially_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   484
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   485
lemma initiallyI: "[| F \<in> program; Init(F)\<subseteq>A |] ==> F \<in> initially(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   486
by (unfold initially_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   487
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   488
lemma initiallyD: "F \<in> initially(A) ==> Init(F)\<subseteq>A"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   489
by (unfold initially_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   490
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   491
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   492
subsection\<open>The Operator @{term stable}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   493
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   494
lemma stable_type: "stable(A)\<subseteq>program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   495
by (unfold stable_def constrains_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   496
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   497
lemma stableI: "F \<in> A co A ==> F \<in> stable(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   498
by (unfold stable_def, assumption)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   499
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   500
lemma stableD: "F \<in> stable(A) ==> F \<in> A co A"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   501
by (unfold stable_def, assumption)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   502
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   503
lemma stableD2: "F \<in> stable(A) ==> F \<in> program & st_set(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   504
by (unfold stable_def constrains_def, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   505
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   506
lemma stable_state [simp]: "stable(state) = program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   507
by (auto simp add: stable_def constrains_def dest: Acts_type [THEN subsetD])
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   508
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   509
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   510
lemma stable_unless: "stable(A)= A unless 0"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   511
by (auto simp add: unless_def stable_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   512
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   513
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   514
subsection\<open>Union and Intersection with @{term stable}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   515
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   516
lemma stable_Un:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   517
    "[| F \<in> stable(A); F \<in> stable(A') |] ==> F \<in> stable(A \<union> A')"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   518
apply (unfold stable_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   519
apply (blast intro: constrains_Un)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   520
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   521
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   522
lemma stable_UN:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   523
     "[|!!i. i\<in>I ==> F \<in> stable(A(i)); F \<in> program |] 
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   524
      ==> F \<in> stable (\<Union>i \<in> I. A(i))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   525
apply (unfold stable_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   526
apply (blast intro: constrains_UN)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   527
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   528
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   529
lemma stable_Int:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   530
    "[| F \<in> stable(A);  F \<in> stable(A') |] ==> F \<in> stable (A \<inter> A')"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   531
apply (unfold stable_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   532
apply (blast intro: constrains_Int)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   533
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   534
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   535
lemma stable_INT:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   536
     "[| !!i. i \<in> I ==> F \<in> stable(A(i)); F \<in> program |]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   537
      ==> F \<in> stable (\<Inter>i \<in> I. A(i))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   538
apply (unfold stable_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   539
apply (blast intro: constrains_INT)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   540
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   541
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   542
lemma stable_All:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   543
    "[|\<forall>z. F \<in> stable({s \<in> state. P(s, z)}); F \<in> program|]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   544
     ==> F \<in> stable({s \<in> state. \<forall>z. P(s, z)})"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   545
apply (unfold stable_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   546
apply (rule constrains_All, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   547
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   548
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   549
lemma stable_constrains_Un:
46823
57bf0cecb366 More mathematical symbols for ZF examples
paulson
parents: 45602
diff changeset
   550
     "[| F \<in> stable(C); F \<in> A co (C \<union> A') |] ==> F \<in> (C \<union> A) co (C \<union> A')"
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   551
apply (unfold stable_def constrains_def st_set_def, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   552
apply (blast dest!: bspec)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   553
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   554
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   555
lemma stable_constrains_Int:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   556
     "[| F \<in> stable(C); F \<in>  (C \<inter> A) co A' |] ==> F \<in> (C \<inter> A) co (C \<inter> A')"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   557
by (unfold stable_def constrains_def st_set_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   558
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   559
(* [| F \<in> stable(C); F  \<in> (C \<inter> A) co A |] ==> F \<in> stable(C \<inter> A) *)
45602
2a858377c3d2 eliminated obsolete "standard";
wenzelm
parents: 32960
diff changeset
   560
lemmas stable_constrains_stable = stable_constrains_Int [THEN stableI]
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   561
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   562
subsection\<open>The Operator @{term invariant}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   563
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   564
lemma invariant_type: "invariant(A) \<subseteq> program"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   565
apply (unfold invariant_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   566
apply (blast dest: stable_type [THEN subsetD])
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   567
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   568
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   569
lemma invariantI: "[| Init(F)\<subseteq>A;  F \<in> stable(A) |] ==> F \<in> invariant(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   570
apply (unfold invariant_def initially_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   571
apply (frule stable_type [THEN subsetD], auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   572
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   573
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   574
lemma invariantD: "F \<in> invariant(A) ==> Init(F)\<subseteq>A & F \<in> stable(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   575
by (unfold invariant_def initially_def, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   576
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   577
lemma invariantD2: "F \<in> invariant(A) ==> F \<in> program & st_set(A)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   578
apply (unfold invariant_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   579
apply (blast dest: stableD2)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   580
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   581
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   582
text\<open>Could also say
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   583
      @{term "invariant(A) \<inter> invariant(B) \<subseteq> invariant (A \<inter> B)"}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   584
lemma invariant_Int:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   585
  "[| F \<in> invariant(A);  F \<in> invariant(B) |] ==> F \<in> invariant(A \<inter> B)"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   586
apply (unfold invariant_def initially_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   587
apply (simp add: stable_Int, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   588
done
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   589
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   590
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   591
subsection\<open>The Elimination Theorem\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   592
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   593
(** The "free" m has become universally quantified!
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   594
 Should the premise be !!m instead of \<forall>m ? Would make it harder
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   595
 to use in forward proof. **)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   596
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   597
text\<open>The general case is easier to prove than the special case!\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   598
lemma "elimination":
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   599
    "[| \<forall>m \<in> M. F \<in> {s \<in> A. x(s) = m} co B(m); F \<in> program  |]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   600
     ==> F \<in> {s \<in> A. x(s) \<in> M} co (\<Union>m \<in> M. B(m))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   601
by (auto simp add: constrains_def st_set_def, blast)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   602
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   603
text\<open>As above, but for the special case of A=state\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   604
lemma elimination2:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   605
     "[| \<forall>m \<in> M. F \<in> {s \<in> state. x(s) = m} co B(m); F \<in> program  |]
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   606
     ==> F:{s \<in> state. x(s) \<in> M} co (\<Union>m \<in> M. B(m))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   607
by (rule UNITY.elimination, auto)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   608
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   609
subsection\<open>The Operator @{term strongest_rhs}\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   610
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   611
lemma constrains_strongest_rhs:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   612
    "[| F \<in> program; st_set(A) |] ==> F \<in> A co (strongest_rhs(F,A))"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   613
by (auto simp add: constrains_def strongest_rhs_def st_set_def
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   614
              dest: Acts_type [THEN subsetD])
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   615
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   616
lemma strongest_rhs_is_strongest:
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   617
     "[| F \<in> A co B; st_set(B) |] ==> strongest_rhs(F,A) \<subseteq> B"
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   618
by (auto simp add: constrains_def strongest_rhs_def st_set_def)
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   619
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   620
ML \<open>
24893
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
   621
fun simp_of_act def = def RS @{thm def_act_simp};
b8ef7afe3a6b modernized specifications;
wenzelm
parents: 16417
diff changeset
   622
fun simp_of_set def = def RS @{thm def_set_simp};
60770
240563fbf41d isabelle update_cartouches;
wenzelm
parents: 58871
diff changeset
   623
\<close>
14077
37c964462747 Conversion of theory UNITY to Isar script
paulson
parents: 14046
diff changeset
   624
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
   625
end