exception RelToHiddenHypothesis;;
exception MetasenvInconsistency;;
exception MutCaseFixAndCofixRefineNotImplemented;;
-exception FreeMetaFound of int;;
exception WrongArgumentNumber;;
let fdebug = ref 0;;
let module C = Cic in
let module R = CicMetaSubst in
let module Un = CicUnification in
- match R.whd subst context expectedtype with
+ match R.whd metasenv subst context expectedtype with
C.MutInd (_,_,_) ->
(n,context,actualtype, [term]), subst, metasenv
| C.Appl (C.MutInd (_,_,_)::tl) ->
| C.Prod (name,so,de) ->
(* we expect that the actual type of the branch has the due
number of Prod *)
- (match R.whd subst context actualtype with
+ (match R.whd metasenv subst context actualtype with
C.Prod (name',so',de') ->
let subst, metasenv =
Un.fo_unif_subst subst context metasenv so so' in
decr fdebug ;
ty,subst',metasenv'
| C.Meta (n,l) ->
- let (_,canonical_context,ty) =
- try
- List.find (function (m,_,_) -> n = m) metasenv
- with
- Not_found -> raise (FreeMetaFound n)
- in
+ let (_,canonical_context,ty) = CicUtil.lookup_meta n metasenv in
let subst',metasenv' =
check_metasenv_consistency subst metasenv context canonical_context l
in
raise
(WrongUriToMutualInductiveDefinitions (U.string_of_uri uri)) in
let rec count_prod t =
- match CicMetaSubst.whd subst context t with
+ match CicMetaSubst.whd metasenv subst context t with
C.Prod (_, _, t) -> 1 + (count_prod t)
| _ -> 0 in
let no_args = count_prod arity in
let _, subst, metasenv =
type_of_aux subst metasenv context expected_type
in
- let actual_type = CicMetaSubst.whd subst context actual_type in
+ let actual_type = CicMetaSubst.whd metasenv subst context actual_type in
let subst,metasenv =
Un.fo_unif_subst subst context metasenv expected_type actual_type
in
type_of_aux subst metasenv context appl
in
*)
- CicMetaSubst.whd subst context appl
+ CicMetaSubst.whd metasenv subst context appl
in
Un.fo_unif_subst subst context metasenv instance instance')
(subst,metasenv) outtypeinstances in
- CicMetaSubst.whd subst
+ CicMetaSubst.whd metasenv subst
context (C.Appl(outtype::right_args@[term])),subst,metasenv
| C.Fix _
| C.CoFix _ -> raise MutCaseFixAndCofixRefineNotImplemented
let subst',metasenv' = CicMetaSubst.unwind_subst metasenv subst in
let t1' = CicMetaSubst.apply_subst subst' t1 in
let t2' = CicMetaSubst.apply_subst subst' t2 in
- let t1'' = CicMetaSubst.whd subst' context t1' in
- let t2'' = CicMetaSubst.whd subst' ((Some (name,C.Decl s))::context) t2' in
+ let t1'' = CicMetaSubst.whd metasenv subst' context t1' in
+ let t2'' =
+ CicMetaSubst.whd metasenv subst' ((Some (name,C.Decl s))::context) t2'
+ in
match (t1'', t2'') with
(C.Sort s1, C.Sort s2)
when (s2 = C.Prop or s2 = C.Set or s2 = C.CProp) -> (* different from Coq manual!!! *)
function
[] -> hetype,subst,metasenv
| (hete, hety)::tl ->
- (match (CicMetaSubst.whd subst context hetype) with
+ (match (CicMetaSubst.whd metasenv subst context hetype) with
Cic.Prod (n,s,t) ->
let subst',metasenv' =
CicUnification.fo_unif_subst subst context metasenv s hety