From 4e912c8961af5a9826638a461818b64eaa3cac59 Mon Sep 17 00:00:00 2001 From: SimonBoulier Date: Tue, 10 Mar 2020 15:45:49 +0100 Subject: Remove a positivity check when Check Positivity is off --- kernel/indtypes.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/indtypes.ml b/kernel/indtypes.ml index b6b8e5265c..253c308974 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 -- cgit v1.2.3 From a35e7f9143c8b1c3928978e3b8edc5b326e1f854 Mon Sep 17 00:00:00 2001 From: SimonBoulier Date: Thu, 12 Mar 2020 10:39:03 +0100 Subject: Add changelog entry --- doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst diff --git a/doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst b/doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst new file mode 100644 index 0000000000..c08ebb7f25 --- /dev/null +++ b/doc/changelog/01-kernel/11811-uncheck_positivity_bug.rst @@ -0,0 +1,4 @@ +- **Fixed:** + Allow more inductive types in `Unset Positivity Checking` mode + (`#11811 `_, + by SimonBoulier). -- cgit v1.2.3 From b62a6df9907169f47a72ee78ebe088c68932dd93 Mon Sep 17 00:00:00 2001 From: SimonBoulier Date: Tue, 17 Mar 2020 10:20:50 +0100 Subject: Add test for PR11811 (disable a positivity check) --- test-suite/bugs/closed/bug_11811.v | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test-suite/bugs/closed/bug_11811.v diff --git a/test-suite/bugs/closed/bug_11811.v b/test-suite/bugs/closed/bug_11811.v new file mode 100644 index 0000000000..a73494b630 --- /dev/null +++ b/test-suite/bugs/closed/bug_11811.v @@ -0,0 +1,13 @@ + +Unset Positivity Checking. + +Inductive foo : Type -> Type := +| bar : foo (foo unit) +| baz : foo nat. + +Definition toto : forall A, foo A -> {A = foo unit} + {A = nat}. +Proof. + intros A x. destruct x; intuition. +Defined. + +Check (eq_refl : toto _ baz = right eq_refl). -- cgit v1.2.3