Module Π.
Import Setoid.
Structure Π (
From To :
Setoid) :
Type ≔
mkΠ
Existing Instance map_proper.
Lemma cong From To (
f :
Π From To) :
∀ x y, x ≈ y → f x ≈ f y.
Show proof.
intros x y eq_xy; now rewrite eq_xy.
Program Definition setoid (
From To :
Setoid) :
Setoid ≔
Show proof.
constructor.
-
intros f x y eq_xy. now rewrite eq_xy.
-
intros f g eq_fg x y eq_xy. rewrite eq_xy. symmetry. now apply eq_fg.
-
intros f g h eq_fg eq_gh x y eq_xy. etransitivity; eauto.
now apply eq_gh.
Notation "[ A ⟶ B ]" ≔ (
Π A B).
Notation make f ≔ (@
mkΠ _ _ f _) (
only parsing).
Notation "'λ' x .. y ↦ F" ≔ (
make (
λ x ∙ .. (
λ y ∙ F) ..))
(
at level 200,
x binder,
y binder,
no associativity).
Program Definition id {
A} :
[A ⟶ A] ≔
make (
λ x ∙ x).
Show proof.
intros f g eq_fg. exact eq_fg.
Program Definition compose {
A B C} (
g :
[B ⟶ C]) (
f :
[A ⟶ B]) :
[A ⟶ C] ≔
make (
λ x ∙ g (
f x)).
Show proof.
intros x y eq_xy. rewrite eq_xy. reflexivity.
End Π.
Module Π₂.
Import Setoid.
Structure Π₂ (
A B C :
Setoid) :
Type ≔
mkΠ₂
Existing Instance map_compose.
Lemma cong A B C (
f :
Π₂ A B C) :
∀ x x' y y', x ≈ x' → y ≈ y' → f x y ≈ f x' y'.
Show proof.
intros x x' y y' eq_xx' eq_yy'; now rewrite eq_xx', eq_yy'.
Notation "[ A ⟶ B ⟶ C ]" ≔ (
Π₂ A B C).
Notation make | f ≔ (@mkΠ₂ _ _ _ f _) (only parsing).
|
Notation "'λ' x .. y ↦₂ F" ≔ (
make (
λ x ∙ .. (
λ y ∙ F) ..))
(
at level 200,
x binder,
y binder,
no associativity).
End Π₂.
Export Setoid Π Π₂.