{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE ExtendedDefaultRules #-} {-# LANGUAGE FlexibleContexts #-} {-@ LIQUID "--higherorder" @-} {-@ LIQUID "--autoproofs" @-} {-@ LIQUID "--totality" @-} {-@ LIQUID "--exact-data-cons" @-} {-@ LIQUID "--no-prune" @-} module FunctionAbstraction where import Axiomatize import Equational {-@ measure fib :: Int -> Int @-} {-@ assume fib :: n:Nat -> {v:Nat| v == fib n && if n == 0 then v == 0 else (if n == 1 then v == 1 else v == fib (n-1) + fib (n-2)) } @-} fib :: Int -> Int fib n | n < 0 = error "cannot happen" | n == 0 = 0 | n == 1 = 1 | otherwise = fib (n-1) + fib (n-2) infixr 2 `with` {-@ with :: forall
Prop, q::Bool -> Prop, r :: Bool -> Prop>. {vp::Bool
|- Bool -> Bool <: Bool
-> Bool