(* Julien Narboux *)
(* Formalization of *)
(* Tarski's axiomatic *)
Require Export Ch07_midpoint.
Unset Regular Subst Tactic.
Definition Per := fun A B C =>
exists C', is_midpoint B C C' /\ Cong A C A C'.
Hint Resolve l8_2 : Perp.
Ltac Perp := eauto with Perp.
intros.
unfold Per.
exists B;intuition.
Qed.
Hint Resolve l8_5 : Perp.
intros.
unfold Per in *.
DecompExAnd H C'.
suppose (Cong A' C A' C').
assert (C=C').
eapply l4_19.
2:apply H4.
2:apply H.
assumption.
subst C'.
eapply l7_3.
assumption.
DecompExAnd H0 C''.
assert (Cong C C C' C'').
eapply l7_13.
apply l7_2.
apply H3.
apply l7_2.
apply H2.
treat_equalities.
auto.
Qed.
Ltac let_symmetric C P A :=
let id1:=fresh in (assert (id1:(exists A', is_midpoint P A A'));
[apply symmetric_point_construction|DecompEx id1 C]).
Hint Resolve l8_7 : Perp.
Proof with Perp.
intros.
eapply l8_7...
Qed.
Proof with Perp.
intros.
cases_equality A B.
left;auto.
right.
assert (Per C B C).
eapply l8_3...
eauto with Col.
Perp.
Qed.
Proof with Perp.
intros.
cases_equality B C.
unfold Cong_3 in H0;intuition.
treat_equalities...
assert (B'<>C').
unfold Cong_3 in H0;intuition.
treat_equalities...
unfold Per in H.
DecompExAnd H D.
let_symmetric D' B' C'.
assert (OFSC C B D A C' B' D' A').
unfold OFSC,Cong_3,is_midpoint in *;intuition.
eapply cong_transitivity with (C:=B) (D:=C);sTarski.
eapply cong_transitivity with (C:=B') (D:=C');sTarski.
assert (Cong D A D' A').
eapply five_segments_with_def;eauto.
unfold OFSC,Cong_3,is_midpoint in *;intuition.
clean_duplicated_hyps.
assert (Cong A' C' A' D').
eapply cong_transitivity with (C:=A) (D:=C);sTarski.
eapply cong_transitivity with (C:=A) (D:=D);sTarski.
unfold Per.
exists D'.
intuition.
unfold is_midpoint...
Qed.
Definition Perp_in := fun X A B C D =>
A<>B /\ C<>D /\ Col X A B /\ Col X C D /\
(forall U V,  Col U A B -> Col V C D -> Per U X V).
Definition Perp := fun A B C D => exists X, Perp_in X A B C D.
Proof with Perp.
unfold Perp_in.
intros;intuition.
Qed.
Definition DistLn := fun A B C D =>
(exists X, Col X A B /\ ~Col X C D) \/ (exists X, ~ Col X A B /\ Col X C D).

Lemma l8_14_1 : forall A B, ~ Perp A B A B.