diff options
-rw-r--r-- | kernel/term.ml | 18 | ||||
-rw-r--r-- | kernel/term.mli | 10 |
2 files changed, 28 insertions, 0 deletions
diff --git a/kernel/term.ml b/kernel/term.ml index 844ffa62c..5c1fcabf8 100644 --- a/kernel/term.ml +++ b/kernel/term.ml @@ -102,6 +102,24 @@ type ('constr, 'types) kind_of_term = | Fix of ('constr, 'types) pfixpoint | CoFix of ('constr, 'types) pcofixpoint +(* Experimental, used in Presburger contrib *) +type ('constr, 'types) kind_of_type = + | SortType of sorts + | CastType of 'types * 'types + | ProdType of name * 'types * 'types + | LetInType of name * 'constr * 'types * 'types + | AtomicType of 'constr * 'constr array + +let kind_of_type = function + | Sort s -> SortType s + | Cast (c,_,t) -> CastType (c, t) + | Prod (na,t,c) -> ProdType (na, t, c) + | LetIn (na,b,t,c) -> LetInType (na, b, t, c) + | App (c,l) -> AtomicType (c, l) + | (Rel _ | Meta _ | Var _ | Evar _ | Const _ | Case _ | Fix _ | CoFix _ | Ind _ as c) + -> AtomicType (c,[||]) + | (Lambda _ | Construct _) -> failwith "Not a type" + (* constr is the fixpoint of the previous type. Requires option -rectypes of the Caml compiler to be set *) type constr = (constr,constr) kind_of_term diff --git a/kernel/term.mli b/kernel/term.mli index 4b9b5fdcc..875ac8989 100644 --- a/kernel/term.mli +++ b/kernel/term.mli @@ -216,6 +216,16 @@ type ('constr, 'types) kind_of_term = val kind_of_term : constr -> (constr, types) kind_of_term +(** Experimental, used in Presburger contrib *) +type ('constr, 'types) kind_of_type = + | SortType of sorts + | CastType of 'types * 'types + | ProdType of name * 'types * 'types + | LetInType of name * 'constr * 'types * 'types + | AtomicType of 'constr * 'constr array + +val kind_of_type : types -> (constr, types) kind_of_type + (** {6 Simple term case analysis. } *) val isRel : constr -> bool |