src/HOL/BCV/DFAandWTI.thy
author paulson
Fri, 18 Feb 2000 15:35:29 +0100
changeset 8255 38f96394c099
parent 7626 5997f35954d7
child 9279 fb4186e20148
permissions -rw-r--r--
new distributive laws
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7626
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/BCV/DFAandWTI.thy
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     4
    Copyright   1999 TUM
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     5
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     6
The relationship between dataflow analysis and a welltyped-insruction predicate.
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     7
*)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     8
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
     9
DFAandWTI = SemiLattice +
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    10
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    11
types 's os = 's option list
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    12
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    13
constdefs
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    14
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    15
 stable :: (nat => 's => 's option) => (nat => nat list) => nat => 's os => bool
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    16
"stable step succs p sos ==
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    17
 !s. sos!p = Some s --> (? t. step p s = Some(t) &
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    18
                              (!q:set(succs p). Some t <= sos!q))"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    19
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    20
 wti_is_fix_step ::
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    21
   "(nat => 's => 's option)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    22
    => (nat => 's os => bool)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    23
    => (nat => nat list)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    24
    => nat => 's set => bool"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    25
"wti_is_fix_step step wti succs n L == !sos p.
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    26
   sos : listsn n (option L) & p < n -->
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    27
   wti p sos = stable step succs p sos"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    28
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    29
 welltyping :: (nat => 's os => bool) => 's os => bool
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    30
"welltyping wti tos == !p<size(tos). wti p tos"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    31
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    32
 is_dfa ::  ('s os => bool)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    33
            => (nat => 's => 's option)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    34
            => (nat => nat list)
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    35
            => nat => 's set => bool
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    36
"is_dfa dfa step succs n L == !sos : listsn n (option L).
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    37
   dfa sos =
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    38
   (? tos : listsn n (option L).
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    39
      sos <= tos & (!p < n. stable step succs p tos))"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    40
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    41
end