src/ZF/UNITY/Constrains.thy
author paulson
Wed, 08 Aug 2001 14:33:10 +0200
changeset 11479 697dcaaf478f
child 12195 ed2893765a08
permissions -rw-r--r--
new ZF/UNITY theory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      ZF/UNITY/Constrains.thy
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Sidi O Ehmety, Computer Laboratory
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   2001  University of Cambridge
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     5
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     6
Safety relations: restricted to the set of reachable states.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     7
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     8
Theory ported from HOL.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     9
*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    10
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    11
Constrains = UNITY +
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    12
consts traces :: "[i, i] => i"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    13
  (* Initial states and program => (final state, reversed trace to it)... 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    14
      the domain might also be state*list(state) *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    15
inductive 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    16
  domains 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    17
     "traces(init, acts)" <=
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    18
         "(init Un (UN act:acts. field(act)))*list(UN act:acts. field(act))"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    19
  intrs 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    20
         (*Initial trace is empty*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    21
    Init  "s: init ==> <s,[]> : traces(init,acts)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    22
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    23
    Acts  "[| act:acts;  <s,evs> : traces(init,acts);  <s,s'>: act |]
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    24
           ==> <s', Cons(s,evs)> : traces(init, acts)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    25
  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    26
  type_intrs "list.intrs@[UnI1, UnI2, UN_I, fieldI2, fieldI1]"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    27
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    28
  consts reachable :: "i=>i"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    29
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    30
inductive
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    31
  domains
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    32
  "reachable(F)" <= "Init(F) Un (UN act:Acts(F). field(act))"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    33
  intrs 
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    34
    Init  "s:Init(F) ==> s:reachable(F)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    35
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    36
    Acts  "[| act: Acts(F);  s:reachable(F);  <s,s'>: act |]
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    37
           ==> s':reachable(F)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    38
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    39
  type_intrs "[UnI1, UnI2, fieldI2, UN_I]"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    40
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    41
  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    42
consts
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    43
  Constrains :: "[i,i] => i"  (infixl "Co"     60)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    44
  op_Unless  :: "[i, i] => i"  (infixl "Unless" 60)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    45
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    46
defs
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    47
  Constrains_def
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    48
    "A Co B == {F:program. F:(reachable(F) Int A) co B &
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    49
		           A:condition & B:condition}"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    50
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    51
  Unless_def
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    52
    "A Unless B == (A-B) Co (A Un B)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    53
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    54
constdefs
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    55
  Stable     :: "i => i"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    56
    "Stable(A) == A Co A"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    57
  (*Always is the weak form of "invariant"*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    58
  Always :: "i => i"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    59
    "Always(A) == {F:program. Init(F) <= A} Int Stable(A)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    60
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    61
  (*
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    62
  The constant Increasing_on defines a weak form of the Charpentier's
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    63
  increasing notion.  It should not be confused with the ZF's
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    64
  increasing constant which have a different meaning.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    65
  Increasing's parameters: a state function f,
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    66
  a domain A and a order relation r over the domain A.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    67
  Should f be a meta function instead ?
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    68
  *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    69
  Increasing_on :: [i,i, i] => i  ("Increasing[_]'(_,_')")
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    70
  "Increasing[A](f, r) == {F:program. f:state->A &
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    71
			      part_order(A,r) &
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    72
			      F: (INT z:A. Stable({s:state.  <z, f`s>:r}))}"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    73
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    74
end
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    75