src/ZF/UNITY/State.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:      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
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
     6
Formalizes UNITY-program states using dependent types:
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
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    13
State = UNITYMisc +
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    14
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    15
consts
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    16
    variable :: i
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    17
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    18
(**
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    19
  Variables are better represented using integers, but at the moment
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    20
  there is a problem with integer translations like "uu" == "Var(#0)", which
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    21
  are needed to give names to variables.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    22
  So for the time being we are using lists of naturals to index variables.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    23
  **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    24
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    25
datatype variable = Var("i:list(nat)")
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    26
  type_intrs "[list_nat_into_univ]"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    27
  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    28
consts
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    29
  state, action, some ::i
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    30
  type_of :: i=>i
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    31
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    32
translations
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    33
  (* The state space is a dependent type *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    34
 "state" == "Pi(variable, type_of)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    35
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    36
  (* Commands are relations over states *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    37
  "action" == "Pow(state*state)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    38
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    39
rules
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    40
  (** We might have defined the state space in a such way that it is already
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    41
  not empty by formation: for example "state==PROD x:variable. type_of(x) Un {0}"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    42
  which contains the function (lam x:variable. 0) is a possible choice.
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    43
  However, we prefer the following way for simpler proofs by avoiding
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    44
  case splitting resulting from type_of(x) Un {0}.  **)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    45
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    46
  some_in_state "some:state"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    47
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    48
constdefs
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    49
  (* State conditions/predicates are sets of states *)
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    50
  condition :: i
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    51
  "condition == Pow(state)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    52
  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    53
  actionSet :: i
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    54
  "actionSet == Pow(action)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    55
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    56
consts  
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    57
  Id :: i
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    58
translations
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    59
  "Id" == "Identity(state)"
697dcaaf478f new ZF/UNITY theory
paulson
parents:
diff changeset
    60
end