match l1,l2 with
[],[] -> []
| he1::tl1, he2::tl2 -> (he1,he2)::combine tl1 tl2
- | he::tl, [] -> (false,C.Rel ~-1)::combine tl [] (* dummy term *)
+ | _::tl, [] -> (false,C.Rel ~-1)::combine tl [] (* dummy term *)
| [],_::_ -> assert false
in
let lefts, _ = HExtlib.split_nth (min j (List.length args)) args in
let t1 = R.whd ~subst context t1 in
let t2 = R.whd ~subst ((name,C.Decl s)::context) t2 in
match t1, t2 with
- | C.Sort s1, C.Sort C.Prop -> t2
+ | C.Sort _, C.Sort C.Prop -> t2
| C.Sort (C.Type u1), C.Sort (C.Type u2) -> C.Sort (C.Type (u1@u2))
- | C.Sort _,C.Sort (C.Type _) -> t2
+ | C.Sort C.Prop,C.Sort (C.Type _) -> t2
| C.Meta (_,(_,(C.Irl 0 | C.Ctx []))), C.Sort _
| C.Meta (_,(_,(C.Irl 0 | C.Ctx []))), C.Meta (_,(_,(C.Irl 0 | C.Ctx [])))
| C.Sort _, C.Meta (_,(_,(C.Irl 0 | C.Ctx []))) -> t2
| [] -> ty_he
| (arg, ty_arg)::tl ->
match R.whd ~subst context ty_he with
- | C.Prod (n,s,t) ->
-(*
- prerr_endline (PP.ppterm ~subst ~metasenv ~context s ^ " - Vs - "
- ^ PP.ppterm ~subst ~metasenv ~context ty_arg);
- prerr_endline (PP.ppterm ~subst ~metasenv ~context
- (S.subst ~avoid_beta_redexes:true arg t));
-*)
+ | C.Prod (_,s,t) ->
if R.are_convertible ~subst context ty_arg s then
aux (S.subst ~avoid_beta_redexes:true arg t) tl
else
match c, params with
| c,[] -> c
| C.Prod (_,_,ta), he::tl -> instantiate_parameters tl (S.subst he ta)
- | t,l -> raise (AssertFailure (lazy "1"))
+ | _,_ -> raise (AssertFailure (lazy "1"))
;;
let specialize_inductive_type_constrs ~subst context ty_term =
match R.whd ~subst context ty_term with
- | C.Const (Ref.Ref (uri,Ref.Ind (_,i,_)) as ref)
- | C.Appl (C.Const (Ref.Ref (uri,Ref.Ind (_,i,_)) as ref) :: _ ) as ty ->
+ | C.Const (Ref.Ref (_,Ref.Ind _) as ref)
+ | C.Appl (C.Const (Ref.Ref (_,Ref.Ind _) as ref) :: _ ) as ty ->
let args = match ty with C.Appl (_::tl) -> tl | _ -> [] in
- let is_ind, leftno, itl, attrs, i = E.get_checked_indtys ref in
+ let _, leftno, itl, _, i = E.get_checked_indtys ref in
let left_args,_ = HExtlib.split_nth leftno args in
let _,_,_,cl = List.nth itl i in
List.map
(PP.ppterm ~subst ~metasenv ~context te))))
;;
-let rec eat_or_subst_lambdas ~subst ~metasenv n te to_be_subst args
- (context, recfuns, x as k)
+let rec eat_or_subst_lambdas
+ ~subst ~metasenv n te to_be_subst args (context,_,_ as k)
=
match n, R.whd ~subst context te, to_be_subst, args with
- | (n, C.Lambda (name,so,ta),true::to_be_subst,arg::args) when n > 0 ->
+ | (n, C.Lambda (_,_,ta),true::to_be_subst,arg::args) when n > 0 ->
eat_or_subst_lambdas ~subst ~metasenv (n - 1) (S.subst arg ta)
to_be_subst args k
- | (n, C.Lambda (name,so,ta),false::to_be_subst,arg::args) when n > 0 ->
+ | (n, C.Lambda (name,so,ta),false::to_be_subst,_::args) when n > 0 ->
eat_or_subst_lambdas ~subst ~metasenv (n - 1) ta to_be_subst args
(shift_k (name,(C.Decl so)) k)
| (_, te, _, _) -> te, k
(*CSC: mettere in cicSubstitution *)
let rec subst_inductive_type_with_dummy _ = function
| C.Const (Ref.Ref (uri',Ref.Ind (true,0,_))) when NUri.eq uri' uri -> dummy
- | C.Appl ((C.Const (Ref.Ref (uri',Ref.Ind (true,0,_))))::tl)
+ | C.Appl ((C.Const (Ref.Ref (uri',Ref.Ind (true,0,_))))::_)
when NUri.eq uri' uri -> dummy
| t -> U.map (fun _ x->x) () subst_inductive_type_with_dummy t
in
strictly_positive ~subst ((name,C.Decl so)::context) (n+1) (nn+1) ta
| C.Appl ((C.Rel m)::tl) when m > n && m <= nn ->
List.for_all (does_not_occur ~subst context n nn) tl
- | C.Appl (C.Const (Ref.Ref (uri,Ref.Ind (_,i,_)) as r)::tl) ->
+ | C.Appl (C.Const (Ref.Ref (uri,Ref.Ind _) as r)::tl) ->
let _,paramsno,tyl,_,i = E.get_checked_indtys r in
let _,name,ity,cl = List.nth tyl i in
let ok = List.length tyl = 1 in
if k = 0 then 0
else
match R.whd context x with
- | C.Rel m when m = n - (indparamsno - k) -> k - 1
- | y -> raise (TypeCheckerFailure (lazy
+ | C.Rel m when m = n - (indparamsno - k) -> k - 1
+ | _ -> raise (TypeCheckerFailure (lazy
("Argument "^string_of_int (indparamsno - k + 1) ^ " (of " ^
string_of_int indparamsno ^ " fixed) is not homogeneous in "^
"appl:\n"^ PP.ppterm ~context ~subst ~metasenv:[] reduct))))
| C.Appl (he::(_::_ as args)) ->
let ty_he = typeof_aux context he in
let args_with_ty = List.map (fun t -> t, typeof_aux context t) args in
-(*
- prerr_endline ("HEAD: " ^ PP.ppterm ~subst ~metasenv ~context ty_he);
- prerr_endline ("TARGS: " ^ String.concat " | " (List.map (PP.ppterm
- ~subst ~metasenv ~context) (List.map snd args_with_ty)));
- prerr_endline ("ARGS: " ^ String.concat " | " (List.map (PP.ppterm
- ~subst ~metasenv ~context) (List.map fst args_with_ty)));
-*)
eat_prods ~subst ~metasenv context he ty_he args_with_ty
| C.Appl _ -> raise (AssertFailure (lazy "Appl of length < 2"))
| C.Match (Ref.Ref (_,Ref.Ind (_,tyno,_)) as r,outtype,term,pl) ->
let outsort = typeof_aux context outtype in
- let inductive,leftno,itl,_,_ = E.get_checked_indtys r in
+ let _,leftno,itl,_,_ = E.get_checked_indtys r in
let constructorsno =
let _,_,_,cl = List.nth itl tyno in List.length cl
in
| (C.Sort C.Prop, C.Sort C.Type _) ->
(* TODO: we should pass all these parameters since we
* have them already *)
- let inductive,leftno,itl,_,i = E.get_checked_indtys r in
+ let _,leftno,itl,_,i = E.get_checked_indtys r in
let itl_len = List.length itl in
let _,name,ty,cl = List.nth itl i in
let cl_len = List.length cl in
in
typeof_aux context term
-and check_mutual_inductive_defs uri ~metasenv ~subst is_ind leftno tyl =
+and check_mutual_inductive_defs uri ~metasenv ~subst leftno tyl =
(* let's check if the arity of the inductive types are well formed *)
List.iter (fun (_,_,x,_) -> ignore (typeof ~subst ~metasenv [] x)) tyl;
(* let's check if the types of the inductive constructors are well formed. *)
let context,ty_sort = split_prods ~subst [] ~-1 ty in
let sx_context_ty_rev,_ = HExtlib.split_nth leftno (List.rev context) in
List.iter
- (fun (_,name,te) ->
+ (fun (_,_,te) ->
let te = debruijn uri len [] te in
let context,te = split_prods ~subst tys leftno te in
let _,chopped_context_rev =
) bos
in
List.iter (fun (bo,k) -> aux k bo) bos_and_ks
- | C.Match (Ref.Ref (uri,Ref.Ind (true,_,_)),outtype,term,pl) as t ->
+ | C.Match (Ref.Ref (_,Ref.Ind (true,_,_)),outtype,term,pl) as t ->
(match R.whd ~subst context term with
| C.Rel m | C.Appl (C.Rel m :: _ ) as t when is_safe m recfuns || m = x ->
let ty = typeof ~subst ~metasenv context term in
| C.Appl ((C.Rel m)::tl) when m > n && m <= nn ->
h && List.for_all (does_not_occur ~subst context n nn) tl
| C.Const (Ref.Ref (_,Ref.Con _)) -> true
- | C.Appl (C.Const (Ref.Ref (uri, Ref.Con (_,j,paramsno))) :: tl) as t ->
+ | C.Appl (C.Const (Ref.Ref (_, Ref.Con (_,j,paramsno))) :: tl) as t ->
let ty_t = typeof ~subst ~metasenv context t in
let dc_ctx, dcl, start, stop =
specialize_and_abstract_constrs ~subst indURI indlen context ty_t in
| C.Appl []
| C.Const (Ref.Ref (_,Ref.Fix _)) -> assert false
| C.Meta _ -> true
- | C.Match (Ref.Ref (uri,Ref.Ind (isinductive,_,_)),outtype,term,pl) ->
+ | C.Match (Ref.Ref (_,Ref.Ind (isinductive,_,_)),_,term,pl) ->
(match term with
| C.Rel m | C.Appl (C.Rel m :: _ ) when is_safe m recfuns || m = x ->
if not isinductive then
) [] subst)
;;
-let typecheck_obj (uri,height,metasenv,subst,kind) =
+let typecheck_obj (uri,_height,metasenv,subst,kind) =
+ (* height is not checked since it is only used to implement an optimization *)
typecheck_metasenv metasenv;
typecheck_subst ~metasenv subst;
match kind with
(PP.ppterm ~subst ~metasenv ~context:[] ty))))
| C.Constant (relevance,_,None,ty,_) ->
ignore (typeof ~subst ~metasenv [] ty)
- | C.Inductive (is_ind, leftno, tyl, _) ->
- check_mutual_inductive_defs uri ~metasenv ~subst is_ind leftno tyl
+ | C.Inductive (_, leftno, tyl, _) ->
+ check_mutual_inductive_defs uri ~metasenv ~subst leftno tyl
| C.Fixpoint (inductive,fl,_) ->
let types, kl =
List.fold_left
dbo, Evil rno)
fl kl)
in
- List.iter2 (fun (_,name,x,ty,_) bo ->
+ List.iter2 (fun (_,_,x,ty,_) bo ->
let ty_bo = typeof ~subst ~metasenv types bo in
if not (R.are_convertible ~subst types ty_bo ty)
then raise (TypeCheckerFailure (lazy ("(Co)Fix: ill-typed bodies")))
| ((_,objs,None)::tl, Cic.Lambda(name,oso,ota), NCic.Lambda(name',so,ta)) ->
split_lambdas_and_letins ((Some(name,(Cic.Decl oso)))::octx)
(Ce (lazy ((name',NCic.Decl so),objs))::ctx) tl (ota,ta)
- | ((_,objs,Some r)::tl,Cic.Lambda(name,oso,ota),NCic.Lambda(name',so,ta)) ->
+ | ((_,_,Some r)::tl,Cic.Lambda(name,oso,ota),NCic.Lambda(name',so,ta)) ->
split_lambdas_and_letins ((Some(name,(Cic.Decl oso)))::octx)
(Fix (lazy (r,name',so))::ctx) tl (ota,ta)
| ((_,objs,None)::tl,Cic.LetIn(name,obo,oty,ota),NCic.LetIn(nam',bo,ty,ta))->
;;
let splat_args ctx t n_fix rels =
- let bound, free, _, primo_ce_dopo_fix = context_tassonomy ctx in
+ let bound, _, _, primo_ce_dopo_fix = context_tassonomy ctx in
if ctx = [] then t
else
let rec aux = function
0, Cic.Sort _ -> 0
| 0, Cic.Prod (name,so,ty) ->
1 + count_prods 0 (Some (name, Cic.Decl so)::context) ty
- | n, Cic.Prod (name,so,ty) ->
+ | _, Cic.Prod (name,so,ty) ->
count_prods (leftno - 1) (Some (name, Cic.Decl so)::context) ty
| _,_ -> assert false
in
begin
match obj, ref with
| (_,_,_,_,NCic.Fixpoint (true,fl,_)) ,
- NReference.Ref (y,NReference.Fix _) ->
+ NReference.Ref (_,NReference.Fix _) ->
ignore(List.fold_left (fun i (_,name,rno,_,_) ->
let ref = NReference.mk_fix i rno ref in
Hashtbl.add cache name (ref,obj);
i+1
) 0 fl)
| (_,_,_,_,NCic.Fixpoint (false,fl,_)) ,
- NReference.Ref (y,NReference.CoFix _) ->
- ignore(List.fold_left (fun i (_,name,rno,_,_) ->
+ NReference.Ref (_,NReference.CoFix _) ->
+ ignore(List.fold_left (fun i (_,name,_,_,_) ->
let ref = NReference.mk_cofix i ref in
Hashtbl.add cache name (ref,obj);
i+1
| Cic.MutConstruct (uri,_,_,exp_named_subst) ->
h := max !h (get_height uri);
List.iter (function (_,t) -> aux t) exp_named_subst
- | Cic.Meta (i,l) -> List.iter (function None -> () | Some t -> aux t) l
+ | Cic.Meta (_,l) -> List.iter (function None -> () | Some t -> aux t) l
| Cic.Cast (t1,t2)
| Cic.Prod (_,t1,t2)
| Cic.Lambda (_,t1,t2) -> aux t1; aux t2