option.v: Add option_guard_decide and option_guard_bool_decide
Merge request reports
Activity
mentioned in commit e0657da4
decide
is harder to use though.bool_decide_True
is an awfully useful lemma. In my experience one wants to useif bool_decide
rather thanif decide
. I remember fighting with annoying occurrences ofdecide
that I fixed by just usingbool_decide
instead.Edited by Ralf JungBut what if
decide P
occurs in the goal and you already have a proof ofP
?I guess you can use
decide_True
, but that was not possible when I had the problem (I forgot the context, but I guess it was not in anif
). I remember reaching fordecide_True_pi
but then things were not actually PI and then I gave up and just changed everything tobool_decide
. I have always usedbool_decide
since then and never regretted it. I don't seedestruct
as a big advantage given that we havecase_bool_decide
.Edited by Ralf JungI guess you can use
decide_True
, but that was not possible when I had the problemI am quite curious where that would happen.
You cannot use
decide_True
if you use the proof, i.e., usematch decide P with left H => ...
, but in that casebool_decide
is not useful either since it gives no proof. Maybe you useddecide P
inProgram
which then implicitly made use of the proof?I think it's easier: with ssreflect rewrite,
rewrite decide_True
basically never works. I've mentioned it in https://mattermost.mpi-sws.org/iris/pl/99cykea83jbq7ea3wkxzafntwo with a testcase:From iris.prelude Require Import prelude. Lemma bar : (if decide (0 = 0) then 0 else 0) = 0. Proof. Succeed by rewrite ->decide_True. Fail rewrite decide_True. (* uglier variants — see https://gist.github.com/Blaisorblade/898115dd0be901d4ba5ca79df0aa2ffa *)
and others have the same experience: https://mattermost.mpi-sws.org/iris/pl/bw767z8c7pgfufgjc6murgaxcc.
It is also the case that rewriting on booleans is intrinsically easier.
Edited by Paolo G. Giarrussowith ssreflect rewrite
Oh, that would explain why things work fine inside std++ but I had issues elsewhere. Opened an issue to track / discuss this further (a closed MR is where issues go to die): #168