| 1 |
Require Import TestSuite.admit. |
| 2 |
(* File reduced by coq-bug-finder from original input, then from 9593 lines to 104 lines, then from 187 lines to 103 lines, then from 113 lines to 90 lines *) |
| 3 |
(* coqc version trunk (October 2014) compiled on Oct 1 2014 18:13:54 with OCaml 4.01.0 |
| 4 |
coqtop version cagnode16:/afs/csail.mit.edu/u/j/jgross/coq-trunk,trunk (68846802a7be637ec805a5e374655a426b5723a5) *) |
| 5 |
Axiom transport : forall {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x), P y. |
| 6 |
Inductive trunc_index := minus_two | trunc_S (_ : trunc_index). |
| 7 |
Axiom IsTrunc : trunc_index -> Type -> Type. |
| 8 |
Existing Class IsTrunc. |
| 9 |
Axiom Contr : Type -> Type. |
| 10 |
Inductive Trunc (n : trunc_index) (A :Type) : Type := tr : A -> Trunc n A. |
| 11 |
Module NonPrim. |
| 12 |
Unset Primitive Projections. |
| 13 |
Set Implicit Arguments. |
| 14 |
Record sigT {A} (P : A -> Type) := existT { projT1 : A ; projT2 : P projT1 }. |
| 15 |
Notation "{ x : A & P }" := (sigT (fun x:A => P)) : type_scope. |
| 16 |
Unset Implicit Arguments. |
| 17 |
Notation "( x ; y )" := (existT _ x y) : fibration_scope. |
| 18 |
Open Scope fibration_scope. |
| 19 |
Notation pr1 := projT1. |
| 20 |
Notation pr2 := projT2. |
| 21 |
Notation "x .1" := (pr1 x) : fibration_scope. |
| 22 |
Notation "x .2" := (pr2 x) : fibration_scope. |
| 23 |
Definition hfiber {A B : Type} (f : A -> B) (y : B) := { x : A & f x = y }. |
| 24 |
Class IsConnected (n : trunc_index) (A : Type) := isconnected_contr_trunc :: Contr (Trunc n A). |
| 25 |
Axiom isconnected_elim : forall {n} {A} `{IsConnected n A} |
| 26 |
(C : Type) `{IsTrunc n C} (f : A -> C), |
| 27 |
{ c:C & forall a:A, f a = c }. |
| 28 |
Class IsConnMap (n : trunc_index) {A B : Type} (f : A -> B) |
| 29 |
:= isconnected_hfiber_conn_map :: forall b:B, IsConnected n (hfiber f b). |
| 30 |
Definition conn_map_elim {n : trunc_index} |
| 31 |
{A B : Type} (f : A -> B) `{IsConnMap n _ _ f} |
| 32 |
(P : B -> Type) {HP : forall b:B, IsTrunc n (P b)} |
| 33 |
(d : forall a:A, P (f a)) |
| 34 |
: forall b:B, P b. |
| 35 |
Proof. |
| 36 |
intros b. |
| 37 |
unshelve (refine (pr1 (isconnected_elim (A:=hfiber f b) _ _))). |
| 38 |
intro x. |
| 39 |
exact (transport P x.2 (d x.1)). |
| 40 |
Defined. |
| 41 |
|
| 42 |
Definition conn_map_elim' {n : trunc_index} |
| 43 |
{A B : Type} (f : A -> B) `{IsConnMap n _ _ f} |
| 44 |
(P : B -> Type) {HP : forall b:B, IsTrunc n (P b)} |
| 45 |
(d : forall a:A, P (f a)) |
| 46 |
: forall b:B, P b. |
| 47 |
Proof. |
| 48 |
intros b. |
| 49 |
unshelve (refine (pr1 (isconnected_elim (A:=hfiber f b) _ _))). |
| 50 |
intros [a p]. |
| 51 |
exact (transport P p (d a)). |
| 52 |
Defined. |
| 53 |
|
| 54 |
Definition conn_map_comp {n : trunc_index} |
| 55 |
{A B : Type} (f : A -> B) `{IsConnMap n _ _ f} |
| 56 |
(P : B -> Type) {HP : forall b:B, IsTrunc n (P b)} |
| 57 |
(d : forall a:A, P (f a)) |
| 58 |
: forall a:A, conn_map_elim f P d (f a) = d a /\ conn_map_elim' f P d (f a) = d a. |
| 59 |
Proof. |
| 60 |
intros a. |
| 61 |
unfold conn_map_elim, conn_map_elim'. |
| 62 |
Set Printing Coercions. |
| 63 |
set (fibermap := fun a0p : hfiber f (f a) |
| 64 |
=> let (a0, p) := a0p in transport P p (d a0)). |
| 65 |
Set Printing Implicit. |
| 66 |
let G := match goal with |- ?G => constr:(G) end in |
| 67 |
first [ match goal with |
| 68 |
| [ |- (@isconnected_elim n (@hfiber A B f (f a)) |
| 69 |
(@isconnected_hfiber_conn_map n A B f H (f a)) |
| 70 |
(P (f a)) (HP (f a)) |
| 71 |
(fun x : @hfiber A B f (f a) => |
| 72 |
@transport B P (f x.1) (f a) x.2 (d x.1))).1 = |
| 73 |
d a /\ _ ] => idtac |
| 74 |
end |
| 75 |
| fail 1 "projection names should be folded, [let] should generate unfolded projections, goal:" G ]; |
| 76 |
first [ match goal with |
| 77 |
| [ |- _ /\ (@isconnected_elim n (@hfiber A B f (f a)) |
| 78 |
(@isconnected_hfiber_conn_map n A B f H (f a)) |
| 79 |
(P (f a)) (HP (f a)) fibermap).1 = d a ] => idtac |
| 80 |
end |
| 81 |
| fail 1 "destruct should generate unfolded projections, as should [let], goal:" G ]. |
| 82 |
admit. |
| 83 |
Defined. |
| 84 |
End NonPrim. |
| 85 |
|
| 86 |
Module Prim. |
| 87 |
Set Primitive Projections. |
| 88 |
Set Implicit Arguments. |
| 89 |
Record sigT {A} (P : A -> Type) := existT { projT1 : A ; projT2 : P projT1 }. |
| 90 |
Notation "{ x : A & P }" := (sigT (fun x:A => P)) : type_scope. |
| 91 |
Unset Implicit Arguments. |
| 92 |
Notation "( x ; y )" := (existT _ x y) : fibration_scope. |
| 93 |
Open Scope fibration_scope. |
| 94 |
Notation pr1 := projT1. |
| 95 |
Notation pr2 := projT2. |
| 96 |
Notation "x .1" := (pr1 x) : fibration_scope. |
| 97 |
Notation "x .2" := (pr2 x) : fibration_scope. |
| 98 |
Definition hfiber {A B : Type} (f : A -> B) (y : B) := { x : A & f x = y }. |
| 99 |
Class IsConnected (n : trunc_index) (A : Type) := isconnected_contr_trunc :: Contr (Trunc n A). |
| 100 |
Axiom isconnected_elim : forall {n} {A} `{IsConnected n A} |
| 101 |
(C : Type) `{IsTrunc n C} (f : A -> C), |
| 102 |
{ c:C & forall a:A, f a = c }. |
| 103 |
Class IsConnMap (n : trunc_index) {A B : Type} (f : A -> B) |
| 104 |
:= isconnected_hfiber_conn_map :: forall b:B, IsConnected n (hfiber f b). |
| 105 |
Definition conn_map_elim {n : trunc_index} |
| 106 |
{A B : Type} (f : A -> B) `{IsConnMap n _ _ f} |
| 107 |
(P : B -> Type) {HP : forall b:B, IsTrunc n (P b)} |
| 108 |
(d : forall a:A, P (f a)) |
| 109 |
: forall b:B, P b. |
| 110 |
Proof. |
| 111 |
intros b. |
| 112 |
unshelve (refine (pr1 (isconnected_elim (A:=hfiber f b) _ _))). |
| 113 |
intro x. |
| 114 |
exact (transport P x.2 (d x.1)). |
| 115 |
Defined. |
| 116 |
|
| 117 |
Definition conn_map_elim' {n : trunc_index} |
| 118 |
{A B : Type} (f : A -> B) `{IsConnMap n _ _ f} |
| 119 |
(P : B -> Type) {HP : forall b:B, IsTrunc n (P b)} |
| 120 |
(d : forall a:A, P (f a)) |
| 121 |
: forall b:B, P b. |
| 122 |
Proof. |
| 123 |
intros b. |
| 124 |
unshelve (refine (pr1 (isconnected_elim (A:=hfiber f b) _ _))). |
| 125 |
intros [a p]. |
| 126 |
exact (transport P p (d a)). |
| 127 |
Defined. |
| 128 |
|
| 129 |
Definition conn_map_comp {n : trunc_index} |
| 130 |
{A B : Type} (f : A -> B) `{IsConnMap n _ _ f} |
| 131 |
(P : B -> Type) {HP : forall b:B, IsTrunc n (P b)} |
| 132 |
(d : forall a:A, P (f a)) |
| 133 |
: forall a:A, conn_map_elim f P d (f a) = d a /\ conn_map_elim' f P d (f a) = d a. |
| 134 |
Proof. |
| 135 |
intros a. |
| 136 |
unfold conn_map_elim, conn_map_elim'. |
| 137 |
Set Printing Coercions. |
| 138 |
set (fibermap := fun a0p : hfiber f (f a) |
| 139 |
=> let (a0, p) := a0p in transport P p (d a0)). |
| 140 |
Set Printing Implicit. |
| 141 |
let G := match goal with |- ?G => constr:(G) end in |
| 142 |
first [ match goal with |
| 143 |
| [ |- (@isconnected_elim n (@hfiber A B f (f a)) |
| 144 |
(@isconnected_hfiber_conn_map n A B f H (f a)) |
| 145 |
(P (f a)) (HP (f a)) |
| 146 |
(fun x : @hfiber A B f (f a) => |
| 147 |
@transport B P (f x.1) (f a) x.2 (d x.1))).1 = |
| 148 |
d a /\ _ ] => idtac |
| 149 |
end |
| 150 |
| fail 1 "projection names should be folded, [let] should generate unfolded projections, goal:" G ]; |
| 151 |
first [ match goal with |
| 152 |
| [ |- _ /\ (@isconnected_elim n (@hfiber A B f (f a)) |
| 153 |
(@isconnected_hfiber_conn_map n A B f H (f a)) |
| 154 |
(P (f a)) (HP (f a)) fibermap).1 = d a ] => idtac |
| 155 |
end |
| 156 |
| fail 1 "destruct should generate unfolded projections, as should [let], goal:" G ]. |
| 157 |
admit. |
| 158 |
Defined. |
| 159 |
End Prim. |