src/HOL/UNITY/Constrains.thy
author paulson
Tue, 04 May 1999 10:26:00 +0200
changeset 6570 a7d7985050a9
parent 6536 281d44905cab
child 6575 70d758762c50
permissions -rw-r--r--
Invariant -> Always and other tidying
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Constrains
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     2
    ID:         $Id$
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     5
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     6
Safety relations: restricted to the set of reachable states.
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     7
*)
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
     8
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
     9
Constrains = UNITY + 
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    10
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    11
consts traces :: "['a set, ('a * 'a)set set] => ('a * 'a list) set"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    12
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    13
  (*Initial states and program => (final state, reversed trace to it)...
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    14
    Arguments MUST be curried in an inductive definition*)
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    15
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    16
inductive "traces init acts"  
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    17
  intrs 
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    18
         (*Initial trace is empty*)
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    19
    Init  "s: init ==> (s,[]) : traces init acts"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    20
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    21
    Acts  "[| act: acts;  (s,evs) : traces init acts;  (s,s'): act |]
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    22
	   ==> (s', s#evs) : traces init acts"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    23
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    24
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    25
consts reachable :: "'a program => 'a set"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    26
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    27
inductive "reachable F"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    28
  intrs 
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    29
    Init  "s: Init F ==> s : reachable F"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    30
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    31
    Acts  "[| act: Acts F;  s : reachable F;  (s,s'): act |]
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5784
diff changeset
    32
	   ==> s' : reachable F"
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    33
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    34
consts
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    35
  Co, Unless :: "['a set, 'a set] => 'a program set"       (infixl 60)
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    36
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    37
defs
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    38
  Constrains_def
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    39
    "A Co B == {F. F : (reachable F  Int  A) co (reachable F  Int  B)}"
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    40
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    41
  Unless_def
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    42
    "A Unless B == (A-B) Co (A Un B)"
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    43
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    44
constdefs
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    45
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5620
diff changeset
    46
  Stable     :: "'a set => 'a program set"
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    47
    "Stable A == A Co A"
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    48
6570
a7d7985050a9 Invariant -> Always and other tidying
paulson
parents: 6536
diff changeset
    49
  (*Always is the weak form of "invariant"*)
a7d7985050a9 Invariant -> Always and other tidying
paulson
parents: 6536
diff changeset
    50
  Always :: "'a set => 'a program set"
a7d7985050a9 Invariant -> Always and other tidying
paulson
parents: 6536
diff changeset
    51
    "Always A == {F. Init F <= A} Int Stable A"
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    52
5784
54276fba8420 the Increasing operator
paulson
parents: 5648
diff changeset
    53
  (*Polymorphic in both states and the meaning of <= *)
54276fba8420 the Increasing operator
paulson
parents: 5648
diff changeset
    54
  Increasing :: "['a => 'b::{ord}] => 'a program set"
54276fba8420 the Increasing operator
paulson
parents: 5648
diff changeset
    55
    "Increasing f == INT z. Stable {s. z <= f s}"
54276fba8420 the Increasing operator
paulson
parents: 5648
diff changeset
    56
5313
1861a564d7e2 Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff changeset
    57
end