feat(hott.init.function): add more notions from the standard library
This commit is contained in:
parent
43fb334914
commit
ce5f60d009
1 changed files with 15 additions and 1 deletions
|
@ -9,7 +9,9 @@ General operations on functions.
|
||||||
-/
|
-/
|
||||||
|
|
||||||
prelude
|
prelude
|
||||||
import init.reserved_notation
|
import init.reserved_notation .types
|
||||||
|
|
||||||
|
open prod
|
||||||
|
|
||||||
namespace function
|
namespace function
|
||||||
|
|
||||||
|
@ -18,6 +20,12 @@ variables {A B C D E : Type}
|
||||||
definition compose [reducible] (f : B → C) (g : A → B) : A → C :=
|
definition compose [reducible] (f : B → C) (g : A → B) : A → C :=
|
||||||
λx, f (g x)
|
λx, f (g x)
|
||||||
|
|
||||||
|
definition compose_right [reducible] (f : B → B → B) (g : A → B) : B → A → B :=
|
||||||
|
λ b a, f b (g a)
|
||||||
|
|
||||||
|
definition compose_left [reducible] (f : B → B → B) (g : A → B) : A → B → B :=
|
||||||
|
λ a b, f (g a) b
|
||||||
|
|
||||||
definition id [reducible] (a : A) : A :=
|
definition id [reducible] (a : A) : A :=
|
||||||
a
|
a
|
||||||
|
|
||||||
|
@ -40,6 +48,12 @@ definition flip [reducible] {C : A → B → Type} (f : Πx y, C x y) : Πy x, C
|
||||||
definition app [reducible] {B : A → Type} (f : Πx, B x) (x : A) : B x :=
|
definition app [reducible] {B : A → Type} (f : Πx, B x) (x : A) : B x :=
|
||||||
f x
|
f x
|
||||||
|
|
||||||
|
definition curry [reducible] : (A × B → C) → A → B → C :=
|
||||||
|
λ f a b, f (a, b)
|
||||||
|
|
||||||
|
definition uncurry [reducible] : (A → B → C) → (A × B → C) :=
|
||||||
|
λ f p, match p with (a, b) := f a b end
|
||||||
|
|
||||||
precedence `∘'`:60
|
precedence `∘'`:60
|
||||||
precedence `on`:1
|
precedence `on`:1
|
||||||
precedence `$`:1
|
precedence `$`:1
|
||||||
|
|
Loading…
Reference in a new issue