src/HOL/MiniML/Instance.thy
author nipkow
Fri, 24 Nov 2000 16:49:27 +0100
changeset 10519 ade64af4c57c
parent 5184 9b8547a9496a
child 14422 b8da5f258b04
permissions -rw-r--r--
hide many names from Datatype_Universe.

(* Title:     HOL/MiniML/Instance.thy
   ID:        $Id$
   Author:    Wolfgang Naraschewski and Tobias Nipkow
   Copyright  1996 TU Muenchen

Instances of type schemes
*)

Instance = Type + 

  
(* generic instances of a type scheme *)

consts
  bound_typ_inst :: [subst, type_scheme] => typ

primrec
  "bound_typ_inst S (FVar n) = (TVar n)"
  "bound_typ_inst S (BVar n) = (S n)"
  "bound_typ_inst S (sch1 =-> sch2) = ((bound_typ_inst S sch1) -> (bound_typ_inst S sch2))"

consts
  bound_scheme_inst :: [nat => type_scheme, type_scheme] => type_scheme

primrec
  "bound_scheme_inst S (FVar n) = (FVar n)"
  "bound_scheme_inst S (BVar n) = (S n)"
  "bound_scheme_inst S (sch1 =-> sch2) = ((bound_scheme_inst S sch1) =-> (bound_scheme_inst S sch2))"
  
consts
  "<|" :: [typ, type_scheme] => bool (infixr 70)
defs
  is_bound_typ_instance "t <| sch == ? S. t = (bound_typ_inst S sch)" 

instance type_scheme :: ord
defs le_type_scheme_def "sch' <= (sch::type_scheme) == !t. t <| sch' --> t <| sch"

consts
  subst_to_scheme :: [nat => type_scheme, typ] => type_scheme

primrec
  "subst_to_scheme B (TVar n) = (B n)"
  "subst_to_scheme B (t1 -> t2) = ((subst_to_scheme B t1) =-> (subst_to_scheme B t2))"
  
instance list :: (ord)ord
defs le_env_def
  "A <= B == length B = length A & (!i. i < length A --> A!i <= B!i)"

end