True
is a bad argument10
is a good argumenttake
and drop
reconstruction0
fib
is an uninterpreted function0
average
take
fib
fib
is an uninterpreted functionList
s Elementsappend
take
and drop
reconstructiontake
and drop
reconstruction
Relating Abstract Refinements
Good: Bring info in scope for verification!
Bad: Modification of run-time code.
Ugly: Pollute the code.
append
Verification requirement:
hdProp = \hd -> hd < x -- property of head elements
tlProp = \tl -> x <= tl -- property of tail elements
----------------------------------------------------------
recProp = \hd tl -> hd <= tl -- recursive (sorted) list
Abstracting over Properties:
forall hd tl. hdProp hd => tlProp tl => recProp hd tl
Note: Abstract requirement is independent of x
!
Turn Requirement:
forall hd tl. hdProp hd => tlProp tl => recProp hd tl
Into a Bound: Haskell function that relates abstract refinements
Bound RecProp
combines
p
hdprop
tlprop
recProp = \hd tl -> hd <= tl -- recursive (sort) property
hdProp = \hd -> hd < x -- property of head elements
tlProp = \tl -> x <= tl -- property of tail elements
Bound Instantiation:
recProp
= \hd tl -> hd < x ==> x <= tl ==> hd <= tl