src/HOL/BCV/Plus.thy
author paulson
Thu, 11 Nov 1999 10:25:17 +0100
changeset 8005 b64d86018785
parent 7626 5997f35954d7
permissions -rw-r--r--
new-style infix declaration for "image"
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/Plus.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
Supremum operation on various domains.
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
Plus = Orders +
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
instance option :: (plus)plus
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    12
instance list   :: (plus)plus
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    13
instance "*"    :: (plus,plus)plus
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
consts list_plus :: "('a::plus)list => 'a list => 'a list"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    16
primrec
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    17
"list_plus [] ys = ys"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    18
"list_plus (x#xs) ys = (case ys of [] => x#xs | z#zs => (x+z)#list_plus xs zs)"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    19
defs
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    20
plus_option "o1 + o2 == case o1 of None => o2
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    21
                        | Some x => (case o2 of None => o1
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    22
                                     | Some y => Some(x+y))"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    23
plus_list "op + == list_plus"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    24
plus_prod "op + == %(a,b) (c,d). (a+c,b+d)"
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    25
5997f35954d7 A new theory: a model of bytecode verification.
nipkow
parents:
diff changeset
    26
end