-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add select_wp and alternative_wp to wp #661
Conversation
hoare_vcg_all_lift hoare_vcg_imp_lift)+ | ||
hoare_vcg_all_lift hoare_vcg_imp_lift | ||
wp_del: select_wp)+ | ||
apply (rule hoare_pre_cont) | ||
apply (wpsimp wp: select_wp)+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few places like this where existing proofs made use of the fact that select_wp
wasn't in the wp
set and were broken by this change. I could probably restructure the proof to avoid this but for now I've just deleted select_wp
wherever required for the original proofs to continue working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you were right and this situation is the rare one, so this is fine by me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
would the |
@@ -334,7 +334,7 @@ lemma no_throw_L1_init [simp]: "no_throw P (L1_init f)" | |||
apply (rule no_throw_bindE [where B=\<top>]) | |||
apply simp | |||
apply simp | |||
apply wp | |||
apply wpsimp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any thoughts on why the switch to wpsimp was required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd have to go in to check this lemma specifically, but generally that switch was needed when the proof used to work with some rule that could directly solve the hoare triple, instead of the more general *_wp
which leaves behind a final goal. I guess an alternative would be to explicitly add that other rule again here so that it is used first, but that feels more clunky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks for the explanation. No need to dive back in.
crunch cdt[wp]: corrupt_ipc_buffer "\<lambda>s. P (cdl_cdt s)" | ||
(wp:select_wp simp:crunch_simps corrupt_intents_def) | ||
crunches corrupt_frame, corrupt_tcb_intent, corrupt_ipc_buffer | ||
for cdt[wp]: "\<lambda>s. P (cdl_cdt s)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off-topic, but would there be any benefit to making crunches look for a free s
in the term and adding a λs.
in front? Would that be something that makes things nicer, or more confusing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, interesting. It would definitely save a lot of repetition and make things a bit nicer for experienced users but my first reaction is that it would be more confusing for people who are encountering it for the first time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it would work, unless you encode the name s
as something special. If you look at the statements, P
is a legitimate free variable in the term and would look the same as an s
to Isabelle unless you start analysing for types etc.
done | ||
|
||
lemma doUserOp_if_cur_thread[ADT_IF_Refine_assms, wp]: | ||
"doUserOp_if f tc \<lbrace>\<lambda>s. P (ksCurThread s)\<rbrace>" | ||
apply (simp add: doUserOp_if_def) | ||
apply (wp select_wp | wpc | simp)+ | ||
apply (wp | wpc | simp)+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably too late now, but isn't this equivalent to wpsimp+
or wpsimp
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it definitely is. In cases like this where it really was just deleting the rule from wp, the process I was using to make these changes made it easier to just keep on moving. Beyond that, it was basically random which lemmas I would stop at and clean up and which I would just remove the rules and move on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bigger improvement than I expected. Thanks!
There are a fair few opportunities this created to collapse apply statements into a wpsimp
, and you caught some of them, but I'm wondering whether it's possible to make a heuristic that can find the more common cases. Another day perhaps.
That would be nice, along with something for automating converting all of the old uses of |
Hmm, I was originally trying to distinguish the commit prefix in the Monads refactor PR where there's a commit that just touches the Thanks for pointing out the second commit message only mentioning |
Hmm. Yeah |
True, now I'm not sure whether it should be more specific in this case. My first reaction was that mentioning nondet in the prefix wouldn't help, but now I think that it would, since otherwise there's no way to tell from the commit message whether this is for the trace monad or the nondet monad. However, I don't like |
Looking at the commit history, there's a bunch prefixed with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. I had not realised that we are using select
that often. It's good, it's a sign that there is some actual abstraction going on :-)
hoare_vcg_all_lift hoare_vcg_imp_lift)+ | ||
hoare_vcg_all_lift hoare_vcg_imp_lift | ||
wp_del: select_wp)+ | ||
apply (rule hoare_pre_cont) | ||
apply (wpsimp wp: select_wp)+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
crunch cdt[wp]: corrupt_ipc_buffer "\<lambda>s. P (cdl_cdt s)" | ||
(wp:select_wp simp:crunch_simps corrupt_intents_def) | ||
crunches corrupt_frame, corrupt_tcb_intent, corrupt_ipc_buffer | ||
for cdt[wp]: "\<lambda>s. P (cdl_cdt s)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it would work, unless you encode the name s
as something special. If you look at the statements, P
is a legitimate free variable in the term and would look the same as an s
to Isabelle unless you start analysing for types etc.
Signed-off-by: Corey Lewis <[email protected]>
Signed-off-by: Corey Lewis <[email protected]>
No description provided.