1
(* A variant of Burali-Forti that used to pass in V8.1beta, because of
2
a bug in the instantiation of sort-polymorphic inductive types *)
4
(* The following type seems to satisfy the hypothesis of the paradox below *)
5
(* It should infer constraints forbidding the paradox to go through, but via *)
6
(* a redefinition that did not propagate constraints correctly in V8.1beta *)
7
(* it was exploitable to derive an inconsistency *)
9
(* We keep the file as a non regression test of the bug *)
11
Record A1 (B:Type) (g:B->Type) : Type := (* Type_i' *)
12
i1 {X0 : B; R0 : g X0 -> g X0 -> Prop}. (* X0: Type_j' *)
14
Definition A2 := A1. (* here was the bug *)
16
Definition A0 := (A2 Type (fun x => x)).
17
Definition i0 := (i1 Type (fun x => x)).
19
(* The rest is as in universes-buraliforti.v *)
22
(* Some properties about relations on objects in Type *)
24
Inductive ACC (A : Type) (R : A -> A -> Prop) : A -> Prop :=
26
forall x : A, (forall y : A, R y x -> ACC A R y) -> ACC A R x.
28
Lemma ACC_nonreflexive :
29
forall (A : Type) (R : A -> A -> Prop) (x : A),
30
ACC A R x -> R x x -> False.
31
simple induction 1; intros.
35
Definition WF (A : Type) (R : A -> A -> Prop) := forall x : A, ACC A R x.
38
Section Inverse_Image.
40
Variables (A B : Type) (R : B -> B -> Prop) (f : A -> B).
42
Definition Rof (x y : A) : Prop := R (f x) (f y).
45
forall y : B, ACC B R y -> forall x : A, y = f x -> ACC A Rof x.
46
simple induction 1; intros.
48
apply (H1 (f y0)); trivial.
49
elim H2 using eq_ind_r; trivial.
52
Lemma ACC_inverse_image : forall x : A, ACC B R (f x) -> ACC A Rof x.
53
intros; apply (ACC_lemma (f x)); trivial.
56
Lemma WF_inverse_image : WF B R -> WF A Rof.
57
red in |- *; intros; apply ACC_inverse_image; auto.
63
(* Remark: the paradox is written in Type, but also works in Prop or Set. *)
65
Section Burali_Forti_Paradox.
67
Definition morphism (A : Type) (R : A -> A -> Prop)
68
(B : Type) (S : B -> B -> Prop) (f : A -> B) :=
69
forall x y : A, R x y -> S (f x) (f y).
71
(* The hypothesis of the paradox:
72
assumes there exists an universal system of notations, i.e:
74
- An injection i0 from relations on any type into A0
75
- The proof that i0 is injective modulo morphism
77
Variable A0 : Type. (* Type_i *)
78
Variable i0 : forall X : Type, (X -> X -> Prop) -> A0. (* X: Type_j *)
81
forall (X1 : Type) (R1 : X1 -> X1 -> Prop) (X2 : Type)
82
(R2 : X2 -> X2 -> Prop),
83
i0 X1 R1 = i0 X2 R2 -> exists f : X1 -> X2, morphism X1 R1 X2 R2 f.
85
(* Embedding of x in y: x and y are images of 2 well founded relations
86
R1 and R2, the ordinal of R2 being strictly greater than that of R1.
88
Record emb (x y : A0) : Prop :=
90
R1 : X1 -> X1 -> Prop;
93
R2 : X2 -> X2 -> Prop;
97
fmorph : morphism X1 R1 X2 R2 f;
99
majf : forall z : X1, R2 (f z) maj}.
101
Lemma emb_trans : forall x y z : A0, emb x y -> emb y z -> emb x z.
103
case H; intros X1 R1 eqx X2 R2 eqy; intros.
104
case H0; intros X3 R3 eqx0 X4 R4 eqy0; intros.
105
generalize eqx0; clear eqx0.
106
elim eqy using eq_ind_r; intro.
107
case (inj _ _ _ _ eqx0); intros.
108
exists X1 R1 X4 R4 (fun x : X1 => f0 (x0 (f x))) maj0; trivial.
114
forall (X : Type) (R : X -> X -> Prop) (x : X),
116
forall (Y : Type) (S : Y -> Y -> Prop) (f : Y -> X),
117
morphism Y S X R f -> (forall y : Y, R (f y) x) -> ACC A0 emb (i0 Y S).
118
simple induction 1; intros.
121
elim eqx using eq_ind_r.
122
case (inj X2 R2 Y S).
123
apply sym_eq; assumption.
126
apply H1 with (y := f (x1 maj)) (f := fun x : X1 => f (x1 (f0 x)));
127
try red in |- *; auto.
130
(* The embedding relation is well founded *)
131
Lemma WF_emb : WF A0 emb.
134
elim eqx using eq_ind_r.
135
apply ACC_emb with (X := X2) (R := R2) (x := maj) (f := f); trivial.
139
(* The following definition enforces Type_j >= Type_i *)
140
Definition Omega : A0 := i0 A0 emb.
147
(* We define the type of elements of A0 smaller than a w.r.t embedding.
148
The Record is in Type, but it is possible to avoid such structure. *)
149
Record sub : Type := {witness : A0; emb_wit : emb witness a}.
151
(* F is its image through i0 *)
152
Definition F : A0 := i0 sub (Rof _ _ emb witness).
154
(* F is embedded in Omega:
155
- the witness projection is a morphism
156
- a is an upper bound because emb_wit proves that witness is
159
Lemma F_emb_Omega : emb F Omega.
160
exists sub (Rof _ _ emb witness) A0 emb witness a; trivial.
163
red in |- *; trivial.
171
Definition fsub (a b : A0) (H : emb a b) (x : sub a) :
172
sub b := Build_sub _ (witness _ x) (emb_trans _ _ _ (emb_wit _ x) H).
174
(* F is a morphism: a < b => F(a) < F(b)
175
- the morphism from F(a) to F(b) is fsub above
176
- the upper bound is a, which is in F(b) since a < b
178
Lemma F_morphism : morphism A0 emb A0 emb F.
182
(Rof _ _ emb (witness x))
184
(Rof _ _ emb (witness y))
186
(Build_sub _ x H); trivial.
187
apply WF_inverse_image.
190
unfold morphism, Rof, fsub in |- *; simpl in |- *; intros.
193
unfold Rof, fsub in |- *; simpl in |- *; intros.
198
(* Omega is embedded in itself:
200
- Omega is an upper bound of the image of F
202
Lemma Omega_refl : emb Omega Omega.
203
exists A0 emb A0 emb F Omega; trivial.
211
(* The paradox is that Omega cannot be embedded in itself, since
212
the embedding relation is well founded.
214
Theorem Burali_Forti : False.
215
apply ACC_nonreflexive with A0 emb Omega.
222
End Burali_Forti_Paradox.
225
(* Note: this proof uses a large elimination of A0. *)
227
forall (X1 : Type) (R1 : X1 -> X1 -> Prop) (X2 : Type)
228
(R2 : X2 -> X2 -> Prop),
229
i0 X1 R1 = i0 X2 R2 -> exists f : X1 -> X2, morphism X1 R1 X2 R2 f.
232
match i0 X1 R1, i0 X2 R2 with
233
| i1 x1 r1, i1 x2 r2 => exists f : _, morphism x1 r1 x2 r2 f
235
case H; simpl in |- *.
236
exists (fun x : X1 => x).
237
red in |- *; trivial.
240
(* The following command raises 'Error: Universe Inconsistency'.
241
To allow large elimination of A0, i0 must not be a large constructor.
242
Hence, the constraint Type_j' < Type_i' is added, which is incompatible
243
with the constraint j >= i in the paradox.
246
Definition Paradox : False := Burali_Forti A0 i0 inj.