2014-01-05 20:05:08 +00:00
|
|
|
import Int.
|
2014-01-08 08:38:39 +00:00
|
|
|
definition revapp {A : (Type U)} {B : A -> (Type U)} (a : A) (f : forall (x : A), B x) : (B a) := f a.
|
2014-01-05 20:05:08 +00:00
|
|
|
infixl 100 |> : revapp
|
2013-11-01 15:51:49 +00:00
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
eval 10 |> (fun x, x + 1)
|
2013-11-01 15:51:49 +00:00
|
|
|
|> (fun x, x + 2)
|
|
|
|
|> (fun x, 2 * x)
|
|
|
|
|> (fun x, 3 - x)
|
|
|
|
|> (fun x, x + 2)
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
definition revcomp {A B C: (Type U)} (f : A -> B) (g : B -> C) : A -> C :=
|
2013-11-01 15:51:49 +00:00
|
|
|
fun x, g (f x)
|
2014-01-05 20:05:08 +00:00
|
|
|
infixl 100 #> : revcomp
|
2013-11-01 15:51:49 +00:00
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
eval (fun x, x + 1) #>
|
2013-11-01 15:51:49 +00:00
|
|
|
(fun x, 2 * x * x) #>
|
|
|
|
(fun x, 10 + x)
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
definition simple := (fun x, x + 1) #>
|
2013-11-01 15:51:49 +00:00
|
|
|
(fun x, 2 * x * x) #>
|
|
|
|
(fun x, 10 + x)
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
check simple
|
|
|
|
eval simple 10
|
2013-11-01 15:51:49 +00:00
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
definition simple2 := (fun x : Int, x + 1) #>
|
2013-11-01 15:51:49 +00:00
|
|
|
(fun x, 2 * x * x) #>
|
|
|
|
(fun x, 10 + x)
|
2014-01-05 20:05:08 +00:00
|
|
|
check simple2
|
|
|
|
eval simple2 (-10)
|