X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fcic_proof_checking%2FcicTypeChecker.ml;h=239bd44155dc08261221c0c13d60042db04af85a;hb=6a388079100673e4f71d28a8a53ea029ee1b08df;hp=6678d509cbcb9ad15f33c7e5e1f0b64be3d6f2b4;hpb=4f1fda223f9b565267054361f0ec9bdedb86fe6a;p=helm.git diff --git a/helm/ocaml/cic_proof_checking/cicTypeChecker.ml b/helm/ocaml/cic_proof_checking/cicTypeChecker.ml index 6678d509c..239bd4415 100644 --- a/helm/ocaml/cic_proof_checking/cicTypeChecker.ml +++ b/helm/ocaml/cic_proof_checking/cicTypeChecker.ml @@ -66,7 +66,7 @@ let debrujin_constructor uri number_of_types = C.Var (uri,exp_named_subst') | C.Meta (i,l) -> let l' = List.map (function None -> None | Some t -> Some (aux k t)) l in - C.Meta (i,l) + C.Meta (i,l') | C.Sort _ | C.Implicit _ as t -> t | C.Cast (te,ty) -> C.Cast (aux k te, aux k ty) @@ -545,7 +545,7 @@ and typecheck_mutual_inductive_defs ~logger uri (itl,_,indparamsno) ugraph = ugraph' ) ugraph cl in (i + 1),ugraph'' - ) itl (1,ugraph) + ) itl (1,ugrap1) in ugraph2 @@ -1126,11 +1126,10 @@ and guarded_by_constructors ~subst context n nn h te args coInductiveTypeURI = | C.Lambda _ | C.LetIn _ -> raise (AssertFailure (lazy "25"))(* due to type-checking *) - | C.Appl ((C.MutInd (uri,_,_))::_) as ty - when uri == coInductiveTypeURI -> + | C.Appl ((C.MutInd (uri,_,_))::_) when uri == coInductiveTypeURI -> guarded_by_constructors ~subst context n nn true te [] coInductiveTypeURI - | C.Appl ((C.MutInd (uri,_,_))::_) as ty -> + | C.Appl ((C.MutInd (uri,_,_))::_) -> guarded_by_constructors ~subst context n nn true te tl coInductiveTypeURI | C.Appl _ -> @@ -1308,18 +1307,18 @@ and check_allowed_sort_elimination ~subst ~metasenv ~logger context uri i let itl_len = List.length itl in let (name,_,ty,cl) = List.nth itl i in let cl_len = List.length cl in - if (itl_len = 1 && cl_len <= 1) then + if (cl_len = 0 || (itl_len = 1 && cl_len = 1)) then let non_informative,ugraph = if cl_len = 0 then true,ugraph else is_non_informative ~logger [Some (C.Name name,C.Decl ty)] paramsno (snd (List.nth cl 0)) ugraph in - (* is a singleton or empty non recursive and non informative + (* is it a singleton or empty non recursive and non informative definition? *) non_informative, ugraph else - false,ugraph + false,ugraph | _ -> raise (TypeCheckerFailure (lazy ("Unknown mutual inductive definition:" ^ @@ -1687,8 +1686,7 @@ and type_of_aux' ~logger ?(subst = []) metasenv context t ugraph = (lazy (sprintf ("Case analysys: analysed term type is %s (%s#1/%d{_}), but is expected to be (an application of) %s#1/%d{_}") (CicPp.ppterm typ) (U.string_of_uri uri') i' (U.string_of_uri uri) i))) - | C.Appl - ((C.MutInd (uri',i',exp_named_subst) as typ):: tl) as typ' -> + | C.Appl ((C.MutInd (uri',i',exp_named_subst) as typ):: tl) -> if U.eq uri uri' && i = i' then let params,args = split tl (List.length tl - k)