-
Notifications
You must be signed in to change notification settings - Fork 0
/
hexamys.v
1336 lines (1112 loc) · 29.8 KB
/
hexamys.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
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Require Export projective_plane_inst.
Require Export FSets.
Module Export uniq := (uniqueness_axioms AbstractProjectivePlane).
Module uniqdec := (decidability AbstractProjectivePlane).
Definition line A B := (proj1_sig (a1_exist A B)).
Definition inter l m := (proj1_sig (a2_exist l m)).
Definition on_inter A P Q R S := Incid A (line P Q) /\ Incid A (line R S).
Definition on_inter' A P Q R S := A = inter (line P Q) (line R S).
Definition Col A B C :=
exists l : Line,
Incid A l /\ Incid B l /\ Incid C l.
Definition Meet l1 l2 l3 :=
exists P : Point, Incid P l1 /\ Incid P l2 /\ Incid P l3.
Definition is_transverse A' B' C' A B C :=
Col A' B' C' /\ Col A B' C /\ Col A C' B /\ Col B A' C.
Definition is_on_inter P A B C D :=
Col P A B /\ Col P C D.
Definition is_on_proper_inter P A B C D :=
Col P A B /\ Col P C D /\ A<>B /\ C<>D /\ line A B <> line C D.
Definition is_hexamy A B C D E F :=
(A<>B /\ A<>C /\ A<>D /\ A<>E /\ A<>F /\
B<>C /\ B<>D /\ B<>E /\ B<>F /\
C<>D /\ C<>E /\ C<>F /\
D<>E /\ D<>F /\
E<>F) /\
let a:= inter (line B C) (line E F) in
let b:= inter (line C D) (line F A) in
let c:= inter (line A B) (line D E) in
Col a b c.
Definition hexamy := forall A B C D E F,
is_hexamy A B C D E F ->
is_hexamy B A C D E F.
Ltac apply_unicity_hyps := match goal with
H1: ?A <> ?B,
H2: ?Incid ?A ?l,
H3: ?Incid ?B ?l,
H4 : ?Incid ?A ?m,
H5: ?Incid ?B ?m |- _ =>
let id:= fresh in assert (id: l=m); try apply (uniq.a1_unique A B l m H1 H2 H3 H4 H5);idtac "we have " l " = " m;subst l
| H1: ?l <> ?m,
H2: ?Incid ?A ?l,
H3: ?Incid ?A ?m,
H4 : ?Incid ?B ?l,
H5: ?Incid ?B ?m |- _ =>
let id:= fresh in assert (id: A=B); try apply (uniq.a2_unique l m A B H1 H2 H3 H4 H5);idtac "we have : " A " = " B;subst A
end.
Ltac collapse_hyps := progress (repeat (apply_unicity_hyps; CleanDuplicatedHyps)).
Ltac solve_eq := solve [intro; repeat subst; try collapse_hyps;intuition].
Ltac apply_unicity_no_hyps := match goal with
HAl: ?Incid ?A ?l,
HBl: ?Incid ?B ?l,
HAm: ?Incid ?A ?m,
HBm: ?Incid ?B ?m |- _ =>
let id:= fresh in assert (id: l=m)
by ( apply (uniq.a1_unique A B l m);
[solve_eq| apply HAl | apply HBl| apply HAm| apply HBm]);
idtac "we have " l " = " m;subst l
|
HAl: ?Incid ?A ?l,
HBl: ?Incid ?B ?l,
HAm: ?Incid ?A ?m,
HBm: ?Incid ?B ?m |- _ =>
let id:= fresh in assert (id: A=B)
by ( apply (uniq.a2_unique l m A B);
[solve_eq| apply HAl | apply HAm| apply HBl| apply HBm]);
idtac "we have " A " = " B;subst A
end.
Ltac aide :=
match goal with
H2: ?Incid ?A ?l,
H3: ?Incid ?B ?l,
H4: ?Incid ?A ?m,
H5: ?Incid ?B ?m |- _ => idtac A " = " B " ou " l "=" m
end.
Ltac collapse_no_hyps := progress (repeat (apply_unicity_no_hyps; CleanDuplicatedHyps)).
Ltac collapse := progress ( try collapse_hyps; try collapse_no_hyps).
Ltac not_eq A B:= assert (A<>B) by solve_eq.
Definition Col_on A B C l := Incid A l /\ Incid B l /\ Incid C l.
Ltac geo_norm :=
unfold Col_on,
is_on_inter, is_on_proper_inter,
dist3, dist4, dist6,
Col in * |-; use_all.
Ltac cases_line l m :=
elim (uniqdec.eq_line_dec l m); intro;
[subst;try collapse|idtac].
Ltac cases_point A B :=
elim (uniqdec.eq_point_dec A B); intro;
[subst;try collapse|idtac].
Lemma line_wd : forall A B l,
Incid A l ->
Incid B l ->
A<>B ->
line A B = l.
Proof.
intros.
unfold line.
elim a1_exist;simpl.
intros.
use_all.
collapse.
trivial.
Qed.
Lemma line_wd_sym : forall A B l,
Incid A l ->
Incid B l ->
B<>A ->
line A B = l.
Proof.
intros.
unfold line.
elim a1_exist;simpl.
intros.
use_all.
collapse.
trivial.
Qed.
Ltac create_line A B l := elim (a1_exist A B);intros l Hl;decompose[and] Hl;clear Hl.
Ltac create_point l m P := elim (a2_exist l m);intros P HP;decompose[and] HP;clear HP.
Ltac create_inter A B C D P :=
let AB:=fresh "l" in
let CD:= fresh "l" in
create_line A B AB; create_line C D CD; create_point AB CD P.
Ltac create_non_existing_line A B := progress first [ (match goal with
HA : Incid A ?l , HB : Incid B ?l |- _ => idtac
end) | (let id:= fresh "l" in create_line A B id) ].
Ltac add_non_existing_lines := repeat (match goal with
_: context[line ?A ?B] |- _ => create_non_existing_line A B
| _: _ |- context[line ?A ?B] => create_non_existing_line A B
end).
Ltac remove_line_occ := repeat ( match goal with
HAB: ?A<>?B, HA: Incid ?A ?l, HB: Incid ?B ?l,
H: context[line ?A ?B] |- _ => rewrite (line_wd A B l) in * by assumption
| HAB: ?B<>?A, HA: Incid ?A ?l, HB: Incid ?B ?l,
H: context[line ?A ?B] |- _ => rewrite (line_wd_sym A B l) in * by assumption
| HAB: ?A<>?B, HA: Incid ?A ?l, HB: Incid ?B ?l
|- context[line ?A ?B] => rewrite (line_wd A B l) in * by assumption
| HAB: ?B<>?A, HA: Incid ?A ?l, HB: Incid ?B ?l
|- context[line ?A ?B] => rewrite (line_wd_sym A B l) in * by assumption
end).
Lemma test2 : forall A B C D l , line A B = l -> line C D = l -> True.
Proof.
intros.
add_non_existing_lines.
auto.
Qed.
Lemma on_inter_points_wd : forall A B C D P l m,
Incid A l ->
Incid B l ->
Incid C m ->
Incid D m ->
Incid P l ->
Incid P m ->
l <> m ->
A <> B ->
C <> D ->
P = inter (line A B) (line C D).
Proof.
intros.
remove_line_occ.
unfold inter.
elim a2_exist.
intros.
simpl in *.
use_all.
collapse.
Qed.
Lemma on_inter_points_wd_spec_1 : forall A B C D l m,
Incid A l ->
Incid B l ->
Incid C m ->
Incid D m ->
Incid A m ->
l <> m ->
A <> B ->
C <> D ->
A = inter (line A B) (line C D).
Proof.
intros.
eapply on_inter_points_wd.
apply H.
apply H0.
apply H1.
apply H2.
auto.
auto.
auto.
auto.
auto.
Qed.
Lemma on_inter_points_wd_spec_2 : forall A B C D l m,
Incid A l ->
Incid B l ->
Incid C m ->
Incid D m ->
Incid B m ->
l <> m ->
A <> B ->
C <> D ->
B = inter (line A B) (line C D).
Proof.
intros.
eapply on_inter_points_wd.
apply H.
apply H0.
apply H1.
apply H2.
auto.
auto.
auto.
auto.
auto.
Qed.
Lemma on_inter_points_wd_spec_3 : forall A B C D l m,
Incid A l ->
Incid B l ->
Incid C m ->
Incid D m ->
Incid C l ->
l <> m ->
A <> B ->
C <> D ->
C = inter (line A B) (line C D).
Proof.
intros.
eapply on_inter_points_wd.
apply H.
apply H0.
apply H1.
apply H2.
auto.
auto.
auto.
auto.
auto.
Qed.
Lemma on_inter_points_wd_spec_4 : forall A B C D l m,
Incid A l ->
Incid B l ->
Incid C m ->
Incid D m ->
Incid D l ->
l <> m ->
A <> B ->
C <> D ->
D = inter (line A B) (line C D).
Proof.
intros.
eapply on_inter_points_wd.
apply H.
apply H0.
apply H1.
apply H2.
auto.
auto.
auto.
auto.
auto.
Qed.
Lemma not_eq_sym_point : forall A B : Point, A<>B -> B<>A.
Proof.
auto.
Qed.
Lemma not_eq_sym_line : forall A B : Line, A<>B -> B<>A.
Proof.
auto.
Qed.
Ltac assumption_or_sym :=
assumption ||
(apply not_eq_sym_point;assumption) ||
(apply not_eq_sym_line;assumption).
Ltac assumptions_or_sym := repeat split;try assumption_or_sym.
Ltac remove_inter_points_occ := repeat (match goal with
HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP1 : Incid ?P ?l,
HP2 : Incid ?P ?m |- context[inter (line ?A ?B) (line ?C ?D)] =>
rewrite <- (on_inter_points_wd A B C D P l m) in *; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?A ?m |- context[inter (line ?A ?B) (line ?C ?D)] =>
rewrite <- (on_inter_points_wd_spec_1 A B C D l m) in *; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?B ?m |- context[inter (line ?A ?B) (line ?C ?D)] =>
rewrite <- (on_inter_points_wd_spec_2 A B C D l m) in *; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?C ?l |- context[inter (line ?A ?B) (line ?C ?D)] =>
rewrite <- (on_inter_points_wd_spec_3 A B C D l m) in *; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?D ?l |- context[inter (line ?A ?B) (line ?C ?D)] =>
rewrite <- (on_inter_points_wd_spec_4 A B C D l m) in *; try assumption_or_sym
|
HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP1 : Incid ?P ?l,
HP2 : Incid ?P ?m ,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd A B C D P l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?A ?m,
H: context[inter (line ?A ?B) (line ?C ?D)]|- _ =>
rewrite <- (on_inter_points_wd_spec_1 A B C D l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?B ?m,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd_spec_2 A B C D l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?C ?l,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd_spec_3 A B C D l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?D ?l,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd_spec_4 A B C D l m) in H; try assumption_or_sym
end).
Lemma on_inter_wd : forall P l m,
Incid P l ->
Incid P m ->
l <> m ->
inter l m = P.
Proof.
intros.
unfold inter.
elim a2_exist.
simpl.
intros.
use_all.
collapse.
trivial.
Qed.
Lemma on_inter_wd_sym : forall P l m,
Incid P l ->
Incid P m ->
l <> m ->
inter m l = P.
Proof.
intros.
unfold inter.
elim a2_exist.
simpl.
intros.
use_all.
collapse.
trivial.
Qed.
Ltac remove_inter_occ :=
first [erewrite on_inter_wd_sym in * by eassumption |
erewrite on_inter_wd in * by eassumption].
Lemma col_col_on_inter : forall A B C D I,
Col A B I -> Col C D I ->
A<>B -> C<>D -> (line A B) <> (line C D) ->
I = inter (line A B) (line C D).
Proof.
intros.
geo_norm.
remove_line_occ.
remove_inter_occ.
trivial.
Qed.
Lemma incid_line_left : forall A B, Incid A (line A B).
Proof.
intros.
intros; unfold line.
repeat (elim a1_exist); simpl; intuition.
Qed.
Lemma incid_line_right : forall A B, Incid B (line A B).
intros; unfold line.
repeat (elim a1_exist); simpl; intuition.
Qed.
Hint Resolve incid_line_left incid_line_right.
Lemma col_incid : forall A B C, B<>C -> Col A B C -> Incid A (line B C).
intros.
geo_norm.
remove_line_occ.
auto.
Qed.
Lemma col_comm : forall A B C, Col A B C -> Col B A C.
Proof.
intros; firstorder.
Qed.
Lemma col_comm2 : forall A B C, Col A B C -> Col A C B.
Proof with (intros; firstorder).
intros...
Qed.
Lemma col_comm3 : forall A B C, Col A B C -> Col B C A.
Proof.
intros; firstorder.
Qed.
Lemma col_comm4 : forall A B C, Col A B C -> Col C A B.
Proof.
intros; firstorder.
Qed.
Lemma col_comm5 : forall A B C, Col A B C -> Col C B A.
Proof.
intros; firstorder.
Qed.
Lemma inter_comm : forall l m, inter l m = inter m l.
Proof.
intros;
elim (uniqdec.eq_line_dec l m).
intro;subst.
trivial.
intros.
intros; unfold inter;firstorder.
repeat (elim a2_exist); simpl;intros.
use_all.
collapse.
Qed.
Lemma line_comm : forall A B, (line A B)=(line B A).
Proof.
intros; elim (uniqdec.eq_point_dec A B).
intros; subst; auto.
intros ; unfold line; repeat (elim a1_exist); simpl; intros; use_all.
collapse.
Qed.
Hint Resolve inter_comm line_comm
col_comm col_comm2 col_comm3 col_comm4 col_comm5.
Lemma line_neq_neq :
forall A B C D, forall l m, A<>B -> C<>D ->
Incid A l -> Incid B l -> Incid C m -> Incid D m -> (line A B) <> (line C D) -> l<>m.
Proof.
intros.
unfold line in *; revert H5.
repeat (elim a1_exist); simpl;firstorder.
collapse.
auto.
Qed.
Lemma incid_inter_left :
forall A B C D, Incid (inter (line A B) (line C D)) (line A B).
Proof.
intros; unfold inter; repeat (elim a2_exist); simpl; firstorder.
Qed.
Lemma incid_inter_right :
forall A B C D, Incid (inter (line A B) (line C D)) (line C D).
Proof.
intros; unfold inter; repeat (elim a2_exist); simpl; firstorder.
Qed.
Hint Resolve incid_inter_left incid_inter_right.
(* Invariance by permutation of hexamy property *)
Lemma hexamy_rot_left : forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy B C D E F A.
Proof.
intros; unfold is_hexamy in *.
unfold Col in *; firstorder.
exists x; firstorder.
rewrite inter_comm; auto.
Qed.
Lemma hexamy_rot_right : forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy F A B C D E.
Proof.
intros; unfold is_hexamy in *.
unfold Col in *; firstorder.
exists x; firstorder.
rewrite inter_comm; auto.
Qed.
Hint Resolve hexamy_rot_left hexamy_rot_right : permut.
Lemma hexamy_swap_2_3 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A C B D E F.
Proof.
intros; apply hexamy_rot_right; apply H;
apply hexamy_rot_left; exact H0.
Qed.
Lemma hexamy_swap_2_4 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A D C B E F.
Proof.
intros;
apply hexamy_rot_right; apply H;
apply hexamy_rot_right; apply H;
apply hexamy_rot_left; apply H;
apply hexamy_rot_left; exact H0.
Qed.
Lemma hexamy_swap_2_5 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A E C D B F.
Proof.
intros;
apply H; apply hexamy_rot_left; apply H;
apply hexamy_rot_left; apply H;
apply hexamy_rot_right; apply H;
apply hexamy_rot_right; apply H; exact H0.
Qed.
Lemma hexamy_swap_2_6 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A F C D E B.
Proof.
intros;
apply H; apply hexamy_rot_left; apply H;
apply hexamy_rot_right; apply H; exact H0.
Qed.
Lemma hexamy_swap_3_4 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A B D C E F.
Proof.
intros;
do 2 apply hexamy_rot_right;
apply H; apply hexamy_rot_left;
apply hexamy_rot_left; exact H0.
Qed.
Lemma hexamy_swap_3_5 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A B E D C F.
Proof.
intro H; intro A; intro B; intro C; intro D; intro E; intro F; intro H0;
apply hexamy_rot_right; apply hexamy_rot_right;
apply H; apply hexamy_rot_right; apply H;
apply hexamy_rot_left; apply H;
apply hexamy_rot_left; apply hexamy_rot_left; exact H0.
Qed.
Lemma hexamy_swap_3_6 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A B F D E C.
Proof.
intros.
do 2 apply hexamy_rot_right;
apply H.
apply hexamy_rot_right.
apply H.
do 2 apply hexamy_rot_right.
apply H;
apply hexamy_rot_right; apply H;
apply hexamy_rot_left; exact H0.
Qed.
Lemma hexamy_swap_4_5 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A B C E D F.
Proof.
intros.
do 3 apply hexamy_rot_left;
apply H;
do 3 apply hexamy_rot_left;
exact H0.
Qed.
Lemma hexamy_swap_4_6 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A B C F E D.
Proof.
intros.
do 3 apply hexamy_rot_right.
apply H.
apply hexamy_rot_right.
apply H.
apply hexamy_rot_left.
apply H.
do 3 apply hexamy_rot_left;
exact H0.
Qed.
Lemma hexamy_swap_5_6 : hexamy -> forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A B C D F E.
Proof.
intros;
do 2 apply hexamy_rot_left;
apply H;
do 2 apply hexamy_rot_right;
exact H0.
Qed.
Ltac put_in_front P := repeat (match goal with
H:_ |- is_hexamy P ?B ?C ?D ?E ?F => idtac
|H:_ |- is_hexamy ?A ?B ?C ?D ?E ?F => apply hexamy_rot_left
|H:_ |- _ => fail "goal must be hexamy"
end).
Ltac hexamy_permut_1:= match goal with
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy _ _ _ _ _ _ => put_in_front A
end.
Ltac hexamy_permut_2 := match goal with
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B _ _ _ _ => idtac
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?X ?B ?Y ?Z ?T => cut (is_hexamy A B X Y Z T) ; [apply (hexamy_swap_2_3 HH) | idtac ]
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?X ?Y ?B ?Z ?T => cut (is_hexamy A B Y X Z T) ; [apply (hexamy_swap_2_4 HH) | idtac]
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?X ?Y ?Z ?B ?T => cut (is_hexamy A B Y Z X T) ; [apply (hexamy_swap_2_5 HH)|idtac]
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?X ?Y ?Z ?T ?B => cut (is_hexamy A B Y Z T X) ; [apply (hexamy_swap_2_6 HH)| idtac]
end.
Ltac hexamy_permut_3 := match goal with
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?C _ _ _ => idtac
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?X ?C ?Y ?Z => cut (is_hexamy A B C X Y Z) ; [apply (hexamy_swap_3_4 HH) | idtac ]
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?X ?Y ?C ?Z => cut (is_hexamy A B C Y X Z) ; [apply (hexamy_swap_3_5 HH) | idtac]
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?X ?Y ?Z ?C => cut (is_hexamy A B C Y Z X) ; [apply (hexamy_swap_3_6 HH)|idtac]
end.
Ltac hexamy_permut_4 := match goal with
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?C ?D _ _ => idtac
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?C ?X ?D ?Y => cut (is_hexamy A B C D X Y) ; [apply (hexamy_swap_4_5 HH) | idtac ]
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?C ?X ?Y ?D => cut (is_hexamy A B C D Y X) ; [apply (hexamy_swap_4_6 HH) | idtac]
end.
Ltac hexamy_permut_5 := match goal with
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?C ?D ?E _ => idtac
| HH: hexamy, H: is_hexamy ?A ?B ?C ?D ?E ?F |- is_hexamy ?A ?B ?C ?D ?X ?E => cut (is_hexamy A B C D E X) ; [apply (hexamy_swap_5_6 HH) | idtac ]
end.
Ltac hexamy_permut := hexamy_permut_1 ; hexamy_permut_2 ; hexamy_permut_3 ; hexamy_permut_4 ; hexamy_permut_5 ; assumption.
Lemma test4 : forall A C J A' C' K, hexamy -> is_hexamy A C J A' C' K -> is_hexamy A A' J C C' K.
Proof.
intros; hexamy_permut.
Qed.
Lemma test5 : forall P M L Q N H, hexamy ->
is_hexamy P M L Q N H -> is_hexamy P Q L M N H.
Proof.
intros; hexamy_permut.
Qed.
Lemma test3 : forall A B C D E F, hexamy -> is_hexamy B F D A E C ->
is_hexamy A B C D E F.
Proof.
intros.
hexamy_permut.
Qed.
Lemma test : forall A B C D E F, hexamy ->
is_hexamy A B C D E F -> is_hexamy B A C E D F.
Proof.
intros.
hexamy_permut.
Qed.
Lemma test3' : forall A B C D E F, hexamy -> is_hexamy B F D A E C ->
is_hexamy A B C D E F.
Proof.
intros.
hexamy_permut.
Qed.
Lemma hexamy_swap_right : hexamy ->
forall A B C D E F,
is_hexamy A B C D E F -> is_hexamy A B C D F E.
Proof.
intros.
hexamy_permut.
Qed.
Lemma col_line_eq : forall A B C,
Col A B C -> A<>B -> A<>C ->
line A B = line A C.
Proof.
intros.
unfold line.
repeat elim a1_exist;intros.
simpl.
unfold Col in H.
use H.
use p.
use p0.
assert (x=x1).
eapply a1_unique;eauto.
subst.
assert (x1=x0).
eapply a1_unique; try apply H0;auto.
subst.
auto.
Qed.
Lemma col_trivial_1: forall A B, Col A A B.
Proof.
intros.
create_line A B lAB.
exists lAB.
auto.
Qed.
Lemma col_trivial_2: forall A B, Col A B B.
Proof.
intros.
create_line A B lAB.
exists lAB.
auto.
Qed.
Lemma col_trivial_3: forall A B, Col A B A.
Proof.
intros.
create_line A B lAB.
exists lAB.
auto.
Qed.
Hint Resolve col_trivial_1 col_trivial_2 col_trivial_3.
Ltac solve_col := match goal with
HA: Incid ?A ?l, HB: Incid ?B ?l, HC : Incid ?C ?l |- Col ?A ?B ?C => exists l; auto
| H:_ |- Col ?A ?A ?B => auto
| H:_ |- Col ?A ?B ?B => auto
| H:_ |- Col ?A ?B ?A => auto
end.
Ltac revert_all_inter T := (match goal with
H: context[inter (line _ _) (line _ _)] |- _ => revert H
end;revert_all_inter T;intro) || T.
Ltac remove_inter_points_occ_all := revert_all_inter remove_inter_points_occ.
Ltac remove_inter_points_occ_assum := do 3 (match goal with
|HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP1 : Incid ?P ?l,
HP2 : Incid ?P ?m ,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd A B C D P l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?A ?m,
H: context[inter (line ?A ?B) (line ?C ?D)]|- _ =>
rewrite <- (on_inter_points_wd_spec_1 A B C D l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?B ?m,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd_spec_2 A B C D l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?C ?l,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd_spec_3 A B C D l m) in H; try assumption_or_sym
| HA: Incid ?A ?l,
HB: Incid ?B ?l,
HC: Incid ?C ?m,
HD: Incid ?D ?m,
HP2 : Incid ?D ?l,
H: context[inter (line ?A ?B) (line ?C ?D)] |- _ =>
rewrite <- (on_inter_points_wd_spec_4 A B C D l m) in H; try assumption_or_sym
end).
Ltac hexamy_proof_1 A B C D E F :=
let T := fresh "hexa" in
assert (T:is_hexamy A B C D E F);
[unfold is_hexamy;split;[assumptions_or_sym|
remove_inter_points_occ; remove_line_occ; try solve [solve_col]]|
idtac].
Ltac print_goal := match goal with
H:_ |- ?X => idtac X
end.
Ltac hexamy_proof A B C D E F A' B' C' D' E' F' :=
let T := fresh "hexa" in
let U := fresh "hexa" in
assert (T:is_hexamy A B C D E F);
[unfold is_hexamy;split;[assumptions_or_sym|
remove_inter_points_occ; remove_line_occ; try solve [solve_col];print_goal]|
assert (U:is_hexamy A' B' C' D' E' F') by hexamy_permut;
unfold is_hexamy in U;use U;
remove_inter_points_occ_assum;auto].
(* This first definition of Pappus is the most general one. *)
Definition pappus_strong :=
forall A B C A' B' C' P Q R,
(dist6 A B C A' B' C' \/
(line A B' <> line A' B /\ A<>B' /\ A'<>B /\
line B C' <> line B' C /\ B<>C' /\ B'<>C /\
line A C' <> line A' C /\ A<>C' /\ A'<>C) ) ->
Col A B C -> Col A' B' C' ->
is_on_inter P A B' A' B ->
is_on_inter Q B C' B' C ->
is_on_inter R A C' A' C ->
Col P Q R.
(* This second definition of Pappus' configuration assumes that all the 6 points are distincts
and that the intersection are all well defined. This implies also that the line AB and A'B'
are distinct. This is the figure without any particular case. *)
Definition pappus_weak :=
forall A B C A' B' C' P Q R,
Col A B C -> Col A' B' C' ->
dist6 A B C A' B' C' ->
is_on_proper_inter P A B' A' B ->
is_on_proper_inter Q B C' B' C ->
is_on_proper_inter R A C' A' C ->
Col P Q R.
Lemma is_on_proper_inter_is_on_inter : forall P A B C D,
is_on_proper_inter P A B C D -> is_on_inter P A B C D.
Proof.
intros.
unfold is_on_proper_inter, is_on_inter in *.
intuition.
Qed.
Lemma pappus_pappus_strong : pappus_weak <-> pappus_strong.
Proof.
unfold pappus_weak, pappus_strong.
split;intros.
2:apply (H A B C A' B' C');auto using is_on_proper_inter_is_on_inter.
decompose [or] H0;clear H0.
elim (uniqdec.eq_line_dec (line A' B) (line A B')).
intros.
geo_norm.
subst.
remove_line_occ.
subst.
rename x5 into l.
rename x6 into m.
rename x3 into lAB'.
rename x2 into lB'C.
rename x1 into lBC'.
rename x0 into lA'C.
rename x into lAC'.
collapse.
solve_col.
intro.
elim (uniqdec.eq_line_dec (line B' C) (line B C')).
intros.
geo_norm.
subst.
remove_line_occ.
subst.
collapse.
solve_col.
intro.
elim (uniqdec.eq_line_dec (line A' C) (line A C')).
intros.
geo_norm.
subst.
remove_line_occ.
subst.
collapse.
solve_col.
intro.
apply (H A B C A' B' C'); auto;
unfold is_on_inter, is_on_proper_inter, dist6 in *;use_all;auto.
use H6.
cases_point A B.
geo_norm.
remove_line_occ.
collapse.
solve_col.
cases_point A C.
geo_norm.
remove_line_occ.
collapse.
solve_col.
cases_point B C.
geo_norm.
remove_line_occ.
collapse.
solve_col.
cases_point A' B'.
geo_norm.
remove_line_occ.
collapse.
solve_col.
cases_point A' C'.
geo_norm.
remove_line_occ.
collapse.
solve_col.