Chasing Bottoms Nils Anders Danielsson Patrik Jansson Chalmers - - PowerPoint PPT Presentation

chasing bottoms
SMART_READER_LITE
LIVE PREVIEW

Chasing Bottoms Nils Anders Danielsson Patrik Jansson Chalmers - - PowerPoint PPT Presentation

Chasing Bottoms Nils Anders Danielsson Patrik Jansson Chalmers Chasing Bottoms p.1/7 Context Cover project. Verification of real Haskell programs. Haskell non-strict partial and infinite values relatively common. Chasing Bottoms


slide-1
SLIDE 1

Chasing Bottoms

Nils Anders Danielsson Patrik Jansson Chalmers

Chasing Bottoms – p.1/7

slide-2
SLIDE 2

Context

Cover project. Verification of real Haskell programs. Haskell non-strict ⇒ partial and infinite values relatively common.

Chasing Bottoms – p.2/7

slide-3
SLIDE 3

Proof methods

Fixpoint induction. The approximation lemma. Coinduction. Fusion.

Chasing Bottoms – p.3/7

slide-4
SLIDE 4

Caveats

η-equality is not valid. ⊥ = λx.⊥

No surjective pairing.

(fst ⊥, snd ⊥) = (⊥, ⊥) = ⊥

Strange pattern matching semantics.

λTrue x.x = λTrue.λx.x

Typical Monad instances not monads.

⊥ > > = return = λx.⊥ = ⊥

Chasing Bottoms – p.4/7

slide-5
SLIDE 5

Testing partial values

isBottom :: a → Bool

Several flavours of bottom: Non-termination.

error "..."

Pattern match failure. (isBottom :: a → IO Bool)

ˆ =, ˆ ⊑ :: Data a ⇒ a → a → Bool

Chasing Bottoms – p.5/7

slide-6
SLIDE 6

Testing infinite values

approx :: Nat → T → T approx 3

  • =

⊥ ⊥ ⊥

The approximation lemma:

t1 = t2

iff

∀n :: Nat. approx n t1 = approx n t2

Chasing Bottoms – p.6/7

slide-7
SLIDE 7

Conclusions

Can test and prove, but tricky. Approximate semantics might be nice.

⊥ ≈ λx.⊥

For more details, see MPC2004 paper.

Chasing Bottoms – p.7/7