2022-07-25 13:30:18 +03:00
|
|
|
module TypeAlias;
|
|
|
|
|
2023-01-03 15:49:04 +03:00
|
|
|
type T :=
|
2022-07-25 13:30:18 +03:00
|
|
|
t : T;
|
|
|
|
|
2023-01-03 15:49:04 +03:00
|
|
|
type T2 :=
|
2022-07-25 13:30:18 +03:00
|
|
|
t2 : T2;
|
|
|
|
|
|
|
|
alias : Type;
|
2022-09-30 03:55:32 +03:00
|
|
|
alias := T;
|
2022-07-25 13:30:18 +03:00
|
|
|
|
|
|
|
x : alias;
|
2022-09-30 03:55:32 +03:00
|
|
|
x := t;
|
2022-07-25 13:30:18 +03:00
|
|
|
|
|
|
|
id : Type → Type;
|
2022-09-30 03:55:32 +03:00
|
|
|
id x := x;
|
2022-07-25 13:30:18 +03:00
|
|
|
|
|
|
|
infixr 9 ⊙;
|
|
|
|
⊙ : (Type → Type) → (Type → Type) → Type → Type;
|
2022-09-30 03:55:32 +03:00
|
|
|
⊙ f g x := f (g x);
|
2022-07-25 13:30:18 +03:00
|
|
|
|
|
|
|
x2 : (id ⊙ id) alias;
|
2022-09-30 03:55:32 +03:00
|
|
|
x2 := t;
|
2022-07-25 13:30:18 +03:00
|
|
|
|
|
|
|
flip : (Type → Type → Type) → id Type → Type → (id ⊙ id) Type;
|
2022-09-30 03:55:32 +03:00
|
|
|
flip f a b := f b a;
|
2022-07-25 13:30:18 +03:00
|
|
|
|
2023-01-03 15:49:04 +03:00
|
|
|
type Pair (A : Type) (B : Type) :=
|
2022-07-25 13:30:18 +03:00
|
|
|
mkPair : id T → id (id A) → B → Pair A B;
|
|
|
|
|
|
|
|
p : {A : Type} → A → Pair A A;
|
2022-09-30 03:55:32 +03:00
|
|
|
p a := mkPair t a a;
|
2022-07-25 13:30:18 +03:00
|
|
|
|
|
|
|
x' : flip Pair (id _) T2;
|
2022-09-30 03:55:32 +03:00
|
|
|
x' := mkPair x t2 t;
|
2022-07-25 13:30:18 +03:00
|
|
|
|
|
|
|
end;
|