src/HOL/UNITY/UNITY.thy
author paulson
Thu, 29 Apr 1999 10:51:58 +0200
changeset 6536 281d44905cab
parent 6535 880f31a62784
child 6713 614a76ce9bc6
permissions -rw-r--r--
made many specification operators infix
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/UNITY
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     5
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     6
The basic UNITY theory (revised version, based upon the "co" operator)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     7
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     8
From Misra, "A Logic for Concurrent Programming", 1994
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     9
*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    10
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    11
UNITY = LessThan + Prefix +
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    12
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    13
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    14
typedef (Program)
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    15
  'a program = "{(init:: 'a set, acts :: ('a * 'a)set set). Id:acts}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    16
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    17
consts
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    18
  co, unless :: "['a set, 'a set] => 'a program set"       (infixl 60)
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    19
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    20
constdefs
6535
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    21
    mk_program :: "('a set * ('a * 'a)set set) => 'a program"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    22
    "mk_program == %(init, acts). Abs_Program (init, insert Id acts)"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    23
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    24
  Init :: "'a program => 'a set"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    25
    "Init F == (%(init, acts). init) (Rep_Program F)"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    26
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    27
  Acts :: "'a program => ('a * 'a)set set"
880f31a62784 eliminated theory UNITY/Traces
paulson
parents: 5804
diff changeset
    28
    "Acts F == (%(init, acts). acts) (Rep_Program F)"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    29
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    30
  stable     :: "'a set => 'a program set"
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    31
    "stable A == A co A"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    32
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    33
  strongest_rhs :: "['a program, 'a set] => 'a set"
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    34
    "strongest_rhs F A == Inter {B. F : A co B}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    35
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    36
  invariant :: "'a set => 'a program set"
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    37
    "invariant A == {F. Init F <= A} Int stable A"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
5648
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    39
  (*Polymorphic in both states and the meaning of <= *)
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    40
  increasing :: "['a => 'b::{ord}] => 'a program set"
fe887910e32e specifications as sets of programs
paulson
parents: 5253
diff changeset
    41
    "increasing f == INT z. stable {s. z <= f s}"
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    42
6536
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    43
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    44
defs
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    45
  constrains_def "A co B == {F. ALL act: Acts F. act^^A <= B}"
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    46
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    47
  unless_def     "A unless B == (A-B) co (A Un B)"
281d44905cab made many specification operators infix
paulson
parents: 6535
diff changeset
    48
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    49
end