Exception Postcondition Stack Notation #
A monad transformer stack carries one exception postcondition for each transformer that throws.
A stack of postconditions is a right-nested × chain with the marker type EStackEnd as its
last component. EStack⟨Nat → σ → Prop, String → σ → Prop⟩ is the stack of
ExceptT Nat (ExceptT String (StateM σ)), and estack⟨e₁, e₂⟩ is a value of it. The notation
hides the nesting and the markers. EStackEnd and EStackEnd.mk are abbreviations of Unit
and (), so the unexpanders can recognize a stack while every Unit instance still applies.
A base monad has one exception postcondition and no stack, so it does not use the notation:
Except ε carries a bare ε → Prop.
Any other type of exception postconditions can declare a ToEStack instance, and vcgen then
weakens its values one stack component at a time.
Exception postcondition stack type: EStack⟨ε₁ → l, ε₂ → l⟩ is (ε₁ → l) × (ε₂ → l) × EStack⟨⟩.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Exception postcondition stack value: estack⟨e₁, e₂⟩ is (e₁, e₂, ()).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Prints EStackEnd as EStack⟨⟩.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Prints a product that ends in EStack⟨⟩ as EStack⟨e₁, e₂, …⟩.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Prints EStackEnd.mk as estack⟨⟩.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Prints a tuple that ends in estack⟨⟩ as estack⟨e₁, e₂, …⟩.
Equations
- One or more equations did not get rendered due to their size.
Instances For
⊥ at the end of an exception postcondition stack is the empty stack value.
toEStack exposes the exception postconditions E as a stack. Example: Thrown with the field
onThrow : String → Prop has toEStack t = estack⟨t.onThrow⟩, and vcgen weakens onThrow.
- toEStack : E → T
The stack that
Econverts to. - le_of_toEStack_le {x y : E} : Lean.Order.PartialOrder.rel (toEStack x) (toEStack y) → Lean.Order.PartialOrder.rel x y
An entailment between the stacks is an entailment between the originals.