Require Export GeoCoq.Tarski_dev.Ch06_out_lines.
Require Export GeoCoq.Tarski_dev.Tactics.ColR.
Ltac not_exist_hyp_comm A B := not_exist_hyp (A<>B);not_exist_hyp (B<>A).
Ltac not_exist_hyp2 A B C D := first [not_exist_hyp_comm A B | not_exist_hyp_comm C D].
Ltac not_exist_hyp3 A B C D E F := first [not_exist_hyp_comm A B | not_exist_hyp_comm C D | not_exist_hyp_comm E F].
Ltac assert_diffs :=
repeat
match goal with
| H:(~Col ?X1 ?X2 ?X3) |- _ =>
let h := fresh in
not_exist_hyp3 X1 X2 X1 X3 X2 X3;
assert (h := not_col_distincts X1 X2 X3 H);decompose [and] h;clear h;clean_reap_hyps
| H:(~Bet ?X1 ?X2 ?X3) |- _ =>
let h := fresh in
not_exist_hyp2 X1 X2 X2 X3;
assert (h := not_bet_distincts X1 X2 X3 H);decompose [and] h;clear h;clean_reap_hyps
| H:Bet ?A ?B ?C, H2 : ?A <> ?B |-_ =>
let T:= fresh in (not_exist_hyp_comm A C);
assert (T:= bet_neq12__neq A B C H H2);clean_reap_hyps
| H:Bet ?A ?B ?C, H2 : ?B <> ?A |-_ =>
let T:= fresh in (not_exist_hyp_comm A C);
assert (T:= bet_neq21__neq A B C H H2);clean_reap_hyps
| H:Bet ?A ?B ?C, H2 : ?B <> ?C |-_ =>
let T:= fresh in (not_exist_hyp_comm A C);
assert (T:= bet_neq23__neq A B C H H2);clean_reap_hyps
| H:Bet ?A ?B ?C, H2 : ?C <> ?B |-_ =>
let T:= fresh in (not_exist_hyp_comm A C);
assert (T:= bet_neq32__neq A B C H H2);clean_reap_hyps
| H:Cong ?A ?B ?C ?D, H2 : ?A <> ?B |-_ =>
let T:= fresh in (not_exist_hyp_comm C D);
assert (T:= cong_diff A B C D H2 H);clean_reap_hyps
| H:Cong ?A ?B ?C ?D, H2 : ?B <> ?A |-_ =>
let T:= fresh in (not_exist_hyp_comm C D);
assert (T:= cong_diff_2 A B C D H2 H);clean_reap_hyps
| H:Cong ?A ?B ?C ?D, H2 : ?C <> ?D |-_ =>
let T:= fresh in (not_exist_hyp_comm A B);
assert (T:= cong_diff_3 A B C D H2 H);clean_reap_hyps
| H:Cong ?A ?B ?C ?D, H2 : ?D <> ?C |-_ =>
let T:= fresh in (not_exist_hyp_comm A B);
assert (T:= cong_diff_4 A B C D H2 H);clean_reap_hyps
| H:Le ?A ?B ?C ?D, H2 : ?A <> ?B |-_ =>
let T:= fresh in (not_exist_hyp_comm C D);
assert (T:= le_diff A B C D H2 H);clean_reap_hyps
| H:Lt ?A ?B ?C ?D |-_ =>
let T:= fresh in (not_exist_hyp_comm C D);
assert (T:= lt_diff A B C D H);clean_reap_hyps
| H:Out ?A ?B ?C |- _ =>
let T:= fresh in (not_exist_hyp2 A B A C);
assert (T:= out_distinct A B C H);
decompose [and] T;clear T;clean_reap_hyps
end.
Ltac ColR :=
let tpoint := constr:(Tpoint) in
let col := constr:(Col) in
treat_equalities; assert_cols; assert_diffs; try (solve [Col]); Col_refl tpoint col.
Section T7_1.
Context `{TnEQD:Tarski_neutral_dimensionless_with_decidable_point_equality}.

(* Specifications: *)
Lemma midpoint_dec :
forall I A B, Midpoint I A B \/ ~ Midpoint I A B.
Lemma is_midpoint_id : forall A B, Midpoint A A B -> A = B.
Lemma is_midpoint_id_2 : forall A B, Midpoint A B A -> A=B.
Lemma l7_2 : forall M A B, Midpoint M A B -> Midpoint M B A.
Lemma l7_3 : forall M A, Midpoint M A A -> M=A.
Lemma l7_3_2 : forall A, Midpoint A A A.
(** This corresponds to l7_8 in Tarski's book. *)
Lemma symmetric_point_construction : forall P A, exists P', Midpoint A P P'.
Lemma symmetric_point_uniqueness : forall A P P1 P2, Midpoint P A P1 -> Midpoint P A P2 -> P1=P2.
Lemma l7_9 : forall P Q A X, Midpoint A P X -> Midpoint A Q X -> P=Q.
Lemma l7_9_bis : forall P Q A X, Midpoint A P X -> Midpoint A X Q -> P=Q.
Lemma l7_13 : forall A P Q P' Q',  Midpoint A P' P -> Midpoint A Q' Q -> Cong P Q P' Q'.
Lemma l7_15 : forall P Q R P' Q' R' A,
Midpoint A P P' -> Midpoint A Q Q' -> Midpoint A R R' -> Bet P Q R -> Bet P' Q' R'.
Lemma l7_16 : forall P Q R S P' Q' R' S' A,
Midpoint A P P' -> Midpoint A Q Q' ->
Midpoint A R R' -> Midpoint A S S' ->
Cong P Q R S -> Cong P' Q' R' S'.
Lemma symmetry_preserves_midpoint :
forall A B C D E F Z,
Midpoint Z A D -> Midpoint Z B E ->
Midpoint Z C F -> Midpoint B A C -> Midpoint E D F.