Debian Codegraph @

test-suite/bugs/HoTT_coq_107.v

raw
1 (* -*- mode: coq; coq-prog-args: ("-nois" "-R" "../theories" "Coq") -*- *)
2 (* File reduced by coq-bug-finder from 4897 lines to 2605 lines, then from 2297 lines to 236 lines, then from 239 lines to 137 lines, then from 118 lines to 67 lines, then from 520 lines to 76 lines. *)
3 (** Note: The bug here is the same as the #113, that is, HoTT_coq_113.v *)
4 Require Import Corelib.Init.Logic.
5 Require Import Corelib.Init.Ltac.
6 Global Set Universe Polymorphism.
7 Global Set Asymmetric Patterns.
8 Set Implicit Arguments.
9
10 Inductive sigT (A:Type) (P:A -> Type) : Type :=
11 existT : forall x:A, P x -> sigT P.
12
13 Notation "{ x : A & P }" := (sigT (fun x:A => P)) : type_scope.
14
15 Generalizable All Variables.
16 Definition admit {T} : T.
17 Admitted.
18 Inductive paths {A : Type} (a : A) : A -> Type :=
19 idpath : paths a a.
20
21 Notation "x = y :> A" := (@paths A x y) : type_scope.
22 Notation "x = y" := (x = y :>_) : type_scope.
23 Definition transport {A : Type} (P : A -> Type) {x y : A} (p : x = y) (u : P x) : P y :=
24 match p with idpath => u end.
25 Class Contr_internal (A : Type) :=
26 BuildContr {
27 center : A ;
28 contr : (forall y : A, center = y)
29 }.
30
31 Arguments center A {_}.
32
33 Inductive trunc_index : Type :=
34 | minus_two : trunc_index
35 | trunc_S : trunc_index -> trunc_index.
36
37 Fixpoint IsTrunc_internal (n : trunc_index) (A : Type) : Type :=
38 match n with
39 | minus_two => Contr_internal A
40 | trunc_S n' => forall (x y : A), IsTrunc_internal n' (x = y)
41 end.
42
43 Create HintDb typeclass_instances discriminated.
44
45 Class IsTrunc (n : trunc_index) (A : Type) : Type :=
46 Trunc_is_trunc : IsTrunc_internal n A.
47
48 Notation Contr := (IsTrunc minus_two).
49
50 #[export] Hint Extern 0 => progress change Contr_internal with Contr in * : typeclass_instances.
51
52 Definition path_contr `{Contr A} (x y : A) : x = y
53 := admit.
54
55 Definition path_sigma' {A : Type} (P : A -> Type) {x x' : A} {y : P x} {y' : P x'}
56 (p : x = x') (q : transport _ p y = y')
57 : existT _ x y = existT _ x' y'
58 := admit.
59 #[export] Instance trunc_sigma `{P : A -> Type}
60 `{IsTrunc n A} `{forall a, IsTrunc n (P a)}
61 : IsTrunc n (sigT P) | 100.
62
63 Proof.
64 generalize dependent A.
65 induction n; [ | apply admit ]; simpl; intros A P ac Pc.
66 (exists (existT _ (center A) (center (P (center A))))).
67 intros [a ?].
68 refine (path_sigma' P (contr a) (path_contr _ _)).
69 Defined.
70 Inductive Bool : Set := true | false.
71 Definition trunc_sum' n A B `{IsTrunc n Bool, IsTrunc n A, IsTrunc n B}
72 : (IsTrunc n { b : Bool & if b then A else B }).
73 Proof.
74 Set Printing All.
75 Set Printing Universes.
76 refine (@trunc_sigma Bool (fun b => if b then A else B) n _ _).
77 (* Toplevel input, characters 23-76:
78 Error:
79 In environment
80 n : trunc_index
81 A : Type (* Top.193 *)
82 B : Type (* Top.194 *)
83 H : IsTrunc (* Set *) n Bool
84 H0 : IsTrunc (* Top.193 *) n A
85 H1 : IsTrunc (* Top.194 *) n B
86 The term
87 "@trunc_sigma (* Top.198 Top.199 Top.200 Top.201 *) Bool
88 (fun b : Bool =>
89 match b return Type (* Top.199 *) with
90 | true => A
91 | false => B
92 end) n ?49 ?50" has type
93 "IsTrunc (* Top.200 *) n
94 (@sig (* Top.199 Top.199 *) Bool
95 (fun b : Bool =>
96 match b return Type (* Top.199 *) with
97 | true => A
98 | false => B
99 end))" while it is expected to have type
100 "IsTrunc (* Top.195 *) n
101 (@sig (* Set Top.197 *) Bool
102 (fun b : Bool =>
103 match b return Type (* Top.197 *) with
104 | true => A
105 | false => B
106 end))" (Universe inconsistency: Cannot enforce Top.197 = Set)).
107 *)
108 apply admit.
109 Defined.