function
C.Rel n as t ->
(match List.nth context (n-1) with
- Some (C.Decl _) -> if l = [] then t else C.Appl (t::l)
- | Some (C.Def bo) -> whdaux l (S.lift n bo)
+ Some (_, C.Decl _) -> if l = [] then t else C.Appl (t::l)
+ | Some (_, C.Def bo) -> whdaux l (S.lift n bo)
| None -> raise RelToHiddenHypothesis
)
| C.Var uri as t ->
(C.Rel n1, C.Rel n2) -> n1 = n2
| (C.Var uri1, C.Var uri2) -> U.eq uri1 uri2
| (C.Meta (n1,l1), C.Meta (n2,l2)) ->
- if n1 = n2 then (assert (l1=l2);true) else false
+ n1 = n2 &&
+ List.fold_left2
+ (fun b t1 t2 ->
+ b &&
+ match t1,t2 with
+ None,None -> true
+ | Some t1',Some t2' -> aux context t1' t2'
+ | _,_ -> false
+ ) true l1 l2
| (C.Sort s1, C.Sort s2) -> true (*CSC da finire con gli universi *)
- | (C.Prod (_,s1,t1), C.Prod(_,s2,t2)) ->
- aux context s1 s2 && aux ((Some (C.Decl s1))::context) t1 t2
- | (C.Lambda (_,s1,t1), C.Lambda(_,s2,t2)) ->
- aux context s1 s2 && aux ((Some (C.Decl s1))::context) t1 t2
- | (C.LetIn (_,s1,t1), C.LetIn(_,s2,t2)) ->
- aux context s1 s2 && aux ((Some (C.Def s1))::context) t1 t2
+ | (C.Prod (name1,s1,t1), C.Prod(_,s2,t2)) ->
+ aux context s1 s2 && aux ((Some (name1, (C.Decl s1)))::context) t1 t2
+ | (C.Lambda (name1,s1,t1), C.Lambda(_,s2,t2)) ->
+ aux context s1 s2 && aux ((Some (name1, (C.Decl s1)))::context) t1 t2
+ | (C.LetIn (name1,s1,t1), C.LetIn(_,s2,t2)) ->
+ aux context s1 s2 && aux ((Some (name1, (C.Def s1)))::context) t1 t2
| (C.Appl l1, C.Appl l2) ->
(try
List.fold_right2 (fun x y b -> aux context x y && b) l1 l2 true
aux context term1 term2 &&
List.fold_right2 (fun x y b -> b && aux context x y) pl1 pl2 true
| (C.Fix (i1,fl1), C.Fix (i2,fl2)) ->
- let tys = List.map (function (_,_,ty,_) -> Some (C.Decl ty)) fl1 in
+ let tys =
+ List.map (function (n,_,ty,_) -> Some (C.Name n,(C.Decl ty))) fl1
+ in
i1 = i2 &&
List.fold_right2
(fun (_,recindex1,ty1,bo1) (_,recindex2,ty2,bo2) b ->
aux (tys@context) bo1 bo2)
fl1 fl2 true
| (C.CoFix (i1,fl1), C.CoFix (i2,fl2)) ->
- let tys = List.map (function (_,ty,_) -> Some (C.Decl ty)) fl1 in
+ let tys =
+ List.map (function (n,ty,_) -> Some (C.Name n,(C.Decl ty))) fl1
+ in
i1 = i2 &&
List.fold_right2
(fun (_,ty1,bo1) (_,ty2,bo2) b ->