| 1 |
Set Primitive Projections. |
| 2 |
Set Implicit Arguments. |
| 3 |
|
| 4 |
Record prod {A} {B}:= pair { fst : A ; snd : B }. |
| 5 |
Notation " A * B " := (@prod A B) : type_scope. |
| 6 |
Record sigT {A} (P : A -> Type) := existT { projT1 : A ; projT2 : P projT1 }. |
| 7 |
Notation pr1 := (@projT1 _ _). |
| 8 |
Arguments prod : clear implicits. |
| 9 |
|
| 10 |
Check (@projT1 _ (fun x : nat => x = x)). |
| 11 |
Check (fun s : @sigT nat (fun x : nat => x = x) => s.(projT1)). |
| 12 |
|
| 13 |
Record rimpl {b : bool} {n : nat} := { foo : forall {x : nat}, x = n }. |
| 14 |
|
| 15 |
Check (fun r : @rimpl true 0 => r.(foo) (x:=0)). |
| 16 |
Check (fun r : @rimpl true 0 => @foo true 0 r 0). |
| 17 |
Check (fun r : @rimpl true 0 => foo r (x:=0)). |
| 18 |
Check (fun r : @rimpl true 0 => @foo _ _ r 0). |
| 19 |
Check (fun r : @rimpl true 0 => r.(@foo _ _)). |
| 20 |
Check (fun r : @rimpl true 0 => r.(foo)). |
| 21 |
|
| 22 |
Notation "{ x : T & P }" := (@sigT T P). |
| 23 |
Notation "{ x : A & P }" := (sigT (A:=A) (fun x => P)) : type_scope. |
| 24 |
(* Notation "{ x : T * U & P }" := (@sigT (T * U) P). *) |
| 25 |
|
| 26 |
Definition compose {A B C : Type} (g : B -> C) (f : A -> B) := fun x => g (f x). |
| 27 |
Inductive paths {A : Type} (a : A) : A -> Type := idpath : paths a a where "x = y" := (@paths _ x y) : type_scope. |
| 28 |
Arguments idpath {A a} , [A] a. |
| 29 |
Class IsEquiv {A B : Type} (f : A -> B) := {}. |
| 30 |
|
| 31 |
Local Instance isequiv_tgt_compose A B |
| 32 |
: @IsEquiv (A -> {xy : B * B & fst xy = snd xy}) |
| 33 |
(A -> B) |
| 34 |
(@compose A {xy : B * B & fst xy = snd xy} B |
| 35 |
(@compose {xy : B * B & fst xy = snd xy} _ B (@snd B B) pr1)) := {}. |
| 36 |
(* Toplevel input, characters 220-223: *) |
| 37 |
(* Error: Cannot infer this placeholder. *) |
| 38 |
|
| 39 |
Local Instance isequiv_tgt_compose' A B |
| 40 |
: @IsEquiv (A -> {xy : B * B & fst xy = snd xy}) |
| 41 |
(A -> B) |
| 42 |
(@compose A {xy : B * B & fst xy = snd xy} B (@compose {xy : B * B & fst xy = snd xy} _ B (@snd _ _) pr1)) := {}. |
| 43 |
(* Toplevel input, characters 221-232: *) |
| 44 |
(* Error: *) |
| 45 |
(* In environment *) |
| 46 |
(* A : Type *) |
| 47 |
(* B : Type *) |
| 48 |
(* The term "pr1" has type "sigT ?30 -> ?29" while it is expected to have type *) |
| 49 |
(* "{xy : B * B & fst xy = snd xy} -> ?27 * B". *) |
| 50 |
|
| 51 |
Local Instance isequiv_tgt_compose'' A B |
| 52 |
: @IsEquiv (A -> {xy : B * B & fst xy = snd xy}) |
| 53 |
(A -> B) |
| 54 |
(@compose A {xy : B * B & fst xy = snd xy} B (@compose {xy : B * B & fst xy = snd xy} _ B (@snd _ _) |
| 55 |
(fun s => s.(projT1)))) := {}. |
| 56 |
(* Toplevel input, characters 15-241: |
| 57 |
Error: |
| 58 |
Cannot infer an internal placeholder of type "Type" in environment: |
| 59 |
|
| 60 |
A : Type |
| 61 |
B : Type |
| 62 |
x : ?32 |
| 63 |
. *) |