-
Notifications
You must be signed in to change notification settings - Fork 12
/
fixPoint.v
625 lines (613 loc) · 27.3 KB
/
fixPoint.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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
From hydras.Ackermann Require Import primRec.
From hydras.Ackermann Require Import cPair.
From Coq Require Import Arith Lia.
From hydras.Ackermann Require Import code.
From hydras.Ackermann Require Import codeSubFormula.
From hydras.Ackermann Require Import folProp.
From hydras.Ackermann Require Import folProof.
From hydras.Ackermann Require Import Languages.
From hydras.Ackermann Require Import subAll.
From hydras.Ackermann Require Import subProp.
From hydras.Ackermann Require Import folLogic3.
From hydras.Ackermann Require Import folReplace.
From hydras.Ackermann Require Import LNN.
From hydras.Ackermann Require Import codeNatToTerm.
From Goedel Require Import PRrepresentable.
From hydras.Ackermann Require Import ListExt.
From Coq Require Import List.
From hydras.Ackermann Require Import NN.
From hydras.Ackermann Require Import expressible.
From hydras Require Import Compat815.
Import FolNotations.
Import NNnotations.
Definition subStar (a v n : nat) : nat := codeSubFormula a v (codeNatToTerm n).
#[export] Instance subStarIsPR : isPR 3 subStar.
Proof.
unfold subStar; apply compose3_3IsPR with
(f1 := fun a v n : nat => a)
(f2 := fun a v n : nat => v)
(f3 := fun a v n : nat => codeNatToTerm n).
- apply pi1_3IsPR.
- apply pi2_3IsPR.
- apply filter001IsPR, codeNatToTermIsPR.
- apply codeSubFormulaIsPR.
Qed.
Section LNN_FixPoint.
Let codeFormula := codeFormula (cl:=LcodeLNN).
Lemma FixPointLNN :
forall (A : Formula) (v : nat),
{B : Formula |
SysPrf NN
(B <-> substF A v (natToTermLNN (codeFormula B)))%fol /\
(forall x : nat,
In x (freeVarF B) <->
In x (List.remove eq_nat_dec v (freeVarF A)))}.
Proof.
intros A v;
set (subStarFormula := primRecFormula _ (proj1_sig subStarIsPR)).
assert (represent : Representable NN 3 subStar subStarFormula).
{ unfold subStarFormula; apply primRecRepresentable. }
set (nv := newVar (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
assert (H: 0 <> nv).
{ intros H; elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
unfold nv in H; rewrite <- H; simpl; right; auto.
}
assert (H0: 1 <> nv).
{ intros H0; elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
unfold nv in H0; rewrite <- H0; simpl; auto.
}
assert (H1: 2 <> nv).
{ intros H1; elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
unfold nv in H1; rewrite <- H1; simpl; auto.
}
assert (H2: 3 <> nv).
{ intro H2; elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
unfold nv in H2; rewrite <- H2; simpl; auto.
} assert (H3: 3 < nv) by lia.
set
(Theta :=
existH v
(andH
(substF
(substF
(substF
(substF subStarFormula 3 (var nv)) 2
(natToTerm nv)) 1 (var nv)) 0 (var v)) A)).
exists (substF Theta nv (natToTerm (codeFormula Theta))).
split.
- set (N :=
natToTermLNN
(codeFormula
(substF Theta nv (natToTerm (codeFormula Theta))))).
unfold Theta at 1; rewrite (subFormulaExist LNN).
induction (eq_nat_dec v nv) as [a | b].
+ elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
fold nv; simpl; auto.
+ induction
(In_dec eq_nat_dec v (freeVarT (natToTerm (codeFormula Theta))))
as [a | b0].
* elim (closedNatToTerm _ _ a).
* clear b b0.
rewrite (subFormulaAnd LNN).
apply iffTrans with
(existH v
(andH
(substF
(substF
(substF
(substF subStarFormula 3
(natToTerm (codeFormula Theta))) 2
(natToTerm nv)) 1 (natToTerm (codeFormula Theta))) 0
(var v)) A)).
-- apply (reduceExist LNN).
++ apply closedNN.
++ apply (reduceAnd LNN).
** eapply iffTrans.
--- apply (subFormulaExch LNN).
+++ assumption.
+++ intros [H4| H4].
*** elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 ::
freeVarF A)).
fold nv; rewrite <- H4; simpl; auto.
*** apply H4.
+++ apply closedNatToTerm.
--- apply (reduceSub LNN).
+++ apply closedNN.
+++ eapply iffTrans.
*** apply (subSubFormula LNN).
assumption.
apply closedNatToTerm.
*** rewrite (subTermVar1 LNN).
apply (reduceSub LNN).
apply closedNN.
eapply iffTrans.
apply (subFormulaExch LNN).
assumption.
apply closedNatToTerm.
apply closedNatToTerm.
apply (reduceSub LNN).
apply closedNN.
apply (subFormulaTrans LNN).
intros H4;
assert (H5: In nv (freeVarF subStarFormula))
by (eapply in_remove, H4).
induction represent as [H6 H7].
elim (Compat815.lt_not_le _ _ H3).
auto.
** apply (subFormulaNil LNN).
intros H4;
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
fold nv; simpl; repeat right; auto.
-- apply iffI.
++ apply impI.
apply existSys.
** apply closedNN.
** intros H4; induction (freeVarSubFormula3 _ _ _ _ _ H4) as [H5 | H5].
--- now elim (in_remove_neq _ _ _ _ _ H5).
--- elim (closedNatToTerm _ _ H5).
** apply impE with (substF
(equal (var 0) N) 0 (var v)).
--- rewrite (subFormulaEqual LNN).
rewrite (subTermVar1 LNN).
rewrite (subTermNil LNN).
+++ apply impI.
apply impE with (substF A v (var v)).
*** apply (subWithEquals LNN).
apply Axm; right; constructor.
*** rewrite (subFormulaId LNN).
eapply andE2.
apply Axm; left; right; constructor.
+++ unfold N; apply closedNatToTerm.
--- apply impE with
(substF
(substF
(substF
(substF subStarFormula 3
(natToTerm (codeFormula Theta))) 2
(natToTerm nv)) 1 (natToTerm (codeFormula Theta))) 0
(var v)).
+++ apply iffE1.
apply sysWeaken.
apply (reduceSub LNN).
*** apply closedNN.
*** induction represent as (H4, H5); simpl in H5.
unfold N;
replace
(codeFormula
(substF Theta nv
(natToTerm (codeFormula Theta))))
with
(subStar (codeFormula Theta) nv (codeFormula Theta)).
apply H5.
unfold subStar; rewrite codeNatToTermCorrectLNN.
unfold codeFormula at 1; rewrite codeSubFormulaCorrect.
reflexivity.
+++ eapply andE1; apply Axm; right; constructor.
++ apply impI; apply existI with N.
rewrite (subFormulaAnd LNN).
apply andI.
** apply sysWeaken.
eapply
impE
with
(substF
(substF (equal (var 0) N) 0 (var v)) v N).
--- apply iffE2.
apply (reduceSub LNN).
+++ apply closedNN.
+++ apply (reduceSub LNN).
*** apply closedNN.
*** induction represent as (H4, H5).
simpl in H5; unfold N;
replace
(codeFormula
(substF Theta nv
(natToTerm (codeFormula Theta))))
with
(subStar (codeFormula Theta) nv (codeFormula Theta)).
apply H5.
unfold subStar; rewrite codeNatToTermCorrectLNN.
unfold codeFormula at 1; now rewrite codeSubFormulaCorrect.
--- repeat rewrite (subFormulaEqual LNN).
repeat rewrite (subTermVar1 LNN).
repeat rewrite (subTermNil LNN N).
+++ apply eqRefl.
+++ unfold N; apply closedNatToTerm.
+++ unfold N; apply closedNatToTerm.
** apply Axm; right; constructor.
- intro x; split.
+ intro H4; unfold Theta at 1 in H4. (* ; unfold existH in H4.*)
induction represent as (H5, H6).
repeat
match goal with
| H1:(?X1 = ?X2),H2:(?X1 <> ?X2) |- _ =>
elim H2; apply H1
| H1:(?X1 = ?X2),H2:(?X2 <> ?X1) |- _ =>
elim H2; symmetry in |- *; apply H1
| H:(In ?X3 (freeVarF (existH ?X1 ?X2))) |- _ =>
assert (In X3 (List.remove eq_nat_dec X1 (freeVarF X2)));
[ apply H | clear H ]
| H:(In ?X3 (freeVarF (forallH LNN ?X1 ?X2))) |- _ =>
assert (In X3 (List.remove eq_nat_dec X1 (freeVarF X2)));
[ apply H | clear H ]
| H:(In ?X3 (List.remove eq_nat_dec ?X1 (freeVarF ?X2))) |- _
=>
assert (In X3 (freeVarF X2));
[ eapply in_remove; apply H
| assert (X3 <> X1); [ eapply in_remove_neq; apply H | clear H ] ]
| H:(In ?X3 (freeVarF (andH ?X1 ?X2))) |- _ =>
assert (In X3 (freeVarF X1 ++ freeVarF X2));
[ apply H | clear H ]
| H:(In ?X3 (freeVarF (impH LNN ?X1 ?X2))) |- _ =>
assert (In X3 (freeVarF X1 ++ freeVarF X2));
[ apply H | clear H ]
| H:(In ?X3 (freeVarF (notH LNN ?X1))) |- _ =>
assert (In X3 (freeVarF X1)); [ apply H | clear H ]
| H:(In _ (_ ++ _)) |- _ =>
induction (in_app_or _ _ _ H); clear H
| H:(In _ (freeVarF (substF ?X1 ?X2 ?X3))) |- _ =>
induction (freeVarSubFormula3 _ _ _ _ _ H); clear H
| H:(In _ (freeVarT (natToTerm _))) |- _ =>
elim (closedNatToTerm _ _ H)
| H:(In _ (freeVarT Zero)) |- _ =>
elim H
| H:(In _ (freeVarT (Succ _))) |- _ =>
rewrite freeVarSucc in H
| H:(In _ (@freeVarT LNN (var _))) |- _ =>
simpl in H; decompose sum H; clear H
end.
elim (Compat815.le_not_lt _ _ (H5 _ H4)); lia.
apply in_in_remove; auto.
+ intro H4; assert (H5: In x (freeVarF A))
by (eapply in_remove, H4).
assert (H6: x <> v) by ( eapply in_remove_neq, H4 ).
clear H4; apply freeVarSubFormula1.
* intro H4; rewrite <- H4 in H5.
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
fold nv; simpl; now repeat right.
* unfold Theta;
apply
(@in_in_remove nat eq_nat_dec
(freeVarF
(substF
(substF
(substF
(substF subStarFormula 3 (var nv)) 2
(natToTerm nv)) 1 (var nv)) 0 (var v)) ++
freeVarF A) x v).
-- assumption.
-- apply in_or_app; now right.
Qed.
End LNN_FixPoint.
From hydras.Ackermann Require Import PA.
From hydras.Ackermann Require Import NN2PA.
Section LNT_FixPoint.
Let codeFormula := codeFormula (cl:=LcodeLNT).
Lemma FixPointLNT (A : Formula) (v : nat):
{B : Formula |
SysPrf PA
(iffH B (substF A v (natToTermLNT (codeFormula B)))) /\
(forall x : nat,
In x (freeVarF B) <->
In x (List.remove eq_nat_dec v (freeVarF A)))}.
Proof.
set (subStarFormula := primRecFormula _ (proj1_sig subStarIsPR)).
assert (represent : Representable NN 3 subStar subStarFormula)
by (unfold subStarFormula; apply primRecRepresentable).
set (nv := newVar (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
assert (H: 0 <> nv).
{ intro H;
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
unfold nv in H; rewrite <- H.
simpl; right; auto.
}
assert (H0: 1 <> nv).
{ intro H0;
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
unfold nv in H0; rewrite <- H0; simpl; auto.
}
assert (H1: 2 <> nv).
{ intro H1;
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A));
unfold nv in H1; rewrite <- H1; simpl; auto.
}
assert (H2: 3 <> nv).
{ intro H2;
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
unfold nv in H2; rewrite <- H2; simpl; auto.
}
assert (H3: 3 < nv) by lia.
set (Theta :=
existH v
(andH
(substF
(substF
(substF
(substF (LNN2LNT_formula subStarFormula) 3
(var nv)) 2 (natToTerm nv)) 1 (var nv)) 0
(var v)) A)).
exists (substF Theta nv (natToTerm (codeFormula Theta))).
split.
- set
(N :=
natToTermLNT
(codeFormula
(substF Theta nv (natToTerm (codeFormula Theta))))).
unfold Theta at 1; rewrite (subFormulaExist LNT).
induction (eq_nat_dec v nv) as [a | b].
+ elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
fold nv; simpl; now left.
+ induction
(In_dec eq_nat_dec v (freeVarT (natToTerm (codeFormula Theta))))
as [a | ?].
* elim (closedNatToTerm _ _ a).
* clear b b0; rewrite (subFormulaAnd LNT).
apply
iffTrans
with
(existH v
(andH
(substF
(substF
(substF
(substF (LNN2LNT_formula subStarFormula) 3
(natToTerm (codeFormula Theta))) 2
(natToTerm nv)) 1 (natToTerm (codeFormula Theta))) 0
(var v)) A)).
-- apply (reduceExist LNT).
++ apply closedPA.
++ apply (reduceAnd LNT).
** eapply iffTrans.
--- apply (subFormulaExch LNT).
+++ assumption.
+++ intros [H4| H4].
*** elim
(newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
fold nv; rewrite <- H4; simpl; auto.
*** apply H4.
+++ apply closedNatToTerm.
--- apply (reduceSub LNT).
+++ apply closedPA.
+++ eapply iffTrans.
*** apply (subSubFormula LNT).
assumption.
apply closedNatToTerm.
*** rewrite (subTermVar1 LNT).
apply (reduceSub LNT).
apply closedPA.
eapply iffTrans.
apply (subFormulaExch LNT).
assumption.
apply closedNatToTerm.
apply closedNatToTerm.
apply (reduceSub LNT).
apply closedPA.
apply (subFormulaTrans LNT).
intros H4.
assert (H5:
In nv (freeVarF
(LNN2LNT_formula subStarFormula)))
by eapply in_remove, H4.
destruct represent as (H6, H7).
elim (Compat815.lt_not_le _ _ H3).
apply H6.
apply LNN2LNT_freeVarF1; assumption.
** apply (subFormulaNil LNT).
intros H4;
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
fold nv; simpl; now repeat right.
-- apply iffI.
++ apply impI, existSys.
** apply closedPA.
** intros H4; induction (freeVarSubFormula3 _ _ _ _ _ H4) as [H5 | H5].
--- now elim (in_remove_neq _ _ _ _ _ H5).
--- elim (closedNatToTerm _ _ H5).
** apply impE with (substF (equal (var 0) N) 0 (var v)).
--- rewrite (subFormulaEqual LNT).
rewrite (subTermVar1 LNT).
rewrite (subTermNil LNT).
+++ apply impI.
apply impE with (substF A v (var v)).
*** apply (subWithEquals LNT).
apply Axm; right; constructor.
*** rewrite (subFormulaId LNT).
eapply andE2.
apply Axm; left; right; constructor.
+++ unfold N; apply closedNatToTerm.
--- apply impE with
(substF
(substF
(substF
(substF
(LNN2LNT_formula subStarFormula) 3
(natToTerm (codeFormula Theta))) 2
(natToTerm nv)) 1 (natToTerm (codeFormula Theta))) 0
(var v)).
+++ apply iffE1.
apply sysWeaken.
apply (reduceSub LNT).
*** apply closedPA.
*** induction represent as (H4, H5).
simpl in H5; unfold N.
replace
(codeFormula
(substF Theta nv
(natToTerm (codeFormula Theta))))
with
(subStar (codeFormula Theta) nv (codeFormula Theta)).
replace
(equal (var 0)
(natToTermLNT (subStar (codeFormula Theta) nv
(codeFormula Theta))))
with
(LNN2LNT_formula
(equal (var 0)
(LNN.natToTerm (subStar (codeFormula Theta) nv
(codeFormula Theta))))).
apply iffTrans with
(LNN2LNT_formula
(substF
(substF
(substF subStarFormula 3
(LNN.natToTerm (codeFormula Theta))) 2
(LNN.natToTerm nv)) 1
(LNN.natToTerm (codeFormula Theta)))).
apply iffSym.
eapply iffTrans; [ apply LNN2LNT_subFormula | idtac ].
rewrite LNN2LNT_natToTerm; apply (reduceSub LNT);
[ apply closedPA | idtac ].
eapply iffTrans; [ apply LNN2LNT_subFormula | idtac ].
rewrite LNN2LNT_natToTerm; apply (reduceSub LNT);
[ apply closedPA | idtac ].
eapply iffTrans; [ apply LNN2LNT_subFormula | idtac ].
rewrite LNN2LNT_natToTerm; apply (reduceSub LNT);
[ apply closedPA | idtac ].
apply iffRefl.
rewrite <- LNN2LNT_iff.
apply NN2PA.
apply H5.
rewrite <- LNN2LNT_natToTerm.
reflexivity.
unfold subStar; rewrite codeNatToTermCorrectLNT.
unfold codeFormula at 1; rewrite codeSubFormulaCorrect.
reflexivity.
+++ eapply andE1.
apply Axm; right; constructor.
++ apply impI.
apply existI with N.
rewrite (subFormulaAnd LNT).
apply andI.
apply sysWeaken.
** eapply impE with
(substF
(substF (equal (var 0) N) 0 (var v)) v N).
--- apply iffE2.
apply (reduceSub LNT).
+++ apply closedPA.
+++ apply (reduceSub LNT).
*** apply closedPA.
*** induction represent as (H4, H5).
simpl in H5.
unfold N;
replace
(codeFormula
(substF Theta nv
(natToTerm (codeFormula Theta))))
with
(subStar (codeFormula Theta) nv (codeFormula Theta)).
replace
(equal (var 0)
(natToTermLNT (subStar (codeFormula Theta) nv
(codeFormula Theta))))
with
(LNN2LNT_formula
(equal (var 0)
(LNN.natToTerm
(subStar (codeFormula Theta) nv
(codeFormula Theta))))).
apply
iffTrans
with
(LNN2LNT_formula
(substF
(substF
(substF subStarFormula 3
(LNN.natToTerm (codeFormula Theta))) 2
(LNN.natToTerm nv)) 1
(LNN.natToTerm
(codeFormula Theta)))).
apply iffSym.
eapply iffTrans; [ apply LNN2LNT_subFormula | idtac ].
rewrite LNN2LNT_natToTerm; apply (reduceSub LNT);
[ apply closedPA | idtac ].
eapply iffTrans; [ apply LNN2LNT_subFormula | idtac ].
rewrite LNN2LNT_natToTerm; apply (reduceSub LNT);
[ apply closedPA | idtac ].
eapply iffTrans; [ apply LNN2LNT_subFormula | idtac ].
rewrite LNN2LNT_natToTerm; apply (reduceSub LNT);
[ apply closedPA | idtac ].
apply iffRefl.
rewrite <- LNN2LNT_iff.
apply NN2PA.
apply H5.
rewrite <- LNN2LNT_natToTerm.
reflexivity.
unfold subStar; rewrite codeNatToTermCorrectLNT.
unfold codeFormula at 1; rewrite codeSubFormulaCorrect.
reflexivity.
--- repeat rewrite (subFormulaEqual LNT).
repeat rewrite (subTermVar1 LNT).
repeat rewrite (subTermNil LNT N).
+++ apply eqRefl.
+++ unfold N; apply closedNatToTerm.
+++ unfold N; apply closedNatToTerm.
** apply Axm; right; constructor.
- intro x; split.
+ intro H4; unfold Theta at 1 in H4.
induction represent as (H5, H6).
repeat
match goal with
| H1:(?X1 = ?X2),H2:(?X1 <> ?X2) |- _ =>
elim H2; apply H1
| H1:(?X1 = ?X2),H2:(?X2 <> ?X1) |- _ =>
elim H2; symmetry in |- *; apply H1
| H:(In ?X3 (freeVarF (existH ?X1 ?X2))) |- _ =>
assert (In X3 (List.remove eq_nat_dec X1 (freeVarF X2)));
[ apply H | clear H ]
| H:(In ?X3 (freeVarF (forallH LNT ?X1 ?X2))) |- _ =>
assert (In X3 (List.remove eq_nat_dec X1 (freeVarF X2)));
[ apply H | clear H ]
| H:(In ?X3 (List.remove eq_nat_dec ?X1 (freeVarF ?X2))) |- _
=>
assert (In X3 (freeVarF X2));
[ eapply in_remove; apply H
| assert (X3 <> X1); [ eapply in_remove_neq; apply H | clear H ] ]
| H:(In ?X3 (freeVarF (andH ?X1 ?X2))) |- _ =>
assert (In X3 (freeVarF X1 ++ freeVarF X2));
[ apply H | clear H ]
| H:(In ?X3 (freeVarF (impH LNT ?X1 ?X2))) |- _ =>
assert (In X3 (freeVarF X1 ++ freeVarF X2));
[ apply H | clear H ]
| H:(In ?X3 (freeVarF (notH LNT ?X1))) |- _ =>
assert (In X3 (freeVarF X1)); [ apply H | clear H ]
| H:(In _ (_ ++ _)) |- _ =>
induction (in_app_or _ _ _ H); clear H
| H:(In _ (freeVarF (substF ?X1 ?X2 ?X3))) |- _ =>
induction (freeVarSubFormula3 _ _ _ _ _ H); clear H
| H:(In _ (freeVarT (natToTerm _))) |- _ =>
elim (closedNatToTerm _ _ H)
| H:(In _ (freeVarT Zero)) |- _ =>
elim H
| H:(In _ (freeVarT (Succ _))) |- _ =>
rewrite freeVarSucc in H
| H:(In _ (@freeVarT LNT (var _))) |- _ =>
simpl in H; decompose sum H; clear H
end.
* elim (Compat815.le_not_lt x 3).
-- apply H5.
now apply LNN2LNT_freeVarF1.
-- lia.
* apply in_in_remove; auto.
+ intro H4;
assert (H5: In x (freeVarF A))
by (eapply in_remove, H4);
assert (H6: x <> v) by (eapply in_remove_neq, H4); clear H4.
apply freeVarSubFormula1.
* intros H4; rewrite <- H4 in H5.
elim (newVar1 (v :: 1 :: 2 :: 3 :: 0 :: freeVarF A)).
fold nv; simpl; now repeat right.
* unfold Theta;
apply
(@in_in_remove nat eq_nat_dec
(freeVarF
(substF
(substF
(substF
(substF
(LNN2LNT_formula subStarFormula) 3
(var nv)) 2 (natToTerm nv)) 1 (var nv)) 0
(var v)) ++ freeVarF A) x v).
-- assumption.
-- apply in_or_app; now right.
Qed.
End LNT_FixPoint.