diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/constr.ml | 5 | ||||
| -rw-r--r-- | kernel/indtypes.ml | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/kernel/constr.ml b/kernel/constr.ml index 84eacb196c..fde08743b6 100644 --- a/kernel/constr.ml +++ b/kernel/constr.ml @@ -1297,7 +1297,8 @@ let hashcons (sh_sort,sh_ci,sh_construct,sh_ind,sh_con,sh_na,sh_id) = fun t -> fst (sh_rec t) (* Exported hashing fonction on constr, used mainly in plugins. - Appears to have slight differences from [snd (hash_term t)] above ? *) + Slight differences from [snd (hash_term t)] above: it ignores binders + and doesn't do [land 0x3FFFFFFF]. *) let rec hash t = match kind t with @@ -1336,7 +1337,7 @@ let rec hash t = | Float f -> combinesmall 19 (Float64.hash f) and hash_term_array t = - Array.fold_left (fun acc t -> combine (hash t) acc) 0 t + Array.fold_left (fun acc t -> combine acc (hash t)) 0 t module CaseinfoHash = struct diff --git a/kernel/indtypes.ml b/kernel/indtypes.ml index 58e5e76b61..c5a39262a4 100644 --- a/kernel/indtypes.ml +++ b/kernel/indtypes.ml @@ -102,7 +102,7 @@ let failwith_non_pos_list n ntypes l = (* Check the inductive type is called with the expected parameters *) (* [n] is the index of the last inductive type in [env] *) -let check_correct_par (env,n,ntypes,_) paramdecls ind_index args = +let check_correct_par ~chkpos (env,n,ntypes,_) paramdecls ind_index args = let nparams = Context.Rel.nhyps paramdecls in let args = Array.of_list args in if Array.length args < nparams then @@ -123,7 +123,7 @@ let check_correct_par (env,n,ntypes,_) paramdecls ind_index args = LocalNonPar (param_index+1, paramdecl_index_in_env, ind_index) in raise (IllFormedInd err) in check (nparams-1) (n-nparamdecls) paramdecls; - if not (Array.for_all (noccur_between n ntypes) realargs) then + if chkpos && not (Array.for_all (noccur_between n ntypes) realargs) then failwith_non_pos_vect n ntypes realargs (* Computes the maximum number of recursive parameters: @@ -325,7 +325,7 @@ let check_positivity_one ~chkpos recursive (env,_,ntypes,_ as ienv) paramsctxt ( if check_head then begin match hd with | Rel j when Int.equal j (n + ntypes - i - 1) -> - check_correct_par ienv paramsctxt (ntypes - i) largs + check_correct_par ~chkpos ienv paramsctxt (ntypes - i) largs | _ -> raise (IllFormedInd (LocalNotConstructor(paramsctxt,nnonrecargs))) end else |
