src/HOL/Subst/UTerm.thy
author oheimb
Wed, 18 Dec 1996 15:12:34 +0100
changeset 2443 a81d4c219c3c
parent 1476 608483c2122a
child 2903 d1d5a0acbf72
permissions -rw-r--r--
factored out HOL_base_ss and val HOL_min_ss, added HOL_safe_min_ss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
     1
(*  Title:      Substitutions/UTerm.thy
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
     2
    Author:     Martin Coen, Cambridge University Computer Laboratory
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     3
    Copyright   1993  University of Cambridge
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     4
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
     5
Simple term structure for unification.
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     6
Binary trees with leaves that are constants or variables.
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     7
*)
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     8
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     9
UTerm = Sexp +
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    10
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    11
types uterm 1
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    12
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    13
arities 
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    14
  uterm     :: (term)term
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    15
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    16
consts
1374
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    17
  uterm     :: 'a item set => 'a item set
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    18
  Rep_uterm :: 'a uterm => 'a item
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    19
  Abs_uterm :: 'a item => 'a uterm
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    20
  VAR       :: 'a item => 'a item
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    21
  CONST     :: 'a item => 'a item
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    22
  COMB      :: ['a item, 'a item] => 'a item
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    23
  Var       :: 'a => 'a uterm
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    24
  Const     :: 'a => 'a uterm
5e407f2a3323 removed quotes from consts and syntax sections
clasohm
parents: 1151
diff changeset
    25
  Comb      :: ['a uterm, 'a uterm] => 'a uterm
1381
57777949b2f8 removed some more quotes
clasohm
parents: 1374
diff changeset
    26
  UTerm_rec :: ['a item, 'a item => 'b, 'a item => 'b, 
57777949b2f8 removed some more quotes
clasohm
parents: 1374
diff changeset
    27
                ['a item , 'a item, 'b, 'b]=>'b] => 'b
57777949b2f8 removed some more quotes
clasohm
parents: 1374
diff changeset
    28
  uterm_rec :: ['a uterm, 'a => 'b, 'a => 'b, 
57777949b2f8 removed some more quotes
clasohm
parents: 1374
diff changeset
    29
                ['a uterm, 'a uterm,'b,'b]=>'b] => 'b
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    30
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    31
defs
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    32
     (*defining the concrete constructors*)
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    33
  VAR_def       "VAR(v) == In0(v)"
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    34
  CONST_def     "CONST(v) == In1(In0(v))"
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    35
  COMB_def      "COMB t u == In1(In1(t $ u))"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    36
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    37
inductive "uterm(A)"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    38
  intrs
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    39
    VAR_I          "v:A ==> VAR(v) : uterm(A)"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    40
    CONST_I  "c:A ==> CONST(c) : uterm(A)"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    41
    COMB_I   "[| M:uterm(A);  N:uterm(A) |] ==> COMB M N : uterm(A)"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    42
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    43
rules
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    44
    (*faking a type definition...*)
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    45
  Rep_uterm             "Rep_uterm(xs): uterm(range(Leaf))"
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    46
  Rep_uterm_inverse     "Abs_uterm(Rep_uterm(xs)) = xs"
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    47
  Abs_uterm_inverse     "M: uterm(range(Leaf)) ==> Rep_uterm(Abs_uterm(M)) = M"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    48
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    49
defs
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    50
     (*defining the abstract constructors*)
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    51
  Var_def       "Var(v) == Abs_uterm(VAR(Leaf(v)))"
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    52
  Const_def     "Const(c) == Abs_uterm(CONST(Leaf(c)))"
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    53
  Comb_def      "Comb t u == Abs_uterm (COMB (Rep_uterm t) (Rep_uterm u))"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    54
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    55
     (*uterm recursion*)
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    56
  UTerm_rec_def 
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    57
   "UTerm_rec M b c d == wfrec (trancl pred_sexp) 
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1381
diff changeset
    58
    (%g. Case (%x.b(x)) (Case (%y. c(y)) (Split (%x y. d x y (g x) (g y))))) M"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    59
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    60
  uterm_rec_def
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    61
   "uterm_rec t b c d == 
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    62
   UTerm_rec (Rep_uterm t) (%x.b(Inv Leaf x)) (%x.c(Inv Leaf x)) 
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    63
                           (%x y q r.d (Abs_uterm x) (Abs_uterm y) q r)"
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    64
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    65
end