Skip to content

hoare_vcg_prop (in default wp set) throws away non-throw information #1007

Description

@Xaphiosis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proof engineeringnicer, shorter, more maintainable etc proofsproof toolsconvenience, automation, productivity tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions