Require Export GeoCoq.Tarski_dev.Ch14_order.

Section T15.

Context `{T2D:Tarski_2D}.
Context `{TE:@Tarski_euclidean Tn TnEQD}.

(** Lemma 15.2 *)
(** Cong corresponds to length equality.*)
(** Le corresponds to length inequality.*)

Lemma length_pos : forall O E E' A B L,
  Length O E E' A B L -> LeP O E E' O L.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.

Lemma length_id_1 : forall O E E' A B,
  Length O E E' A B O -> A=B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
treat_equalities.
(* Goal: @eq (@Tpoint Tn) O O *)
reflexivity.
Qed.

Lemma length_id_2 : forall O E E' A,
  O<>E -> Length O E E' A A O.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' A B AB *)
unfold Length.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: and (@LeP Tn O E E' A B) (not (@eq (@Tpoint Tn) A B)) *)
unfold LeP.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Cong Tn A P Q A *)
Cong.
Qed.

Lemma length_id : forall O E E' A B,
 Length O E E' A B O <-> (A=B /\ O<>E).
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @eq (@Tpoint Tn) A B *)
(* Goal: not (@eq (@Tpoint Tn) O E) *)
(* Goal: forall _ : and (@eq (@Tpoint Tn) A B) (not (@eq (@Tpoint Tn) O E)), @Length Tn O E E' A B O *)
eauto using length_id_1.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Lt Tn T A P A *)
spliter. subst.
(* Goal: @Length Tn O E E' A A O *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply length_id_2.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma length_eq_cong_1 : forall O E E' A B C D AB,
 Length O E E' A B AB -> Length O E E' C D AB -> Cong A B C D.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Cong Tn A P Q A *)
apply cong_transitivity with O AB;Cong.
Qed.

Lemma length_eq_cong_2 : forall O E E' A B C D AB,
 Length O E E' A B AB -> Cong A B C D -> Length O E E' C D AB.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Per Tn P T A *)
repeat split;try assumption.
(* Goal: @Cong Tn A P Q A *)
apply cong_transitivity with A B;Cong.
Qed.

Lemma ltP_pos : forall O E E' A, LtP O E E' O A  -> Ps O E A.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: not (@eq (@Tpoint Tn) A B) *)
unfold LtP in H.
(* Goal: @Ps Tn O E A *)
ex_and H A'.

(* Goal: @Ps Tn O E A *)
assert(~Col O E E' /\ Col O E A).
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E A) *)
(* Goal: @Ps Tn O E A *)
unfold Diff in H.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
ex_and H X.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E A) *)
(* Goal: @Ps Tn O E A *)
unfold Sum in H1.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
(* Goal: @eq (@Tpoint Tn) O O *)
(* Goal: @Sumg Tn O E E' O O O *)
unfold Ar2 in H1.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Ps Tn O E A *)
assert(HH:= diff_A_O O E E' A H1 H2).
(* Goal: @Ps Tn O E A *)
assert(A = A').
(* Goal: @Per Tn P T A *)
apply(diff_uniqueness O E E' A O A A'); assumption.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst A'.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma bet_leP : forall O E E' AB CD,
  Bet O AB CD -> LeP O E E' O AB -> LeP O E E' O CD -> LeP O E E' AB CD.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeP Tn O E E' A B *)
unfold LeP in *.
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
induction H0; induction H1.

(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold LtP in H0.
(* Goal: False *)
unfold LtP in H1.
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
ex_and H0 P.
(* Goal: not (@Col Tn O E E') *)
(* Goal: or (and (@Col Tn O E AB) (not (@Col Tn O E E'))) (@eq (@Tpoint Tn) AB O) *)
ex_and H1 Q.

(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(Ar2 O E E' AB CD P /\ Col O E Q).
(* Goal: and (@Ar2 Tn O E E' AB CD P) (@Col Tn O E Q) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Diff in H0.
(* Goal: and (@Ar2 Tn O E E' AB CD P) (@Col Tn O E Q) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
ex_and H0 X.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Diff in H1.
(* Goal: and (@Ar2 Tn O E E' AB CD P) (@Col Tn O E Q) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
ex_and H1 Y.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Sum in H4.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Ar2 in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ar2 in H4.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(P = AB).
(* Goal: @eq (@Tpoint Tn) P AB *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply (diff_uniqueness O E E' AB O); auto.
(* Goal: @Diff Tn O E E' CD O CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply diff_A_O; auto.
(* Goal: @Lt Tn A A P A *)
(* Goal: @Lt Tn A A P A *)
subst P.

(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(Q = CD).
(* Goal: @eq (@Tpoint Tn) Q CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply (diff_uniqueness O E E' CD O); auto.
(* Goal: @Diff Tn O E E' CD O CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply diff_A_O; auto.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
subst Q.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
clean_duplicated_hyps.

(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
induction(eq_dec_points AB CD).
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @LtP Tn O E E' AB CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
clear H0 H1.


(* Goal: @LtP Tn O E E' AB CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(HH:=opp_exists O E E' H4 AB H6).
(* Goal: @LtP Tn O E E' AB CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
ex_and HH AB'.

(* Goal: @LtP Tn O E E' AB CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(exists P, Sum O E E' CD AB' P).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(sum_exists O E E' H4 CD AB'); Col.
(* Goal: @Col Tn O E AB' *)
(* Goal: @LtP Tn O E E' AB CD *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Opp in H0.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X O *)
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E AB *)
unfold Ar2 in H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: False *)
ex_and H1 P.


(* Goal: @LtP Tn O E E' A B *)
unfold LtP.
(* Goal: @ex (@Tpoint Tn) (fun P : @Tpoint Tn => and (@InAngle Tn P D' E F') (@CongA Tn A' B C' D' E P)) *)
exists P.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @Diff Tn O E E' CD AB P *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Diff.
(* Goal: @ex (@Tpoint Tn) (fun B' : @Tpoint Tn => and (@Opp Tn O E E' AB B') (@Sum Tn O E E' CD B' P)) *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
exists AB'.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.


(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(Diff O E E' CD AB P).
(* Goal: @Diff Tn O E E' CD AB P *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Diff.
(* Goal: @ex (@Tpoint Tn) (fun B' : @Tpoint Tn => and (@Opp Tn O E E' AB B') (@Sum Tn O E E' CD B' P)) *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
exists AB'.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.

(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply diff_sum in H1.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction (eq_dec_points AB O).
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Ps Tn O E P *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Ps in H2.
(* Goal: not (@eq (@Tpoint Tn) AB O) *)
(* Goal: not (@eq (@Tpoint Tn) E O) *)
(* Goal: or (@Bet Tn O AB E) (@Bet Tn O E AB) *)
unfold Out in H2.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(Parallelogram_flat O AB CD P).
(* Goal: @Parallelogram_flat Tn O AB CD P *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply (sum_cong O E E' H4 AB P CD H1).
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Parallelogram_flat in H10.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(Bet CD P O).
(* Goal: @Bet Tn CD P O *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply(l4_6 O AB CD CD P O).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
repeat split; Cong.
(* Goal: @Ps Tn O E A *)
unfold Ps.
(* Goal: @Ps Tn O E A *)
unfold Out.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Lt Tn A A P A *)
(* Goal: @Lt Tn A A P A *)
subst P.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) E O) *)
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
assert(AB=CD).
(* Goal: @eq (@Tpoint Tn) AB CD *)
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) E O) *)
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply cong_symmetry in H13.
(* Goal: @Cong Tn A P Q A *)
apply (cong_identity _ _ O); Cong.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: False *)
apply H4.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Ps in H3.
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
unfold Out in H3.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
induction H17.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Bet Tn O P E *)
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply (between_exchange4 O P CD E); Between.
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply (l5_3 O P E CD); Between.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: or (@LtP Tn O E E' AB O) (@eq (@Tpoint Tn) AB O) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply between_identity in H.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
right; auto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Per Tn P T A *)
left; assumption.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
right; auto.
Qed.

Lemma leP_bet : forall O E E' AB CD,
  LeP O E E' AB CD -> LeP O E E' O AB -> LeP O E E' O CD -> Bet O AB CD.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LtP Tn O E E' A B *)
unfold LeP in H.
(* Goal: False *)
induction H.
(* Goal: not (@eq (@Tpoint Tn) A B) *)
unfold LtP in H.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
ex_and H X.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply diff_sum in H.

(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
assert(Out O AB X \/ AB=O).
(* Goal: or (@Out Tn O AB X) (@eq (@Tpoint Tn) AB O) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold LeP in H0.
(* Goal: @LeP Tn O E E' S2 AB2 *)
induction H0.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Out Tn O AB X *)
(* Goal: or (@Out Tn O AB X) (@eq (@Tpoint Tn) AB O) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply ltP_pos in H0.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in *.
(* Goal: @Out Tn O AB X *)
(* Goal: or (@Out Tn O AB X) (@eq (@Tpoint Tn) AB O) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
eapply (l6_7 _ _ E); auto.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Lt Tn A T P A *)
auto.

(* Goal: @Bet Tn P A Q *)
induction H3.

(* Goal: @Lt Tn A T P A *)
apply (l14_36_a O E E' AB X CD); auto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Bet Tn O O CD *)
(* Goal: @Bet Tn O AB CD *)
apply between_trivial2.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Bet Tn O AB AB *)
apply between_trivial.
Qed.

Lemma length_Ar2 : forall O E E' A B AB,
  Length O E E' A B AB -> (Col O E AB /\ ~Col O E E') \/ AB = O.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Cong Tn A B O AB *)
unfold Length in H.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: or (and (@Col Tn O E AB) (not (@Col Tn O E E'))) (@eq (@Tpoint Tn) AB O) *)
unfold LeP in H1.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: False *)
unfold LtP in H1.
(* Goal: False *)
ex_and H1 P.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Diff in H1.
(* Goal: not (@Col Tn O E E') *)
(* Goal: or (and (@Col Tn O E AB) (not (@Col Tn O E E'))) (@eq (@Tpoint Tn) AB O) *)
ex_and H1 Q.
(* Goal: not (@Col Tn O E E') *)
(* Goal: or (and (@Col Tn O E AB) (not (@Col Tn O E E'))) (@eq (@Tpoint Tn) AB O) *)
unfold Sum in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Ar2 in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
right; auto.
Qed.

Lemma length_leP_le_1 : forall O E E' A B C D AB CD,
 Length O E E' A B AB -> Length O E E' C D CD -> LeP O E E' AB CD -> Le A B C D.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Le Tn A B C D *)
assert(Bet O AB CD).
(* Goal: @Per Tn P T A *)
apply (leP_bet O E E'); assumption.

(* Goal: @Le Tn A B C D *)
prolong D C M' A B.
(* Goal: @Le Tn A B C D *)
assert(HH:=symmetric_point_construction M' C).
(* Goal: @Le Tn A B C D *)
ex_and HH M.
(* Goal: @Le Tn A B C D *)
unfold Midpoint in H11.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Le Tn A B C D *)
assert(Cong A B C M).
(* Goal: @Cong Tn A P Q A *)
apply (cong_transitivity _ _ C M'); Cong.

(* Goal: @Le Tn A B C D *)
apply(le_transitivity _ _ C M).
(* Goal: @Le Tn O A O P *)
(* Goal: @Le Tn O B O Q *)
unfold Le.
(* Goal: @ex (@Tpoint Tn) (fun E : @Tpoint Tn => and (@Bet Tn C E M) (@Cong Tn A B C E)) *)
(* Goal: @Le Tn C M C D *)
exists M.
(* Goal: and (@Bet Tn C M M) (@Cong Tn A B C M) *)
(* Goal: @Le Tn C M C D *)
split; Between.

(* Goal: @Bet Tn O AB CD *)
assert(Le O AB O CD).
(* Goal: @Le Tn O A O P *)
(* Goal: @Le Tn O B O Q *)
unfold Le.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
exists AB.
(* Goal: @Cong Tn A P Q A *)
split; Cong.

(* Goal: @Cong Tn A P Q A *)
apply(l5_6 O AB O CD C M C D); Cong.
(* Goal: @Cong Tn A P Q A *)
apply (cong_transitivity _ _ A B); Cong.
Qed.

Lemma length_leP_le_2 : forall O E E' A B C D AB CD,
 Length O E E' A B AB -> Length O E E' C D CD -> Le A B C D -> LeP O E E' AB CD.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.

(* Goal: @LeP Tn O E E' AB CD *)
assert(HH1:= length_Ar2 O E E' A B AB H).
(* Goal: @LeP Tn O E E' AB CD *)
assert(HH2:= length_Ar2 O E E' C D CD H0).
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Per Tn P T A *)
apply bet_leP; try assumption.

(* Goal: @Bet Tn O AB CD *)
induction(eq_dec_points O CD).
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Bet Tn O AB O *)
(* Goal: @Bet Tn O AB CD *)
apply cong_symmetry in H4.
(* Goal: @Bet Tn O AB O *)
(* Goal: @Bet Tn O AB CD *)
apply cong_identity in H4.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Le in H1.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
ex_and H1 X.
(* Goal: @Bet Tn O AB O *)
(* Goal: @Bet Tn O AB CD *)
apply between_identity in H1.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Bet Tn O AB O *)
(* Goal: @Bet Tn O AB CD *)
apply cong_identity in H4.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Bet Tn O AB O *)
(* Goal: @Bet Tn O AB CD *)
apply cong_identity in H7.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: @Bet Tn O AB CD *)
assert(Le O AB O CD).

(* Goal: @Cong Tn A P Q A *)
apply(l5_6 A B C D O AB O CD); Cong.
(* Goal: @eq (@Tpoint Tn) M O *)
unfold Le in H8.
(* Goal: @Bet Tn O AB CD *)
ex_and H9 M.

(* Goal: @Bet Tn O AB CD *)
induction HH1; induction HH2.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Le in H1.
(* Goal: False *)
ex_and H1 P.

(* Goal: @LeP Tn O E E' A B *)
unfold LeP in *.
(* Goal: @Bet Tn P A Q *)
induction H6; induction H3.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold LtP in *.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
ex_and H6 X.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
ex_and H3 Y.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply diff_sum in H6.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply diff_sum in H3.
(* Goal: @Lt Tn A T P A *)
apply sum_cong in H6; auto.
(* Goal: @Lt Tn A T P A *)
apply sum_cong in H3; auto.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Parallelogram_flat in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply cong_symmetry in H19.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply cong_identity in H19.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply cong_symmetry in H23.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply cong_identity in H23.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @eq (@Tpoint Tn) M O *)
clean_trivial_hyps.

(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
assert(AB = M \/ Midpoint O AB M).
(* Goal: @Cong Tn A P Q A *)
apply(l7_20 O AB M); Cong.

(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in *.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
assert(Out O AB CD).
(* Goal: @Lt Tn A T P A *)
apply (l6_7 O AB E CD); auto.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Col Tn AB O M *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply out_col in H3.
(* Goal: @Col Tn AB O M *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply bet_col in H9.
(* Goal: @Col Tn AB O M *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply col_permutation_2.

(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply (col_transitivity_1 _ CD); Col.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Le Tn T M T A *)
subst M.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Midpoint in H3.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
assert(Out O AB CD).
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in *.

(* Goal: @Lt Tn A T P A *)
apply (l6_7 O AB E CD); auto.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
assert(Bet AB O CD).

(* Goal: @Bet Tn P A Q *)
eapply (outer_transitivity_between _ _ M); Between.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Le Tn T M T A *)
subst M.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Out in H18.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
induction H22.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(AB = O).
(* Goal: @Bet Tn P A Q *)
apply(between_equality _ _ CD); Between.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
assert(Bet CD O CD).
(* Goal: @Bet Tn P A Q *)
apply (between_exchange3 AB); Between.
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
assert(O = CD).
(* Goal: @eq (@Tpoint Tn) O CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply between_equality in H23.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
(* Goal: False *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Ps in H17.
(* Goal: False *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Out in H17.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: False *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
unfold Ps in H16.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
unfold Out in H16.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.

Lemma l15_3 : forall O E E' A B C, Sum O E E' A B C -> Cong O B A C.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Cong Tn O B A C *)
assert(Ar2 O E E' A B C).
(* Goal: @Ar2 Tn O E E' A B C *)
(* Goal: @Cong Tn O B A C *)
unfold Sum in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Col Tn O E AB *)
unfold Ar2 in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
induction (eq_dec_points A O).
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
(* Goal: @Cong Tn O B O C *)
(* Goal: @Cong Tn O B A C *)
assert(B = C).
(* Goal: @Lt Tn A T P A *)
apply (sum_uniqueness O E E' O B); auto.
(* Goal: @Lt Tn A T P A *)
apply sum_O_B; auto.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @Lt Tn A T P A *)
apply sum_cong in H; auto.
(* Goal: @Cong Tn O B A C *)
unfold Parallelogram_flat in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Cong Tn A P Q A *)
Cong.
Qed.

(** Lemma 15.4. *)
(** Triangular equality. *)
Lemma length_uniqueness : forall O E E' A B AB AB',
  Length O E E' A B AB -> Length O E E' A B AB' -> AB = AB'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(Col O E AB /\ ~ Col O E E' \/ AB = O).
(* Goal: @Per Tn P T A *)
eapply (length_Ar2 O E E' A B AB); assumption.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(Col O E AB' /\ ~ Col O E E' \/ AB' = O).
(* Goal: @Per Tn P T A *)
eapply (length_Ar2 O E E' A B AB'); assumption.

(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(Cong O AB O AB').
(* Goal: @Cong Tn A P Q A *)
apply cong_transitivity with A B; Cong.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(AB = AB' \/ Midpoint O AB AB').
(* Goal: or (@eq (@Tpoint Tn) AB AB') (@Midpoint Tn O AB AB') *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
apply(l7_20 O AB AB').
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
induction H10.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
unfold Midpoint in H10.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @eq (@Tpoint Tn) AB AB' *)
induction H1; induction H2.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @LeP Tn O E E' A B *)
unfold LeP in *.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
induction H4; induction H7.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
unfold LtP in H4.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
unfold LtP in H7.
(* Goal: False *)
ex_and H4 X.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
ex_and H7 Y.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply diff_sum in H4.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply diff_sum in H7.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(X = AB').
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(sum_O_B_eq O E E'); Col.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(Y = AB).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(sum_O_B_eq O E E'); Col.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in *.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(Out O AB AB').
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
eapply (l6_7 _ _ E).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
apply l6_6; assumption.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
unfold Out in H16.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
induction H18.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(AB = O).
(* Goal: @Bet Tn P A Q *)
eapply (between_equality _ _ AB'); Between.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @eq (@Tpoint Tn) O AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
apply cong_symmetry in H11.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
apply cong_identity in H11.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
assert(AB' = O).
(* Goal: @Bet Tn P A Q *)
eapply (between_equality _ _ AB); Between.
(* Goal: @eq (@Tpoint Tn) O AB' *)
subst AB'.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
apply cong_identity in H11.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @eq (@Tpoint Tn) O AB' *)
subst AB'.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @eq (@Tpoint Tn) O AB' *)
subst AB'.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @eq (@Tpoint Tn) O AB' *)
subst AB'.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @eq (@Tpoint Tn) O AB' *)
subst AB'.
(* Goal: @eq (@Tpoint Tn) O O *)
reflexivity.
Qed.

Lemma length_cong : forall O E E' A B AB, Length O E E' A B AB -> Cong A B O AB.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Cong Tn A B O AB *)
unfold Length in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Cong Tn A P Q A *)
Cong.
Qed.

Lemma length_Ps : forall O E E' A B AB,
  AB <> O -> Length O E E' A B AB -> Ps O E AB.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @eq (@Tpoint Tn) AB O *)
unfold Length in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A2 B2 *)
unfold LeP in H2.
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB O *)
unfold LtP in H2.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB O *)
ex_and H2 X.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB O *)
apply diff_sum in H2.
(* Goal: @Ps Tn O E AB *)
(* Goal: @Ps Tn O E AB *)
apply sum_cong in H2.
(* Goal: @Ps Tn O E AB *)
(* Goal: not (@Col Tn O E E') *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Ps Tn O E AB *)
unfold Parallelogram_flat in H2.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Sum Tn O E E' O BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply cong_symmetry in H6.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: False *)
unfold Sum in H2.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
unfold Ar2 in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: False *)
unfold Ps in H4.
(* Goal: False *)
unfold Out in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.

Lemma length_not_col_null : forall O E E' A B AB,
  Col O E E' -> Length O E E' A B AB -> AB=O.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @eq (@Tpoint Tn) AB O *)
unfold Length in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A2 B2 *)
unfold LeP in H2.
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB O *)
unfold LtP in H2.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB O *)
ex_and H2 X.
(* Goal: @eq (@Tpoint Tn) AB O *)
(* Goal: @eq (@Tpoint Tn) AB O *)
apply diff_sum in H2.
(* Goal: False *)
unfold Sum in H2.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
unfold Ar2 in H2.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Lt Tn A T P A *)
auto.
Qed.

Lemma triangular_equality_equiv :
  (forall O E A , O<>E -> (forall E' B C AB BC AC,
   Bet A B C ->
   Length O E E' A B AB -> Length O E E' B C BC -> Length O E E' A C AC ->
   Sum O E E' AB BC AC)) <->
  (forall O E E' A B C AB BC AC,
   O<>E -> Bet A B C ->
   Length O E E' A B AB -> Length O E E' B C BC -> Length O E E' A C AC ->
   Sum O E E' AB BC AC).
Proof.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: forall (_ : forall (O E E' A B C AB BC AC : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) O E)) (_ : @Bet Tn A B C) (_ : @Length Tn O E E' A B AB) (_ : @Length Tn O E E' B C BC) (_ : @Length Tn O E E' A C AC), @Sum Tn O E E' AB BC AC) (O E A : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) O E)) (E' B C AB BC AC : @Tpoint Tn) (_ : @Bet Tn A B C) (_ : @Length Tn O E E' A B AB) (_ : @Length Tn O E E' B C BC) (_ : @Length Tn O E E' A C AC), @Sum Tn O E E' AB BC AC *)
assert(HH:= H O E A H0).
(* Goal: @Lt Tn A T P A *)
apply (HH E' B C); auto.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(HH:= H O E E' A B C AB BC AC H0 H1 H2 H3 H4).
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma not_triangular_equality1 : forall O E A ,
  O<>E ->
  ~ (forall E' B C AB BC AC,
  Bet A B C ->
  Length O E E' A B AB -> Length O E E' B C BC -> Length O E E' A C AC ->
  Sum O E E' AB BC AC).
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
assert(HH:=(H0 E A A O O O)).
(* Goal: @Bet Tn P A Q *)
assert(Bet A A A); Between.
(* Goal: False *)
assert(Length O E E A A O).
(* Goal: @Lt Tn A T P A *)
apply(length_id_2); auto.
(* Goal: False *)
assert(HHH:= (HH H1 H2 H2 H2)).
(* Goal: False *)
unfold Sum in HHH.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
ex_and H4 X.
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 Y.
(* Goal: False *)
unfold Ar2 in H3.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
apply H3.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
Qed.

Lemma triangular_equality : forall O E E' A B C AB BC AC,
  O<>E -> Bet A B C ->
  Is_length O E E' A B AB -> Is_length O E E' B C BC ->
  Is_length O E E' A C AC ->
  Sumg O E E' AB BC AC.
Proof.
(* Goal: forall (O E E' A B C AB BC AC : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) O E)) (_ : @Bet Tn A B C) (_ : @Is_length Tn O E E' A B AB) (_ : @Is_length Tn O E E' B C BC) (_ : @Is_length Tn O E E' A C AC), @Sumg Tn O E E' AB BC AC *)
intros O E E' A B C AB BC AC H H0 Hl1 Hl2 Hl3.

(* Goal: @Sumg Tn O E E' AB BC AC *)
unfold Is_length in *.

(* Goal: @Sumg Tn O E E' AB BC AC *)
induction Hl1; induction Hl2; induction Hl3; try(spliter; contradiction).
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A B *)
unfold LeP in *.
(* Goal: @Sum Tn O E E' AB BC AC *)
induction H11; induction H8; induction H5.

(* General Case *)

(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold LtP in *.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H11 X.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H8 Y.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 Z.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H11.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_sum in H8.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(AB = X).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H11.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ar2 in H11.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
apply(sum_O_B); tauto.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(BC = Y).
(* Goal: @eq (@Tpoint Tn) Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O Y).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X BC *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H8.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
apply(sum_O_B); tauto.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(AC = Z).
(* Goal: @eq (@Tpoint Tn) AC Z *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply (sum_uniqueness O E E' O Z).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
apply(sum_O_B); tauto.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
subst Z.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(forall A B : Tpoint,Col O E A -> Col O E B -> exists C : Tpoint, Sum O E E' A B C).
(* Goal: forall (A B : @Tpoint Tn) (_ : @Col Tn O E A) (_ : @Col Tn O E B), @ex (@Tpoint Tn) (fun C : @Tpoint Tn => @Sum Tn O E E' A B C) *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(sum_exists O E E' ).
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H11.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ar2 in H11.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(HS:= H16 AB BC H10 H7).
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and HS AC'.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Bet O AB AC').
(* Goal: @Bet Tn O AB AC' *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l14_36_a O E E' AB BC AC' H17).
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
eapply (l6_7 _ _ E).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(HH:= l15_3 O E E' AB BC AC' H17).

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Cong O AC' A C).
(* Goal: @Cong Tn A P Q A *)
apply(l2_11 O AB AC' A B C); Cong.
(* Goal: @Cong Tn A P Q A *)
apply cong_transitivity with O BC; Cong.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(HP:= sum_pos_pos O E E' AB BC AC' H13 H14 H17).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(AC = AC').
(* Goal: @eq (@Tpoint Tn) AC AC' *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l6_11_uniqueness O A C E AC AC').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AB BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply between_identity in H0.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H15.
(* Goal: False *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H15.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H15.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Ps in HP.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AC'.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Per Tn P T A *)
assumption.

(* Case AC = O *)

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Sum Tn O E E' O BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply cong_symmetry in H6.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AB BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply between_identity in H0.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H0.
(* Goal: False *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X=O).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply(sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X O *)
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E AB *)
unfold Ar2 in H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H5.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X O *)
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H5.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H5.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* BC = O *)

(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Cong O AB O AC).
(* Goal: @Cong Tn A P Q A *)
apply cong_transitivity with A B; Cong.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H11.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H11 X.
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H9.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
assert(X = AB).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H9.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BpA *)
unfold Ar2 in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 Y.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.

(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Y = AC).
(* Goal: @eq (@Tpoint Tn) Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O Y).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H9.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BpA *)
unfold Ar2 in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: @Col Tn A C' B *)
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply out_col in H13.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AB = AC).
(* Goal: @eq (@Tpoint Tn) AB AC *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l6_11_uniqueness O A B E AB AC).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Sum Tn O E E' AC O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_A_O.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H9.
(* Goal: @Col Tn O E BpA *)
unfold Ar2 in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.

(* Case AC = O /\ BC = O *)

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' O BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply cong_symmetry in H6.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_O_O.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H11.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H11 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Case AB = O *)

(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.

(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(BC = AC).
(* Goal: @eq (@Tpoint Tn) BC AC *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l6_11_uniqueness O A C E BC AC).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_sum in H8.
(* Goal: False *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X = O).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X BC *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H8.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
tauto;
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in H9.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply out_col in H9.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in H9.
(* Goal: False *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_sum in H8.

(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X = BC).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X BC *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H8.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
tauto;
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.

(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X = AC).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
tauto;
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.

(* Case AB = O /\ AC = O *)

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply cong_symmetry in H6.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_O_O.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Case AB = O /\ BC = O *)

(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_O_O.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Case AB = O /\ BC = O /\ AC= O *)


(* Goal: False *)
treat_equalities.
(* Goal: @Sumg Tn O E E' O O O *)
assert(HH:=col_dec O E E').
(* Goal: @eq (@Tpoint Tn) A B *)
induction HH.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @eq (@Tpoint Tn) O O *)
(* Goal: @Sumg Tn O E E' O O O *)
unfold Ar2 in H1.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_O_O.
(* Goal: @Lt Tn A T P A *)
auto.
Qed.

Lemma length_O : forall O E E', O <> E -> Length O E E' O O O.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' A B AB *)
unfold Length.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: and (@LeP Tn O E E' A B) (not (@eq (@Tpoint Tn) A B)) *)
unfold LeP.
(* Goal: @Lt Tn A T P A *)
right;auto.
(* Goal: @Cong Tn A P Q A *)
Cong.
Qed.


Lemma triangular_equality_bis : forall O E E' A B C AB BC AC,
  A <> B \/ A <> C \/ B <> C -> O<>E -> Bet A B C ->
  Length O E E' A B AB -> Length O E E' B C BC -> Length O E E' A C AC ->
  Sum O E E' AB BC AC.
Proof.
(* Goal: forall (O E E' A B C AB BC AC : @Tpoint Tn) (_ : or (not (@eq (@Tpoint Tn) A B)) (or (not (@eq (@Tpoint Tn) A C)) (not (@eq (@Tpoint Tn) B C)))) (_ : not (@eq (@Tpoint Tn) O E)) (_ : @Bet Tn A B C) (_ : @Length Tn O E E' A B AB) (_ : @Length Tn O E E' B C BC) (_ : @Length Tn O E E' A C AC), @Sum Tn O E E' AB BC AC *)
intros O E E' A B C AB BC AC.
(* Goal: forall (_ : or (not (@eq (@Tpoint Tn) A B)) (or (not (@eq (@Tpoint Tn) A C)) (not (@eq (@Tpoint Tn) B C)))) (_ : not (@eq (@Tpoint Tn) O E)) (_ : @Bet Tn A B C) (_ : @Length Tn O E E' A B AB) (_ : @Length Tn O E E' B C BC) (_ : @Length Tn O E E' A C AC), @Sum Tn O E E' AB BC AC *)
intro HH0.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.

(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A B *)
unfold LeP in *.
(* Goal: @Sum Tn O E E' AB BC AC *)
induction H11; induction H8; induction H5.

(* General Case *)

(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold LtP in *.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H11 X.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H8 Y.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 Z.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H11.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_sum in H8.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(AB = X).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H11.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ar2 in H11.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
apply(sum_O_B); tauto.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(BC = Y).
(* Goal: @eq (@Tpoint Tn) Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O Y).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X BC *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H8.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
apply(sum_O_B); tauto.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(AC = Z).
(* Goal: @eq (@Tpoint Tn) AC Z *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply (sum_uniqueness O E E' O Z).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
apply(sum_O_B); tauto.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
subst Z.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(forall A B : Tpoint,Col O E A -> Col O E B -> exists C : Tpoint, Sum O E E' A B C).
(* Goal: forall (A B : @Tpoint Tn) (_ : @Col Tn O E A) (_ : @Col Tn O E B), @ex (@Tpoint Tn) (fun C : @Tpoint Tn => @Sum Tn O E E' A B C) *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(sum_exists O E E' ).
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H11.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ar2 in H11.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(HS:= H16 AB BC H10 H7).
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and HS AC'.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Bet O AB AC').
(* Goal: @Bet Tn O AB AC' *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l14_36_a O E E' AB BC AC' H17).
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
eapply (l6_7 _ _ E).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(HH:= l15_3 O E E' AB BC AC' H17).

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Cong O AC' A C).
(* Goal: @Cong Tn A P Q A *)
apply(l2_11 O AB AC' A B C); Cong.
(* Goal: @Cong Tn A P Q A *)
apply cong_transitivity with O BC; Cong.

(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(HP:= sum_pos_pos O E E' AB BC AC' H13 H14 H17).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(AC = AC').
(* Goal: @eq (@Tpoint Tn) AC AC' *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l6_11_uniqueness O A C E AC AC').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H15.
(* Goal: False *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H15.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AB BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply between_identity in H0.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H15.
(* Goal: False *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H15.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Out Tn O AC' E *)
(* Goal: @Cong Tn O AC' A C *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H15.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Ps in HP.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AC'.
(* Goal: @Per Tn P T A *)
assumption.

(* Case AC = O *)

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Sum Tn O E E' O BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply cong_symmetry in H6.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AB BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply between_identity in H0.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H0.
(* Goal: False *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X=O).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply(sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X O *)
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E AB *)
unfold Ar2 in H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H5.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X O *)
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H5.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H5.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* BC = O *)

(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Cong O AB O AC).
(* Goal: @Cong Tn A P Q A *)
apply cong_transitivity with A B; Cong.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H11.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H11 X.
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H9.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
assert(X = AB).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H9.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BpA *)
unfold Ar2 in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 Y.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.

(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(Y = AC).
(* Goal: @eq (@Tpoint Tn) Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O Y).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H9.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BpA *)
unfold Ar2 in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: @Col Tn A C' B *)
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply out_col in H13.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AB = AC).
(* Goal: @eq (@Tpoint Tn) AB AC *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l6_11_uniqueness O A B E AB AC).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Sum Tn O E E' AC O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_A_O.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H9.
(* Goal: @Col Tn O E BpA *)
unfold Ar2 in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.

(* Case AC = O /\ BC = O *)

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' O BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply cong_symmetry in H6.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_O_O.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H11.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H11 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Case AB = O *)

(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.

(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(BC = AC).
(* Goal: @eq (@Tpoint Tn) BC AC *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply(l6_11_uniqueness O A C E BC AC).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_sum in H8.
(* Goal: False *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X = O).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X BC *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H8.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
tauto;
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H13.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in H9.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply out_col in H9.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in H9.
(* Goal: False *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_sum in H8.

(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X = BC).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X BC *)
(* Goal: @Out Tn O BC E *)
(* Goal: @Cong Tn O BC A C *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Sum in H8.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
tauto;
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.

(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
assert(X = AC).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
tauto;
(* Goal: False *)
(* Goal: @Out Tn O AB E *)
(* Goal: @Cong Tn O AB A B *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A B *)
(* Goal: @Sum Tn O E E' AB O AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Out in H13.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AC *)
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply out_col in H11.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Out Tn O AC E *)
(* Goal: @Cong Tn O AC A C *)
(* Goal: @Sum Tn O E E' O BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ps in H11.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.

(* Case AB = O /\ AC = O *)

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O BC O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply cong_symmetry in H6.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_O_O.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Case AB = O /\ BC = O *)

(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Sum Tn O E E' O O O *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply sum_O_O.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold LtP in H5.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
ex_and H5 X.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
apply diff_sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
unfold Ar2 in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Case AB = O /\ BC = O /\ AC= O *)

(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.

(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_symmetry in H9.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H9.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' O O O *)
apply cong_identity in H6.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
induction HH0; tauto.
Qed.

(** Lemma 15.5. *)
(** Known as Thales theorem or intercept theorem. *)
Lemma length_out : forall O E E' A B C D AB CD,
  A <> B -> C <> D -> Length O E E' A B AB -> Length O E E' C D CD ->
  Out O AB CD.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A B *)
unfold LeP in *.
(* Goal: @Out Tn O AB CD *)
induction H7; induction H4.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold LtP in *.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
ex_and H7 X.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
ex_and H4 Y.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply diff_sum in H7.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply diff_sum in H4.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
assert(X = AB).
(* Goal: @eq (@Tpoint Tn) X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O X).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Sum in H4.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ar2 in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in H9.
(* Goal: @Col Tn O E X *)
(* Goal: @Sum Tn O E E' O X AB *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply out_col in H9.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
subst X.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
assert(Y = CD).
(* Goal: @eq (@Tpoint Tn) Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply (sum_uniqueness O E E' O Y).
(* Goal: @Sum Tn O E E' O Y Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply sum_O_B.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Sum in H4.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ar2 in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in H10.
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
apply out_col in H10.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
unfold Ps in *.
eapply (l6_7  _ _ E).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Out Tn O AB O *)
apply cong_symmetry in H5.
(* Goal: @Out Tn O AB O *)
apply cong_identity in H5.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Out Tn O O CD *)
(* Goal: @Out Tn O AB CD *)
apply cong_symmetry in H8.
(* Goal: @Out Tn O O CD *)
(* Goal: @Out Tn O AB CD *)
apply cong_identity in H8.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Out Tn O AB CD *)
subst CD.
(* Goal: @Out Tn O AB O *)
apply cong_symmetry in H5.
(* Goal: @Out Tn O AB O *)
apply cong_identity in H5.
(* Goal: @Bet Tn P A Q *)
contradiction.
Qed.

Lemma image_preserves_bet1 : forall X Y A B C A' B' C',
  Bet A B C -> Reflect A A' X Y -> Reflect B B' X Y -> Reflect C C' X Y ->
  Bet A' B' C'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Bet Tn A' B' C' *)
induction(eq_dec_points X Y).
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
(* Goal: @ReflectL Tn B B' X Y *)
(* Goal: @ReflectL Tn C C' X Y *)
(* Goal: @Bet Tn A B C *)
unfold Reflect in *.
(* Goal: @LeP Tn O E E' S2 AB2 *)
induction H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
clean_duplicated_hyps.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
apply(l7_15 A B C A' B' C' X).
(* Goal: @Midpoint Tn X A A' *)
(* Goal: @Midpoint Tn X B B' *)
(* Goal: @Midpoint Tn X C C' *)
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn A' B' C' *)
apply l7_2.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @Lt Tn A T P A *)
apply l7_2; auto.
(* Goal: @Lt Tn A T P A *)
apply l7_2; auto.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn A' B' C' *)
apply (image_preserves_bet A B C A' B' C' X Y).
(* Goal: @ReflectL Tn A A' X Y *)
(* Goal: @ReflectL Tn B B' X Y *)
(* Goal: @ReflectL Tn C C' X Y *)
(* Goal: @Bet Tn A B C *)
unfold Reflect in H0.
(* Goal: @LeP Tn O E E' S2 AB2 *)
induction H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @ReflectL Tn B B' X Y *)
(* Goal: @ReflectL Tn C C' X Y *)
(* Goal: @Bet Tn A B C *)
unfold Reflect in *.
(* Goal: @Bet Tn A B C *)
induction H0; induction H1; induction H2; try( spliter; contradiction).
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @Bet Tn A B C *)
induction H0; induction H1; induction H2; try( spliter; contradiction).
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @Bet Tn A B C *)
induction H0; induction H1; induction H2; try( spliter; contradiction).
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn A T P A *)
auto.
Qed.

Lemma image_preserves_col : forall X Y A B C A' B' C',
  Col A B C -> Reflect A A' X Y -> Reflect B B' X Y -> Reflect C C' X Y ->
  Col A' B' C'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: False *)
induction H.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Lt Tn A T P A *)
apply (image_preserves_bet1 X Y A B C A' B' C'); auto.
(* Goal: False *)
induction H.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right; left.
(* Goal: @Lt Tn A T P A *)
apply (image_preserves_bet1 X Y B C A B' C' A'); auto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right; right.
(* Goal: @Lt Tn A T P A *)
apply (image_preserves_bet1 X Y C A B C' A' B'); auto.
Qed.

Lemma image_preserves_out : forall X Y A B C A' B' C',
  Out A B C -> Reflect A A' X Y -> Reflect B B' X Y -> Reflect C C' X Y ->
  Out A' B' C'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Out Tn A' B' C' *)
unfold Out in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
repeat split; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst B'.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
assert(B = A).
(* Goal: @eq (@Tpoint Tn) B A *)
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply (l10_2_uniqueness X Y A' B A H1 H0).
(* Goal: @Bet Tn P A Q *)
contradiction.

(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst C'.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
assert(C=A).
(* Goal: @eq (@Tpoint Tn) C A *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply (l10_2_uniqueness X Y A' C A H2 H0).
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @eq (@Tpoint Tn) M O *)
induction H4.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Lt Tn A T P A *)
apply (image_preserves_bet1 X Y A B C); auto.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Lt Tn A T P A *)
apply (image_preserves_bet1 X Y A C B); auto.
Qed.


Lemma project_preserves_out : forall A B C A' B' C' P Q X Y,
  Out A B C -> ~Par A B X Y ->
  Proj A A' P Q X Y -> Proj B B' P Q X Y -> Proj C C' P Q X Y ->
  Out A' B' C'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst B'.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Out in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Proj in H1.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Proj in H2.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
induction H9; induction H13.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
assert(Par A A' B A').
(* Goal: @Lt Tn A T P A *)
apply (par_trans _ _ X Y); auto.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
induction H14.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply H14.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A A') (@Col Tn X C A')) *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
exists A'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply H0.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Par Tn X Y A B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply(par_col_par X Y A A' B).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst A'.
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply H0.
(* Goal: @Par Tn A C X Y *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_left_comm.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst A'.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst A'.
(* Goal: @Bet Tn P A Q *)
contradiction.

(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
assert(HC:Col A B C).
(* Goal: @Col Tn A B C *)
(* Goal: not (@eq (@Tpoint Tn) C' A') *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply out_col in H.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Out in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst C'.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Proj in H1 ,H3.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
induction H9; induction H13.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
assert(Par A A' C A').
(* Goal: @Par Tn A A' C A' *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply (par_trans _ _ X Y).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
induction H14.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply H14.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A A') (@Col Tn X C A')) *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
exists A'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply H0.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Par Tn X Y A B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply (par_col_par X Y A A' B).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst A'.
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply H0.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Par Tn X Y A B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply(par_col_par X Y A C B).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Par Tn A C X Y *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_left_comm.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst A'.
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply H0.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Par Tn X Y A B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply(par_col_par X Y A C B).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
subst A'.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Out in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
induction H5.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Per Tn P T A *)
apply (project_preserves_bet P Q X Y A B C A' B' C'); assumption.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Per Tn P T A *)
apply (project_preserves_bet P Q X Y A C B A' C' B'); assumption.
Qed.

Lemma conga_bet_conga : forall A B C D E F A' C' D' F',
  CongA A B C D E F -> A' <> B -> C' <> B -> D' <> E -> F' <> E ->
  Bet A B A' -> Bet C B C' -> Bet D E D' -> Bet F E F' ->
  CongA A' B C' D' E F'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @CongA Tn A' B C' D' E F' *)
assert(HH:= l11_13 A B C D E F A' D' H H4 H0 H6 H2).
(* Goal: @CongA Tn C B A' F E D' *)
apply conga_comm.
(* Goal: @Lt Tn A T P A *)
apply(l11_13 C B A' F E D' C' F'); auto.
(* Goal: @CongA Tn C B A' F E D' *)
apply conga_comm.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma thales : forall O E E' P A B C D A1 B1 C1 D1 AD,
  O <> E -> Col P A B -> Col P C D -> ~ Col P A C -> Pj A C B D ->
  Length O E E' P A A1 -> Length O E E' P B B1 ->
  Length O E E' P C C1 -> Length O E E' P D D1 ->
  Prodg O E E' A1 D1 AD ->
  Prodg O E E' C1 B1 AD.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
induction(col_dec O E E').
unfold Prodg.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Col Tn O E B2mA2 *)
unfold Ar2 in H10.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
unfold Prodg in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction H8.
unfold Prod in H8.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction H8.

induction(eq_dec_points P B).
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
apply length_cong in H5.
(* Goal: @Out Tn O AB O *)
apply cong_symmetry in H5.
(* Goal: @Out Tn O AB O *)
apply cong_identity in H5.
subst B1.
unfold Pj in H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
(* Goal: False *)
apply H3.
(* Goal: @ex (@Tpoint Tn) (fun E0 : @Tpoint Tn => and (@Bet Tn B E0 C) (@Cong Tn E F B E0)) *)
exists C.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @LtP Tn O E E' A B *)
subst D.
apply length_cong in H7.
apply cong_symmetry in H7.
(* Goal: @Bet Tn O AB O *)
(* Goal: @Bet Tn O AB CD *)
apply cong_identity in H7.
subst D1.
assert (AD = O).
apply (prod_uniqueness O E E' A1 O).
(* Goal: @Per Tn P T A *)
assumption.
apply prod_0_r.
(* Goal: @Per Tn P T A *)
assumption.
unfold Prod in H8.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
unfold Ar2 in H3.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
subst AD.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
apply prod_0_r.
(* Goal: @Per Tn P T A *)
assumption.

unfold Length in H6.
(* Goal: @Lt Tn T A P A *)
spliter.
unfold LeP in H6.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
induction H6.
unfold LtP in H6.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
ex_and H6 X.
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply diff_sum in H6.
unfold Sum in H6.
(* Goal: @Lt Tn T A P A *)
spliter.
unfold Ar2 in H6.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst C1; Col.

(* Goal: @LeP Tn O E E' AC BC *)
induction(eq_dec_points A B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
(* Goal: False *)
apply H3.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
assert(C=D).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(l6_21 P C A C); Col.
(* Goal: @LtP Tn O E E' A B *)
subst D.
assert(A1=B1).
(* Goal: @Lt Tn A T P A *)
apply (length_uniqueness O E E' P A);auto.
subst B1.
assert(C1 = D1).
(* Goal: @Lt Tn A T P A *)
apply (length_uniqueness O E E' P C);auto.
subst D1.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Prod Tn O E E' AB AH AC2 *)
(* Goal: forall _ : @Prod Tn O E E' AB AH AC2, @Prod Tn O E E' AC AC AC2 *)
apply prod_comm.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H2; Col.
}

rename H11 into HAB.

assert(Hl0:= H4).
assert(Hl1:= H5).
assert(Hl2:= H6).
assert(Hl3:= H7).

(* Goal: @Col Tn O E AC *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Length in H4.
unfold Length in H5.
unfold Length in H6.
unfold Length in H7.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
clean_duplicated_hyps.


assert(exists C' : Tpoint, Cong_3 P A C O A1 C' /\ OS O A1 E' C').
(* Goal: @Lt Tn T A P A *)
{
apply(l10_16 P A C O A1 E');
(* Goal: @Cong Tn A P Q A *)
Cong.
apply length_Ar2 in Hl0.
induction Hl0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction(eq_dec_points A1 O).
subst A1.
apply cong_symmetry in H22.
apply cong_identity in H22.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: False *)
apply H5.
(* Goal: @Col Tn T P Q *)
ColR.
subst A1.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply cong_symmetry in H22.
apply cong_identity in H22.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
}

ex_and H4 C1'.

assert(CongA P A C O A1 C1').
(* Goal: @Lt Tn T A P A *)
{
apply(cong3_conga).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H2; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H2; Col.
(* Goal: @Per Tn P T A *)
assumption.
}

assert(HN:~Col O C1 C1').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
unfold OS in H5.
ex_and H5 K.
unfold TS in H23.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H23.
(* Goal: @Col Tn AB O M *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply col_permutation_2.
apply (col_transitivity_1 _ C1).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst C1.
(* Goal: False *)
treat_equalities.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
}

assert(HH:= midpoint_existence C1 C1').
(* Goal: @Le Tn A B C D *)
ex_and HH M.

assert(HH:= l10_2_existence O M D1).
ex_and HH D1'.
unfold Reflect in H23.
induction H23.
(* Goal: @Lt Tn T A P A *)
spliter.
unfold ReflectL in H24.
(* Goal: @Lt Tn T A P A *)
spliter.
ex_and H24 N.

assert(Out O C1 D1).
(* Goal: @Lt Tn T A P A *)
{
apply (length_out O E E' P C P D).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply cong_identity in H16.
subst C1.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H2; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @LtP Tn O E E' A B *)
subst D.
apply cong_identity in H13.
subst D1.
assert(AD=O).
(* Goal: @Lt Tn T A P A *)
{
apply (prod_uniqueness O E E' A1 O).
(* Goal: @Per Tn P T A *)
assumption.
apply prod_0_r.
unfold Prod in H8.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
}
subst AD.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: False *)
apply H3.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
subst B; tauto.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
assumption.
}

(*********************)
assert(Out O A1 C1).
(* Goal: @Lt Tn T A P A *)
{
apply (length_out O E E' P A P C).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply cong_identity in H22.
subst A1.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H2; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply cong_identity in H16.
subst C1.
unfold Out in H27.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
assumption.
}
(*********************)

assert(M <> C1).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Le Tn T M T A *)
subst M.
eapply (symmetric_point_uniqueness _ _ C1) in H7.
subst C1'.
apply H2.
(* Goal: @Col Tn O E AB *)
(* Goal: and (not (@eq (@Tpoint Tn) O E)) (and (@Col Tn O E AB) (and (@LeP Tn O E E' O AB) (@Cong Tn O AB A B))) *)
apply out_col.

apply(cong3_preserves_out O A1 C1 P A C H28).
unfold Cong_3 in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Cong Tn A P Q A *)
repeat split; Cong.
apply l7_3_2.
}

assert(Per O M C1).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Per Tn A T' P *)
unfold Per.
exists C1'.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @Per Tn P T A *)
assumption.
unfold Cong_3 in H4.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Cong Tn A P Q A *)
apply (cong_transitivity _ _ P C); Cong.
}

(* Goal: @Lt Tn A T P A *)
apply per_perp_in in H30; auto.
apply perp_in_comm in H30.
apply perp_in_perp_bis in H30.


assert(Out O C1' D1').
(* Goal: @Lt Tn T A P A *)
{
apply(image_preserves_out O M O C1 D1).
(* Goal: @Per Tn P T A *)
assumption.
unfold Reflect.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.
unfold ReflectL.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
exists O.
split; finish.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Lt Tn A T P A *)
auto.

unfold Reflect.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.
unfold ReflectL.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @ex (@Tpoint Tn) (fun E : @Tpoint Tn => and (@Bet Tn C E M) (@Cong Tn A B C E)) *)
(* Goal: @Le Tn C M C D *)
exists M.
split; finish.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
induction H30.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
apply perp_sym.
(* Goal: @Perp Tn H A C H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_comm.
apply (perp_col _ M).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst C1'.

apply l7_3 in H7.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
unfold Midpoint in H7.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
apply perp_distinct in H30.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
unfold Reflect.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.
unfold ReflectL.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
exists N.
split; finish.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
induction H25.
(* Goal: @Perp Tn A C H' C' *)
(* Goal: not (@eq (@Tpoint Tn) A H') *)
(* Goal: not (@eq (@Tpoint Tn) H' C') *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_right_comm.
(* Goal: @Per Tn P T A *)
assumption.
subst D1'.
apply l7_3 in H24.
subst D1.
induction H30.
apply perp_not_col in H24.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply H24.
apply out_col in H27.
(* Goal: @Col Tn AB O M *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) Y O)) *)
(* Goal: or (not (@eq (@Tpoint Tn) O O)) (not (@eq (@Tpoint Tn) X O)) *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
(* Goal: @Bet Tn O AB CD *)
apply col_permutation_2.
apply (col_transitivity_1 _ N).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst N.
(* Goal: @eq (@Tpoint Tn) AB CD *)
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) E O) *)
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
apply cong_symmetry in H13.
apply cong_identity in H13.
(* Goal: @LtP Tn O E E' A B *)
subst D.
unfold Pj in H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: False *)
apply H3.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
apply perp_distinct in H24.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}

assert(Perp O N D1 N).
(* Goal: @Lt Tn T A P A *)
{
apply (perp_col O M D1 N).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst N.
apply HN.
unfold Midpoint in H24.
(* Goal: @Lt Tn T A P A *)
spliter.
apply bet_col in H24.
apply out_col in H31.
apply out_col in H27.
eapply (col_transitivity_1 _ D1').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst D1'.
apply cong_identity in H32.
subst D1.
(* Goal: False *)
treat_equalities.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: False *)
apply H1.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
apply(col_transitivity_1 _ D1).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst D1.
(* Goal: False *)
treat_equalities.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: False *)
apply H1.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
apply perp_sym.
apply (perp_col _ D1').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst N.
unfold Midpoint in H24.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
treat_equalities.
apply HN.
apply out_col in H31.
apply out_col in H27.
apply (col_transitivity_1 _ D1).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst D1.
(* Goal: False *)
treat_equalities.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: False *)
apply H1.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
induction H25.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
subst D1'.
apply l7_3 in H24.
subst N.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply out_col in H31.
apply out_col in H27.
apply HN.
apply (col_transitivity_1 _ D1).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst D1.
(* Goal: False *)
treat_equalities.
(* Goal: False *)
treat_equalities.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: False *)
apply H1.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
unfold Midpoint in H24.
(* Goal: @Lt Tn T A P A *)
spliter.
apply bet_col in H24.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
}
apply perp_left_comm in H32.

assert(Cong O D1 O D1').
(* Goal: @Lt Tn T A P A *)
{
apply perp_perp_in in H32.
apply perp_in_comm in H32.
apply perp_in_per in H32.
unfold Per in H32.
ex_and H32 D2.
assert(D2 = D1').
eapply (l7_9 _ _ N D1);
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
subst D2.
(* Goal: @Per Tn P T A *)
assumption.
}

assert(Pj C1 C1' D1 D1').
(* Goal: @Lt Tn T A P A *)
{
unfold Pj.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
induction H25; induction H30.
apply (l12_9_2D _ _ _ _ O M).
apply (perp_col _ M).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst C1'.
apply HN.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
unfold Midpoint in H7.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
apply perp_distinct in H30.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
subst D1'.
apply l7_3 in H24.
subst N.
apply perp_distinct in H32.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
subst D1'.
apply l7_3 in H24.
subst N.
apply perp_distinct in H32.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}
assert(Cong_3 P C A O C1' A1).
(* Goal: @Lt Tn T A P A *)
{
unfold Cong_3 in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Cong Tn A P Q A *)
repeat split; Cong.
}
assert(CongA P C A O C1' A1).
(* Goal: @Lt Tn T A P A *)
{
apply cong3_conga.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
}
unfold Cong_3 in H35.
(* Goal: @Lt Tn T A P A *)
spliter.
assert(Cong P A O A1 /\ (P <> A -> CongA C P A C1' O A1 /\ CongA C A P C1' A1 O)).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Cong Tn A P Q A *)
apply(l11_49 P C A O C1' A1); Cong.
}
(* Goal: @Lt Tn T A P A *)
spliter.
assert(P <> A).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
}
apply H40 in H41.
clear H40.
(* Goal: @Lt Tn T A P A *)
spliter.

assert(CongA C A P D B P).
(* Goal: @Lt Tn T A P A *)
{
induction(bet_dec C P D).
assert(Bet A P B).
apply(project_preserves_bet A P A C C P D).
(* Goal: @Per Tn P T A *)
assumption.
unfold Proj.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H43.
apply H43.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Par Tn A C X Y *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_left_comm.
(* Goal: @eq (@Tpoint Tn) O O *)
apply par_reflexivity.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
unfold Proj.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H43.
apply H43.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @eq (@Tpoint Tn) O O *)
reflexivity.
unfold Proj.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H43.
apply H43.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
unfold Pj in H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
apply par_right_comm.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.

assert(CongA C A B D B A <-> Par A C B D).
apply(l12_21 A C B D).
unfold TS.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply H2.

assert(P <> D).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: False *)
apply H3.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
apply H3.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply (l6_21 P B A C); Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Col Tn T P Q *)
ColR.

(* Goal: @ex (@Tpoint Tn) (fun P : @Tpoint Tn => and (@InAngle Tn P D' E F') (@CongA Tn A' B C' D' E P)) *)
exists P.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
destruct H44.
(* Goal: @Bet Tn P A Q *)
induction H3.
assert(HH3:=H3).
apply H45 in HH3.
apply(out_conga C A B D B A C P D P).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn E P P *)
apply out_trivial.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn E P P *)
apply out_trivial.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @LtP Tn O E E' A B *)
subst D.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
apply H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Bet Tn P A Q *)
right; Between.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.

assert(Out P C D).
unfold Col in H1.
(* Goal: @Ps Tn O E A *)
unfold Out.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H42.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @LtP Tn O E E' A B *)
subst D.
apply H42.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: @Per Tn P T A *)
left; assumption.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: @Bet Tn P A Q *)
right; Between.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply H42.
(* Goal: @Bet Tn P A Q *)
Between.

assert(Out P A B).
apply (project_preserves_out P C D  P A B  P A A C).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H44.
apply H44.
(* Goal: @ex (@Tpoint Tn) (fun E0 : @Tpoint Tn => and (@Bet Tn B E0 C) (@Cong Tn E F B E0)) *)
exists C.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
unfold Proj.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H44.
apply H44.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @eq (@Tpoint Tn) O O *)
reflexivity.

unfold Proj.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H44.
apply H44.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Par Tn A C X Y *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_left_comm.
(* Goal: @eq (@Tpoint Tn) O O *)
apply par_reflexivity.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
unfold Proj.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H2; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H2; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H44.
apply H44.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Par Tn A C X Y *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_left_comm.
(* Goal: @Par Tn X Y A C *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
apply par_symmetry.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.

apply (l12_22 A C B D P).
(* Goal: @Per Tn P T A *)
assumption.
apply out_one_side.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
}
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(C <> A).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
unfold CongA in H42.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}

assert(P <> A).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
unfold CongA in H42.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}

assert(~Par P A C A).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H45.
apply H45.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
}

assert(CongA C P A D P B).
(* Goal: @Lt Tn T A P A *)
{
induction(bet_dec C P D).

assert(Bet A P B).
(* Goal: @Lt Tn A T P A *)
apply (project_preserves_bet P A C A C P D A P B); auto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
unfold Pj in H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @Lt Tn A T P A *)
apply(l11_14 C P A D B); auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
unfold CongA in H36.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: False *)
apply H3.
exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.


assert(Out P C D).
apply(not_bet_out).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Per Tn P T A *)
assumption.
assert(Out P A B).
apply(project_preserves_out P C D P A B P A C A).
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply H46.
(* Goal: @Bet Tn P A Q *)
Between.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @LtP Tn O E E' A B *)
subst D.
apply H46.
(* Goal: @Bet Tn P A Q *)
Between.
unfold Out in H47.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H48.
apply H48.
(* Goal: @ex (@Tpoint Tn) (fun E0 : @Tpoint Tn => and (@Bet Tn B E0 C) (@Cong Tn E F B E0)) *)
exists C.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
unfold Pj in H3.
(* Goal: @Bet Tn P A Q *)
induction H3.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
unfold CongA in H42.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

apply conga_sym.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(out_conga C P A C P A D B C A); finish.
apply conga_refl.
(* Goal: @Out Tn E P P *)
apply out_trivial.
unfold Out in H47.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
unfold Out in H48.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn E P P *)
apply out_trivial.
unfold Out in H47.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}

assert(C1 <> C1').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst C1'.
apply HN.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
}

assert(O <> C1').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst C1'.
unfold CongA in H36.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}

assert(~Col O C1 C1').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H30.
apply perp_not_col in H30.
apply H30.
unfold Midpoint in H7.
(* Goal: @Lt Tn T A P A *)
spliter.
apply bet_col in H7.
(* Goal: @Col Tn T P Q *)
ColR.
apply perp_distinct in H30.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}
assert(~Par O C1' C1 C1').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H50.
apply H50.
exists C1'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
}

assert(~Par O C1 C1 C1').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
induction H51.
apply H51.
exists C1.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn P A Q *)
contradiction.
}
assert(Out O C1' D1').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
apply(project_preserves_out O C1 D1 O C1' D1' O C1' C1 C1'); auto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
apply(l12_9_2D D1 D1' C1 C1' O M).
assert(Perp D1 D1' N O).
apply(perp_col D1 N N O D1').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst D1'.
apply l7_3 in H24.
subst N.
apply perp_distinct in H32.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
unfold Midpoint in H24.
(* Goal: @Lt Tn T A P A *)
spliter.
apply bet_col in H24.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
apply perp_sym.
apply(perp_col O N D1 D1' M).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
induction H30.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply (perp_col C1 M O M C1'); finish.
unfold Midpoint in H7.
(* Goal: @Lt Tn T A P A *)
spliter.
apply bet_col in H7.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
apply perp_distinct in H30.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}
assert(CongA C1' O A1 D1' O B1).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
apply(out_conga C1' O A1 C1' O A1 C1' A1 D1' B1); auto.
apply conga_refl.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst A1.
unfold Out in H28.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Out Tn E P P *)
apply out_trivial.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @Out Tn E P P *)
apply out_trivial.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst A1.
unfold Out in H28.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn A T P A *)
apply(length_out O E E' P A  P B A1 B1); auto.
}
assert(CongA D1' O B1 D P B).
(* Goal: @Lt Tn T A P A *)
{
apply (conga_trans _ _ _ C P A).
apply (conga_trans _ _ _ C1' O A1).
apply conga_sym.
(* Goal: @Per Tn P T A *)
assumption.
apply conga_sym.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
assumption.
}
assert((D1' <> B1 -> CongA O D1' B1 P D B /\ CongA O B1 D1' P B D)).
(* Goal: @Lt Tn T A P A *)
{
apply (l11_49 D1' O B1 D P B).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
apply (cong_transitivity _ _ O D1); Cong.
(* Goal: @Per Tn P T A *)
assumption.
}

assert(D1' <> B1).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst D1'.
induction H34.
induction H34.
apply H34.
exists C1.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
split; Col.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Lt Tn T A P A *)
spliter.
apply H49.
(* Goal: @Col Tn T P Q *)
ColR.
subst D1.
apply l7_3 in H24.
subst N.
apply perp_distinct in H32.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
}
apply H55 in H56.
(* Goal: @Lt Tn T A P A *)
spliter.
clear H55.
apply conga_comm in H57.

assert(CongA C1' A1 O D1' B1 O <-> Par A1 C1' B1 D1').
(* Goal: @Lt Tn T A P A *)
{
apply(l12_22 A1 C1' B1 D1' O).
(* Goal: @Lt Tn A T P A *)
apply (length_out O E E' P A P B); auto.
apply out_one_side.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply H49.
assert(A1 <> O).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst A1.
unfold CongA in H53.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Per Tn P T A *)
assumption.
}
destruct H55.
assert(Par A1 C1' B1 D1').
(* Goal: @Lt Tn T A P A *)
{
apply H55.
apply (conga_trans _ _ _ D B P).
apply (conga_trans _ _ _ C A P).
apply conga_sym.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
assumption.
apply conga_sym.
(* Goal: @Per Tn P T A *)
assumption.
}
clear H55 H58.
assert(Prod O C1 C1' A1 D1 B1).
(* Goal: @Lt Tn T A P A *)
{
unfold Prod.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Col Tn T P Q *)
ColR.
exists D1'.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: @Per Tn P T A *)
assumption.

apply out_col in H31.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
}

assert(exists Y : Tpoint, Prod O E C1' A1 D1 Y /\ Prod O E C1' C1 B1 Y).
(* Goal: @Lt Tn T A P A *)
{
apply(prod_x_axis_unit_change O C1 C1' A1 D1 C1 B1 E).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
exists B1.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply prod_1_l; Col.
(* Goal: @Col Tn T P Q *)
ColR.
}
ex_and H58 Y.
assert(HH:=prod_y_axis_change O E C1' E' A1 D1 Y H58 H9).
(* Goal: @Lt Tn T A P A *)
{
assert(Y = AD).
(* Goal: @Lt Tn A T P A *)
apply(prod_uniqueness O E E' A1 D1); auto.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
subst Y.
assert(HP:=prod_y_axis_change O E C1' E' C1 B1 AD H60 H9).
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Per Tn P T A *)
assumption.
}
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Le Tn T M T A *)
subst M.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
unfold Midpoint in H7.
(* Goal: @Lt Tn T A P A *)
spliter.
apply bet_col in H7.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.

(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Prod Tn O E E' AC AC AC2 *)
apply H8.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
(* Goal: @Sum Tn O E E' AB BC AC *)
unfold Ar2 in H11.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: @Col Tn O E AC *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Length in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
unfold Length in H7.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
unfold Length in H7.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma length_existence : forall O E E' A B,
  ~ Col O E E' -> exists AB, Length O E E' A B AB.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
assert(NEO : E <> O).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
apply H.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
assert(HH:= segment_construction_2 E O A B NEO).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
ex_and HH AB.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
exists AB.
(* Goal: @Length Tn O E E' A B AB *)
unfold Length.
(* Goal: and (not (@eq (@Tpoint Tn) O E)) (and (@Col Tn O E AB) (and (@LeP Tn O E E' O AB) (@Cong Tn O AB A B))) *)
assert(AB = O \/ Out O E AB).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction(eq_dec_points AB O).
(* Goal: @Per Tn P T A *)
left; assumption.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
right.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
repeat split; auto.
(* Goal: and (not (@eq (@Tpoint Tn) O E)) (and (@Col Tn O E AB) (and (@LeP Tn O E E' O AB) (@Cong Tn O AB A B))) *)
assert(Col O E AB).
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: @Col Tn O E AB *)
(* Goal: and (not (@eq (@Tpoint Tn) O E)) (and (@Col Tn O E AB) (and (@LeP Tn O E E' O AB) (@Cong Tn O AB A B))) *)
apply out_col.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: and (@LeP Tn O E E' A B) (not (@eq (@Tpoint Tn) A B)) *)
unfold LeP.
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
right; auto.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @LtP Tn O E E' A B *)
unfold LtP.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
exists AB.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_A_O; Col.
(* Goal: not (@eq (@Tpoint Tn) AB O) *)
(* Goal: not (@eq (@Tpoint Tn) E O) *)
(* Goal: or (@Bet Tn O AB E) (@Bet Tn O E AB) *)
unfold Out in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @LeP Tn O E E' S2 AB2 *)
induction H0.
(* Goal: @Per Tn P T A *)
right; assumption.
(* Goal: @Per Tn P T A *)
left; assumption.
Qed.

(** Known as Euklid *)
Lemma l15_7 : forall O E E' A B C H AB AC AH AC2,
  O<>E -> Per A C B -> Perp_at H C H A B ->
  Length O E E' A B AB -> Length O E E' A C AC -> Length O E E' A H AH ->
  (Prod O E E' AC AC AC2 <-> Prod O E E' AB AH AC2).
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction(eq_dec_points AB O).
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: False *)
assert(A = B).
(* Goal: @Per Tn P T A *)
apply (length_id_1 O E E'); assumption.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_distinct in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(~Col O E E' /\ Col O E AB).
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Length in H3.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LeP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold LtP in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H8 X.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply diff_sum in H8.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply sum_ar2 in H8.
(* Goal: @Col Tn O E BmA *)
unfold Ar2 in H8.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AB.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction(eq_dec_points H A).
(* Goal: False *)
(* Goal: @Perp Tn A B H C *)
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(AH=O).
(* Goal: @Lt Tn A T P A *)
apply (length_uniqueness O E E' A A); auto.
(* Goal: @Length Tn O E E' A A O *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply length_id_2.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AH.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB O AC2) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_per in H2.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB O AC2) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(A = C).
apply (l8_7 B);
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AC2 AB2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AC = O).
(* Goal: @Lt Tn A T P A *)
apply (length_uniqueness O E E' A A); auto.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
split;intros;
(* Goal: @Sum Tn O E E' AC2 AB2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AC2=O).
(* Goal: @Lt Tn A T P A *)
apply (prod_uniqueness O E E' O O); auto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply prod_0_r; Col.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply prod_0_r; Col.
(* Goal: @Lt Tn A T P A *)
apply (prod_uniqueness O E E' AB O); auto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply prod_0_r; Col.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply prod_0_r; Col.



(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(C <> A).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_right_comm in H2.
(* Goal: False *)
(* Goal: @Perp Tn H' C' A C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_id in H2.
(* Goal: @Bet Tn P A Q *)
contradiction.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(HH:= segment_construction_2 H A A C H9).
(* Goal: @LtP Tn O E E' A B *)
ex_and HH C'.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Out A H C').
(* Goal: @Ps Tn O E A *)
unfold Out.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
repeat split; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst C'.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H12.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H12.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(HH:= segment_construction_2 C A A H H10).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and HH H'.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Out A C H').
(* Goal: @Lt Tn A T P A *)
repeat split;auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H'.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_symmetry in H15.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply cong_identity in H15.
(* Goal: False *)
(* Goal: @Perp Tn A B H C *)
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(H <> C).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Perp Tn A B H C *)
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_distinct in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Cong H C H' C' /\ (H <> C -> CongA A H C A H' C' /\ CongA A C H A C' H')).
(* Goal: and (@Cong Tn H C H' C') (forall _ : not (@eq (@Tpoint Tn) H C), and (@CongA Tn A H C A H' C') (@CongA Tn A C H A C' H')) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(l11_49 H A C H' A C').
(* Goal: @CongA Tn H A C H' A C' *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply (l11_10 H A C C A H).
(* Goal: @CongA Tn H A C C A H *)
(* Goal: @Out Tn A H H *)
(* Goal: @Out Tn A C C *)
(* Goal: @Out Tn A H' C *)
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply conga_right_comm.
(* Goal: @Lt Tn A T P A *)
apply conga_refl; auto.
(* Goal: @Lt Tn A T P A *)
apply out_trivial; auto.
(* Goal: @Lt Tn A T P A *)
apply out_trivial; auto.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(HH:= H19 H17).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
clear H19.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Per A H C).
(* Goal: @Per Tn A H C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_per.
(* Goal: @Perp_at Tn H A H H C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_comm.
(* Goal: @Perp_at Tn H H A C H *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_perp_in.
(* Goal: @Perp Tn H A C H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_comm.
apply (perp_col  _ B).
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @Perp Tn C H A B *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_perp_bis in H2.
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: not (@eq (@Tpoint Tn) A T) *)
(* Goal: @Per Tn P T A *)
apply perp_distinct in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
apply perp_sym.
(* Goal: @Perp Tn H C A B *)
(* Goal: @Col Tn A B H *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_left_comm.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_col in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(HH:= l11_17 A H C A H' C' H21 H19).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Par C B H' C').
(* Goal: @Par Tn C B H' C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(l12_9_2D C B H' C' A C).
(* Goal: @Perp Tn C B A C *)
(* Goal: @Perp Tn H' C' A C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply per_perp_in in H1.
(* Goal: @Perp Tn C B A C *)
(* Goal: not (@eq (@Tpoint Tn) A C) *)
(* Goal: not (@eq (@Tpoint Tn) C B) *)
(* Goal: @Perp Tn H' C' A C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_comm in H1.
(* Goal: @Perp Tn C B A C *)
(* Goal: not (@eq (@Tpoint Tn) A C) *)
(* Goal: not (@eq (@Tpoint Tn) C B) *)
(* Goal: @Perp Tn H' C' A C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_perp_bis in H1.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: @Perp Tn C B A C *)
(* Goal: not (@eq (@Tpoint Tn) A C) *)
(* Goal: not (@eq (@Tpoint Tn) C B) *)
(* Goal: @Perp Tn H' C' A C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_distinct in H1.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: False *)
(* Goal: @Perp Tn H' C' A C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_id in H2.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Perp Tn H' C' A C *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply per_perp_in in HH.
(* Goal: @Perp Tn H' C' A C *)
(* Goal: not (@eq (@Tpoint Tn) A H') *)
(* Goal: not (@eq (@Tpoint Tn) H' C') *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_comm in HH.
(* Goal: @Perp Tn H' C' A C *)
(* Goal: not (@eq (@Tpoint Tn) A H') *)
(* Goal: not (@eq (@Tpoint Tn) H' C') *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_perp_bis in HH.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
apply perp_sym.
(* Goal: @Perp Tn A C H' C' *)
(* Goal: not (@eq (@Tpoint Tn) A H') *)
(* Goal: not (@eq (@Tpoint Tn) H' C') *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_right_comm.
(* Goal: @Perp Tn A C C' H' *)
(* Goal: not (@eq (@Tpoint Tn) A H') *)
(* Goal: not (@eq (@Tpoint Tn) H' C') *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(perp_col A H' C' H' C).
(* Goal: @Lt Tn A T P A *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
induction HH.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: @Perp Tn A H' C' H' *)
(* Goal: @Col Tn A H' C *)
(* Goal: not (@eq (@Tpoint Tn) A H') *)
(* Goal: not (@eq (@Tpoint Tn) H' C') *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_distinct in H22.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply out_col in H16.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H'.
(* Goal: False *)
(* Goal: @Perp Tn A B H C *)
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply conga_distinct in H19.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H'.
(* Goal: False *)
(* Goal: @Perp Tn A B H C *)
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply conga_distinct in H19.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(HL1:=length_existence O E E' A H' H7).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and HL1 AH'.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(HL1:=length_existence O E E' A C' H7).
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and HL1 AC'.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(exists P : Tpoint, Prod O E E' AC' AC P).

(* Goal: @ex (@Tpoint Tn) (fun P : @Tpoint Tn => @Prod Tn O E E' AC' AC P) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(prod_exists O E E' H7 AC' AC).
(* Goal: @Col Tn O E AC' *)
(* Goal: @Col Tn O E AC *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Length in H24.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Col Tn O E AC *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Length in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
ex_and H25 P.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Perp C H A B).
(* Goal: @Perp Tn C H A B *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_perp_bis in H2.
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: not (@eq (@Tpoint Tn) A T) *)
(* Goal: @Per Tn P T A *)
apply perp_distinct in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Per Tn P T A *)
assumption.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Prodg O E E' AH' AB P).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(thales O E E' A C' B H' C  AC' AB AH' AC   P); Col.
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_col in H2.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Col Tn A C' B *)
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply out_col in H13.
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply out_col in H16.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Perp H A C H).
(* Goal: @Perp Tn H A C H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_comm.
(* Goal: @Perp Tn A H H C *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(perp_col A B H C H).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Perp Tn A B H C *)
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H.
(* Goal: False *)
(* Goal: @Perp Tn A B H C *)
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply conga_distinct in H19.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: @Col Tn A B H *)
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_in_col in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply perp_not_col in H28.
(* Goal: False *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H28.
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(A <> C').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst C'.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold CongA in H20.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Col A H H').
(* Goal: @Col Tn T P Q *)
ColR.
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(A <> H').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst H'.
(* Goal: False *)
(* Goal: @Col Tn H A C *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold CongA in H19.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Col Tn T P Q *)
ColR.

(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
left.
(* Goal: @Per Tn P T A *)
assumption.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Prod O E E' AH' AB P).
(* Goal: @Prod Tn O E E' AH' AB P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
induction H27.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn P A P A *)
apply False_ind.
(* Goal: False *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H27.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.
(* Goal: @Col Tn O E AH' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
unfold Length in H23.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.


(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Length O E E' A H' AH).
(* Goal: @Length Tn O E E' A H' AH *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(length_eq_cong_2 O E E' A H A H' AH H5).
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(AH = AH').
(* Goal: @Lt Tn A T P A *)
apply (length_uniqueness O E E' A H'); auto.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AH'.

(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(Length O E E' A C' AC).
(* Goal: @Length Tn O E E' A C' AC *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(length_eq_cong_2 O E E' A C A C' AC H4).
(* Goal: @Cong Tn A P Q A *)
Cong.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
assert(AC = AC').
(* Goal: @Lt Tn A T P A *)
apply (length_uniqueness O E E' A C'); auto.
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
subst AC'.

(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Prod Tn O E E' AC AC AC2 *)
assert(P = AC2).
(* Goal: @Lt Tn A T P A *)
apply (prod_uniqueness O E E' AC AC); auto.
(* Goal: @Lt Tn A A P A *)
(* Goal: @Lt Tn A A P A *)
subst P.
(* Goal: @Prod Tn O E E' AB AH AC2 *)
(* Goal: forall _ : @Prod Tn O E E' AB AH AC2, @Prod Tn O E E' AC AC AC2 *)
apply prod_comm.
(* Goal: @Per Tn P T A *)
assumption.

(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @Prod Tn O E E' AC AC AC2 *)
assert(P = AC2).
(* Goal: @Lt Tn A T P A *)
apply (prod_uniqueness O E E' AB AH); auto.
(* Goal: @Prod Tn O E E' AB AH P *)
(* Goal: @Prod Tn O E E' AC AC AC2 *)
apply prod_sym.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Lt Tn A A P A *)
(* Goal: @Lt Tn A A P A *)
subst P.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma l15_7_1 : forall O E E' A B C H AB AC AH AC2,
  O<>E -> Per A C B -> Perp_at H C H A B ->
  Length O E E' A B AB -> Length O E E' A C AC -> Length O E E' A H AH ->
  Prod O E E' AC AC AC2 ->
  Prod O E E' AB AH AC2.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Prod Tn O E E' AC AC AC2 *)
destruct(l15_7 O E E' A B C H AB AC AH AC2 H0 H1 H2 H3 H4 H5).
(* Goal: False *)
apply H7.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma l15_7_2 : forall O E E' A B C H AB AC AH AC2,
  O<>E -> Per A C B -> Perp_at H C H A B ->
  Length O E E' A B AB -> Length O E E' A C AC -> Length O E E' A H AH ->
  Prod O E E' AB AH AC2 ->
  Prod O E E' AC AC AC2.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Prod Tn O E E' AC AC AC2 *)
destruct(l15_7 O E E' A B C H AB AC AH AC2 H0 H1 H2 H3 H4 H5).
(* Goal: @Prod Tn O E E' AC AC AC2 *)
apply H8.
(* Goal: @Per Tn P T A *)
assumption.
Qed.


Lemma length_sym : forall O E E' A B AB,
  Length O E E' A B AB -> Length O E E' B A AB.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Length Tn O E E' B A AB *)
unfold Length in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
repeat split; auto.
(* Goal: @Cong Tn A P Q A *)
Cong.
Qed.

Lemma pythagoras : forall O E E' A B C AC BC AB AC2 BC2 AB2,
  O <> E -> Per A C B ->
  Length O E E' A B AB ->
  Length O E E' A C AC ->
  Length O E E' B C BC ->
  Prod O E E' AC AC AC2 ->
  Prod O E E' BC BC BC2 ->
  Prod O E E' AB AB AB2 ->
  Sum  O E E' AC2 BC2 AB2.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(~Col O E E' /\ Col O E AB2 /\ Col O E AC2 /\ Col O E BC).
(* Goal: and (not (@Col Tn O E E')) (and (@Col Tn O E A) (and (@Col Tn O E B) (@Col Tn O E C))) *)
unfold Prod in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (not (@Col Tn O E E')) (and (@Col Tn O E AB2) (and (@Col Tn O E AC2) (@Col Tn O E BC))) *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
unfold Ar2 in H4 ,H5 ,H6.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
repeat split; tauto.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
induction(col_dec A C B).
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(HH:=l8_9 A C B H0 H11).
(* Goal: @eq (@Tpoint Tn) A B *)
induction HH.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AB = BC).
(* Goal: @eq (@Tpoint Tn) AB AC *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(length_uniqueness O E E' A B).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Length Tn O E E' P B BP *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply length_sym.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AB2 = BC2).
(* Goal: @Lt Tn A T P A *)
apply(prod_uniqueness O E E' AB AB); auto.
(* Goal: @Sum Tn O E E' AB2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst BC2.

(* Goal: @Sum Tn O E E' AC2 AB2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AC = O).
(* Goal: @eq (@Tpoint Tn) AC O *)
(* Goal: @Sum Tn O E E' AC2 AB2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(length_uniqueness O E E' A A).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
apply length_id_2; assumption.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Sum Tn O E E' AC2 AB2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AC2=O).
(* Goal: @eq (@Tpoint Tn) BC2 O *)
(* Goal: @Sum Tn O E E' AB2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(prod_uniqueness O E E' O O).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply prod_0_l; Col.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply sum_O_B; Col.

(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AB = AC).
(* Goal: @eq (@Tpoint Tn) AB AC *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(length_uniqueness O E E' A B).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(AB2 = AC2).
(* Goal: @Lt Tn A T P A *)
apply(prod_uniqueness O E E' AB AB); auto.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst AC2.

(* Goal: @Sum Tn O E E' AB2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(BC = O).
(* Goal: @eq (@Tpoint Tn) BC O *)
(* Goal: @Sum Tn O E E' AB2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(length_uniqueness O E E' B B).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Per Tn P T A *)
apply length_id_2; assumption.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: @Sum Tn O E E' AB2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(BC2=O).
(* Goal: @eq (@Tpoint Tn) BC2 O *)
(* Goal: @Sum Tn O E E' AB2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(prod_uniqueness O E E' O O).
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply prod_0_l; Col.
(* Goal: @Sum Tn O E E' AB2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
subst BC2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply sum_A_O; Col.



(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(exists X : Tpoint, Col A B X /\ Perp A B C X).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(l8_18_existence A B C); Col.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
ex_and H12 P.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(Perp_at P A B C P).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply(l8_14_2_1b_bis A B C P P H13); Col.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(Bet A P B /\ A <> P /\ B <> P).
(* Goal: and (@Bet Tn A P B) (and (not (@eq (@Tpoint Tn) A P)) (not (@eq (@Tpoint Tn) B P))) *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(l11_47 A B C P H0).
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
finish.
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(HL1:= length_existence O E E' A P H7).
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(HL2:= length_existence O E E' B P H7).
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
ex_and HL1 AP.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
ex_and HL2 BP.

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(Sum O E E' AP BP AB).
(* Goal: @Lt Tn A T P A *)
apply(triangular_equality_bis O E E' A P B AP BP AB); auto.
(* Goal: @Length Tn O E E' P B BP *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply length_sym.
(* Goal: @Per Tn P T A *)
assumption.

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(Prod O E E' AB AP AC2).
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
apply(l15_7_1 O E E' A B C P AB AC AP AC2 H H0); finish.

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(Prod O E E' AB BP BC2).
(* Goal: @Perp_at Tn P C P A B *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
eapply(l15_7_1 O E E' B A C P AB BC); finish.
(* Goal: @Lt Tn A T P A *)
apply length_sym;auto.

(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
assert(HD:=distr_l O E E' AB AP BP AB AC2 BC2 AB2 H20 H21 H22 H6).
(* Goal: @Per Tn P T A *)
assumption.
Qed.


Lemma is_length_exists : forall O E E' X Y,
  ~ Col O E E' -> exists XY, Is_length O E E' X Y XY.
Proof.
(* Goal: forall (O E E' X Y : @Tpoint Tn) (_ : not (@Col Tn O E E')), @ex (@Tpoint Tn) (fun XY : @Tpoint Tn => @Is_length Tn O E E' X Y XY) *)
intros O E E' X Y HNC.
elim (eq_dec_points X Y); intro HXY;
[treat_equalities; exists O; left; apply length_id_2; assert_diffs; auto|
destruct (length_existence O E E' X Y) as [XY HLength]; Col; exists XY; left; auto].
Qed.

(********************************************************)

Lemma lt_to_ltp : forall O E E' A B L C D M, Length O E E' A B L -> Length O E E' C D M 
              -> Lt A B C D -> LtP O E E' L M.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LtP Tn O E E' L M *)
induction(eq_dec_points L M).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Le Tn T M T A *)
  subst M.
(* Goal: @LtP Tn O E E' L L *)
  apply length_cong in H0.
(* Goal: @LtP Tn O E E' L L *)
  apply length_cong in H.
(* Goal: @LtP Tn O E E' L L *)
  unfold Lt in H1.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn P A P A *)
  apply False_ind.
(* Goal: @Cong Tn A P Q A *)
  apply H2; eCong.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @LtP Tn O E E' L M *)
  assert(Le A B C D).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply lt__le; auto.
  }
(* Goal: @LtP Tn O E E' L M *)
  assert(HH:= length_leP_le_2 O E E' A B C D L M H H0 H3).
(* Goal: @LtP Tn O E E' L M *)
  unfold LeP in HH.
(* Goal: @eq (@Tpoint Tn) A B *)
  induction HH.
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Per Tn P T A *)
    assumption.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
}
Qed.

Lemma ltp_to_lep : forall O E E' L M, LtP O E E' L M -> LeP O E E' L M.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: and (@LeP Tn O E E' A B) (not (@eq (@Tpoint Tn) A B)) *)
unfold LeP.
(* Goal: @Lt Tn A T P A *)
left; auto.
Qed.


Lemma ltp_to_lt : forall O E E' A B L C D M, Length O E E' A B L -> Length O E E' C D M 
              -> LtP O E E' L M -> Lt A B C D.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Lt Tn A B C D *)
assert(LeP O E E' L M).
(* Goal: @Lt Tn A T P A *)
apply ltp_to_lep; auto.
(* Goal: @Lt Tn A B C D *)
unfold Lt.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @Lt Tn A T P A *)
apply(length_leP_le_1 O E E' A B C D  L M); auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
assert(HH:= length_eq_cong_2 O E E' A B C D L H H3).
(* Goal: False *)
assert(L = M).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (length_uniqueness O E E' C D); auto.
}
(* Goal: @Le Tn T M T A *)
subst M.
(* Goal: False *)
unfold LtP in H1.
(* Goal: False *)
ex_and H1 P.

assert(~Col O E E' /\  Col O E L).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
  unfold Diff in H1.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
  ex_and H1 X.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Sum in H5.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E L) *)
  unfold Ar2 in H5.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @Lt Tn T A P A *)
spliter.

(* Goal: False *)
assert(HP:= diff_null O E E' L H5 H6).
(* Goal: False *)
assert(P = O).
(* Goal: @Lt Tn A T P A *)
apply(diff_uniqueness O E E' L L P O); auto.
(* Goal: @Lt Tn A A P A *)
(* Goal: @Lt Tn A A P A *)
subst P.
(* Goal: False *)
unfold Ps in H4.
(* Goal: False *)
unfold Out in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.


Lemma prod_col : forall O E E' A B AB ,Ar2 O E E' A B A -> Prod O E E' A B AB -> Col O E AB.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Col Tn O E AB *)
unfold Prod in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Col Tn O E AB *)
unfold Ar2 in H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.


Lemma square_increase_strict : forall O E E' A B A2 B2, Ar2 O E E' A B A ->  Ps O E A -> Ps O E B 
                              -> LtP O E E' A B
                              -> Prod O E E' A A A2 -> Prod O E E' B B B2
                              -> LtP O E E' A2 B2.
Proof.

(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(HA2 : Col O E A2).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (prod_col O E E' A A); auto.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Ar2 in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(HB2: Col O E B2).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (prod_col O E E' B B); auto.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Ar2 in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: and (not (@eq (@Tpoint Tn) O E)) (@Col Tn O E A) *)
unfold Ar2 in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(HD:=diff_exists O E E' B A H H6 H7).
(* Goal: @LtP Tn O E E' A2 B2 *)
ex_and HD BmA.
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(HS:=sum_exists O E E' H B A H6 H7).
(* Goal: @LtP Tn O E E' A2 B2 *)
ex_and HS BpA.
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(HD:=diff_exists O E E' B2 A2 H HB2 HA2).
(* Goal: @LtP Tn O E E' A2 B2 *)
ex_and HD B2mA2.
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(Col O E BpA).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Col Tn O E BpA *)
  apply sum_ar2 in H9.
(* Goal: @Col Tn O E BpA *)
  unfold Ar2 in H9.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(Col O E BmA).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Col Tn O E BmA *)
  apply diff_ar2 in H8.
(* Goal: @Col Tn O E BmA *)
  unfold Ar2 in H8.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @LtP Tn O E E' A2 B2 *)
assert(Col O E B2mA2).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Col Tn O E B2mA2 *)
  apply diff_ar2 in H10.
(* Goal: @Col Tn O E B2mA2 *)
  unfold Ar2 in H10.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}

(* Goal: @LtP Tn O E E' A2 B2 *)
assert(HP:= prod_exists O E E' H BpA BmA H11 H12).
(* Goal: @LtP Tn O E E' A2 B2 *)
ex_and HP F.

(* Goal: @LtP Tn O E E' A2 B2 *)
assert(HC:= diff_of_squares O E E' B A B2 A2 B2mA2 BpA BmA F H4 H3 H10 H9 H8 H14).
(* Goal: @LtP Tn O E E' A2 B2 *)
subst F.
(* Goal: @LtP Tn O E E' A B *)
unfold LtP.
(* Goal: @ex (@Tpoint Tn) (fun D : @Tpoint Tn => and (@Diff Tn O E E' B2 A2 D) (@Ps Tn O E D)) *)
exists B2mA2.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.
(* Goal: @Lt Tn A T P A *)
apply (prod_pos_pos O E E' BpA BmA); auto.
(* Goal: @Lt Tn A T P A *)
apply (sum_pos_pos O E E' B A); auto.
(* Goal: @Lt Tn A T P A *)
apply (lt_diff_ps O E E' B A); auto.
Qed.

Lemma square_increase : forall O E E' A B A2 B2, Ar2 O E E' A B A ->  Ps O E A -> Ps O E B 
                              -> LeP O E E' A B
                              -> Prod O E E' A A A2 -> Prod O E E' B B B2
                              -> LeP O E E' A2 B2.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeP Tn O E E' A2 B2 *)
unfold LeP in H2.
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: @Lt Tn A T P A *)
apply (square_increase_strict O E E' A B A2 B2) in H2; auto.
(* Goal: @Lt Tn A T P A *)
apply ltp_to_lep in H2; auto.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @LeP Tn O E E' A2 B2 *)
assert(A2 = B2).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (prod_uniqueness O E E' A A); auto.
}
(* Goal: @LeP Tn O E E' A2 B2 *)
subst B2.
(* Goal: and (@LeP Tn O E E' A B) (not (@eq (@Tpoint Tn) A B)) *)
unfold LeP.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
right; auto.
Qed.


Lemma signeq__prod_pos : forall O E E' A B C, SignEq O E A B -> Prod O E E' A B C -> Ps O E C.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
unfold SignEq in H.
(* Goal: False *)
induction H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn A T P A *)
apply (prod_pos_pos O E E' A B); auto.

assert(HP:=H0).
(* Goal: @Lt Tn T A P A *)
spliter.
apply prod_to_prodp in H0.

unfold Prodp in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
ex_and H3 B'.
assert(HPP:= HP).
unfold Prod in HP.
unfold Ar2 in HP.
(* Goal: @Lt Tn T A P A *)
spliter.
assert(Bet B' O E').
(* Goal: @Lt Tn T A P A *)
{
  assert(HQQ:=project_preserves_bet).
(* Goal: @Lt Tn A T P A *)
  apply(project_preserves_bet O E' E E' B O E B' O E'); auto.
  unfold Ng in H1.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
  apply project_trivial; 
  try(intro;subst E';apply H5; Col).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H10.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
  induction H10.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H10.
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply H13.
    exists E'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
  unfold Proj.
  repeat split; try(intro;subst E';apply H5; Col).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H10.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
  induction H10.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H10.
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply H13.
    exists E'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  left.
(* Goal: @eq (@Tpoint Tn) O O *)
  apply par_reflexivity.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  subst E'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply H5; Col.
}

assert(Bet A O C).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Bet Tn P A Q *)
  apply(project_preserves_bet O E A E' E' O B' A O C); Between.
 unfold Proj.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  repeat split; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
  subst E.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply H5; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: @eq (@Tpoint Tn) M O *)
  subst A.
(* Goal: @Bet Tn P A Q *)
  contradiction.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H11.
  induction H11.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H11.
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
    apply H14.
    exists A;
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: False *)
    apply H5.
(* Goal: @Col Tn T P Q *)
    ColR.
  }
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  left.
(* Goal: @Par Tn A C X Y *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
  apply par_left_comm.
(* Goal: @eq (@Tpoint Tn) O O *)
  apply par_reflexivity.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: @eq (@Tpoint Tn) M O *)
  subst A.
(* Goal: @Bet Tn P A Q *)
  contradiction.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply project_trivial; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  intro; subst E; apply H5; Col.
(* Goal: @Bet Tn P A Q *)
  intro;subst A;contradiction.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H11.
  induction H11.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H11.
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
    apply H14.
    exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Col Tn T P Q *)
    apply H5; ColR.
  }
}
(* Goal: @Ps Tn O E A *)
unfold Ps.
unfold Ng in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Out Tn A C' H *)
(* Goal: @Cong Tn A H A H' *)
(* Goal: @Cong Tn A C A C' *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply l6_6.
assert(HH:= l6_2 E C A O).
(* Goal: @Bet Tn P A Q *)
apply HH; Between.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply prod_null in HPP.
unfold Ng in H1.
(* Goal: @Lt Tn T A P A *)
spliter.
induction HPP;
(* Goal: @Bet Tn P A Q *)
contradiction.
Qed.

Lemma pos_neg__prod_neg : forall O E E' A B C, Ps O E A -> Ng O E B -> Prod O E E' A B C -> Ng O E C.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(HP:=H1).
(* Goal: @Lt Tn T A P A *)
spliter.
apply prod_to_prodp in H1.

unfold Prodp in H1.
(* Goal: @Lt Tn T A P A *)
spliter.
ex_and H3 B'.
assert(HPP:= HP).
unfold Prod in HP.
unfold Ar2 in HP.
(* Goal: @Lt Tn T A P A *)
spliter.
clear H6.
assert(Bet B' O E').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply(project_preserves_bet O E' E E' B O E B' O E'); auto.
(* Goal: False *)
  unfold Ng in H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
  apply project_trivial; 
  try(intro;subst E';apply H5; Col).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H6.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
  induction H6.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H6.
(* Goal: @Lt Tn T A P A *)
  spliter.
    apply H12.
    exists E'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
  unfold Proj.
  repeat split; try(intro;subst E';apply H5; Col).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H6.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
  induction H6.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H6.
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply H12.
    exists E'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  Col.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  left.
(* Goal: @eq (@Tpoint Tn) O O *)
  apply par_reflexivity.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  subst E'.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply H5; Col.
}

assert(Bet A O C).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Bet Tn P A Q *)
  apply(project_preserves_bet O E A E' E' O B' A O C); Between.
 unfold Proj.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  repeat split; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
  subst E.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply H5; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: @eq (@Tpoint Tn) M O *)
  subst A.
(* Goal: @Bet Tn P A Q *)
  contradiction.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H10.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
  induction H10.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H10.
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply H13.
    exists A;
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: False *)
    apply H5.
(* Goal: @Col Tn T P Q *)
    ColR.
  }
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  left.
(* Goal: @Par Tn A C X Y *)
(* Goal: @Col Tn A C B *)
(* Goal: False *)
(* Goal: False *)
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
  apply par_left_comm.
(* Goal: @eq (@Tpoint Tn) O O *)
  apply par_reflexivity.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: @eq (@Tpoint Tn) M O *)
  subst A.
(* Goal: @Bet Tn P A Q *)
  contradiction.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply project_trivial; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  intro; subst E; apply H5; Col.
(* Goal: @Bet Tn P A Q *)
  intro;subst A;contradiction.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold Par in H10.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
  induction H10.
(* Goal: @Lt Tn T A P A *)
  {
    unfold Par_strict in H10.
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply H13.
    exists A.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    split; Col.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Col Tn T P Q *)
    apply H5; ColR.
  }
}

(* Goal: @Ng Tn O E A *)
unfold Ng.
(* Goal: and (@Diff Tn O E E' AB O AB) (@Ps Tn O E AB) *)
repeat split.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) A O *)
subst C.
apply prod_null in HPP.
induction HPP.
unfold Ps in H.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Out in H.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: False *)
unfold Ng in H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
subst E.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply H5; Col.
unfold Ps in H.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
unfold Out in H.
(* Goal: @Lt Tn T A P A *)
spliter.
induction H12;
(* Goal: @Bet Tn P A Q *)
eBetween.
Qed.


Lemma sign_dec : forall O E A, Col O E A -> O <> E -> A = O \/ Ps O E A \/ Ng O E A.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
induction(eq_dec_points A O).
(* Goal: @Lt Tn A T P A *)
left; auto.
(* Goal: or (@eq (@Tpoint Tn) A O) (or (@Ps Tn O E A) (@Ng Tn O E A)) *)
assert(HH:= third_point O E A H).

(* Goal: @eq (@Tpoint Tn) A B *)
induction HH.
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    right;right.
(* Goal: @Ng Tn O E A *)
    unfold Ng.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
    repeat split; auto.
  }
   
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    right;left.
(* Goal: @Ps Tn O E A *)
    unfold Ps.
(* Goal: @Ps Tn O E A *)
    unfold Out.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
    repeat split; auto.
  }
Qed.


Lemma not_signEq_prod_neg : forall O E E' A B C, A <> O -> B <> O -> ~SignEq O E A B -> Prod O E E' A B C -> Ng O E C.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(HP:=H2).
unfold Prod in HP.
unfold Ar2 in HP.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
clear H4.
assert(O <> E).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  intro; subst E; apply H1; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply False_ind; Col.
}
assert(HA:=sign_dec O E A H5 H4).
assert(HB:= sign_dec O E B H6 H4).
(* Goal: @Bet Tn P A Q *)
induction HA; induction HB; try contradiction.
induction H8;induction H9.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn P A P A *)
  apply False_ind.
(* Goal: False *)
  apply H1.
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
  unfold SignEq.
(* Goal: @Lt Tn A T P A *)
  left; auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply(pos_neg__prod_neg O E E' A B); auto.
}
(* Goal: @Lt Tn T A P A *)
{
  apply prod_comm in H2.
(* Goal: @Lt Tn A T P A *)
  apply(pos_neg__prod_neg O E E' B A); auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn P A P A *)
  apply False_ind.
(* Goal: False *)
  apply H1.
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
  unfold SignEq.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
  right; auto.
}
Qed.



Lemma prod_pos__signeq : forall O E E' A B C, A <> O -> B <> O -> Prod O E E' A B C -> Ps O E C -> SignEq O E A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(HP:= H1).
unfold Prod in HP.
unfold Ar2 in HP.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
clear H4.
assert(HA:= sign_dec O E A H5).
assert(HB:= sign_dec O E B H6).
assert(O <> E).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
  subst E.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply H3; Col.
}

(* Goal: @Lt Tn A T P A *)
induction HA;auto.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @Lt Tn A T P A *)
induction HB; auto.
(* Goal: @Bet Tn P A Q *)
contradiction.

induction H8; induction H9.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
  unfold SignEq.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  left.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  split; auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply pos_neg__prod_neg in H1; auto.
  apply pos_not_neg in H2.
(* Goal: @Bet Tn P A Q *)
  contradiction.
}
(* Goal: @Lt Tn T A P A *)
{
  apply prod_comm in H1.
(* Goal: @Lt Tn A T P A *)
  apply pos_neg__prod_neg in H1; auto.
  apply pos_not_neg in H2.
(* Goal: @Bet Tn P A Q *)
  contradiction.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
  unfold SignEq.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  right.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  split; auto.
}
Qed.

Lemma prod_ng___not_signeq : forall O E E' A B C, A <> O -> B <> O -> Prod O E E' A B C -> Ng O E C -> ~SignEq O E A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(HP:= H1).
unfold Prod in HP.
unfold Ar2 in HP.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
clear H4.
assert(HA:= sign_dec O E A H5).
assert(HB:= sign_dec O E B H6).
assert(O <> E).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
  subst E.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply H3; Col.
}

(* Goal: @Lt Tn A T P A *)
induction HA;auto.
(* Goal: @Lt Tn A T P A *)
induction HB; auto.

induction H8; induction H9.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn P A P A *)
  apply False_ind.
  apply signeq__prod_pos in H1.
  apply pos_not_neg in H1.
(* Goal: @Bet Tn P A Q *)
  contradiction.
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
  unfold SignEq.
(* Goal: @Lt Tn A T P A *)
  left; auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold SignEq in H10.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
  induction H10.
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply pos_not_neg in H11.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply pos_not_neg in H8.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  unfold SignEq in H10.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
  induction H10.
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Lt Tn A T P A *)
    apply pos_not_neg in H8; auto.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
    apply pos_not_neg in H9.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
}
(* Goal: @Lt Tn T A P A *)
{
  apply signeq__prod_pos in H1.
(* Goal: @Lt Tn A T P A *)
  apply pos_not_neg in H1; auto.
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
  unfold SignEq.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  right.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  split; auto.
}
Qed.

Lemma ltp__diff_pos : forall O E E' A B D, LtP O E E' A B -> Diff O E E' B A D -> Ps O E D.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: not (@eq (@Tpoint Tn) A B) *)
unfold LtP in H.
(* Goal: @Ps Tn O E D *)
ex_and H D'.
(* Goal: @Ps Tn O E D *)
assert(D = D').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (diff_uniqueness O E E' B A); auto.
}
(* Goal: @Ps Tn O E D *)
subst D'.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma diff_pos__ltp : forall O E E' A B D, Diff O E E' B A D -> Ps O E D -> LtP O E E' A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LtP Tn O E E' A B *)
unfold LtP.
(* Goal: @ex (@Tpoint Tn) (fun D : @Tpoint Tn => and (@Diff Tn O E E' B A D) (@Ps Tn O E D)) *)
exists D.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.
Qed.


Lemma square_increase_rev : forall O E E' A B A2 B2, Ps O E A -> Ps O E B 
                              -> LtP O E E' A2 B2
                              -> Prod O E E' A A A2 -> Prod O E E' B B B2
                              -> LtP O E E' A B.
Proof.

(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(HP2:= H2).
assert(HP3:=H3).
unfold Prod in HP2.
unfold Prod in HP3.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Ar2 in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
clean_duplicated_hyps.
clear H7 H5.
assert(HS:=sum_exists O E E' H6 B A H8 H11).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and HS SS.
assert(HD:= diff_exists O E E' B A H6 H8 H11).
ex_and HD DD.

assert(exists C : Tpoint, Prod O E E' SS DD C).
(* Goal: @Lt Tn T A P A *)
{
  apply(prod_exists O E E' H6 SS DD).
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
  unfold Sum in H4.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
  unfold Ar2 in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
  unfold Diff in H5.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Sum Tn O E E' AB BC AC *)
  ex_and H5 X.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Sum in H7.
(* Goal: @Lt Tn T A P A *)
  spliter.
  unfold Ar2 in H7.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}

ex_and H7 PSD.

assert(HH:= diff_exists O E E' B2 A2 H6 H10 H13).
ex_and HH D2.

assert(HH:= diff_of_squares O E E' B A B2 A2 D2 SS DD PSD H3 H2 H7 H4 H5 H9).
subst PSD.

assert(HH:=(ltp__diff_pos O E E' A2 B2 D2 H1 H7)).

(* Goal: @Lt Tn A T P A *)
apply(prod_pos__signeq) in H9; auto.

unfold SignEq in H9.
induction H9.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn A T P A *)
  apply diff_pos__ltp in H5; auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn P A P A *)
  apply False_ind.
  assert(HS:= sum_pos_pos O E E' B A SS H0 H H4).
  apply pos_not_neg in HS.
(* Goal: @Bet Tn P A Q *)
  contradiction.
}
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst SS.
(* Goal: @Lt Tn A T P A *)
apply sum_pos_pos in H4; auto.
(* Goal: False *)
unfold Ps in H4.
(* Goal: False *)
unfold Out in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
subst DD.
apply diff_null_eq in H5.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.

assert(Prod O E E' SS O O).
(* Goal: @Lt Tn T A P A *)
{
  apply (prod_0_r O E E' SS).
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  Col.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
  unfold Sum in H4.
(* Goal: not (@Col Tn O E E') *)
(* Goal: @Col Tn O E Y *)
(* Goal: @Sum Tn O E E' O Y CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
(* Goal: @Out Tn O AB CD *)
  unfold Ar2 in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  spliter; tauto.
}
assert(D2 = O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (prod_uniqueness O E E' SS O); auto.
}
subst D2.
assert(B2 = A2).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply(diff_null_eq O E E'); auto.
}
(* Goal: @LeP Tn O E E' A2 B2 *)
subst B2.
(* Goal: False *)
unfold LtP in H1.
ex_and H1 DF.
assert(HD:= diff_null O E E' A2 H6 H13).
assert(DF=O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply(diff_uniqueness O E E' A2 A2); auto.
}
subst DF.
unfold Ps in H12.
unfold Out in H12.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.


Lemma ltp__ltps: forall O E E' A B, LtP O E E' A B -> LtPs O E E' A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: not (@eq (@Tpoint Tn) A B) *)
unfold LtP in H.
(* Goal: not (@eq (@Tpoint Tn) A B) *)
ex_and H D.
(* Goal: @LtPs Tn O E E' A B *)
unfold LtPs.
(* Goal: @ex (@Tpoint Tn) (fun D : @Tpoint Tn => and (@Diff Tn O E E' B A D) (@Ps Tn O E D)) *)
exists D.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.

(* Goal: @Sum Tn O E E' A D B *)
apply diff_sum.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma ltps__ltp: forall O E E' A B, LtPs O E E' A B -> LtP O E E' A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LtP Tn O E E' A B *)
unfold LtPs in H.
(* Goal: not (@eq (@Tpoint Tn) A B) *)
ex_and H D.
(* Goal: @LtP Tn O E E' A B *)
unfold LtP.
(* Goal: @ex (@Tpoint Tn) (fun D : @Tpoint Tn => and (@Diff Tn O E E' B A D) (@Ps Tn O E D)) *)
exists D.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
split; auto.
(* Goal: @Diff Tn O E E' B A D *)
apply sum_diff.
(* Goal: @Per Tn P T A *)
assumption.
Qed.

Lemma ltp__lep_neq : forall O E E' A B, LtP O E E' A B -> LeP O E E' A B /\ A <> B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: and (@LeP Tn O E E' A B) (not (@eq (@Tpoint Tn) A B)) *)
unfold LeP.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @Lt Tn A T P A *)
left; auto.
(*apply ltp__ltps in H.*)
(* Goal: not (@eq (@Tpoint Tn) A B) *)
unfold LtP in H.
(* Goal: not (@eq (@Tpoint Tn) A B) *)
ex_and H D.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: False *)
assert(HD:= H).
(* Goal: False *)
unfold Diff in HD.
(* Goal: False *)
ex_and HD B'.
(* Goal: False *)
unfold Sum in H2.
(* Goal: False *)
unfold Ar2 in H2.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A B *)
clear H3.
(* Goal: False *)
assert(Diff O E E' A A O).
(* Goal: @Lt Tn A T P A *)
apply diff_null; auto.
(* Goal: False *)
assert(D = O).
(* Goal: @Lt Tn A T P A *)
apply (diff_uniqueness O E E' A A); auto.
(* Goal: @LtP Tn O E E' A B *)
subst D.
(* Goal: False *)
unfold Ps in H0.
(* Goal: False *)
unfold Out in H0.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.


Lemma lep_neq__ltp : forall O E E' A B,  LeP O E E' A B /\ A <> B -> LtP O E E' A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LtP Tn O E E' A B *)
unfold LeP in H.
(* Goal: False *)
induction H.
(* Goal: @Per Tn P T A *)
assumption.
(* Goal: @Bet Tn P A Q *)
contradiction.
Qed.


Lemma sum_preserves_ltp : forall O E E' A B C AC BC, LtP O E E' A B -> Sum O E E' A C AC -> Sum O E E' B C BC -> LtP O E E' AC BC.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LtP Tn O E E' AC BC *)
apply ltp__lep_neq in H.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LtP Tn O E E' AC BC *)
apply lep_neq__ltp.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @LeP Tn O E E' AC BC *)
(* Goal: not (@eq (@Tpoint Tn) AC BC) *)
apply(compatibility_of_sum_with_order O E E' A B C AC BC H H0 H1).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
subst BC.
(* Goal: False *)
assert(HS:= H0).
(* Goal: False *)
unfold Sum in HS.
(* Goal: False *)
unfold Ar2 in HS.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
clear H4.
(* Goal: False *)
assert(A = B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (sum_uniquenessA O E E' H3 C A B AC); auto.
}
(* Goal: @Bet Tn P A Q *)
contradiction.
Qed.

Lemma sum_preserves_lep : forall O E E' A B C AC BC, LeP O E E' A B -> Sum O E E' A C AC -> Sum O E E' B C BC -> LeP O E E' AC BC.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeP Tn O E E' AC BC *)
induction(eq_dec_points A B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) M O *)
  subst B.
  assert(HH:=sum_uniqueness O E E' A C  AC BC H0 H1).
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
  subst BC.
(* Goal: @LeP Tn O E E' AB2 AB2 *)
  apply leP_refl.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @LeP Tn O E E' AC BC *)
  assert(LtP O E E' A B).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(lep_neq__ltp O E E' A B ); auto.
  }
(* Goal: @LeP Tn O E E' S2 AB2 *)
  apply ltp_to_lep.
(* Goal: @Lt Tn A T P A *)
  apply (sum_preserves_ltp O E E' A B C AC BC); auto.
}
Qed.

Lemma sum_preserves_ltp_rev : forall O E E' A B C AC BC, Sum O E E' A C AC -> Sum O E E' B C BC -> LtP O E E' AC BC
                                ->  LtP O E E' A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeP Tn O E E' A B *)
assert(HS1:= H).
(* Goal: @LeP Tn O E E' A B *)
assert(HS2:= H0).
(* Goal: @LeP Tn O E E' A B *)
unfold Sum in HS1.
(* Goal: @LeP Tn O E E' A B *)
unfold Sum in HS2.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Ar2 in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A B *)
clear H8.
(* Goal: @LeP Tn O E E' A B *)
clear H3.

(* Goal: @LtP Tn O E E' A B *)
assert(HH:= opp_exists O E E' H2 C H10).
(* Goal: @LtP Tn O E E' A B *)
ex_and HH C'.
(* Goal: @LtP Tn O E E' A B *)
assert (OP:=H3).
(* Goal: @LtP Tn O E E' A B *)
unfold Opp in OP.
(* Goal: @LtP Tn O E E' A B *)
unfold Sum in OP.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Ar2 in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LtP Tn O E E' A B *)
clear H12.

(* Goal: @LtP Tn O E E' A B *)
unfold Opp in H3.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply sum_comm in H3; Col.

(* Goal: @LtP Tn O E E' A B *)
assert(HH:= sum_exists O E E' H7 AC C' H11 H13).
(* Goal: @LtP Tn O E E' A B *)
ex_and HH D.
(* Goal: @LtP Tn O E E' A B *)
assert(HH:=sum_assoc O E E' A C C' AC O D H H3).
(* Goal: @LtP Tn O E E' A B *)
destruct HH.
(* Goal: @LtP Tn O E E' A B *)
assert(Sum O E E' A O D).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply H17; auto.
}
(* Goal: @LtP Tn O E E' A B *)
assert(HS:=sum_A_O_eq O E E' H2 A D H18).
(* Goal: @LtP Tn O E E' A B *)
subst D.

(* Goal: @LtP Tn O E E' A B *)
assert(HH:= sum_exists O E E' H7 BC C' H6 H13).
(* Goal: @LtP Tn O E E' A B *)
ex_and HH D.
(* Goal: @LtP Tn O E E' A B *)
assert(HH:=sum_assoc O E E' B C C' BC O D H0 H3).
(* Goal: @LtP Tn O E E' A B *)
destruct HH.
(* Goal: @LtP Tn O E E' A B *)
assert(Sum O E E' B O D).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply H21; auto.
}
(* Goal: @LtP Tn O E E' A B *)
assert(HS:=sum_A_O_eq O E E' H2 B D H22).
(* Goal: @LtP Tn O E E' A B *)
subst D.
apply(sum_preserves_ltp O E E'  AC BC C' A B H1 H12 H19).
Qed.


Lemma sum_preserves_lep_rev : forall O E E' A B C AC BC, Sum O E E' A C AC -> Sum O E E' B C BC -> LeP O E E' AC BC
                                ->  LeP O E E' A B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.

(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeP Tn O E E' A B *)
assert(HS1:= H).
(* Goal: @LeP Tn O E E' A B *)
assert(HS2:= H0).
(* Goal: @LeP Tn O E E' A B *)
unfold Sum in HS1.
(* Goal: @LeP Tn O E E' A B *)
unfold Sum in HS2.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Ar2 in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @LeP Tn O E E' A B *)
clear H8.
(* Goal: @LeP Tn O E E' A B *)
clear H3.
(* Goal: @LeP Tn O E E' A B *)
unfold LeP in *.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  left.
(* Goal: @Lt Tn A T P A *)
  apply (sum_preserves_ltp_rev O E E' A B C AC BC); auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
  subst BC.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  right.
(* Goal: @Lt Tn A T P A *)
  apply (sum_uniquenessA O E E' H7 C A B AC); auto.
}
Qed.

Lemma cong2_lea__le :   forall A B C D E F : Tpoint,
  Cong A B D E -> Cong A C D F -> LeA F D E C A B -> Le E F B C.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.

(* Goal: @Le Tn E F B C *)
assert(LtA F D E C A B \/ CongA F D E C A B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (@LtA Tn F D E C A B) (@CongA Tn F D E C A B) *)
  unfold LtA.
(* Goal: or (and (@LeA Tn F D E C A B) (not (@CongA Tn F D E C A B))) (@CongA Tn F D E C A B) *)
  induction (conga_dec F D E C A B).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Per Tn P T A *)
    right; assumption.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    left.
    split;
(* Goal: @Lt Tn A T P A *)
    auto.
  }
}
(* Goal: @Bet Tn P T Q *)
induction H2.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Le Tn E F B C *)
  assert(Lt E F B C).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(t18_18 A B C D E F);auto.
  }
(* Goal: @Le Tn E F B C *)
  apply lt__le.
(* Goal: @Per Tn P T A *)
  assumption.
}
(* Goal: @Le Tn E F B C *)
assert(Cong F E C B /\ (F <> E -> CongA D F E A C B /\ CongA D E F A B C)).
(* Goal: @Cong Tn A P Q A *)
apply(l11_49 F D E C A B); Cong.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Le Tn O A O P *)
(* Goal: @Le Tn O B O Q *)
unfold Le.
(* Goal: @ex (@Tpoint Tn) (fun E0 : @Tpoint Tn => and (@Bet Tn B E0 C) (@Cong Tn E F B E0)) *)
exists C.
(* Goal: @Cong Tn A P Q A *)
split;Cong.
(* Goal: @Bet Tn P A Q *)
Between.
Qed.

Lemma lea_out_lea : forall A B C D E F A' C' D' F', Out B A A' -> Out B C C' -> Out E D D' -> Out E F F'
                      -> LeA A B C D E F -> LeA A' B C' D' E F'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeA Tn A' B C' D' E F' *)
unfold LeA in *.
(* Goal: @ex (@Tpoint Tn) (fun P : @Tpoint Tn => and (@InAngle Tn P D' E F') (@CongA Tn A' B C' D' E P)) *)
ex_and H3 P.
(* Goal: @ex (@Tpoint Tn) (fun P : @Tpoint Tn => and (@InAngle Tn P D' E F') (@CongA Tn A' B C' D' E P)) *)
exists P.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
apply (l11_25 P D E F D' F' P);
(* Goal: @Lt Tn A T P A *)
try(apply l6_6); auto.
(* Goal: @Out Tn E P P *)
apply out_trivial.
(* Goal: not (@eq (@Tpoint Tn) P E) *)
unfold CongA in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn A T P A *)
apply (out_conga A B C D E P); auto.
(* Goal: @Out Tn E P P *)
apply out_trivial.
(* Goal: not (@eq (@Tpoint Tn) P E) *)
unfold CongA in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.

Lemma lta_out_lta : forall A B C D E F A' C' D' F', Out B A A' -> Out B C C' -> Out E D D' -> Out E F F'
                      -> LtA A B C D E F -> LtA A' B C' D' E F'.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LtA Tn A' B C' D' E F' *)
unfold LtA in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: and (@LeA Tn A' B C' D' E F') (not (@CongA Tn A' B C' D' E F')) *)
split.
(* Goal: @Lt Tn A T P A *)
apply(lea_out_lea A B C D E F A' C' D' F');auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
apply H4.
apply (out_conga A' B C' D' E F');
(* Goal: @Lt Tn A T P A *)
try(apply l6_6); auto.
Qed.


Lemma pythagoras_obtuse : forall O E E' A B C AC BC AB AC2 BC2 AB2 S2,
  O<>E -> Obtuse A C B ->
  Length O E E' A B AB -> Length O E E' A C AC -> Length O E E' B C BC ->
  Prod O E E' AC AC AC2 -> Prod O E E' BC BC BC2 -> Prod O E E' AB AB AB2 ->
  Sum  O E E' AC2 BC2 S2 -> LtP O E E' S2 AB2.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
unfold Obtuse in H0.
ex_and H0 A'.
ex_and H8 B'.
ex_and H0 C'.
assert(A' <> B' /\ C' <> B' /\ C <> A /\ C' <> B' /\ C <> B).
(* Goal: @Lt Tn T A P A *)
{
  unfold GtA in H8.
  unfold LtA in H8.
(* Goal: @Lt Tn T A P A *)
  spliter.
  unfold LeA in H8.
  ex_and H8 P.
  unfold CongA in H10.
  unfold InAngle in H8.
  repeat split;
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  try tauto.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn A T P A *)
  auto.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn A T P A *)
  auto.
}
(* Goal: @Lt Tn T A P A *)
spliter.
assert(HH:=l6_11_existence B' C A A' H9 H11).
ex_and HH AA.
assert(HH:=l6_11_existence B' C B C' H12 H13).
ex_and HH CC.
assert(Lt AA CC A B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Cong Tn A P Q A *)
  apply(t18_18 C A B B' AA CC);Cong.
  unfold GtA in H8.
  apply lta_comm.
  apply(lta_out_lta A' B' C' A C B);
  try(apply l6_6; auto).
(* Goal: @Lt Tn A T P A *)
  apply out_trivial; auto.
(* Goal: @Lt Tn A T P A *)
  apply out_trivial; auto.
(* Goal: @Lt Tn A T P A *)
  auto.
}
assert(~Col O E E').
(* Goal: @Lt Tn T A P A *)
{
  unfold Prod in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  unfold Ar2 in H5; tauto.
}
assert(exists S1 : Tpoint, Length O E E' AA CC S1).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply(length_existence O E E' AA CC);auto.
}
destruct H20 as [S1 H21].
(* ex_and H20 S1. *)
assert(exists SS : Tpoint, Prod O E E' S1 S1 SS).
(* Goal: @Lt Tn T A P A *)
{
  apply(prod_exists O E E' H19 S1 S1);
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  unfold Length in H21;tauto.
} 
ex_and H20 SS.
(* Goal: @Lt Tn A T P A *)
apply (per_col _ _ _ CC) in H0;auto.
apply l8_2 in H0.
(* Goal: @Lt Tn A T P A *)
apply (per_col _ _ _ AA) in H0;auto.

assert(Sum O E E' AC2 BC2 SS).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply(pythagoras O E E' AA CC B' AC BC S1 AC2 BC2 SS H); auto.
(* Goal: @Lt Tn A T P A *)
  apply l8_2; auto.
(* Goal: @Cong Tn A P Q A *)
  apply(length_eq_cong_2  O E E' A C AA B'); Cong.
(* Goal: @Cong Tn A P Q A *)
  apply(length_eq_cong_2  O E E' B C CC B'); Cong.

}

assert(S2=SS).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply (sum_uniqueness O E E' AC2 BC2);auto.
}
(* Goal: False *)
treat_equalities.
assert(HH:= lt_to_ltp O E E' AA CC S1 A B AB H21 H1 H18).


assert(Ps O E S1).
(* Goal: @Lt Tn T A P A *)
{

  assert(AA <> B').
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: not (@eq (@Tpoint Tn) A T') *)
    intro.
(* Goal: False *)
    treat_equalities.
    unfold Out in H14.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
  assert(CC <> B').
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: not (@eq (@Tpoint Tn) A T') *)
    intro.
(* Goal: False *)
    treat_equalities.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
    unfold Out in H16.
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }

  assert(AA <> CC).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
  treat_equalities.
  apply l8_8 in H0.
(* Goal: False *)
  treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.

(* Goal: @Lt Tn A T P A *)
  apply length_Ps in H21; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  apply sym_equal in H24.
(* Goal: False *)
  treat_equalities.
  apply length_cong in H21.
(* Goal: False *)
  treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}

(* Goal: @Lt Tn A T P A *)
apply(square_increase_strict O E E' S1 AB S2 AB2); auto.
unfold Length in H1.
unfold Length in H21.
(* Goal: @Lt Tn T A P A *)
spliter.


(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
repeat split; Col.

(* Goal: @Lt Tn A T P A *)
apply (length_Ps O E E' A B); auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply sym_equal in H20.
(* Goal: False *)
treat_equalities.
apply ltP_neg in HH.
apply pos_not_neg in H12.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply out_col in H14; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
apply out_col in H16; Col.
Qed.

Lemma pythagoras_obtuse_or_per : forall O E E' A B C AC BC AB AC2 BC2 AB2 S2,
  O<>E -> Obtuse A C B \/ Per A C B ->
  Length O E E' A B AB -> Length O E E' A C AC -> Length O E E' B C BC ->
  Prod O E E' AC AC AC2 -> Prod O E E' BC BC BC2 -> Prod O E E' AB AB AB2 ->
  Sum  O E E' AC2 BC2 S2 -> LeP O E E' S2 AB2.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeP Tn O E E' S2 AB2 *)
induction H0.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @LeP Tn O E E' S2 AB2 *)
  apply ltp_to_lep.
(* Goal: @Lt Tn A T P A *)
  apply (pythagoras_obtuse O E E' A B C AC BC AB AC2 BC2 AB2 S2); auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @LeP Tn O E E' S2 AB2 *)
  assert(HH:= pythagoras O E E' A B C AC BC AB AC2 BC2 AB2 H H0 H1 H2 H3 H4 H5 H6).
(* Goal: @LeP Tn O E E' S2 AB2 *)
  assert(S2 = AB2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (sum_uniqueness O E E' AC2 BC2); auto.
  }
(* Goal: @LeP Tn O E E' S2 AB2 *)
  subst S2.
(* Goal: @LeP Tn O E E' AB2 AB2 *)
  apply leP_refl.
}
Qed.

Lemma pythagoras_acute : forall O E E' A B C AC BC AB AC2 BC2 AB2 S2,
  O<>E -> Acute A C B ->
  Length O E E' A B AB -> Length O E E' A C AC -> Length O E E' B C BC ->
  Prod O E E' AC AC AC2 -> Prod O E E' BC BC BC2 -> Prod O E E' AB AB AB2 ->
  Sum  O E E' AC2 BC2 S2 -> LtP O E E' AB2 S2.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
unfold Acute in H0.
ex_and H0 A'.
ex_and H8 B'.
ex_and H0 C'.

assert(A <> C /\ B <> C).
(* Goal: @Lt Tn T A P A *)
{
  split;
  intro;
  treat_equalities;
  unfold LtA in H8;
  spliter;
  unfold LeA in H8;
  ex_and H8 P;
  unfold CongA in *;
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @Lt Tn T A P A *)
spliter.
assert(~Col O E E').
(* Goal: @Lt Tn T A P A *)
{
  unfold Prod in H5.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  unfold Ar2 in H5; tauto.
}

(* Goal: @LeP Tn O E E' AC BC *)
induction(eq_dec_points A B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: False *)
  treat_equalities.
  assert(Length O E E' A A O).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
      apply length_id_2; auto.
  }
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
  assert(AB = O).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (length_uniqueness O E E' A A); auto.
  }
  apply sym_equal in H12.
(* Goal: False *)
  treat_equalities.
  apply(prod_O_l_eq) in H6.
  subst AB2.
  apply length_Ps in H2.
  apply length_Ps in H3.
  assert(Ps O E AC2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (signeq__prod_pos O E E' AC AC); auto.
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
    unfold SignEq.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    left.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
    split; auto.
  }
  assert(Ps O E BC2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (signeq__prod_pos O E E' BC BC); auto.
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
    unfold SignEq.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    left.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
    split; auto.
  }
(* Goal: @Lt Tn A T P A *)
  apply sum_pos_pos in H7; auto.
(* Goal: @LtP Tn O E E' A B *)
  unfold LtP.
  exists S2.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  split; auto.
(* Goal: @Lt Tn A T P A *)
  apply(diff_A_O O E E'  S2 ); auto.
(* Goal: @Ps Tn O E P *)
(* Goal: @Ps Tn O E P *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
  unfold Ps in H2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply out_col in H2; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: or (@LtP Tn O E E' A B) (@eq (@Tpoint Tn) A B) *)
  subst BC.
  apply length_cong in H3.
  treat_equalities; tauto;
  apply sym_equal in H6.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
(* Goal: @Sum Tn O E E' AC2 BC2 AB2 *)
  subst AC.
  apply length_cong in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  treat_equalities; tauto.
}
(* Goal: @Lt Tn T A P A *)
{
  assert(A' <> B' /\ C' <> B'  /\ C' <> B').
(* Goal: @Lt Tn T A P A *)
  {

    unfold LtA in H8.
(* Goal: @Lt Tn T A P A *)
    spliter.
    unfold LeA in H8.
    ex_and H8 P.
    unfold CongA in H10.
    unfold InAngle in H8.
    repeat split;
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
    tauto.
  }
(* Goal: @Lt Tn T A P A *)
  spliter.
  assert(exists X : Tpoint, Out B' X A' /\ Cong B' X C A).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(l6_11_existence B' C A A' H13); auto.
  }
  ex_and H16 AA.
  assert(exists X : Tpoint, Out B' X C' /\ Cong B' X C B).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(l6_11_existence B' C B C'); auto.
  }
  ex_and H18 CC.
  assert(Lt A B AA CC).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Cong Tn A P Q A *)
    apply(t18_18 B' AA CC C A B );Cong.
    apply lta_comm.
    apply(lta_out_lta  A C B A' B' C');
    try(apply l6_6; auto).
(* Goal: @Lt Tn A T P A *)
    apply out_trivial; auto.
(* Goal: @Lt Tn A T P A *)
    apply out_trivial; auto.
(* Goal: @Lt Tn A T P A *)
    auto.
  }

  assert(exists S1 : Tpoint, Length O E E' AA CC S1).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(length_existence O E E' AA CC);auto.
  }
  destruct H21 as [S1 H22].
  assert(exists SS : Tpoint, Prod O E E' S1 S1 SS).
(* Goal: @Lt Tn T A P A *)
  {
    apply(prod_exists O E E' H11 S1 S1);
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
    unfold Length in H22;tauto.
  } 
  ex_and H21 SS.
(* Goal: @Lt Tn A T P A *)
  apply (per_col _ _ _ CC) in H0;auto.
  apply l8_2 in H0.
(* Goal: @Lt Tn A T P A *)
  apply (per_col _ _ _ AA) in H0;auto.

  assert(Sum O E E' AC2 BC2 SS).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(pythagoras O E E' AA CC B' AC BC S1 AC2 BC2 SS H); auto.
(* Goal: @Lt Tn A T P A *)
    apply l8_2; auto.
(* Goal: @Cong Tn A P Q A *)
    apply(length_eq_cong_2  O E E' A C AA B'); Cong.
(* Goal: @Cong Tn A P Q A *)
    apply(length_eq_cong_2  O E E' B C CC B'); Cong.
  }

  assert(S2=SS).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (sum_uniqueness O E E' AC2 BC2);auto.
  }
(* Goal: False *)
  treat_equalities.
  assert(HH:= lt_to_ltp O E E' A B AB AA CC S1 H1 H22 H20).

(* Goal: @Lt Tn A T P A *)
  apply(square_increase_strict O E E' AB S1 AB2 S2); auto.
  unfold Length in H1.
  unfold Length in H22.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  repeat split; Col.
  apply (length_Ps O E E' A B) in H1.
(* Goal: @Lt Tn A T P A *)
  auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  apply sym_equal in H15.
(* Goal: False *)
  treat_equalities.
  apply (length_cong O E E') in H1.
(* Goal: False *)
  treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.

  assert(AA <> B').
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: False *)
      treat_equalities.
      unfold Out in H14.
(* Goal: @Bet Tn P A Q *)
      contradiction.
    }
    assert(CC <> B').
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: False *)
      treat_equalities.
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
(* Goal: @eq (@Tpoint Tn) AB AB' *)
      unfold Out in H16.
(* Goal: @Bet Tn P A Q *)
      contradiction.
    }

  assert(AA <> CC).
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
  treat_equalities.
  apply l8_8 in H0.
(* Goal: False *)
  treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
(* Goal: @Lt Tn A T P A *)
  apply length_Ps in H22; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
  apply sym_equal in H25.
(* Goal: False *)
  treat_equalities.
  apply length_cong in H22.
(* Goal: False *)
  treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply out_col in H16; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  apply out_col in H18; Col.
}
Qed.

Lemma pyth_context : forall O E E' A B C : Tpoint, ~Col O E E' -> exists AB BC AC AB2 BC2 AC2 SS,
                      Col O E AB /\ Col O E BC /\ Col O E AC
                    /\ Col O E AB2 /\ Col O E BC2 /\ Col O E AC2
                    /\  Length O E E' A B AB /\ Length O E E' B C BC /\ Length O E E' A C AC
                    /\ Prod O E E' AB AB AB2 /\ Prod O E E' BC BC BC2 /\ Prod O E E' AC AC AC2
                    /\ Sum O E E' AB2 BC2 SS .
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Lab:=length_existence O E E' A B H).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and Lab AB.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Lbc:=length_existence O E E' B C H).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and Lbc BC.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Lac:=length_existence O E E' A C H).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and Lac AC.

(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Col O E AB /\ Col O E BC /\ Col O E AC).
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
unfold Length in *; tauto.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Pab:= prod_exists O E E' H AB AB H3 H3).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and Pab AB2.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Pbc:= prod_exists O E E' H BC BC H4 H4).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and Pbc BC2.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Pac:= prod_exists O E E' H AC AC H5 H5).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and Pac AC2.

(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(Col O E AB2 /\ Col O E BC2 /\ Col O E AC2).
(* Goal: and (not (@Col Tn O E E')) (and (@Col Tn O E A) (and (@Col Tn O E B) (@Col Tn O E C))) *)
unfold Prod in *.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
unfold Ar2 in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
assert(HS:= sum_exists O E E' H AB2 BC2 H9 H10).
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
ex_and HS SS.

(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))))) *)
exists AB.
(* Goal: @ex (@Tpoint Tn) (fun BC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS)))))))))))))))))) *)
exists BC.
(* Goal: @ex (@Tpoint Tn) (fun AC : @Tpoint Tn => @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))))) *)
exists AC.
(* Goal: @ex (@Tpoint Tn) (fun AB2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS)))))))))))))))) *)
exists AB2.
(* Goal: @ex (@Tpoint Tn) (fun BC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))))) *)
exists BC2.
(* Goal: @ex (@Tpoint Tn) (fun AC2 : @Tpoint Tn => @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS)))))))))))))) *)
exists AC2.
(* Goal: @ex (@Tpoint Tn) (fun SS : @Tpoint Tn => and (@Col Tn O E AB) (and (@Col Tn O E BC) (and (@Col Tn O E AC) (and (@Col Tn O E AB2) (and (@Col Tn O E BC2) (and (@Col Tn O E AC2) (and (@Length Tn O E E' A B AB) (and (@Length Tn O E E' B C BC) (and (@Length Tn O E E' A C AC) (and (@Prod Tn O E E' AB AB AB2) (and (@Prod Tn O E E' BC BC BC2) (and (@Prod Tn O E E' AC AC AC2) (@Sum Tn O E E' AB2 BC2 SS))))))))))))) *)
exists SS.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
Qed.


Lemma length_pos_or_null : forall O E E' A B AB, Length O E E' A B AB -> Ps O E AB \/ A = B.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @LeP Tn O E E' AC BC *)
induction(eq_dec_points A B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
  right; auto.
}
(* Goal: @Lt Tn T A P A *)
{
  apply length_Ps in H.
(* Goal: @Lt Tn A T P A *)
  left; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E AB) *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  subst AB.
(* Goal: @Cong Tn A B O AB *)
  unfold Length in H.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: False *)
  treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
Qed.

Lemma not_neg_pos : forall O E A, E <> O -> Col O E A -> ~Ng O E A -> Ps O E A \/ A = O.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
induction(eq_dec_points A O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
  right; auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
  left.
(* Goal: @Ps Tn O E A *)
  unfold Out.
(* Goal: @Ps Tn O E A *)
  apply l6_4_2.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  split; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
  apply H1.
(* Goal: @Ng Tn O E A *)
  unfold Ng.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  repeat split; auto.
}
Qed.

Lemma sum_pos_null : forall O E E' A B, ~Ng O E A -> ~Ng O E B -> Sum O E E' A B O -> A = O /\ B = O.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(Col O E A /\ Col O E B /\ O <> E /\ ~Col O E E').
(* Goal: @Lt Tn T A P A *)
{
(* Goal: and (not (@Col Tn O E E')) (@Col Tn O E A) *)
(* Goal: @Ps Tn O E A *)
  unfold Sum in H1.
(* Goal: False *)
(* Goal: @eq (@Tpoint Tn) O O *)
(* Goal: @Sumg Tn O E E' O O O *)
  unfold Ar2 in H1.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  repeat split;Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
  intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun AB : @Tpoint Tn => @Length Tn O E E' A B AB) *)
  subst E.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  Col.
}
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(Ps O E A \/ A = O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) A B *)
  induction(eq_dec_points A O).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
    right; auto.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    left.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    apply (not_neg_pos O E A) in H; Col.
(* Goal: False *)
    induction H.
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      auto.
    }
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Bet Tn P A Q *)
      contradiction.
    }
  }
}
(* Goal: @eq (@Tpoint Tn) A B *)
assert(Ps O E B\/ B = O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) A B *)
  induction(eq_dec_points B O).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
    right; auto.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    left.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    apply (not_neg_pos O E B) in H0; Col.
(* Goal: @LeP Tn O E E' S2 AB2 *)
    induction H0.
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      auto.
    }
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Bet Tn P A Q *)
      contradiction.
    }
  }
}
induction H6; induction H7.
(* Goal: @Lt Tn T A P A *)
{
  assert(HH:= sum_pos_pos O E E' A B O H6 H7 H1).
  unfold Ps in HH.
  unfold Out in HH.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) M O *)
  subst B.
  assert(HH:=sum_A_O O E E' H5 A H2).
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  split; auto.
(* Goal: @Lt Tn A T P A *)
  apply (sum_uniqueness O E E' A O); auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) M O *)
  subst A.
  assert(HH:=sum_O_B O E E' H5 B H3).
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
  split; auto.
(* Goal: @Lt Tn A T P A *)
  apply (sum_uniqueness O E E' O B );auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
Qed.




Lemma length_not_neg : forall O E E' A B AB, Length O E E' A B AB -> ~Ng O E AB.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
assert(HH:= length_cong O E E' A B AB H).
(* Goal: False *)
apply length_pos_or_null in H.
(* Goal: False *)
induction H.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: False *)
  apply pos_not_neg in H.
(* Goal: @Bet Tn P A Q *)
  contradiction.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: False *)
  unfold Ng in H0.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @eq (@Tpoint Tn) M O *)
  subst B.
(* Goal: False *)
  treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
Qed.

Lemma signEq_refl : forall O E A, O <> E -> Col O E A -> A = O \/ SignEq O E A A.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
assert(HH:= sign_dec O E A H0 H).
(* Goal: or (@eq (@Tpoint Tn) A O) (@SignEq Tn O E A A) *)
unfold SignEq.
(* Goal: @eq (@Tpoint Tn) A B *)
induction HH.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  left; auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  induction H1.
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    right; left; auto.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
    right; right; auto.
  }
}
Qed.

Lemma square_not_neg : forall O E E' A A2, Prod O E E' A A A2 -> ~Ng O E A2.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
(* Goal: False *)
assert(O <> E /\ Col O E A).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: and (not (@eq (@Tpoint Tn) O E)) (@Col Tn O E A) *)
  unfold Prod in H.
(* Goal: and (not (@eq (@Tpoint Tn) O E)) (@Col Tn O E A) *)
  unfold Ar2 in H.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  split; Col.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
  intro; subst E; Col.
}
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
assert(HP:=signEq_refl O E A H1 H2).
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: False *)
induction HP.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) M O *)
  subst A.
(* Goal: False *)
  assert(HH:=prod_O_l_eq O E E' O A2 H).
(* Goal: False *)
  unfold Ng in H0.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Bet Tn P A Q *)
  contradiction.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: False *)
  assert(HH:= signeq__prod_pos O E E' A A A2 H3 H).
(* Goal: False *)
  apply pos_not_neg in HH.
(* Goal: @Bet Tn P A Q *)
  contradiction.
}
Qed.


Lemma root_uniqueness : forall O E E' A B C, ~Ng O E A -> ~Ng O E B -> Prod O E E' A A C -> Prod O E E' B B C -> A = B.
Proof.
(* Goal: forall (O E E' A B C : @Tpoint Tn) (_ : not (@Ng Tn O E A)) (_ : not (@Ng Tn O E B)) (_ : @Prod Tn O E E' A A C) (_ : @Prod Tn O E E' B B C), @eq (@Tpoint Tn) A B *)
intros O E E' A B C PA PB.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(~ Col O E E' /\ Col O E A /\ Col O E B /\ Col O E C).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: and (not (@Col Tn O E E')) (and (@Col Tn O E A) (and (@Col Tn O E B) (@Col Tn O E C))) *)
  unfold Prod in *.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Ar2 in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(HS:= sum_exists O E E' H1 A B H2 H3).
(* Goal: @eq (@Tpoint Tn) A B *)
ex_and HS ApB.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(HD:= diff_exists O E E' A B H1 H2 H3).
(* Goal: @eq (@Tpoint Tn) A B *)
ex_and HD AmB.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(Col O E ApB /\ Col O E AmB).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Sum in H5.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Diff in H6.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  ex_and H6 X.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Sum in H7.
(* Goal: and (@Col Tn O E ApB) (@Col Tn O E AmB) *)
  unfold Ar2 in *.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
}
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(HP:= prod_exists O E E' H1 ApB AmB H7 H8).
(* Goal: @eq (@Tpoint Tn) A B *)
ex_and HP PP.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(Diff O E E' C C O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply diff_null; auto.
}
(* Goal: @eq (@Tpoint Tn) A B *)
assert(HH:= diff_of_squares O E E' A B C C O ApB AmB PP H H0 H10 H5 H6 H9).
(* Goal: False *)
treat_equalities.
(* Goal: @eq (@Tpoint Tn) A B *)
assert(HH:= prod_null O E E' ApB AmB H9).
(* Goal: @eq (@Tpoint Tn) A B *)
induction (eq_dec_points A O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) M O *)
  subst A.
(* Goal: @eq (@Tpoint Tn) O B *)
  apply prod_O_l_eq in H.
(* Goal: @eq (@Tpoint Tn) A O *)
  subst C.
(* Goal: @eq (@Tpoint Tn) O B *)
  apply prod_null in H0.
(* Goal: @Lt Tn A T P A *)
  induction H0; subst B; auto.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @eq (@Tpoint Tn) A B *)
  assert(E <> O).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: not (@eq (@Tpoint Tn) A T') *)
    intro.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    subst E; Col.
  }
(* Goal: @eq (@Tpoint Tn) A B *)
  induction (eq_dec_points B O).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @eq (@Tpoint Tn) M O *)
    subst B.
(* Goal: @eq (@Tpoint Tn) A O *)
    apply prod_O_l_eq in H0.
(* Goal: @eq (@Tpoint Tn) A O *)
    subst C.
(* Goal: @eq (@Tpoint Tn) A O *)
    apply prod_null in H.
(* Goal: @Lt Tn A T P A *)
    induction H; subst A; auto.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @eq (@Tpoint Tn) A B *)
    induction HH.
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @eq (@Tpoint Tn) A B *)
      assert(Ps O E A \/ A = O).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply(not_neg_pos O E A); auto.
      }
(* Goal: @eq (@Tpoint Tn) A B *)
      assert(Ps O E B \/ B = O).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply(not_neg_pos O E B); auto.
      }
(* Goal: @eq (@Tpoint Tn) A B *)
      induction H15; induction H16; try(contradiction).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @eq (@Tpoint Tn) A B *)
        assert(HP:=sum_pos_pos O E E' A B ApB H15 H16 H5).
(* Goal: @eq (@Tpoint Tn) A B *)
        unfold Ps in HP.
(* Goal: @eq (@Tpoint Tn) A B *)
        unfold Out in HP.
(* Goal: @eq (@Tpoint Tn) A B *)
        subst ApB.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        tauto.
      }
    }
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @eq (@Tpoint Tn) A B *)
      subst AmB.
(* Goal: @eq (@Tpoint Tn) A B *)
      apply diff_null_eq in H6.
(* Goal: @Lt Tn A T P A *)
      auto.
    }
  }
}
Qed.

Lemma inter_tangent_circle : forall P Q O M, P <> Q -> Cong P O Q O -> Col P O Q
                      -> Le P M P O -> Le Q M Q O
                      -> M = O.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @eq (@Tpoint Tn) M O *)
assert(P = Q \/ Midpoint O P Q).
(* Goal: @Cong Tn A P Q A *)
apply(l7_20 O P Q H1);Cong.
(* Goal: @eq (@Tpoint Tn) M O *)
induction H4.
(* Goal: @Bet Tn P A Q *)
contradiction.
(* Goal: @eq (@Tpoint Tn) M O *)
unfold Midpoint in *.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) M O *)
assert(Le Q M P O).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Cong Tn A P Q A *)
  apply (l5_6 Q M Q O Q M  P O H3); Cong.
}
(* Goal: @eq (@Tpoint Tn) M O *)
assert(Le P M O P).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Cong Tn A P Q A *)
  apply(l5_6 P M P O P M O P); Cong.
}
(* Goal: @eq (@Tpoint Tn) M O *)
assert(Le Q M O Q).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Cong Tn A P Q A *)
  apply(l5_6 Q M Q O Q M O Q); Cong.
}
(* Goal: @eq (@Tpoint Tn) M O *)
unfold Le in H7.
(* Goal: @eq (@Tpoint Tn) M O *)
unfold Le in H8.
(* Goal: @eq (@Tpoint Tn) M O *)
ex_and H7 A.
(* Goal: @eq (@Tpoint Tn) M O *)
ex_and H8 B.
(* Goal: @Bet Tn P A Q *)
assert(Bet A O B); eBetween.
(* Goal: @eq (@Tpoint Tn) M O *)
assert(Le P Q A B).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Cong Tn A P Q A *)
  apply(triangle_inequality_2 P M Q A O B); Cong.
}

(* Goal: @eq (@Tpoint Tn) M O *)
assert(Le A B P Q).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Bet Tn P A Q *)
  apply(bet2_le2__le O O P Q A B); Between.
(* Goal: @Le Tn O A O P *)
(* Goal: @Le Tn O B O Q *)
  unfold Le.
(* Goal: @Cong Tn A P Q A *)
  exists A; Cong.
(* Goal: @Cong Tn A P Q A *)
  exists B; Cong.
}
(* Goal: @eq (@Tpoint Tn) M O *)
assert(Cong A B P Q).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn A T P A *)
  apply le_anti_symmetry; auto.
}

(* Goal: @eq (@Tpoint Tn) M O *)
assert(B = Q /\ P = A).
(* Goal: @Bet Tn P A Q *)
apply(bet_cong_eq P A B Q);eBetween.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @eq (@Tpoint Tn) M O *)
subst A.
(* Goal: @eq (@Tpoint Tn) M O *)
subst B.
(* Goal: @eq (@Tpoint Tn) M O *)
clean_trivial_hyps.
(* Goal: @Cong Tn A P Q A *)
assert(Cong Q M O P); eCong.
(* Goal: @Cong Tn A P Q A *)
assert(Cong Q M P M); eCong.
(* Goal: @eq (@Tpoint Tn) M O *)
assert(O = M).
(* Goal: @Lt Tn T A P A *)
{
  apply(l4_18 P Q O M); Col;
(* Goal: @Cong Tn A P Q A *)
  induction(eq_dec_points M O); Cong.
}
(* Goal: @Lt Tn A T P A *)
auto.
Qed.

Lemma inter_circle_per : forall P Q A T M, Cong P A Q A 
                          -> Le P M P A -> Le Q M Q A 
                          ->  Projp A T P Q -> Per P T M -> Le T M T A.

Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(HH:=lower_dim).
set(O:=PA) in *.
set(E:=PB) in *.
set(E':=PC) in *.
assert(HD:~Col O E E').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply HH.
unfold Col in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
clear HH.

(* Goal: @Lt Tn T A P A *)
induction(eq_dec_points P T).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  subst T.
(* Goal: @Lt Tn A T P A *)
  auto.
}

(* Goal: @Lt Tn T A P A *)
{
  unfold Projp in H2.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
  induction H5.
(* Goal: @Lt Tn T A P A *)
  spliter.

  assert(HX:O<>E).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Col Tn T P Q *)
    ColR.
  }
  assert(Per P T A).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (perp_col _ _ _ _ T) in H6; auto.
    apply perp_left_comm in H6.
    apply perp_perp_in in H6.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
    apply perp_in_comm in H6.
    apply perp_in_per in H6.
(* Goal: @Per Tn P T A *)
    assumption.
  }

  assert(Py:= pyth_context O E E' P T A HD).
  ex_and Py PT .
  ex_and H8 TA .
  ex_and H9 AP.
  ex_and H8 PT2.
  ex_and H9 TA2.
  ex_and H8 AP2.
  ex_and H9 SS.

  assert(Pyth : Sum O E E' PT2 TA2 AP2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(pythagoras O E E' P A T PT TA AP PT2 TA2 AP2 HX); auto.
(* Goal: @Lt Tn A T P A *)
    apply length_sym;auto.
  }
  assert(HE: SS = AP2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(sum_uniqueness O E E' PT2 TA2); auto.
  }
  subst SS.
(* Goal: @Lt Tn A T P A *)
  apply sum_comm in Pyth; auto.
  apply sum_diff in Pyth.

  assert(Py:= pyth_context O E E' P T M HD).
  ex_and Py PT' .
  ex_and H21 TM .
  ex_and H22 PM.
  ex_and H21 PT2'.
  ex_and H22 TM2.
  ex_and H21 PM2.
  ex_and H22 SS'.
  assert(PT=PT').
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (length_uniqueness O E E' P T); auto.
  }
  subst PT'.
  assert(PT2=PT2').
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (prod_uniqueness O E E' PT PT); auto.
  }
  subst PT2'.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
  clean_duplicated_hyps.
  assert(PythM : Sum O E E' PT2 TM2 PM2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(pythagoras O E E' P M T PT TM PM PT2 TM2 PM2 HX); auto.
(* Goal: @Lt Tn A T P A *)
    apply length_sym;auto.
  }
  assert(SS'=PM2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (sum_uniqueness O E E' PT2 TM2); auto.
  }
  subst SS'.
(* Goal: @Le Tn T M T A *)
  induction(eq_dec_points T M).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    subst T.
(* Goal: @Le Tn T T T A *)
    apply le_trivial.
  }
  
(* Goal: @Lt Tn T A P A *)
  {
    induction(eq_dec_points P M).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Le Tn T M T A *)
      subst M.

      assert(HH:= length_id_2 O E E' P HX).
      assert(PM = O).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply (length_uniqueness O E E' P P); auto.
      }
      subst PM.
      assert(PM2=O).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
         apply(prod_O_l_eq O E E' O);auto.
      }
      subst PM2.
      apply(sum_pos_null) in H33.
(* Goal: @Lt Tn T A P A *)
      spliter.
      subst PT2.
      apply prod_null in H17.
(* Goal: or (@Bet Tn O P E) (@Bet Tn O E P) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
(* Goal: or (@LtP Tn O E E' AB CD) (@eq (@Tpoint Tn) AB CD) *)
      induction H17.
(* Goal: @Lt Tn T A P A *)
      {
        subst PT.
        apply length_cong in H14.
(* Goal: False *)
        treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        tauto.
      }
(* Goal: @Lt Tn T A P A *)
      {
        subst PT.
        apply length_cong in H14.
(* Goal: False *)
        treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        tauto.
      }
(* Goal: @Lt Tn A T P A *)
       apply (square_not_neg O E E' PT); auto.
(* Goal: @Lt Tn A T P A *)
       apply (square_not_neg O E E' TM); auto.
    }
(* Goal: @Lt Tn T A P A *)
    {
      assert(LeP O E E' PM AP).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply(length_leP_le_2 O E E' P M P A PM AP); auto.
      }
      assert(LeP O E E' PM2 AP2).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply(square_increase O E E' PM AP); auto.
        unfold Ar2.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
        repeat split; auto.
(* Goal: @Lt Tn A T P A *)
        apply (length_Ps O E E' P M); auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
(* Goal: False *)
        treat_equalities.
        set(O:=PA) in *.
        subst PM.
        assert(PM2=O).
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: @Lt Tn A T P A *)
          apply(prod_O_l_eq O E E' O);auto.
        }
        subst PM2.
        apply length_id_1 in H29.
(* Goal: @Bet Tn P A Q *)
        contradiction.
        apply length_pos_or_null in H16.
        induction H16.
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: @Per Tn P T A *)
          assumption.
        }
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: False *)
          treat_equalities.
          assert(HH:= length_id_2 O E E' Q  HX).
          assert(HP:=length_uniqueness O E E' Q Q O PM HH H29).
(* Goal: False *)
          treat_equalities.
          apply(prod_O_l_eq)in H32.
          subst PM2.
          apply sum_pos_null in H33.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
          spliter; tauto.
          apply(square_not_neg O E E' PT PT2 H17).
          apply(square_not_neg O E E' TM TM2 H31).
        }
      }
(* Goal: @Lt Tn A T P A *)
      apply sum_comm in H33; auto.
(* Goal: @Lt Tn A T P A *)
      apply sum_comm in H20; auto.
      assert(HH:=sum_preserves_lep_rev O E E' TM2 TA2 PT2 PM2 AP2 H33 H20 H30).
      induction(eq_dec_points TA TM).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: False *)
        treat_equalities.
        assert(Cong T M T A).
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: @Lt Tn A T P A *)
          apply(length_eq_cong_1 O E E' _ _ _ _ TA); auto.
        }
(* Goal: @Lt Tn A T P A *)
        apply cong__le; auto.
      }
      assert(LtP O E E' TM2 TA2).
(* Goal: @Lt Tn T A P A *)
      {
        apply(lep_neq__ltp O E E').
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
        split; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        apply H34.
        subst TM2.
(* Goal: @Lt Tn A T P A *)
        apply(root_uniqueness O E E' TA TM TA2); auto.
(* Goal: @Lt Tn A T P A *)
        apply(length_not_neg O E E' T A); auto.
(* Goal: @Lt Tn A T P A *)
        apply(length_not_neg O E E' T M); auto.
      }

      assert(LtP O E E' TM TA).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply (square_increase_rev O E E' TM TA TM2 TA2); auto.
(* Goal: @Lt Tn A T P A *)
        apply length_Ps in H28; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        subst TM.
        apply length_id_1 in H28.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        tauto.
(* Goal: @Lt Tn A T P A *)
        apply length_Ps in H15; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        subst TA.
        apply length_id_1 in H15.
(* Goal: @Lt Tn T A P A *)
        subst T.
        apply perp_distinct in H6.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        tauto.
      }
(* Goal: @Le Tn E F B C *)
      apply lt__le.
(* Goal: @Lt Tn A T P A *)
      apply (ltp_to_lt O E E' T M TM T A TA); auto.
    }
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
    assert(HH:=(inter_tangent_circle P Q A M H2 H)).
    assert(M = A).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
      apply HH; Col.
    }
(* Goal: @Le Tn T M T A *)
    subst M.
(* Goal: @eq (@Tpoint Tn) O O *)
    apply le_reflexivity.
  }
}
Qed.

Lemma inter_circle_obtuse : forall P Q A T M, Cong P A Q A 
                          -> Le P M P A -> Le Q M Q A 
                          ->  Projp A T P Q -> Obtuse P T M \/ Per P T M -> Le T M T A.

Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
assert(HH:=lower_dim).
set(O:=PA) in *.
set(E:=PB) in *.
set(E':=PC) in *.
assert(HD:~Col O E E').
(* Goal: not (@eq (@Tpoint Tn) A T') *)
intro.
apply HH.
unfold Col in H4.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
tauto.
clear HH.

(* Goal: @Lt Tn T A P A *)
induction(eq_dec_points P T).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  subst T.
(* Goal: @Lt Tn A T P A *)
  auto.
}
(* Goal: @Lt Tn T A P A *)
{
  unfold Projp in H2.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: or (@Bet Tn A' B' C') (@Bet Tn A' C' B') *)
  induction H5.
(* Goal: @Lt Tn T A P A *)
  spliter.

  assert(HX:O<>E).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Col Tn T P Q *)
    ColR.
  }
  assert(Per P T A).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (perp_col _ _ _ _ T) in H6; auto.
    apply perp_left_comm in H6.
    apply perp_perp_in in H6.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
    apply perp_in_comm in H6.
    apply perp_in_per in H6.
(* Goal: @Per Tn P T A *)
    assumption.
  }

  assert(Py:= pyth_context O E E' P T A HD).
  ex_and Py PT .
  ex_and H8 TA .
  ex_and H9 AP.
  ex_and H8 PT2.
  ex_and H9 TA2.
  ex_and H8 AP2.
  ex_and H9 SS.

  assert(Py:= pyth_context O E E' P T M HD).
  ex_and Py PT' .
  ex_and H21 TM .
  ex_and H22 PM.
  ex_and H21 PT2'.
  ex_and H22 TM2.
  ex_and H21 PM2.
  ex_and H22 SS'.
  assert(PT=PT').
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (length_uniqueness O E E' P T); auto.
  }
  subst PT'.
  assert(PT2=PT2').
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply (prod_uniqueness O E E' PT PT); auto.
  }
  subst PT2'.
(* Goal: @Bet Tn A' B' C' *)
(* Goal: @Bet Tn A' B' C' *)
  clean_duplicated_hyps.

  assert(Pyth : Sum O E E' PT2 TA2 AP2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(pythagoras O E E' P A T PT TA AP PT2 TA2 AP2 HX); auto.
(* Goal: @Lt Tn A T P A *)
    apply length_sym;auto.
  }
  assert(HE: SS = AP2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(sum_uniqueness O E E' PT2 TA2); auto.
  }
  subst SS.
  assert(Pyth1 : LeP O E E' SS' PM2).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn A T P A *)
    apply(pythagoras_obtuse_or_per O E E' P M T PT TM PM PT2 TM2 PM2 SS'); auto.
(* Goal: @Lt Tn A T P A *)
    apply length_sym; auto.
  }
(* Goal: @Le Tn T M T A *)
  induction(eq_dec_points T M).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Le Tn T M T A *)
    subst M.
(* Goal: @Le Tn T T T A *)
    apply le_trivial.
  }
(* Goal: @Lt Tn T A P A *)
  {
    induction(eq_dec_points P M).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Le Tn T M T A *)
      subst M.
      assert(HH:= length_id_2 O E E' P HX).
      assert(PM = O).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply (length_uniqueness O E E' P P); auto.
      }
      subst PM.
      assert(PM2=O).
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
         apply(prod_O_l_eq O E E' O);auto.
      }
      subst PM2.

      assert(Ps O E SS').
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        apply(sum_pos_pos O E E' PT2 TM2 SS'); auto.
(* Goal: @Lt Tn A T P A *)
        apply (square_pos O E E' PT); auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        subst PT.
        apply length_cong in H14.
        apply cong_identity in H14.
(* Goal: @Bet Tn P A Q *)
        contradiction.

(* Goal: @Lt Tn A T P A *)
        apply (square_pos O E E' TM); auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        subst TM.
        apply length_cong in H28.
        apply cong_identity in H28.
(* Goal: @Bet Tn P A Q *)
        contradiction.
      }
      unfold LeP in Pyth1.
      induction Pyth1.
      apply (ltP_neg) in H27.
      apply pos_not_neg in H24.
(* Goal: @Bet Tn P A Q *)
      contradiction.
      subst SS'.
      unfold Ps in H24.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
      unfold Out in H24;tauto.
    }
    assert(LeP O E E' PM AP).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      apply(length_leP_le_2 O E E' P M P A PM AP); auto.
    }
    assert(LeP O E E' PM2 AP2).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      apply(square_increase O E E' PM AP); auto.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
      repeat split; auto.
      apply length_pos_or_null in H29.
      induction H29.
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        auto.
      }
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        treat_equalities; tauto.
      }

      apply length_pos_or_null in H16.
      induction H16.
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        auto.
      }
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        treat_equalities; tauto.
      }
    }
    assert(LeP O E E' SS' AP2).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      apply (leP_trans O E E' SS' PM2 AP2); auto.
    }
    assert(LeP O E E' TM2 TA2).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      apply(sum_preserves_lep_rev O E E' TM2 TA2 PT2 SS' AP2); auto.
(* Goal: @Lt Tn A T P A *)
      apply sum_comm; auto.
(* Goal: @Lt Tn A T P A *)
      apply sum_comm; auto.
    }
    
    assert(Ps O E  TM).
(* Goal: @Lt Tn T A P A *)
    {
      apply length_pos_or_null in H28.
      induction H28.
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        auto.
      }
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        treat_equalities; tauto.
      }
    }
    assert(Ps O E  TA).
(* Goal: @Lt Tn T A P A *)
    {
      apply length_pos_or_null in H15.
      induction H15.
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn A T P A *)
        auto.
      }
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Lt Tn T A P A *)
        subst T.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
        apply perp_distinct in H6; tauto.
      }
    }


    assert(LeP  O E E' TM TA).
(* Goal: @Lt Tn T A P A *)
    {
      induction(eq_dec_points TM TA).
(* Goal: @Lt Tn T A P A *)
      {
        subst TM.
(* Goal: @LeP Tn O E E' AB2 AB2 *)
        apply leP_refl.
      }
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @LeP Tn O E E' S2 AB2 *)
        apply ltp_to_lep.
(* Goal: @Lt Tn A T P A *)
        apply (square_increase_rev O E E' TM TA TM2 TA2); auto.
        apply(lep_neq__ltp O E E').
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
        split; auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        apply H38.
        subst TM2.
(* Goal: @Lt Tn A T P A *)
        apply (root_uniqueness O E E' TM TA TA2); auto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        apply pos_not_neg in H36.
(* Goal: @Bet Tn P A Q *)
        contradiction.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
        intro.
        apply pos_not_neg in H37.
(* Goal: @Bet Tn P A Q *)
        contradiction.
      }
    }
(* Goal: @Lt Tn A T P A *)
    apply(length_leP_le_1 O E E' T M  T A TM TA); auto.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
    assert(HH:=(inter_tangent_circle P Q A M H2 H)).
    assert(M = A).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
      apply HH; Col.
    }
(* Goal: @Le Tn T M T A *)
    subst M.
(* Goal: @eq (@Tpoint Tn) O O *)
    apply le_reflexivity.
  }
}
Qed.

Lemma circle_projp_between : forall P Q A T, Cong P A Q A 
                          ->  Projp A T P Q -> Bet P T Q.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.

(* Goal: @Lt Tn T A P A *)
induction(eq_dec_points P T).
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Bet Tn P A Q *)
  subst T; Between.
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  unfold Projp in H0.
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Bet Tn P T Q *)
  induction H2.
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Bet Tn P T Q *)
    assert(Per A T P).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      apply (perp_col _ _ _ _ T) in H3; auto.
(* Goal: @Per Tn A T P *)
      apply perp_left_comm in H3.
(* Goal: @Per Tn A T P *)
      apply perp_perp_in in H3.
(* Goal: @Per Tn A T P *)
      apply perp_in_comm in H3.
(* Goal: @Per Tn A T P *)
      apply perp_in_per in H3.
(* Goal: @Per Tn A T P *)
      apply l8_2.
(* Goal: @Per Tn P T A *)
      assumption.
    }
(* Goal: @Bet Tn P T Q *)
    assert(HM:=midpoint_existence P Q).
(* Goal: @Bet Tn P T Q *)
    ex_and HM T'.
(* Goal: @Bet Tn P T Q *)
    assert(Per A T' P).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Per Tn A T' P *)
      unfold Per.
(* Goal: @ex (@Tpoint Tn) (fun C' : @Tpoint Tn => and (@Midpoint Tn T' P C') (@Cong Tn A P A C')) *)
      exists Q.
(* Goal: @Cong Tn A P Q A *)
      split; Cong.
    }
(* Goal: @Bet Tn P T Q *)
    assert(T' = T \/ ~ Col T P Q).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
      apply(col_per2_cases A T' P Q T); Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: False *)
      treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
      apply perp_distinct in H3; tauto.
    }
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
    induction H7.
(* Goal: @Bet Tn P T Q *)
    subst T'.
(* Goal: @Bet Tn P A Q *)
    Between.
(* Goal: @Bet Tn P T Q *)
    assert(Col T A T').
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
      apply(col_perp2_ncol__col A T A T' P Q); Col.
(* Goal: @Per Tn Q P A *)
      Perp.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@Col Tn A P Q) *)
      apply per_perp_in in H6.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
      apply perp_in_comm in H6.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
      apply perp_in_perp in H6.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
      apply perp_sym in H6.
(* Goal: @Perp Tn A T' P Q *)
(* Goal: not (@eq (@Tpoint Tn) A T') *)
(* Goal: not (@eq (@Tpoint Tn) T' P) *)
(* Goal: not (@Col Tn A P Q) *)
      apply perp_sym.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
      apply (perp_col _ T'); Perp; Col.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: False *)
      treat_equalities.
(* Goal: @Lt Tn T A P A *)
      unfold Midpoint in H5; spliter.
(* Goal: @Col Tn T P Q *)
      apply H7; ColR.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: @Bet Tn P T Q *)
      subst T'.
(* Goal: False *)
(* Goal: not (@Col Tn A P Q) *)
      apply is_midpoint_id in H5.
(* Goal: @Bet Tn P A Q *)
      contradiction.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: False *)
      apply H7.
(* Goal: @Col Tn T P Q *)
      ColR.
    }
(* Goal: @Bet Tn P T Q *)
    assert(T=T').
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Per Tn Q P A *)
      apply(per2_col_eq A T T' P); Perp.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: False *)
      treat_equalities.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
      apply perp_distinct in H3; tauto.
(* Goal: not (@eq (@Tpoint Tn) A T') *)
      intro.
(* Goal: False *)
      treat_equalities.
(* Goal: @Lt Tn T A P A *)
      unfold Midpoint in H5; spliter.
(* Goal: @Col Tn T P Q *)
      apply H7; ColR.
    }
(* Goal: @Bet Tn P T Q *)
    subst T'.
(* Goal: @Bet Tn P A Q *)
    Between.
  }
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn T A P A *)
  subst T.
(* Goal: @Bet Tn P A Q *)
  assert(P = Q \/ Midpoint A P Q).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
    apply(l7_20 A P Q); Col.
(* Goal: @Cong Tn A P Q A *)
    Cong.
  }
(* Goal: @Bet Tn P A Q *)
  induction H3.
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Bet Tn P A Q *)
    contradiction.
  }
(* Goal: @Bet Tn P A Q *)
  Between.
}
Qed.


Lemma inter_circle : forall P Q A T M, Cong P A Q A 
                          -> Le P M P A -> Le Q M Q A 
                          ->  Projp A T P Q -> Le T M T A.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.
(* Goal: @Le Tn T M T A *)
assert(HH:= circle_projp_between P Q A T H H2).
(* Goal: @Le Tn T M T A *)
induction(eq_dec_points T M).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Le Tn T M T A *)
    subst M.
(* Goal: @Le Tn T T T A *)
    apply le_trivial.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    induction(eq_dec_points P T).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      treat_equalities; auto.
    }
(* Goal: @Le Tn T M T A *)
    assert(HA:= angle_partition P T M H4 H3).
(* Goal: @Le Tn T M T A *)
    induction(eq_dec_points Q T).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      treat_equalities; auto.
    }
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Le Tn T M T A *)
      induction HA.
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Le Tn T M T A *)
        assert(HB:= acute_bet__obtuse P T M Q HH H5 H6).
(* Goal: @Cong Tn A P Q A *)
        apply(inter_circle_obtuse Q P); Cong.
(* Goal: @Projp Tn A T Q P *)
        unfold Projp in *.
(* Goal: @Lt Tn T A P A *)
        spliter.
(* Goal: and (not (@eq (@Tpoint Tn) Q P)) (or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T))) *)
        split; auto.
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
        induction H7.
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
          left.
(* Goal: @Lt Tn T A P A *)
          spliter.
(* Goal: @Per Tn Q P A *)
          split; Col; Perp.
        }
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: or (and (@Col Tn Q P T) (@Perp Tn Q P A T)) (and (@Col Tn Q P A) (@eq (@Tpoint Tn) A T)) *)
          right.
(* Goal: @Lt Tn T A P A *)
          spliter.
(* Goal: not (@Col Tn A C' H') *)
(* Goal: @Pj Tn C' H' B C *)
(* Goal: @Prodg Tn O E E' AC' AC P *)
(* Goal: iff (@Prod Tn O E E' AC AC AC2) (@Prod Tn O E E' AB AH AC2) *)
          split; Col.
        }
      }
(* Goal: @Lt Tn T A P A *)
      {
(* Goal: @Cong Tn A P Q A *)
        apply(inter_circle_obtuse P Q); Cong.
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
        induction H6.
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: or (@Obtuse Tn P T M) (@Per Tn P T M) *)
          right; auto.
        }
(* Goal: @Lt Tn T A P A *)
        {
(* Goal: @Lt Tn A T P A *)
          left; auto.
        }
      }
    }
  }
Qed.


Lemma projp_lt : forall P Q A T, Cong P A Q A 
                          ->  Projp A T P Q -> Lt T A P A.
Proof.
(* Goal: forall (P Q A T : @Tpoint Tn) (_ : @Cong Tn P A Q A) (_ : @Projp Tn A T P Q), @Lt Tn T A P A *)
intros.

(* Goal: @Lt Tn T A P A *)
unfold Projp in H0.
(* Goal: @Lt Tn T A P A *)
spliter.
(* Goal: @Lt Tn T A P A *)
induction H1.
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  spliter.

(* Goal: @Lt Tn T A P A *)
  induction(eq_dec_points P T).
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    subst T.
(* Goal: @Lt Tn P A P A *)
    assert(Lt Q P Q A /\ Lt A P Q A).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: and (@Lt Tn Q P Q A) (@Lt Tn A P Q A) *)
      apply(per_lt Q P A).
(* Goal: @Lt Tn A T P A *)
      auto.
(* Goal: not (@eq (@Tpoint Tn) A T) *)
(* Goal: @Per Tn P T A *)
      apply perp_distinct in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
      tauto.
(* Goal: @Per Tn Q P A *)
      Perp.
    }
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Lt Tn P A P A *)
    unfold Lt in H4.
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Lt Tn P A P A *)
    apply False_ind.
(* Goal: False *)
    apply H5.
(* Goal: @Cong Tn A P Q A *)
    Cong.
  }
(* Goal: @Lt Tn T A P A *)
  {
(* Goal: @Lt Tn T A P A *)
    assert(Lt P T P A /\ Lt A T P A).
(* Goal: @Lt Tn T A P A *)
    {
(* Goal: @Lt Tn A T P A *)
      apply(per_lt P T A); auto.
(* Goal: not (@eq (@Tpoint Tn) A T) *)
(* Goal: @Per Tn P T A *)
      apply perp_distinct in H2.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
      tauto.
      apply (perp_col  _ _ _ _ T)  in H2;
(* Goal: @Per Tn Q P A *)
      Perp.
    }
(* Goal: @Lt Tn T A P A *)
    spliter.
(* Goal: @Lt Tn T A P A *)
    apply lt_left_comm.
(* Goal: @Lt Tn A T P A *)
    auto.
  }
}
(* Goal: @Lt Tn T A P A *)
{
(* Goal: @Lt Tn T A P A *)
  spliter.
(* Goal: @Lt Tn T A P A *)
  subst T.
(* Goal: @Lt Tn A A P A *)
  induction(eq_dec_points P A).
(* Goal: @Lt Tn A A P A *)
(* Goal: @Lt Tn A A P A *)
  subst P.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  apply cong_symmetry in H.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  apply cong_identity in H.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  subst Q.
(* Goal: @Lt Tn A A A A *)
(* Goal: @Lt Tn A A P A *)
  tauto.
(* Goal: @Lt Tn A T P A *)
  apply lt1123; auto.
}
Qed.



End T15.
