src/HOL/UNITY/Comp.thy
author paulson
Tue, 19 Jan 1999 11:15:40 +0100
changeset 6138 b7e6e607bb4d
parent 6012 1894bfc4aee9
child 6295 351b3c2b0d83
permissions -rw-r--r--
updated comments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Comp.thy
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     5
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     6
Composition
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     7
a12b25c53df1 composition theory
paulson
parents:
diff changeset
     8
From Chandy and Sanders, "Reasoning About Program Composition"
6138
b7e6e607bb4d updated comments
paulson
parents: 6012
diff changeset
     9
b7e6e607bb4d updated comments
paulson
parents: 6012
diff changeset
    10
QUESTIONS:
b7e6e607bb4d updated comments
paulson
parents: 6012
diff changeset
    11
  refines_def: needs the States F = States G?
b7e6e607bb4d updated comments
paulson
parents: 6012
diff changeset
    12
b7e6e607bb4d updated comments
paulson
parents: 6012
diff changeset
    13
  uv_prop, component: should be States F = States (F Join G)
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    14
*)
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    15
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    16
Comp = Union +
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    17
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    18
constdefs
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    19
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    20
  (*Existential and Universal properties.  I formalize the two-program
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    21
    case, proving equivalence with Chandy and Sanders's n-ary definitions*)
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    22
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    23
  ex_prop  :: 'a program set => bool
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    24
   "ex_prop X ==
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    25
      ALL F G. (F:X | G: X) & States F = States G --> (F Join G) : X"
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    26
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    27
  strict_ex_prop  :: 'a program set => bool
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    28
   "strict_ex_prop X ==
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    29
      ALL F G. States F = States G --> (F:X | G: X) = (F Join G : X)"
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    30
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    31
  uv_prop  :: 'a program set => bool
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    32
   "uv_prop X ==
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    33
      SKIP UNIV : X &
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    34
      (ALL F G. F:X & G: X & States F = States G --> (F Join G) : X)"
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    35
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    36
  strict_uv_prop  :: 'a program set => bool
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    37
   "strict_uv_prop X ==
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    38
      SKIP UNIV : X &
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    39
      (ALL F G. States F = States G --> (F:X & G: X) = (F Join G : X))"
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    40
5612
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    41
  (*Ill-defined programs can arise through "Join"*)
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    42
  welldef :: 'a program set  
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    43
   "welldef == {F. Init F ~= {}}"
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    44
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    45
  component :: ['a program, 'a program] => bool
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    46
   "component F H == EX G. F Join G = H & States F = States G"
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    47
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    48
  guarantees :: ['a program set, 'a program set] => 'a program set (infixl 65)
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    49
   "X guarantees Y == {F. ALL H. component F H --> H:X --> H:Y}"
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    50
5612
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    51
  refines :: ['a program, 'a program, 'a program set] => bool
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    52
			("(3_ refines _ wrt _)" [10,10,10] 10)
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    53
   "G refines F wrt X ==
6012
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    54
      States F = States G &
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    55
      (ALL H. States F = States H & (F Join H) : welldef Int X
1894bfc4aee9 Addition of the States component; parts of Comp not working
paulson
parents: 5612
diff changeset
    56
        --> G Join H : welldef Int X)"
5612
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    57
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    58
  iso_refines :: ['a program, 'a program, 'a program set] => bool
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    59
			("(3_ iso'_refines _ wrt _)" [10,10,10] 10)
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    60
   "G iso_refines F wrt X ==
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    61
      F : welldef Int X --> G : welldef Int X"
e981ca6f7332 Finished proofs to end of section 5.1 of Chandy and Sanders
paulson
parents: 5597
diff changeset
    62
5597
a12b25c53df1 composition theory
paulson
parents:
diff changeset
    63
end