module Compose where {-@ cmp :: forall < pref :: b -> Bool, postf :: b -> c -> Bool , pre :: a -> Bool, postg :: a -> b -> Bool , post :: a -> c -> Bool >. {xx::a
, w::b|- c <: c } {ww::a |- b<: b } f:(y:b -> c ) -> g:(z:a -> b) -> x: a -> c@-} cmp :: (b -> c) -> (a -> b) -> a -> c cmp f g x = f (g x) {-@ incr :: x:Nat -> {v:Nat | v == x + 1} @-} incr :: Int -> Int incr x = x + 1 {-@ incr2 :: x:Nat -> {v:Nat | v == x + 2} @-} incr2 :: Int -> Int incr2 = cmp incr incr {-@ plus1 :: x:Nat -> {v:Nat | v == x + 20} @-} plus1 :: Int -> Int plus1 x = x + 20 {-@ plus2 :: x:{v:Nat | v > 10} -> {v:Nat | v == x + 22} @-} plus2 :: Int -> Int plus2 x = x + 22 {-@ plus42 :: x:Nat -> {v:Nat | v == x + 42} @-} plus42 :: Int -> Int plus42 = cmp plus2 plus1