From 06e9498bf967323fe12d6383ec7b279a4546a06c Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Mon, 20 May 2002 09:14:13 +0000 Subject: [PATCH] cicReductionNaif.ml was left out from the commit that introduced explicit substitutions. Then I also destroyed it. This is a new implementation that considers explicit substitutions and has not been tested. I hope that it works... --- .../cic_proof_checking/cicReductionNaif.ml | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/helm/ocaml/cic_proof_checking/cicReductionNaif.ml b/helm/ocaml/cic_proof_checking/cicReductionNaif.ml index 089906b6d..fbfe21c44 100644 --- a/helm/ocaml/cic_proof_checking/cicReductionNaif.ml +++ b/helm/ocaml/cic_proof_checking/cicReductionNaif.ml @@ -56,8 +56,8 @@ let whd context = 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 -> @@ -207,14 +207,22 @@ let are_convertible = (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 @@ -250,7 +258,9 @@ let are_convertible = 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 -> @@ -258,7 +268,9 @@ let are_convertible = 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 -> -- 2.39.2