src/ZF/UNITY/State.thy
author paulson
Tue, 21 May 2002 13:06:36 +0200
changeset 13168 afcbca3498b0
parent 12195 ed2893765a08
child 14046 6616e6c53d48
permissions -rw-r--r--
converted domrange to Isar and merged with equalities
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/State.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
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
     6
Formalizes UNITY-program states using dependent types so that:
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     7
 - variables are typed.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     8
 - the state space is uniform, common to all defined programs.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     9
 - variables can be quantified over.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    10
*)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    11
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    12
State = UNITYMisc +
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    13
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    14
consts var::i
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    15
datatype var = Var("i:list(nat)")
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    16
         type_intrs "[list_nat_into_univ]"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    17
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    18
consts
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    19
  type_of :: i=>i
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    20
  some    :: i
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    21
  state   :: i
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    22
  st_set  :: i =>o
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    23
translations
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    24
  "state" == "Pi(var, type_of)"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    25
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    26
defs  
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    27
  (* To prevent typing conditions (like `A<=state') from
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    28
     being used in combination with the rules `constrains_weaken', etc. *)
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    29
  st_set_def "st_set(A) == A<=state"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    30
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    31
rules
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    32
  some_assume "some:state"
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    33
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    34
(***
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    35
REMARKS:
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    36
  1. The reason of indexing variables by lists instead of integers is that,
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    37
at the time I was writing this theory, translations like `foo == Var(#1)'
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    38
mysteriously provoke a syntactical error. Such translations are used
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    39
for introducing variable names when specifying programs.
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    40
12195
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    41
  2. State space `state' is required to be not empty. This requirement
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    42
can be achieved by definition: the space "PROD x:var. type_of(x) Un {0}"
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    43
includes the state `lam x:state. 0'. However, such definition leads to
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    44
complications later during program type-chinking. For example, to prove
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    45
that the assignment `foo:=#1' is well typed, for `foo' an integer
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    46
variable, we would have to show two things: (a) that #1 is an integer
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    47
but also (b) that #1 is different from 0. Hence axiom `some_assume'.
ed2893765a08 *** empty log message ***
ehmety
parents: 11479
diff changeset
    48
***)
11479
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    49
end