(* $Id$ *)
-(*
-
exception MetaSubstFailure of string Lazy.t
exception Uncertain of string Lazy.t
+
+(*
exception AssertFailure of string Lazy.t
exception DeliftingARelWouldCaptureAFreeVariable;;
-
-(* The entry (i,t) in a substitution means that *)
-(* (META i) have been instantiated with t. *)
-(* type substitution = (int * (Cic.context * Cic.term)) list *)
-
- (** @raise SubstNotFound *)
-
-(* apply_subst subst t *)
-(* applies the substitution [subst] to [t] *)
-(* [subst] must be already unwinded *)
-
val apply_subst : Cic.substitution -> Cic.term -> Cic.term
val apply_subst_context : Cic.substitution -> Cic.context -> Cic.context
val apply_subst_metasenv: Cic.substitution -> Cic.metasenv -> Cic.metasenv
(*** delifting ***)
-val delift :
- int -> Cic.substitution -> Cic.context -> Cic.metasenv ->
- (Cic.term option) list -> Cic.term ->
- Cic.term * Cic.metasenv * Cic.substitution
val restrict :
Cic.substitution -> (int * int) list -> Cic.metasenv ->
Cic.metasenv * Cic.substitution
+*)
-(** delifts the Rels in t of n
- * @raise DeliftingARelWouldCaptureAFreeVariable
+(* the delift function takes in input a metavariable index, a local_context
+ * and a term t, and substitutes every Rel in t with its position in
+ * the local_context (which is the Rel moved to the canonical context).
+ * Typically, the list of optional terms is the explicit
+ * substitution that is applied to a metavariable occurrence and the result of
+ * the delift function is a term the implicit variable can be substituted with
+ * to make the term [t] unifiable with the metavariable occurrence. In general,
+ * the problem is undecidable if we consider equivalence in place of alpha
+ * convertibility. Our implementation, though, is even weaker than alpha
+ * convertibility, since it replace the term [tk] if and only if [tk] is a Rel
+ * (missing all the other cases). Does this matter in practice?
+ * The metavariable index is the index of the metavariable that must not occur
+ * in the term (for occur check).
*)
-val delift_rels :
- Cic.substitution -> Cic.metasenv -> int -> Cic.term ->
- Cic.term * Cic.substitution * Cic.metasenv
-
-(** {2 Pretty printers} *)
-val use_low_level_ppterm_in_context : bool ref
-val set_ppterm_in_context :
- (metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> Cic.context ->
- string) -> unit
-
-val ppsubst_unfolded: metasenv:Cic.metasenv -> Cic.substitution -> string
-val ppsubst: metasenv:Cic.metasenv -> Cic.substitution -> string
-val ppterm: metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> string
-val ppcontext:
- metasenv:Cic.metasenv -> ?sep: string -> Cic.substitution -> Cic.context ->
- string
-val ppterm_in_name_context:
- metasenv:Cic.metasenv -> Cic.substitution -> Cic.term ->
- (Cic.name option) list -> string
-val ppterm_in_context:
- metasenv:Cic.metasenv -> Cic.substitution -> Cic.term -> Cic.context -> string
-val ppmetasenv: ?sep: string -> Cic.substitution -> Cic.metasenv -> string
+val delift :
+ NCic.metasenv -> NCic.substitution -> NCic.context ->
+ int -> NCic.local_context -> NCic.term ->
+ (NCic.metasenv * NCic.substitution) * NCic.term
-(** {2 Format-like pretty printers}
- * As above with prototypes suitable for toplevel/ocamldebug printers. No
- * subsitutions are applied here since such printers are required to be invoked
- * with only one argument.
- *)
+val restrict:
+ NCic.metasenv ->
+ NCic.substitution ->
+ int -> int list -> NCic.metasenv * NCic.substitution * int
-val fppsubst: Format.formatter -> Cic.substitution -> unit
-val fppterm: Format.formatter -> Cic.term -> unit
-val fppmetasenv: Format.formatter -> Cic.metasenv -> unit
+val mk_meta:
+ ?name:string ->
+ NCic.metasenv -> NCic.context -> NCic.term option ->
+ NCic.metasenv * NCic.term * NCic.term (* menv, instance, type *)
-(*
-(* DEBUG *)
-val print_counters: unit -> unit
-val reset_counters: unit -> unit
-*)
+(* returns the resulting type, the metasenv and the arguments *)
+val saturate:
+ ?delta:int -> NCic.metasenv -> NCic.context -> NCic.term -> int ->
+ NCic.term * NCic.metasenv * NCic.term list
-(* val clean_up_meta :
- Cic.substitution -> Cic.metasenv -> Cic.term -> Cic.term
-*)
-*)