File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -877,12 +877,23 @@ let rec ty_strictly_positive_in_type (env:env)
877877 and that it is strictly positive in the return type" );
878878 let sbs , c = U. arrow_formals_comp in_type in
879879 let return_type = FStarC.Syntax.Util. comp_result c in
880+ let effect_args = U. comp_effect_args c in
880881 let ty_lid_not_to_left_of_arrow =
881882 L. for_all
882883 ( fun ({ binder_bv = b }) -> mutuals_unused_in_type mutuals b . sort )
883884 sbs
884885 in
885- if ty_lid_not_to_left_of_arrow
886+ (* We should also consider the effect arguments for positivity. See
887+ https://github.com/FStarLang/FStar/issues/4252. We simply forbid the
888+ effect args from mentioning the type. We do not track positivity
889+ of effect definitions or mark arguments as positive. If this becomes
890+ a limitation, we should revisit. *)
891+ let mutuals_unused_in_effect_args =
892+ L. for_all
893+ ( fun ( a , _ ) -> mutuals_unused_in_type mutuals a )
894+ effect_args
895+ in
896+ if ty_lid_not_to_left_of_arrow && mutuals_unused_in_effect_args
886897 then (
887898 (* and is strictly positive also in the return type *)
888899 ty_strictly_positive_in_type
Original file line number Diff line number Diff line change 1+ module Bug4252
2+
3+ [ @@expect_failure [ 3 ]]
4+ noeq
5+ type t =
6+ | C : (unit -> Pure unit True ( fun _ -> ( exists ( x : t ). True ) ==> False )) -> t
7+
8+ [ @@expect_failure [ 3 ]]
9+ noeq
10+ type t' =
11+ | C : (unit -> Pure unit True ( fun _ -> forall ( x : t' ). False )) -> t'
12+
13+ // let f1 (x : t) : Lemma False =
14+ // match x with
15+ // | C f -> f ()
16+
17+ // let f2 : False =
18+ // f1 (C (fun _ -> Classical.forall_intro f1))
You can’t perform that action at this time.
0 commit comments