After discussing with @corlewis we didn't end up with a consensus on what if anything should be done about it.
In this situation:
1. ⦃λ_. True⦄
if UCAST(9 → 64) minIRQ ≤ irq ∧ irq ≤ Kernel_Config.maxIRQ then returnOk ()
else throwError (Fault_H.syscall_error.RangeError (UCAST(9 → 64) minIRQ) Kernel_Config.maxIRQ)
⦃λ_ _. toEnum (unat irq) ≤ Kernel_Config.maxIRQ⦄, ⦃λ_ _. True⦄
which is obviously true, if I ask wp to handle it, it gives me:
True ⟹ toEnum (unat irq) ≤ Kernel_Config.maxIRQ
which is obviously not true; I need to instead do this:
apply (clarsimp simp: unlessE_def) (* don't block the if_split *)
apply (rule conjI; clarsimp)
apply wp (* non-throw case: gives provable goal *)
defer
apply wp (* throw case: solves goal outright *)
With supply hoare_vcg_prop[wp del], I get the expected outcome:
True ⟹
(UCAST(9 → 64) minIRQ ≤ irq ∧ irq ≤ Kernel_Config.maxIRQ ⟶ toEnum (unat irq) ≤ Kernel_Config.maxIRQ) ∧
(¬ (UCAST(9 → 64) minIRQ ≤ irq ∧ irq ≤ Kernel_Config.maxIRQ) ⟶ True)
which simplifies to the one case I want:
⟦UCAST(9 → 64) minIRQ ≤ irq; irq ≤ Kernel_Config.maxIRQ⟧ ⟹ toEnum (unat irq) ≤ Kernel_Config.maxIRQ
So in this case our infrastructure is throwing info away. I tried rewriting the unlessE to a whenE, but that didn't change anything.
After discussing with @corlewis we didn't end up with a consensus on what if anything should be done about it.
In this situation:
which is obviously true, if I ask wp to handle it, it gives me:
which is obviously not true; I need to instead do this:
With
supply hoare_vcg_prop[wp del], I get the expected outcome:which simplifies to the one case I want:
So in this case our infrastructure is throwing info away. I tried rewriting the unlessE to a whenE, but that didn't change anything.