-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeductive_System.v
241 lines (214 loc) · 6.32 KB
/
Deductive_System.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
Require Import Modal_Library List Classical Logic.
(**** HILBERT SYSTEM (axiomatic method) ****)
Inductive axiom : Set :=
| ax1 : modalFormula -> modalFormula -> axiom
| ax2 : modalFormula -> modalFormula -> modalFormula -> axiom
| ax3 : modalFormula -> modalFormula -> axiom
| ax4 : modalFormula -> modalFormula -> axiom
| ax5 : modalFormula -> modalFormula -> axiom
| ax6 : modalFormula -> modalFormula -> axiom
| ax7 : modalFormula -> modalFormula -> axiom
| ax8 : modalFormula -> modalFormula -> axiom
| ax9 : modalFormula -> modalFormula -> modalFormula -> axiom
| ax10 : modalFormula -> modalFormula -> axiom
| axK : modalFormula -> modalFormula -> axiom
| axPos : modalFormula -> modalFormula -> axiom
| axT : modalFormula -> axiom
| axB : modalFormula -> axiom
| axK4 : modalFormula -> axiom
| axD : modalFormula -> axiom
| axK5 : modalFormula -> axiom.
Definition instantiate (a: axiom): modalFormula :=
match a with
| ax1 φ ψ => φ .-> (ψ .-> φ)
| ax2 φ ψ Ɣ => (φ .-> (ψ .-> Ɣ)) .-> ((φ .-> ψ) .-> (φ .-> Ɣ))
| ax3 φ ψ => (.~ ψ .-> .~ φ) .-> (φ .-> ψ)
| ax4 φ ψ => φ .-> (ψ .-> (φ ./\ ψ))
| ax5 φ ψ => (φ ./\ ψ) .-> φ
| ax6 φ ψ => (φ ./\ ψ) .-> ψ
| ax7 φ ψ => φ .-> (φ .\/ ψ)
| ax8 φ ψ => ψ .-> (φ .\/ ψ)
| ax9 φ ψ Ɣ => (φ .-> Ɣ) .-> ((ψ .-> Ɣ) .-> ((φ .\/ ψ) .-> Ɣ))
| ax10 φ ψ => .~ .~ φ .-> φ
| axK φ ψ => .[] (φ .-> ψ) .-> (.[] φ .-> .[] ψ)
| axPos φ ψ => .<> (φ .\/ ψ) .-> (.<> φ .\/ .<> ψ)
| axT φ => .[]φ .-> φ
| axB φ => φ .-> .[] .<> φ
| axK4 φ => .[] φ .-> .[] .[] φ
| axD φ => .[] φ .-> .<> φ
| axK5 φ => .<> φ .-> .[] .<> φ
end.
Inductive deduction (A: axiom -> Prop): theory -> modalFormula -> Prop :=
(* Premise. *)
| Prem: forall (t: theory)
(f: modalFormula)
(i: nat),
(nth_error t i = Some f) -> deduction A t f
(* Axiom. *)
| Ax: forall (t: theory)
(a: axiom)
(f: modalFormula),
A a -> instantiate a = f -> deduction A t f
(* Modus Ponens. *)
| Mp: forall (t: theory)
(f g: modalFormula)
(d1: deduction A t (f .-> g))
(d2: deduction A t f),
deduction A t g
(* Generalization. *)
| Nec: forall (t: theory)
(f: modalFormula)
(d1: deduction A t f),
deduction A t (.[] f).
Inductive K: axiom -> Prop :=
| K_ax1: forall φ ψ, K (ax1 φ ψ)
| K_ax2: forall φ ψ Ɣ, K (ax2 φ ψ Ɣ)
| K_ax3: forall φ ψ, K (ax3 φ ψ)
| K_ax4: forall φ ψ, K (ax4 φ ψ)
| K_ax5: forall φ ψ, K (ax5 φ ψ)
| K_ax6: forall φ ψ, K (ax6 φ ψ)
| K_ax7: forall φ ψ, K (ax7 φ ψ)
| K_ax8: forall φ ψ, K (ax8 φ ψ)
| K_ax9: forall φ ψ Ɣ, K (ax9 φ ψ Ɣ)
| K_ax10: forall φ ψ, K (ax10 φ ψ)
| K_axK: forall φ ψ, K (axK φ ψ)
| K_axPos: forall φ ψ, K (axPos φ ψ).
(* Reflexive *)
Inductive T: axiom -> Prop :=
| T_K: forall φ, K φ -> T φ
| T_axT: forall φ , T (axT φ).
(* Reflexive and Symmetry *)
Inductive B: axiom -> Prop :=
| B_T: forall φ, T φ -> B φ
| B_axB: forall φ , B (axB φ).
(* Transitive *)
Inductive K4: axiom -> Prop :=
| K4_K: forall φ, K φ -> K4 φ
| K4_axK4: forall φ , K4 (axK4 φ).
(* Serial *)
Inductive D: axiom -> Prop :=
| D_K: forall φ, K φ -> D φ
| D_axD: forall φ , D (axD φ).
(* Euclidean *)
Inductive K5: axiom -> Prop :=
| K5_K: forall φ, K φ -> K5 φ
| K5_axK5: forall φ , K5 (axK5 φ).
(* Reflexive and Transitive*)
Inductive S4: axiom -> Prop :=
| S4_T: forall φ, T φ -> S4 φ
| S4_axK4: forall φ , S4 (axK4 φ).
(* Symmetry and S4 *)
Inductive S5: axiom -> Prop :=
| S5_B: forall φ, B φ -> S5 φ
| S5_S4: forall φ , S4 φ -> S5 φ.
(* Reflexive and Euclidean *)
Inductive S5_2: axiom -> Prop :=
| S5_2_T: forall φ, T φ -> S5_2 φ
| S5_2_K5: forall φ , K5 φ -> S5_2 φ.
(* Notations and Theorems *)
(* Coercion T_K: K >-> T. *)
Notation "A ; G |-- p" := (deduction A G p)
(at level 110, no associativity).
Lemma derive_identity:
forall Γ φ,
K; Γ |-- φ .-> φ.
Proof.
intros.
apply Mp with (f := φ.-> φ .-> φ).
- apply Mp with (f := φ .-> (φ .-> φ) .-> φ).
+ apply Ax with (a := (ax2 φ (φ .-> φ) φ)).
* constructor.
* reflexivity.
+ apply Ax with (a := (ax1 φ (φ .-> φ))).
* constructor.
* reflexivity.
- apply Ax with (a := (ax1 φ φ)).
+ constructor.
+ reflexivity.
Qed.
Lemma derive_refl :
forall A Γ φ,
A; φ :: Γ |-- φ.
Proof.
intros.
apply Prem with (i := 0).
reflexivity.
Qed.
Definition subset (Γ Δ : theory) : Prop :=
forall φ,
In φ Γ ->
In φ Δ.
Notation "A ⊆ B" := (subset A B)
(at level 70, only printing, no associativity) : type_scope.
Lemma derive_In:
forall A Γ φ ,
In φ Γ ->
A; Γ |-- φ.
Proof.
intros; eapply In_nth_error in H.
destruct H.
apply Prem with (i:=x).
assumption.
Qed.
Lemma derive_weak:
forall Γ ẟ,
subset Γ ẟ ->
forall A φ,
(A; Γ |-- φ) ->
(A; ẟ |-- φ).
Proof.
intros.
induction H0.
- eapply derive_In; apply H.
eapply nth_error_In.
exact H0.
- apply Ax with (a:= a).
+ assumption.
+ assumption.
- eapply Mp;
eauto.
- apply Nec;
intuition.
Qed.
Lemma derive_monotonicity :
forall ẟ Γ φ,
(K; Γ |-- φ) ->
(K; ẟ ++ Γ |-- φ).
Proof.
intros.
apply derive_weak with Γ.
- unfold subset. intros.
induction ẟ.
+ simpl; assumption.
+ simpl in *; right; assumption.
- assumption.
Qed.
Require Import Equality.
Lemma derive_modus_ponens:
forall Γ φ ψ,
(K; φ::Γ |-- ψ) ->
(K; Γ |-- φ) ->
(K; Γ |-- ψ).
Proof.
intros; dependent induction H.
- apply nth_error_In in H.
destruct H.
+ destruct H.
assumption.
+ apply derive_In.
assumption.
- apply Ax with (a:=a).
+ assumption.
+ reflexivity.
- eapply Mp.
+ eapply IHdeduction1.
* eauto.
* assumption.
+ eapply IHdeduction2.
* eauto.
* assumption.
- apply Nec.
+ eapply IHdeduction.
* eauto.
* assumption.
Qed.