Debian Codegraph @

test-suite/bugs/bug_3314.v

raw
1 Require Import TestSuite.admit.
2 Set Universe Polymorphism.
3 Definition Lift
4 : ltac:(let U1 := constr:(Type) in
5 let U0 := constr:(Type : U1) in
6 exact (U0 -> U1))
7 := fun T => T.
8
9 Fail Check nat:Prop. (* The command has indeed failed with message:
10 => Error:
11 The term "nat" has type "Set" while it is expected to have type "Prop". *)
12 Set Printing All.
13 Set Printing Universes.
14 Fail Check Lift nat : Prop. (* Lift (* Top.8 Top.9 Top.10 *) nat:Prop
15 : Prop
16 (* Top.10
17 Top.9
18 Top.8 |= Top.10 < Top.9
19 Top.9 < Top.8
20 Top.9 <= Prop
21 *)
22 *)
23 Fail Eval compute in Lift nat : Prop.
24 (* = nat
25 : Prop *)
26
27 Monomorphic Definition Type2 := Type.
28 Monomorphic Definition Type1 := Type : Type2.
29
30 Section Hurkens.
31
32 (** Assumption of a retract from Type into Prop *)
33
34 Variable down : Type1 -> Prop.
35 Variable up : Prop -> Type1.
36
37 Hypothesis back : forall A, up (down A) -> A.
38
39 Hypothesis forth : forall A, A -> up (down A).
40
41 Hypothesis backforth : forall (A:Type) (P:A->Type) (a:A),
42 P (back A (forth A a)) -> P a.
43
44 Hypothesis backforth_r : forall (A:Type) (P:A->Type) (a:A),
45 P a -> P (back A (forth A a)).
46
47 (** Proof *)
48
49 Definition V : Type1 := forall A:Prop, ((up A -> Prop) -> up A -> Prop) -> up A -> Prop.
50 Definition U : Type1 := V -> Prop.
51
52 Definition sb (z:V) : V := fun A r a => r (z A r) a.
53 Definition le (i:U -> Prop) (x:U) : Prop := x (fun A r a => i (fun v => sb v A r a)).
54 Definition le' (i:up (down U) -> Prop) (x:up (down U)) : Prop := le (fun a:U => i (forth _ a)) (back _ x).
55 Definition induct (i:U -> Prop) : Type1 := forall x:U, up (le i x) -> up (i x).
56 Definition WF : U := fun z => down (induct (fun a => z (down U) le' (forth _ a))).
57 Definition I (x:U) : Prop :=
58 (forall i:U -> Prop, up (le i x) -> up (i (fun v => sb v (down U) le' (forth _ x)))) -> False.
59
60 Lemma Omega : forall i:U -> Prop, induct i -> up (i WF).
61 Proof.
62 intros i y.
63 apply y.
64 unfold le, WF, induct.
65 apply forth.
66 intros x H0.
67 apply y.
68 unfold sb, le', le.
69 compute.
70 apply backforth_r.
71 exact H0.
72 Qed.
73
74 Lemma lemma1 : induct (fun u => down (I u)).
75 Proof.
76 unfold induct.
77 intros x p.
78 apply forth.
79 intro q.
80 generalize (q (fun u => down (I u)) p).
81 intro r.
82 apply back in r.
83 apply r.
84 intros i j.
85 unfold le, sb, le', le in j |-.
86 apply backforth in j.
87 specialize q with (i := fun y => i (fun v:V => sb v (down U) le' (forth _ y))).
88 apply q.
89 exact j.
90 Qed.
91
92 Lemma lemma2 : (forall i:U -> Prop, induct i -> up (i WF)) -> False.
93 Proof.
94 intro x.
95 generalize (x (fun u => down (I u)) lemma1).
96 intro r; apply back in r.
97 apply r.
98 intros i H0.
99 apply (x (fun y => i (fun v => sb v (down U) le' (forth _ y)))).
100 unfold le, WF in H0.
101 apply back in H0.
102 exact H0.
103 Qed.
104
105 Theorem paradox : False.
106 Proof.
107 exact (lemma2 Omega).
108 Qed.
109
110 End Hurkens.
111
112 Definition informative (x : bool) :=
113 match x with
114 | true => Type
115 | false => Prop
116 end.
117
118 Definition depsort (T : Type) (x : bool) : informative x :=
119 match x with
120 | true => T
121 | false => True
122 end.
123
124 (** This definition should fail *)
125 Fail Definition Box (T : Type1) : Prop := Lift T.
126
127 Fail Definition prop {T : Type1} (t : Box T) : T := t.
128 Fail Definition wrap {T : Type1} (t : T) : Box T := t.
129
130 Fail Definition down (x : Type1) : Prop := Box x.
131 Definition up (x : Prop) : Type1 := x.
132
133 Fail Definition back A : up (down A) -> A := @prop A.
134
135 Fail Definition forth (A : Type1) : A -> up (down A) := @wrap A.
136
137 Fail Definition backforth (A:Type1) (P:A->Type) (a:A) :
138 P (back A (forth A a)) -> P a := fun H => H.
139
140 Fail Definition backforth_r (A:Type1) (P:A->Type) (a:A) :
141 P a -> P (back A (forth A a)) := fun H => H.
142
143 Theorem pandora : False.
144 Fail apply (paradox down up back forth backforth backforth_r).
145 admit.
146 Qed.
147
148 Print Assumptions pandora.