- (C.Rel n1, C.Rel n2) -> n1 = n2
- | (C.Var uri1, C.Var uri2) -> U.eq uri1 uri2
- | (C.Meta n1, C.Meta n2) -> n1 = n2
- | (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 ((C.Decl s1)::context) t1 t2
- | (C.Lambda (_,s1,t1), C.Lambda(_,s2,t2)) ->
- aux context s1 s2 && aux ((C.Decl s1)::context) t1 t2
- | (C.LetIn (_,s1,t1), C.LetIn(_,s2,t2)) ->
- aux context s1 s2 && aux ((C.Def s1)::context) t1 t2
+ (C.Rel n1, C.Rel n2) -> (n1 = n2),ugraph
+ | (C.Var (uri1,exp_named_subst1), C.Var (uri2,exp_named_subst2)) ->
+ let b = U.eq uri1 uri2 in
+ if b then
+ (try
+ List.fold_right2
+ (fun (uri1,x) (uri2,y) (b,ugraph) ->
+ (* FIXME: lazy! *)
+ let b',ugraph' = aux test_equality_only context x y ugraph in
+ (U.eq uri1 uri2 && b' && b),ugraph'
+ ) exp_named_subst1 exp_named_subst2 (true,ugraph)
+ with
+ Invalid_argument _ -> false,ugraph
+ )
+ else
+ false,ugraph
+ | (C.Meta (n1,l1), C.Meta (n2,l2)) ->
+ let b = n1 = n2 in
+ if b then
+ List.fold_left2
+ (fun (b,ugraph) t1 t2 ->
+ if b then
+ match t1,t2 with
+ None,_
+ | _,None -> true,ugraph
+ | Some t1',Some t2' ->
+ aux test_equality_only context t1' t2' ugraph
+ else
+ false,ugraph
+ ) (true,ugraph) l1 l2
+ else
+ false,ugraph
+ (* TASSI: CONSTRAINTS *)
+ | (C.Sort (C.Type t1), C.Sort (C.Type t2)) when test_equality_only ->
+ true,(CicUniv.add_eq t2 t1 ugraph)
+ (* TASSI: CONSTRAINTS *)
+ | (C.Sort (C.Type t1), C.Sort (C.Type t2)) ->
+ true,(CicUniv.add_ge t2 t1 ugraph)
+ (* TASSI: CONSTRAINTS *)
+ | (C.Sort s1, C.Sort (C.Type _)) -> (not test_equality_only),ugraph
+ (* TASSI: CONSTRAINTS *)
+ | (C.Sort s1, C.Sort s2) -> (s1 = s2),ugraph
+ | (C.Prod (name1,s1,t1), C.Prod(_,s2,t2)) ->
+ let b',ugraph' = aux true context s1 s2 ugraph in
+ if b' then
+ aux test_equality_only ((Some (name1, (C.Decl s1)))::context)
+ t1 t2 ugraph'
+ else
+ false,ugraph
+ | (C.Lambda (name1,s1,t1), C.Lambda(_,s2,t2)) ->
+ let b',ugraph' = aux test_equality_only context s1 s2 ugraph in
+ if b' then
+ aux test_equality_only ((Some (name1, (C.Decl s1)))::context)
+ t1 t2 ugraph'
+ else
+ false,ugraph
+ | (C.LetIn (name1,s1,t1), C.LetIn(_,s2,t2)) ->
+ let b',ugraph' = aux test_equality_only context s1 s2 ugraph in
+ if b' then
+ aux test_equality_only
+ ((Some (name1, (C.Def (s1,None))))::context) t1 t2 ugraph'
+ else
+ false,ugraph