-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathModelCC_em.v
167 lines (138 loc) · 3.87 KB
/
ModelCC_em.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Require Import basic.
Require Import Sublogic.
Require Import Models GenModelSyntax.
Require Import ZF ZFcoc.
(** Set-theoretical model of the Classical Calculus of Constructions in IZF *)
(** * Instantiation of the abstract model of CC *)
Module ClassicCCM <: CC_Model.
Definition X := set.
Definition inX : X -> X -> Prop := in_set.
Definition eqX : X -> X -> Prop := eq_set.
Definition inclX : X -> X -> Prop := incl_set.
Definition eqX_equiv : Equivalence eqX := eq_set_equiv.
Notation "x ∈ y" := (inX x y).
Notation "x == y" := (eqX x y).
Lemma in_ext: Proper (eqX ==> eqX ==> iff) inX.
Proof in_set_morph.
Definition props : X := cl_props.
Definition app : X -> X -> X := cc_app.
Definition lam : X -> (X -> X) -> X := cc_lam.
Definition prod : X -> (X -> X) -> X := cc_prod.
Definition eq_fun (x:X) (f1 f2:X->X) :=
forall y1 y2, y1 ∈ x -> y1 == y2 -> f1 y1 == f2 y2.
Lemma lam_ext :
forall x1 x2 f1 f2,
x1 == x2 ->
eq_fun x1 f1 f2 ->
lam x1 f1 == lam x2 f2.
Proof.
intros.
apply cc_lam_ext; intros; trivial.
Qed.
Lemma app_ext:
forall x1 x2 : X, x1 == x2 ->
forall x3 x4 : X, x3 == x4 ->
app x1 x3 == app x2 x4.
Proof cc_app_morph.
Lemma prod_ext :
forall x1 x2 f1 f2,
x1 == x2 ->
eq_fun x1 f1 f2 ->
prod x1 f1 == prod x2 f2.
Proof.
intros.
apply cc_prod_ext; intros; trivial.
Qed.
Lemma prod_intro : forall dom f F,
eq_fun dom f f ->
eq_fun dom F F ->
(forall x, x ∈ dom -> f x ∈ F x) ->
lam dom f ∈ prod dom F.
Proof cc_prod_intro.
Lemma prod_elim : forall dom f x F,
eq_fun dom F F ->
f ∈ prod dom F ->
x ∈ dom ->
app f x ∈ F x.
Proof fun dom f x F _ H H0 => cc_prod_elim dom f x F H H0.
Lemma impredicative_prod : forall dom F,
eq_fun dom F F ->
(forall x, x ∈ dom -> F x ∈ props) ->
prod dom F ∈ props.
Proof cc_cl_impredicative_prod.
Lemma beta_eq:
forall dom F x,
eq_fun dom F F ->
x ∈ dom ->
app (lam dom F) x == F x.
Proof cc_beta_eq.
End ClassicCCM.
(** * Instantiating the generic model construction *)
Module BuildModel := MakeModel(ClassicCCM).
Import BuildModel T J R.
Lemma El_int_arr T U i :
int (Prod T (lift 1 U)) i == cc_arr (int T i) (int U i).
simpl.
apply cc_prod_ext.
reflexivity.
red; intros.
rewrite simpl_int_lift.
rewrite lift0_term; reflexivity.
Qed.
(** The model in ZF implies the consistency of CC *)
Require Import Term Env.
Require Import TypeJudge.
Load "template/Library.v".
Lemma mt_cl_props: empty ∈ cl_props.
Proof.
apply subset_intro.
unfold props; apply empty_in_power.
unfold p2P.
intros [ ].
intro in_mt.
apply empty_ax in in_mt; trivial.
Qed.
Hint Resolve mt_cl_props.
Lemma em_consistent :
let FF := T.Prod T.prop (T.Ref 0) in
let N p := T.Prod p FF in
let EM := T.Prod T.prop (T.Prod (N (N (T.Ref 0))) (T.Ref 1)) in
val_ok (EM::nil) (fun _ => empty).
intros; red; intros.
destruct n as [ | [|?]]; try discriminate.
injection H; clear H; intros; subst T.
simpl. unfold ClassicCCM.prod, ClassicCCM.props.
red.
apply cc_forall_intro.
do 2 red; intros.
apply cc_arr_morph; trivial.
apply cc_arr_morph; [|reflexivity].
apply cc_arr_morph; [trivial|reflexivity].
intros P Pty.
assert (Pty' := Pty).
apply subset_ax in Pty'; destruct Pty' as (Pty',(P',eqP,Pcl)).
rewrite <- eqP in Pcl.
apply cc_forall_intro; [auto with *|].
intros prf nnpty.
apply Pcl.
intro.
apply cc_prod_elim with (x:=empty) in nnpty.
apply cc_prod_elim with (2:=mt_cl_props) in nnpty.
apply empty_ax in nnpty; trivial.
apply cc_forall_intro; auto with *.
intros p pty.
elim H.
rewrite props_proof_irrelevance with (P:=P) (x:=p) in pty; trivial.
Qed.
Lemma cl_cc_consistency M M': ~ eq_typ (EM::nil) M M' FALSE.
Proof.
unfold FALSE; red in |- *; intros.
specialize BuildModel.int_sound with (1 := H); intro.
destruct H0 as (H0,_).
simpl in H0.
apply abstract_theory_consistency with (1:=mt_cl_props) (4:=H0).
exists (fun _ => empty).
apply em_consistent.
red; intros.
apply empty_ax with (1:=H1).
Qed.