Debian Codegraph @

test-suite/bugs/HoTT_coq_108.v

raw
1 Require Import TestSuite.admit.
2 (* -*- mode: coq; coq-prog-args: ("-indices-matter") -*- *)
3 (* NOTE: This bug is only triggered with -load-vernac-source / in interactive mode. *)
4 (* File reduced by coq-bug-finder from 139 lines to 124 lines. *)
5 Set Universe Polymorphism.
6 Reserved Notation "g 'o' f" (at level 40, left associativity).
7 Generalizable All Variables.
8 Inductive paths {A : Type} (a : A) : A -> Type :=
9 idpath : paths a a.
10 Arguments idpath {A a} , [A] a.
11 Notation "x = y :> A" := (@paths A x y) : type_scope.
12 Notation "x = y" := (x = y :>_) : type_scope.
13
14 Definition transport {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x) : P y :=
15 match p with idpath => u end.
16
17 Definition ap {A B:Type} (f:A -> B) {x y:A} (p:x = y) : f x = f y
18 := match p with idpath => idpath end.
19
20 Definition apD10 {A} {B:A->Type} {f g : forall x, B x} (h:f=g)
21 : forall x, f x = g x
22 := fun x => match h with idpath => idpath end.
23
24 Definition ap11 {A B} {f g:A->B} (h:f=g) {x y:A} (p:x=y) : f x = g y.
25 admit.
26 Defined.
27 Class IsEquiv {A B : Type} (f : A -> B) := {}.
28 Class Contr_internal (A : Type) := BuildContr {
29 center : A ;
30 contr : (forall y : A, center = y)
31 }.
32
33 Arguments center A {_}.
34
35 Inductive trunc_index : Type :=
36 | minus_two : trunc_index
37 | trunc_S : trunc_index -> trunc_index.
38
39 Fixpoint nat_to_trunc_index (n : nat) : trunc_index
40 := match n with
41 | 0 => trunc_S (trunc_S minus_two)
42 | S n' => trunc_S (nat_to_trunc_index n')
43 end.
44
45 Coercion nat_to_trunc_index : nat >-> trunc_index.
46
47 Fixpoint IsTrunc_internal (n : trunc_index) (A : Type) : Type :=
48 match n with
49 | minus_two => Contr_internal A
50 | trunc_S n' => forall (x y : A), IsTrunc_internal n' (x = y)
51 end.
52 Class IsTrunc (n : trunc_index) (A : Type) : Type :=
53 Trunc_is_trunc : IsTrunc_internal n A.
54
55 #[export] Instance istrunc_paths (A : Type) n `{H : IsTrunc (trunc_S n) A} (x y : A)
56 : IsTrunc n (x = y)
57 := H x y.
58
59 Notation Contr := (IsTrunc minus_two).
60
61 Notation IsHSet := (IsTrunc 0).
62
63 Class Funext :=
64 { isequiv_apD10 :: forall (A : Type) (P : A -> Type) f g, IsEquiv (@apD10 A P f g) }.
65 Global Instance contr_forall `{Funext} `{P : A -> Type} `{forall a, Contr (P a)}
66 : Contr (forall a, P a) | 100.
67 admit.
68 Defined.
69 #[export] Hint Extern 0 => progress change Contr_internal with Contr in * : typeclass_instances.
70 Global Instance trunc_forall `{Funext} `{P : A -> Type} `{forall a, IsTrunc n (P a)}
71 : IsTrunc n (forall a, P a) | 100.
72 Proof.
73 generalize dependent P.
74 induction n as [ | n' IH]; [ | admit ]; simpl; intros P ?.
75 exact _.
76 Defined.
77 Set Implicit Arguments.
78
79 Record PreCategory :=
80 { object :> Type;
81 morphism : object -> object -> Type;
82 identity : forall x, morphism x x;
83 compose : forall s d d', morphism d d' -> morphism s d -> morphism s d';
84 trunc_morphism : forall s d, IsHSet (morphism s d) }.
85
86 #[export] Existing Instance trunc_morphism.
87 Infix "o" := (@compose _ _ _ _) : morphism_scope.
88 Local Open Scope morphism_scope.
89
90 Record Functor (C D : PreCategory) :=
91 { object_of :> C -> D;
92 morphism_of : forall s d, morphism C s d
93 -> morphism D (object_of s) (object_of d);
94 composition_of : forall s d d'
95 (m1 : morphism C s d) (m2: morphism C d d'),
96 morphism_of _ _ (m2 o m1)
97 = (morphism_of _ _ m2) o (morphism_of _ _ m1);
98 identity_of : forall x, morphism_of _ _ (@identity _ x)
99 = @identity _ (object_of x) }.
100
101 Definition Sect {A B : Type} (s : A -> B) (r : B -> A) :=
102 forall x : A, r (s x) = x.
103
104 Section path_functor.
105 Context `{Funext}.
106 Variable C : PreCategory.
107 Variable D : PreCategory.
108 Local Notation path_functor'_T F G
109 := { HO : object_of F = object_of G
110 & transport (fun GO => forall s d, morphism C s d -> morphism D (GO s) (GO d))
111 HO
112 (morphism_of F)
113 = morphism_of G }
114 (only parsing).
115 Definition path_functor'_sig (F G : Functor C D) : path_functor'_T F G -> F = G.
116 Proof.
117 intros [H' H''].
118 destruct F, G; simpl in *.
119 induction H'. (* while destruct H' works *) destruct H''.
120 apply ap11; [ apply ap | ];
121 apply center; abstract exact _.
122 Set Printing Universes.
123 (* Fail Defined.*)
124 (* The command has indeed failed with message:
125 => Error: path_functor'_sig_subproof already exists. *)
126 Defined.
127 (* Anomaly: Backtrack.backto 55: a state with no vcs_backup. Please report. *)
128 End path_functor.