src/HOL/Subst/UTerm.thy
author clasohm
Wed, 21 Jun 1995 15:47:10 +0200
changeset 1151 c820b3cc3df0
parent 968 3cdaa8724175
child 1374 5e407f2a3323
permissions -rw-r--r--
removed \...\ inside strings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
968
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     1
(*  Title: 	Substitutions/UTerm.thy
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     2
    Author: 	Martin Coen, Cambridge University Computer Laboratory
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
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
     5
Simple term structure for unifiation.
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
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    17
  uterm     :: "'a item set => 'a item set"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    18
  Rep_uterm :: "'a uterm => 'a item"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    19
  Abs_uterm :: "'a item => 'a uterm"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    20
  VAR       :: "'a item => 'a item"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    21
  CONST     :: "'a item => 'a item"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    22
  COMB      :: "['a item, 'a item] => 'a item"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    23
  Var       :: "'a => 'a uterm"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    24
  Const     :: "'a => 'a uterm"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    25
  Comb      :: "['a uterm, 'a uterm] => 'a uterm"
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    26
  UTerm_rec :: "['a item, 'a item => 'b, 'a item => 'b, 
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    27
                ['a item , 'a item, 'b, 'b]=>'b] => 'b"
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    28
  uterm_rec :: "['a uterm, 'a => 'b, 'a => 'b, 
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
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*)
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    33
  VAR_def  	"VAR(v) == In0(v)"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    34
  CONST_def  	"CONST(v) == In1(In0(v))"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    35
  COMB_def 	"COMB t u == In1(In1(t $ u))"
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
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    39
    VAR_I	   "v:A ==> VAR(v) : uterm(A)"
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...*)
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    45
  Rep_uterm 		"Rep_uterm(xs): uterm(range(Leaf))"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    46
  Rep_uterm_inverse 	"Abs_uterm(Rep_uterm(xs)) = xs"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    47
  Abs_uterm_inverse 	"M: uterm(range(Leaf)) ==> Rep_uterm(Abs_uterm(M)) = M"
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*)
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    51
  Var_def  	"Var(v) == Abs_uterm(VAR(Leaf(v)))"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    52
  Const_def  	"Const(c) == Abs_uterm(CONST(Leaf(c)))"
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    53
  Comb_def 	"Comb t u == Abs_uterm (COMB (Rep_uterm t) (Rep_uterm u))"
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*)
3cdaa8724175 converted Subst with curried function application
clasohm
parents:
diff changeset
    56
  UTerm_rec_def	
1151
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    57
   "UTerm_rec M b c d == wfrec (trancl pred_sexp) M 
c820b3cc3df0 removed \...\ inside strings
clasohm
parents: 968
diff changeset
    58
          (Case (%x g.b(x)) (Case (%y g. c(y)) (Split (%x y g. d x y (g x) (g y)))))"
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