(* Gabriel Braun February 2013 *)

Require Export GeoCoq.Tarski_dev.Annexes.quadrilaterals_inter_dec.

Section Vectors.

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

Lemma eqv_refl : forall A B, EqV A B A B.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D')))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D'))))) *)
unfold EqV.
(* Goal: @Same_dir Tn A B D C *)
induction (eq_dec_points A B).
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
split; auto.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Parallelogram_flat Tn A B B A *)
apply plgf_trivial.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma eqv_sym : forall A B C D, EqV A B C D -> EqV C D A B.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma eqv_trans : forall A B C D E F, EqV A B C D -> EqV C D E F -> EqV A B E F.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.

(* Goal: @eq (@Tpoint Tn) D D' *)
induction H; induction H0.
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
assert(Parallelogram A B F E \/ A = B /\ D = C /\ E = F /\ A = E).
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (and (@eq (@Tpoint Tn) D C) (and (@eq (@Tpoint Tn) E F) (@eq (@Tpoint Tn) A E)))) *)
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
(* Goal: or (@Parallelogram Tn A B F E) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) E F)) *)
apply (plg_pseudo_trans A B D C E F); auto.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @EqV Tn C C E F *)
subst F.
(* Goal: @Same_dir Tn A B D C *)
induction (eq_dec_points A B).
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
unfold TS in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: or (@Bet Tn C C' D) (@Bet Tn C D C') *)
(* Goal: @Bet Tn D C C' *)
apply H3.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_sym in H.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
unfold TS in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @EqV Tn C C E F *)
subst F.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma eqv_comm : forall A B C D, EqV A B C D -> EqV B A D C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma vector_construction : forall A B C, exists D, EqV A B C D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Same_dir Tn A B D C *)
induction (eq_dec_points A B).
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @ex (@Tpoint Tn) (fun D : @Tpoint Tn => @EqV Tn A B C D) *)
assert(HH:= midpoint_existence B C).
(* Goal: @Parallelogram_strict Tn A B' C' D *)
ex_and HH M.
(* Goal: @ex (@Tpoint Tn) (fun D : @Tpoint Tn => @EqV Tn A B C D) *)
prolong A M D A M.
(* Goal: @ex (@Tpoint Tn) (fun T : @Tpoint Tn => and (@Col Tn T D A) (@Bet Tn C T C')) *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
exists D.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Parallelogram Tn A B D C *)
apply (mid_plg _ _ _ _ M).

(* Goal: or (not (@eq (@Tpoint Tn) A D)) (not (@eq (@Tpoint Tn) B C)) *)
(* Goal: @Midpoint Tn M A D *)
(* Goal: @Midpoint Tn M B C *)
induction(eq_dec_points A D).
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: @Midpoint Tn B A C *)
(* Goal: @Midpoint Tn B A C *)
apply l7_3 in H0.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
apply between_identity in H1.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
subst M.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Midpoint Tn M A D *)
(* Goal: @Midpoint Tn M B C *)
split; Cong.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma vector_construction_uniqueness :
 forall A B C D D',
 EqV A B C D ->
 EqV A B C D' ->
 D = D'.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.
(* Goal: @eq (@Tpoint Tn) D D' *)
induction H; induction H0.
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
apply plg_comm2 in H.
(* Goal: @eq (@Tpoint Tn) D D' *)
(* Goal: @eq (@Tpoint Tn) D D' *)
(* Goal: @eq (@Tpoint Tn) D D' *)
(* Goal: @eq (@Tpoint Tn) D D' *)
apply plg_comm2 in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
apply (plg_uniqueness B A C); auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
unfold TS in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @eq (@Tpoint Tn) D C *)
(* Goal: @eq (@Tpoint Tn) D D' *)
(* Goal: @eq (@Tpoint Tn) D D' *)
apply (plgf_trivial_neq A D C ).
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
unfold TS in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @eq (@Tpoint Tn) C D' *)
(* Goal: @eq (@Tpoint Tn) D D' *)
apply plgf_comm2 in H.
(* Goal: @eq (@Tpoint Tn) C D' *)
(* Goal: @eq (@Tpoint Tn) D D' *)
apply (plgf_trivial_neq A C D').
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.

Lemma null_vector : forall A B C, EqV A A B C -> B = C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Midpoint Tn B A C *)
unfold EqV in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
unfold TS in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma vector_uniqueness : forall A B C, EqV A B A C -> B = C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Midpoint Tn B A C *)
unfold EqV in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
unfold TS in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
apply H2.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Bet Tn A B C' *)
(* Goal: @Bet Tn D C C' *)
apply plgf_permut in H.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_sym in H.
(* Goal: @eq (@Tpoint Tn) B C *)
(* Goal: @eq (@Tpoint Tn) B C *)
apply (plgf_trivial_neq A B C ).
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) B C *)
subst A.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.

Lemma eqv_trivial : forall A B , EqV A A B B.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D')))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D'))))) *)
unfold EqV.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma eqv_permut :
  forall A B C D,
  EqV A B C D ->
  EqV A C B D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn A C B D *)
induction (eq_dec_points A C).
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: @EqV Tn A A B D *)
(* Goal: @EqV Tn A C B D *)
assert(B = D).
(* Goal: @eq (@Tpoint Tn) B D *)
(* Goal: @EqV Tn A A B D *)
(* Goal: @EqV Tn A C B D *)
apply (vector_uniqueness A).
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @EqV Tn C C E E *)
apply eqv_trivial.

(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Parallelogram Tn A C C' A' *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
apply plg_permut.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @Parallelogram Tn A C C A *)
apply plg_trivial.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma eqv_par :
 forall A B C D,
  A <> B ->
  EqV A B C D ->
  Par A B C D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold EqV in H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: @Par Tn A B C D *)
(* Goal: @Par Tn A B C D *)
unfold Parallelogram in H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: @Par Tn A B C D *)
(* Goal: @Par Tn A B C D *)
(* Goal: @Par Tn A B C D *)
unfold Parallelogram_strict in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Par Tn A B D C *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply par_right_comm.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold Parallelogram_flat in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
repeat split; Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @Col Tn A C D *)
(* Goal: @Col Tn B C D *)
(* Goal: @Par Tn A B C D *)
apply cong_identity in H2.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.

(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
Qed.

Lemma eqv_opp_null :
  forall A B,
  EqV A B B A ->
  A = B.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Midpoint Tn B A C *)
unfold EqV in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_irreflexive in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma eqv_sum :
  forall A B C A' B' C',
  EqV A B A' B' ->
  EqV B C B' C' ->
  EqV A C A' C'.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.

(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
apply plg_comm2 in H.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plg_permut in H.
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
apply plg_permut in H0.
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
apply plg_sym in H0.
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
assert(HH:= plg_pseudo_trans A A' B' B C C' H H0).
(* Goal: @Parallelogram_strict Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
induction HH.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Parallelogram Tn A C C' A' *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
apply plg_permut.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C') *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
(* Goal: or (@Parallelogram Tn A C C' A') (and (@eq (@Tpoint Tn) A C) (@eq (@Tpoint Tn) A' C')) *)
subst A'.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
subst B'.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma null_sum :
 forall A B C,
  SumV A B B A C C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @SumV Tn A B C D A F *)
unfold SumV.
(* Goal: forall (D' : @Tpoint Tn) (_ : @EqV Tn B C B D'), @EqV Tn A D' A C *)
intros D H.
(* Goal: @EqV Tn A D C C *)
assert(A = D).
(* Goal: @eq (@Tpoint Tn) C D *)
(* Goal: @EqV Tn A D A C *)
apply (vector_uniqueness B).
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @EqV Tn C C E E *)
apply eqv_trivial.
Qed.

Lemma chasles :
 forall A B C,
  SumV A B B C A C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @SumV Tn A B C D A F *)
unfold SumV.
(* Goal: forall (D' : @Tpoint Tn) (_ : @EqV Tn B C B D'), @EqV Tn A D' A C *)
intros D H.
(* Goal: @EqV Tn A D A C *)
assert(C = D).
(* Goal: @eq (@Tpoint Tn) C D *)
(* Goal: @EqV Tn A D A C *)
apply (vector_uniqueness B).
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @EqV Tn A B A B *)
apply eqv_refl.
Qed.

Lemma eqv_mid :
 forall A B C,
  EqV A B B C ->
  Midpoint B A C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Midpoint Tn B A C *)
unfold EqV in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @Midpoint Tn B A C *)
(* Goal: @Midpoint Tn B A C *)
apply plg_mid in H.
(* Goal: @Midpoint Tn B A C *)
(* Goal: @Midpoint Tn B A C *)
ex_and H M.
(* Goal: @Midpoint Tn B A C *)
(* Goal: @Midpoint Tn B A C *)
apply l7_3 in H0.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
subst M.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @Midpoint Tn A A A *)
apply l7_3_2.
Qed.

Lemma mid_eqv :
  forall A B C, Midpoint A B C ->
  EqV B A A C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D')))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D'))))) *)
unfold EqV.
(* Goal: @Same_dir Tn A B D C *)
induction(eq_dec_points A B).
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: or (@Parallelogram Tn A A C A) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Parallelogram Tn B A C A) (and (@eq (@Tpoint Tn) B A) (@eq (@Tpoint Tn) A C)) *)
apply is_midpoint_id in H.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.

(* Goal: @Parallelogram Tn B A C A *)
apply (mid_plg _ _ _ _ A).
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: False *)
(* Goal: @Midpoint Tn A B C *)
(* Goal: @Midpoint Tn A A A *)
apply l7_3 in H.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Midpoint Tn M0 D' C *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
Midpoint.
Qed.


Lemma sum_sym :
  forall A B C D E F,
  SumV A B C D E F ->
  SumV C D A B E F.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn E F E' F' *)
unfold SumV in *.
(* Goal: @EqV Tn E F E' F' *)
assert(HH:=vector_construction C D B).
(* Goal: @EqV Tn E F E' F' *)
ex_and HH D'.


(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@EqV Tn B D' C D) (@EqV Tn A D' E F)) *)
assert(HH:= (H D' H0)).
(* Goal: @EqV Tn B D0 F E *)
clear H.

(* Goal: @EqV Tn C D'0 E F *)
assert(EqV C B D D').
(* Goal: @EqV Tn A B C D'0 *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply eqv_permut.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @EqV Tn C D'0 E F *)
assert(EqV A D B D'0).
(* Goal: @EqV Tn A B C D'0 *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply eqv_permut.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @EqV Tn C D'0 E F *)
induction (eq_dec_points A D'0).
(* Goal: @EqV Tn A D'0 E F *)
subst D'0.

(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply eqv_comm in H1.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
assert(HP:= (eqv_mid B A D H1)).

(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold EqV in H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply plg_mid in H0.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
ex_and H0 M.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
assert( A = M).
(* Goal: @eq (@Tpoint Tn) M1 M0 *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply (l7_17 B D).
(* Goal: @Midpoint Tn A B D *)
(* Goal: @Midpoint Tn M B D *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply HP.
(* Goal: @Midpoint Tn M0 D' C *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
Midpoint.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
subst M.

(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply mid_eqv in H0.
(* Goal: @EqV Tn E F E' F' *)
apply (eqv_trans _ _ A D').
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply (eqv_trans _ _ A B).
(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @EqV Tn D' A F E *)
apply eqv_comm.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H0; induction H1.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply plg_mid in H0.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply plg_mid in H1.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
ex_and H0 M0.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
ex_and H1 M1.

(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
assert(M1 = M0).
(* Goal: @eq (@Tpoint Tn) M1 M0 *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply (l7_17 B D).
(* Goal: @Bet Tn A B D' *)
(* Goal: @Bet Tn B D' C *)
(* Goal: not (@eq (@Tpoint Tn) B D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H5.
(* Goal: @Midpoint Tn M0 D' C *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
Midpoint.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
subst M1.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
assert(Parallelogram A D' D'0 C).
(* Goal: @Parallelogram Tn A D' D'0 C *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply (mid_plg _ _ _ _ M0).
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Midpoint Tn M0 D' C *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
Midpoint.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
assert(EqV C D'0 A D').
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D')))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D'))))) *)
unfold EqV.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @EqV Tn E F E' F' *)
apply (eqv_trans _ _ A D').
(* Goal: @OS Tn B C D A *)
(* Goal: @OS Tn B C D B' *)
(* Goal: @Bet Tn D C C' *)
apply H7.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @EqV Tn A D'0 E F *)
subst D'0.
(* Goal: @EqV Tn C D E F *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
assert(EqV C D A D').
(* Goal: @EqV Tn A B C D'0 *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply eqv_permut.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @EqV Tn E F E' F' *)
apply (eqv_trans _ _ A D').
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.

(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
assert(EqV A B C D'0).
(* Goal: @EqV Tn A B C D'0 *)
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply eqv_permut.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @EqV Tn C D'0 E F *)
(* Goal: @EqV Tn C D'0 E F *)
apply (eqv_trans _ _ A B).
(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @EqV Tn A D'0 E F *)
subst D'0.
(* Goal: @EqV Tn C C E F *)
apply null_vector in HH.
(* Goal: @EqV Tn C C E F *)
subst F.
(* Goal: @EqV Tn C C E E *)
apply eqv_trivial.
Qed.


Lemma opposite_sum :
  forall A B C D E F,
  SumV A B C D E F ->
  SumV B A D C F E.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn E F E' F' *)
unfold SumV in *.
(* Goal: forall (D' : @Tpoint Tn) (_ : @EqV Tn D C A D'), @EqV Tn B D' F E *)
intros D0 H0.
(* Goal: @EqV Tn E F E' F' *)
assert(HH:=vector_construction C D B).
(* Goal: @EqV Tn E F E' F' *)
ex_and HH D'.
(* Goal: @EqV Tn E F E' F' *)
assert(HH:= (H D' H1)).
(* Goal: @EqV Tn B D0 F E *)
clear H.

(* Goal: @EqV Tn B D0 F E *)
assert(EqV D' B A D0).
(* Goal: @EqV Tn D' B A D0 *)
(* Goal: @EqV Tn B D0 F E *)
apply (eqv_trans _ _ D C).
(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @EqV Tn D' A F E *)
apply eqv_comm.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @EqV Tn B D0 F E *)
apply eqv_permut in H.
(* Goal: @EqV Tn B D0 F E *)
eapply (eqv_trans _ _ D' A).
(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @EqV Tn D' A F E *)
apply eqv_comm.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma null_sum_eq :
  forall A B C D,
  SumV A B B C D D ->
  A = C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @SumV_exists Tn A B C D E F *)
unfold SumV in H.
(* Goal: @eq (@Tpoint Tn) A C *)
assert(HH:= vector_construction B C B).
(* Goal: @EqV Tn E F E' F' *)
ex_and HH D'.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@EqV Tn B D' C D) (@EqV Tn A D' E F)) *)
assert(HH:= (H D' H0)).
(* Goal: @eq (@Tpoint Tn) A C *)
assert(A = D').
(* Goal: @eq (@Tpoint Tn) A D' *)
(* Goal: @eq (@Tpoint Tn) A C *)
apply (null_vector D).
(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @EqV Tn A D' D D *)
(* Goal: @eq (@Tpoint Tn) A C *)
apply HH.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: @eq (@Tpoint Tn) A C *)
apply vector_uniqueness in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.

Lemma is_to_ise :
  forall A B C D E F,
  SumV A B C D E F ->
  SumV_exists A B C D E F.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @SumV_exists Tn A B C D E F *)
unfold SumV in H.
(* Goal: @SumV_exists Tn A B C D E F *)
unfold SumV_exists.
(* Goal: @EqV Tn E F E' F' *)
assert(HH:= (vector_construction C D B)).
(* Goal: @EqV Tn E F E' F' *)
ex_and HH D'.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@EqV Tn B D' C D) (@EqV Tn A D' E F)) *)
assert(HH:=(H D' H0)).
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@EqV Tn B D' C D) (@EqV Tn A D' E F)) *)
exists D'.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.

(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma ise_to_is :
 forall A B C D E F,
  SumV_exists A B C D E F ->
  SumV A B C D E F.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
(* Goal: @SumV Tn A B C D A F *)
unfold SumV.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn A D'0 E F *)
assert(D'= D'0).
(* Goal: @eq (@Tpoint Tn) D' D'0 *)
(* Goal: @EqV Tn A D'0 E F *)
apply (vector_construction_uniqueness C D B).
(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @EqV Tn A D'0 E F *)
subst D'0.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma sum_exists :
 forall A B C D, exists E, exists F, SumV A B C D E F.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn E F E' F' *)
assert(HH:= vector_construction C D B).
(* Goal: @ex (@Tpoint Tn) (fun E : @Tpoint Tn => @ex (@Tpoint Tn) (fun F : @Tpoint Tn => @SumV Tn A B C D E F)) *)
ex_and HH F.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @ex (@Tpoint Tn) (fun F : @Tpoint Tn => @SumV Tn A B C D A F) *)
exists F.
(* Goal: @SumV Tn A B C D A F *)
unfold SumV.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn A D' A F *)
assert(D' = F).
(* Goal: @eq (@Tpoint Tn) A B *)
apply (vector_construction_uniqueness C D B); auto.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: @EqV Tn A B A B *)
apply eqv_refl.
Qed.

Lemma sum_uniqueness :
 forall A B C D E F E' F',
 SumV A B C D E F ->
 SumV A B C D E' F' ->
 EqV E F E' F'.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn E F E' F' *)
unfold SumV in *.
(* Goal: @EqV Tn E F E' F' *)
assert(HH:= vector_construction C D B).
(* Goal: @EqV Tn E F E' F' *)
ex_and HH D'.
(* Goal: @EqV Tn E F E' F' *)
assert(HH:= (H D' H1)).
(* Goal: @EqV Tn E F E' F' *)
assert(HP := (H0 D' H1)).
(* Goal: @EqV Tn E F E' F' *)
apply (eqv_trans _ _ A D').
(* Goal: @EqV Tn E F A D' *)
(* Goal: @EqV Tn A D' E' F' *)
apply eqv_sym.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.

Lemma same_dir_refl : forall A B, Same_dir A B A B.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: @Same_dir Tn A B D C *)
induction (eq_dec_points A B).
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Out Tn D C C *)
(* Goal: @EqV Tn A B D C *)
apply out_trivial.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @EqV Tn A B A B *)
apply eqv_refl.
Qed.

Lemma same_dir_ts :
  forall A B C D,
  Same_dir A B C D ->
  exists M, Bet A M D /\ Bet B M C.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: and (@Bet Tn A A D) (@Bet Tn A A C) *)
split; Between.

(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(exists M : Tpoint, Midpoint M A D' /\ Midpoint M B C).
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Midpoint Tn M A D') (@Midpoint Tn M B C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply plg_mid.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
ex_and H1 M.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
unfold Midpoint in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(HH:=plgs_two_sides A B D' C H0).
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(B <> C).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
unfold TS in H6.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(~ Col B C D').
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
unfold TS in H6.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(OS B C D' D).
(* Goal: @OS Tn B C D' D *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply l6_6 in H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply (out_one_side_1 _ _ _ _ C); Col.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(TS B C A D).
(* Goal: @TS Tn B C D' A *)
(* Goal: @OS Tn B C D' D *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply l9_2.
(* Goal: @TS Tn B C D A *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (l9_8_2 _ _ D').
(* Goal: @TS Tn B C D' A *)
(* Goal: @OS Tn B C D' D *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply l9_2.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply H6.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(~ Col A B C).
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
induction H10.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
induction H10.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
ex_and H13 T.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(OS A B D' C /\ OS D' C A B).
(* Goal: and (@OS Tn A B D' C) (@OS Tn D' C A B) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply(plgs_one_side A B D' C).
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(~Col A B C).
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(Par_strict A B D' C /\ Par_strict A C B D').

(* Goal: and (@Par_strict Tn A B D' C) (@Par_strict Tn A C B D') *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply(plgs_par_strict A B D' C).
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(A <> B).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H18.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(Par C D A B).
(* Goal: @Par Tn C D A B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (par_col_par_2 _ D').
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Col Tn C D' D *)
(* Goal: @Par Tn C D' A B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply out_col in H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Par Tn D C A B *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply par_symmetry.
(* Goal: @Par Tn A B D C *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply par_right_comm.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(Par_strict A B C D).
(* Goal: @Par_strict Tn C D A B *)
(* Goal: @Col Tn A B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply par_strict_symmetry.
(* Goal: @Par_strict Tn C D A B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H21.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H17.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction(col_dec A B T).
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(B = T).
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply (l6_21 A B C B); Col.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) A D) *)
(* Goal: or (@Bet Tn D T A) (@Bet Tn D A T) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
subst T.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H22.
(* Goal: @ex (@Tpoint Tn) (fun T : @Tpoint Tn => and (@Col Tn T D A) (@Bet Tn C T C')) *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
exists D.
(* Goal: and (@Col Tn A A B) (@Col Tn A C D) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply bet_col in H14.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction(col_dec C D T).
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(C = T).
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply (l6_21 C D B C); Col.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) A D) *)
(* Goal: or (@Bet Tn D T A) (@Bet Tn D A T) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
subst T.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H22.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: and (@Col Tn A A B) (@Col Tn A C D) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply bet_col in H14.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H13.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(OS B A T D).
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply (out_one_side_1 _ _ _ _ A); Col.

(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) A D) *)
(* Goal: or (@Bet Tn D T A) (@Bet Tn D A T) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
subst T.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) D A) *)
(* Goal: or (@Bet Tn A T D) (@Bet Tn A D T) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H23.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H22.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(OS B A T C).
(* Goal: @OS Tn B C A B' *)
(* Goal: @Bet Tn D C C' *)
apply (one_side_transitivity _ _ _ D).
(* Goal: @OS Tn C D T A *)
(* Goal: @OS Tn C D A B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H25.
(* Goal: @OS Tn B A D C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (par_strict_one_side _ _ _ C).
(* Goal: @Par_strict Tn B A D C *)
(* Goal: @Col Tn D C C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply par_strict_comm.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H22.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(TS B A T C).
(* Goal: @TS Tn B C A B' *)
(* Goal: @Bet Tn D C C' *)
unfold TS.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
repeat split; Col.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply l9_9 in H26.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H13.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(OS C D T A).
(* Goal: @OS Tn C D T A *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (out_one_side_1 _ _ _ _ D).
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) A D) *)
(* Goal: or (@Bet Tn D T A) (@Bet Tn D A T) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
subst T.
(* Goal: False *)
(* Goal: not (@Col Tn B C D) *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H24.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H22.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(OS C D T B).
(* Goal: @OS Tn C D T B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (one_side_transitivity _ _ _ A).
(* Goal: @OS Tn C D T A *)
(* Goal: @OS Tn C D A B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H25.
(* Goal: @OS Tn C D A B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (par_strict_one_side _ _ _ B).
(* Goal: @Par_strict Tn C D A B *)
(* Goal: @Col Tn A B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply par_strict_symmetry.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H22.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(TS C D T B).
(* Goal: @TS Tn B C A B' *)
(* Goal: @Bet Tn D C C' *)
unfold TS.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@Col Tn B C D) *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H24.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @ex (@Tpoint Tn) (fun T0 : @Tpoint Tn => and (@Col Tn T0 C D) (@Bet Tn T T0 B)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply H22.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply l9_9 in H27.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
exists T.
(* Goal: and (@Bet Tn A A D) (@Bet Tn A A C) *)
split; Between.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(HH:= plgf_bet A B C D' H0).

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction (eq_dec_points A D').
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold Parallelogram_flat in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(B = C \/ Midpoint A B C).
(* Goal: or (@eq (@Tpoint Tn) A D') (@Midpoint Tn B A D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply l7_20.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
Cong.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H9.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @Bet Tn B A C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply midpoint_bet.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Bet Tn D C C' *)
induction (eq_dec_points B C).
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold Parallelogram_flat in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
assert(A = D' \/ Midpoint B A D').
(* Goal: or (@eq (@Tpoint Tn) A D') (@Midpoint Tn B A D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply l7_20.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
Cong.
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
induction H10.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
induction H10.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H13.
(* Goal: @Bet Tn A B C *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply (between_inner_transitivity _ _ _ D').
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Bet Tn A B C *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply (outer_transitivity_between _ _ D').
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

(* Goal: @Parallelogram_strict Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
induction HH.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
apply (outer_transitivity_between _ _ D'); Between.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H7.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @Bet Tn B A C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply between_symmetry.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
apply (outer_transitivity_between _ _ D'); Between.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H7.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
induction H10.
(* Goal: @Bet Tn A C D *)
(* Goal: @Bet Tn A C D *)
(* Goal: @Bet Tn B C C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(Bet C B D \/ Bet C D B).
(* Goal: @eq (@Tpoint Tn) A B *)
apply (l5_3 _ _ _ D'); auto.
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H11.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
apply (outer_transitivity_between _ _ B); Between.
(* Goal: @Bet Tn A C D *)
(* Goal: @Bet Tn A C D *)
(* Goal: @Bet Tn B C C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (between_inner_transitivity _ _ _ B).
(* Goal: @OS Tn B C D A *)
(* Goal: @OS Tn B C D B' *)
(* Goal: @Bet Tn D C C' *)
apply H7.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
apply (outer_transitivity_between _ _ B); Between.
(* Goal: @Bet Tn C B D *)
(* Goal: @Bet Tn B C C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (between_exchange4 _ _ D').
(* Goal: @Bet Tn B C D' *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H8.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
induction H10.
(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(Bet B C D).
(* Goal: @Bet Tn A B C *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply (between_inner_transitivity _ _ _ D').
(* Goal: @Bet Tn B C D' *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H8.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
eBetween.

(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply (outer_transitivity_between _ _ C).
(* Goal: @OS Tn B C D A *)
(* Goal: @OS Tn B C D B' *)
(* Goal: @Bet Tn D C C' *)
apply H7.
(* Goal: @Bet Tn A B C *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply (outer_transitivity_between _ _ D' ).
(* Goal: @Bet Tn B C D' *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H8.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: and (@Bet Tn A A D) (@Bet Tn A A C) *)
split; Between.
Qed.

Lemma one_side_col_out :
 forall A B X Y,
  Col A X Y ->
  OS A B X Y ->
  Out A X Y.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Out Tn A X Y *)
assert(A <> B /\ ~ Col X A B /\ ~ Col Y A B /\ X <> A /\ Y <> A).
(* Goal: and (not (@eq (@Tpoint Tn) A B)) (and (not (@Col Tn X A B)) (and (not (@Col Tn Y A B)) (and (not (@eq (@Tpoint Tn) X A)) (not (@eq (@Tpoint Tn) Y A))))) *)
(* Goal: @Out Tn A X Y *)
unfold OS in H0.
(* Goal: and (not (@eq (@Tpoint Tn) A B)) (and (not (@Col Tn X A B)) (and (not (@Col Tn Y A B)) (and (not (@eq (@Tpoint Tn) X A)) (not (@eq (@Tpoint Tn) Y A))))) *)
(* Goal: @Out Tn A X Y *)
ex_and H0 T.
(* Goal: and (not (@eq (@Tpoint Tn) A B)) (and (not (@Col Tn X A B)) (and (not (@Col Tn Y A B)) (and (not (@eq (@Tpoint Tn) X A)) (not (@eq (@Tpoint Tn) Y A))))) *)
(* Goal: @Out Tn A X Y *)
unfold TS in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) Y A) *)
(* Goal: @Out Tn A X Y *)
subst X.
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
intro;
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Out Tn A X Y *)
subst Y.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

(* Goal: @Out Tn A X Y *)
assert(TS A B X Y).
(* Goal: @TS Tn B C A B' *)
(* Goal: @Bet Tn D C C' *)
unfold TS.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @Out Tn A X Y *)
apply l9_9 in H6.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
Qed.

Lemma par_ts_same_dir :
 forall A B C D, Par_strict A B C D ->
 (exists M, Bet A M D /\ Bet B M C) ->
 Same_dir A B C D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
ex_and H0 M.
(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.

assert(HH:=vector_construction A B C).
(* Goal: @EqV Tn E F E' F' *)
ex_and HH D'.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@EqV Tn B D' C D) (@EqV Tn A D' E F)) *)
exists D'.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @eq (@Tpoint Tn) A B *)
2: auto.

assert(A <> B /\ C <> D).
unfold Par in H.
unfold Par_strict in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

assert(A <> M).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C A E F *)
(* Goal: @EqV Tn C D'0 E F *)
subst M.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
apply bet_col in H1.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

induction (eq_dec_points B D').
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
assert( A = C).
(* Goal: @eq (@Tpoint Tn) C D *)
(* Goal: @EqV Tn A D A C *)
apply (vector_uniqueness B).
(* Goal: @EqV Tn D' A F E *)
apply eqv_comm.
(* Goal: False *)
apply H2.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.

assert(Bet A D B \/ Bet A B D).
apply (l5_1 _ M).
(* Goal: @Bet Tn A B D' *)
(* Goal: @Bet Tn B D' C *)
(* Goal: not (@eq (@Tpoint Tn) B D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H5.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.

assert(Par A B D' C).
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H2; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

assert(Col C D D').
apply col_permutation_1.
apply (parallel_uniqueness A B _ _ C _ C).
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Par Tn A B D C *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
2: apply par_right_comm.
(* Goal: @OS Tn B C D A *)
(* Goal: @OS Tn B C D B' *)
(* Goal: @Bet Tn D C C' *)
2: apply H7.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.

assert(HH := (plgs_two_sides A B D' C H2)).
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(TS B C A D).
(* Goal: @TS Tn B C A B' *)
(* Goal: @Bet Tn D C C' *)
unfold TS.
unfold TS in H10.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
repeat split;
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H11.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
exists M.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
apply bet_col in H1.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

assert(OS B C D D').
apply (l9_8_1 _ _ _ _ A).
(* Goal: @TS Tn B C D' A *)
(* Goal: @OS Tn B C D' D *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply l9_2.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H11.
(* Goal: @TS Tn B C D' A *)
(* Goal: @OS Tn B C D' D *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply l9_2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

apply (one_side_col_out _ B).
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply invert_one_side.
(* Goal: @OS Tn B C C' D *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply H12.

(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
unfold Parallelogram_flat in H2.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma same_dir_out : forall A B C, Same_dir A B A C -> Out A B C \/ A = B /\ A = C.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Same_dir in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold EqV in H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply plgs_par_strict in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply plgf_permut in H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply plgf_sym in H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply plgf_trivial_neq in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A P B *)
(* Goal: @EqV Tn A B A B *)
apply l6_6.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma same_dir_out1 : forall A B C, Same_dir A B B C -> Out A B C \/ A = B /\ A = C.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Same_dir in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold EqV in H0.

(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H0.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply plgs_par_strict in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold Parallelogram_flat in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
assert(A = D' \/ Midpoint B A D').
(* Goal: or (@eq (@Tpoint Tn) A D') (@Midpoint Tn B A D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply l7_20.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
Cong.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H5.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B C *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
unfold Midpoint in H5.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C A) *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply cong_symmetry in H6.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) C A) *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply cong_identity in H6.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
induction H4; tauto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
apply (between_equality _ _ D');
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @OS Tn B C D A *)
(* Goal: @OS Tn B C D B' *)
(* Goal: @Bet Tn D C C' *)
apply H7.
apply (between_equality _ _ A);
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Bet Tn A B C *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply (between_inner_transitivity _ _ _ D').
(* Goal: @Bet Tn A B D' *)
(* Goal: @Bet Tn B D' C *)
(* Goal: not (@eq (@Tpoint Tn) B D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H5.
(* Goal: @Bet Tn B C D' *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H8.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
apply (outer_transitivity_between _ _  D').
(* Goal: @Bet Tn A B D' *)
(* Goal: @Bet Tn B D' C *)
(* Goal: not (@eq (@Tpoint Tn) B D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H5.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma same_dir_null : forall A B C, Same_dir A A B C -> B = C.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Same_dir in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) B C *)
ex_and H D.
(* Goal: @eq (@Tpoint Tn) B C *)
apply null_vector in H0.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.



Lemma plgs_out_plgs :
 forall A B C D B' C',
 Parallelogram_strict A B C D ->
 Out A B B' ->
 Out D C C' ->
 Cong A B' D C' ->
 Parallelogram_strict A B' C' D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(OS A D C B /\ OS C B A D).
(* Goal: and (@OS Tn A D C B) (@OS Tn C B A D) *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply plgs_one_side.
(* Goal: @Parallelogram_strict Tn D A B' C' *)
(* Goal: @Bet Tn D C C' *)
apply plgs_permut.
(* Goal: @Parallelogram_strict Tn D C P Q *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert( A <> B /\ A <> B' /\ D <> C /\ D <> C').
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold Out in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(Par_strict A B C D).
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(Par_strict A B' D C').
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(Par A B' D C').
(* Goal: @Par Tn A B' P Q *)
(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply (par_col_par_2 _ B).
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Col Tn A B B' *)
(* Goal: @Par Tn A B P Q *)
(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Par Tn D C A B *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply par_symmetry.
(* Goal: @Par Tn D C' A B *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply (par_col_par_2 _ C).
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Col Tn A B B' *)
(* Goal: @Par Tn A B P Q *)
(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Par Tn D C A B *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply par_symmetry.
(* Goal: @Par Tn A B D C *)
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply par_right_comm.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Par_strict Tn A B' D C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
induction H10.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col in H0.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col in H1.

(* Goal: False *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(~Col A C D).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: False *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply H14.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.

(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(OS A D B B').
(* Goal: @OS Tn A D B B' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply (out_one_side_1 A _ _ _ A).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @ex (@Tpoint Tn) (fun T : @Tpoint Tn => and (@Col Tn T D A) (@Bet Tn C T C')) *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
exists D.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(OS A D C C').
(* Goal: @OS Tn A D C C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply (out_one_side_1 _ D _ _ D).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @Parallelogram_strict Tn A B' C' D *)
assert(OS A D B' C').
(* Goal: @OS Tn D A C C' *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply (one_side_transitivity _ _ _ B).
(* Goal: @OS Tn B C D C' *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply one_side_symmetry.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H11.
(* Goal: @OS Tn A D B C' *)
(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply (one_side_transitivity _ _ _ C).
(* Goal: @OS Tn B C D C' *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply one_side_symmetry.
(* Goal: False *)
(* Goal: or (@Bet Tn C C' D) (@Bet Tn C D C') *)
(* Goal: @Bet Tn D C C' *)
apply H3.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.


assert(HH:=par_cong_mid_os  A B' D C' H10 H2 H13).
(* Goal: @Parallelogram_strict Tn A B' C' D *)
ex_and HH M.

(* Goal: @Parallelogram_strict Tn A B' C' D *)
apply (mid_plgs _ _ _ _ M).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
exists C'.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma plgs_plgs_bet :
 forall A B C D B' C',
 Parallelogram_strict A B C D ->
 Bet A B B' ->
 Parallelogram_strict A B' C' D ->
 Bet D C C'.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Bet Tn D C C' *)
assert(Col C' C D /\ Col D C D).
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply (parallel_uniqueness A B C D C' D D); Col.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Par Tn A B C' D *)
(* Goal: @Bet Tn D C C' *)
apply (par_col_par_2 _ B').
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply bet_col in H0.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Bet Tn D C C' *)
clear H3.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.

(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_permut in H.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_permut in H1.

(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
assert(HH1:=plgs_one_side B C D A H).
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
assert(HH2:=plgs_one_side B' C' D A H1).
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
assert(OS D A C C').
(* Goal: @OS Tn D A C C' *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply (one_side_transitivity _ _ _ B).
(* Goal: @OS Tn B C D C' *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply one_side_symmetry.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply H6.
(* Goal: @OS Tn B C D C' *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply one_side_symmetry.
(* Goal: @OS Tn D A C' B *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply (one_side_transitivity _ _ _ B').
(* Goal: @OS Tn B C D C' *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply one_side_symmetry.
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @OS Tn D A B' B *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply (out_one_side_1 _ _ _ _ A).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D')) *)
exists B'.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
subst B'.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
assert(TS D A C C').
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
exists C'.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @ex (@Tpoint Tn) (fun T : @Tpoint Tn => and (@Col Tn T D A) (@Bet Tn C T C')) *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
exists D.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply l9_9 in H8.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.

(* Goal: @Bet Tn D C C' *)
assert(Parallelogram_strict B C D A).
(* Goal: @Parallelogram_strict Tn D A B' C' *)
(* Goal: @Bet Tn D C C' *)
apply plgs_permut.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Bet Tn D C C' *)
assert(Parallelogram_strict D A B' C').
(* Goal: @Parallelogram_strict Tn D A B' C' *)
(* Goal: @Bet Tn D C C' *)
apply plgs_permut.
(* Goal: @Parallelogram_strict Tn P' Q D C' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_sym.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Bet Tn D C C' *)
induction (eq_dec_points C C').
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

(* Goal: @Bet Tn D C C' *)
assert(HH:= plgs_pseudo_trans B C D A B' C' H3 H4).
(* Goal: @Bet Tn D C C' *)
assert(Parallelogram_strict B C C' B').
(* Goal: @Parallelogram_strict Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
induction HH.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Parallelogram_strict Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
unfold Parallelogram_flat in H6.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.

(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Col Tn B C D *)
(* Goal: @Bet Tn D C C' *)
apply bet_col in H2.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.

(* Goal: @Bet Tn D C C' *)
assert(HH1:=plgs_one_side B C C' B' H6).
(* Goal: @Bet Tn D C C' *)
assert(HH2:=plgs_one_side B C D A H3).
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

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

(* Goal: @Bet Tn D C C' *)
assert(TS B C A B').
(* Goal: @TS Tn B C A B' *)
(* Goal: @Bet Tn D C C' *)
unfold TS.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H6.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply H6.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D')) *)
exists B'.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Bet Tn D C C' *)
assert(OS B C C' D).
(* Goal: @OS Tn B C C' D *)
(* Goal: @Bet Tn D C C' *)
apply (out_one_side_1 _ _ _ _ C).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H6.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply H6.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
exists C'.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply col_trivial_2.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: or (@Bet Tn C C' D) (@Bet Tn C D C') *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H3.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: or (@Bet Tn C C' D) (@Bet Tn C D C') *)
(* Goal: @Bet Tn D C C' *)
apply H3.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

(* Goal: @Bet Tn D C C' *)
assert(OS B C A B').
(* Goal: @OS Tn B C A B' *)
(* Goal: @Bet Tn D C C' *)
apply (one_side_transitivity _ _ _ D).
(* Goal: @OS Tn B C D C' *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply one_side_symmetry.
(* Goal: @OS Tn B C D A *)
(* Goal: @OS Tn B C D B' *)
(* Goal: @Bet Tn D C C' *)
apply H7.
(* Goal: @OS Tn B C D B' *)
(* Goal: @Bet Tn D C C' *)
apply (one_side_transitivity _ _ _ C').
(* Goal: @OS Tn B C D C' *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply one_side_symmetry.
(* Goal: @OS Tn B C C' D *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply H12.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Bet Tn D C C' *)
apply l9_9 in H11.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.
Qed.

Lemma plgf_plgf_bet :
 forall A B C D B' C',
 Parallelogram_flat A B C D ->
 Bet A B B' ->
 Parallelogram_flat A B' C' D ->
 Bet D C C'.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Same_dir Tn A B D C *)
induction (eq_dec_points A B).
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
assert(C = D /\ A <> C).
apply plgf_trivial_neq.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

assert(HH:=not_col_exists A B H2).
(* Goal: @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B A Y) (@Cong Tn A Y C D)) *)
ex_and HH P.
assert(HH:=plg_existence A B P H2).
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ex_and HH Q.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict A B P Q).
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
unfold Parallelogram_flat in H4.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict C D Q P).

(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply(plgf_plgs_trans C D A B P Q).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
assert(A = B /\ C <> A).
apply plgf_trivial_neq.
(* Goal: @Parallelogram_flat Tn C D A B *)
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgf_sym.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @Parallelogram_flat Tn C D A B *)
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgf_sym.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Bet Tn D C C' *)
assert(A <> B').
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
subst B'.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply between_identity in H0.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(HH:=vector_construction A B' Q).
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ex_and HH P'.

(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
2 : tauto.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(B <> P).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst P.
(* Goal: False *)
(* Goal: or (@Bet Tn C C' D) (@Bet Tn C D C') *)
(* Goal: @Bet Tn D C C' *)
apply H3.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(B' <> P').
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst P'.

(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
apply plgs_par_strict in H8.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
apply plgs_par_strict in H5.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
apply plgf_permut in H8.
assert(Q = A /\ B' <> Q).
apply plgf_trivial_neq.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst Q.
(* Goal: @Bet Tn A B D' *)
(* Goal: @Bet Tn B D' C *)
(* Goal: not (@eq (@Tpoint Tn) B D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H5.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Par A B' P Q).
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H8; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply bet_col in H0.

(* Goal: @eq (@Tpoint Tn) A B *)
apply (par_col_par_2 _ B); auto.
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H4; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Col P' P Q /\ Col Q P Q).
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply(parallel_uniqueness A B' P Q P' Q Q ); Col.
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H8; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
clear H13.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict A B' P' Q).
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Parallelogram_flat in H8.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
unfold Parallelogram_flat in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply bet_col in H0.
assert(Col B' P' Q).
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.

apply plgs_par_strict in H5.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Bet Tn A B D' *)
(* Goal: @Bet Tn B D' C *)
(* Goal: not (@eq (@Tpoint Tn) B D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H5.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X P Q)) *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
exists Q.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict D C' P' Q).
apply (plgf_plgs_trans _ _ B' A).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
apply plgf_sym in H1.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgf_trivial_neq in H1.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
apply plgf_comm2.
(* Goal: @Parallelogram_flat Tn C D A B *)
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgf_sym.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Parallelogram_strict Tn D C P Q *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

assert(Bet Q P P').
(* Goal: @eq (@Tpoint Tn) A B *)
apply(plgs_plgs_bet A B P Q B' P'); auto.
apply(plgs_plgs_bet Q P C D P' C').
(* Goal: @Parallelogram_strict Tn P' Q D C' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_sym.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Parallelogram_strict Tn D C P Q *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_comm2.
(* Goal: @Parallelogram_strict Tn P' Q D C' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_sym.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.

Lemma plg_plg_bet :
 forall A B C D B' C',
 Parallelogram A B C D ->
 Bet A B B' ->
 Parallelogram A B' C' D ->
 Bet D C C'.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.

(* Goal: @Same_dir Tn A B D C *)
induction(eq_dec_points A B).
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: False *)
(* Goal: @Same_dir Tn A A D C *)
(* Goal: @Same_dir Tn A B D C *)
apply plgs_sym in H.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

(* Goal: @Bet Tn D C C' *)
induction (eq_dec_points B C).
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @Same_dir Tn A A D C *)
(* Goal: @Same_dir Tn A B D C *)
apply plgs_sym in H.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Bet Tn A B C' *)
(* Goal: @Bet Tn D C C' *)
apply plgf_permut in H.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Bet Tn A B C' *)
(* Goal: @Bet Tn D C C' *)
apply plgf_permut in H.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_sym in H.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

(* Goal: @Bet Tn D C C' *)
assert(A <> B').
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
subst B'.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply between_identity in H0.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.

(* Goal: @Bet Tn D C C' *)
assert(B' <> C').
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plg_permut in H1.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgf_trivial_neq in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plg_permut in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_sym in H.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: @Bet Tn D C C' *)
assert(HH:=H).
(* Goal: @Bet Tn D C C' *)
assert(HH1:=H1).

(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H1; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @Bet Tn D C C' *)
assert(Par A B C' D).
(* Goal: @eq (@Tpoint Tn) A B *)
apply (par_col_par_2 _ B'); auto.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply bet_col in H0.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Bet Tn D C C' *)
assert(Col C' C D /\ Col D C D).

(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply(parallel_uniqueness A B C D C' D D); Col.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Bet Tn D C C' *)
clear H10.

(* Goal: @Bet Tn D C C' *)
induction HH; induction HH1.
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
apply (plgs_plgs_bet A B _ _ B').
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Parallelogram_flat in H11.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H10.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply bet_col in H0.
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
assert(Col A B C').
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
exists C'.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
unfold Parallelogram_flat in H10.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_par_strict in H11.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply bet_col in H0.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H11.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B') (@Col Tn X C' D)) *)
(* Goal: @Bet Tn D C C' *)
assert(Col A B' C).
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

(* Goal: @Bet Tn D C C' *)
apply (plgf_plgf_bet A B _ _ B').
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.


Lemma plgf_out_plgf :
 forall A B C D B' C',
 Parallelogram_flat A B C D ->
 Out A B B' ->
 Out D C C' ->
 Cong A B' D C' ->
 Parallelogram_flat A B' C' D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert( A <> B /\ A <> B' /\ D <> C /\ D <> C').
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold Out in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(HH:=not_col_exists A B H3).
(* Goal: @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B A Y) (@Cong Tn A Y C D)) *)
ex_and HH P.
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(HH:=plg_existence A B P H3).
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ex_and HH Q.
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict A B P Q).
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Parallelogram_flat in H8.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict C D Q P).

(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply(plgf_plgs_trans C D A B P Q).
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Parallelogram_flat Tn C D A B *)
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgf_sym.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(HH:=vector_construction A B' Q).
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ex_and HH P'.
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H11.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(B <> P).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst P.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_par_strict in H9.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(B' <> P').
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst P'.
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H11.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_par_strict in H11.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H11.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D')) *)
exists B'.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Parallelogram_flat in H11.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply cong_identity in H15.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst Q.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Col Q P P').
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H8; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
apply plg_par in H11; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Par A B' P Q).
(* Goal: @Par Tn A B' P Q *)
(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply (par_col_par_2 _ B).
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Col Tn A B B' *)
(* Goal: @Par Tn A B P Q *)
(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col.
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Col Tn Q P P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Col P' P Q /\ Col Q P Q).
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply(parallel_uniqueness A B' P Q P' Q Q); Col.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.


(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict A B' P' Q).
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H11.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Parallelogram_flat in H11.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.

(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_par_strict in H9.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X P Q)) *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
exists Q.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.

(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col in H0.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(P <> Q).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst Q.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H9.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(P' <> Q).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
subst Q.
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_strict Tn P' Q D C' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H15.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram_strict D C' P' Q).
(* Goal: @Parallelogram_strict Tn D C' P' Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply (plgs_out_plgs _ C P).
(* Goal: @Parallelogram_strict Tn D C P Q *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_comm2.
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.

(* Goal: or (@Bet Tn Q P P') (@Bet Tn Q P' P) *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Out in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H19.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.

(* Goal: @eq (@Tpoint Tn) A B *)
apply (plgs_plgs_bet A B P Q B' P' H9); auto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.

(* Goal: @eq (@Tpoint Tn) A B *)
apply(plgs_plgs_bet A B' P' Q B P); auto.

(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plg_cong in H11.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
eCong.

(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Parallelogram A B' C' D).
(* Goal: @Parallelogram Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply (plgs_pseudo_trans _ _ P' Q).
(* Goal: @Parallelogram_strict Tn A B' P' Q *)
(* Goal: @Parallelogram_strict Tn P' Q D C' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H15.
(* Goal: @Parallelogram_strict Tn P' Q D C' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_sym.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H19.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply plgs_par_strict in H19.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Parallelogram_flat in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col in H0.
(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply out_col in H1.

(* Goal: False *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H19.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.

(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
assert(Col B C D).
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
(* Goal: @Col Tn B C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
ColR.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
subst B'.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.




Lemma plg_out_plg : 
 forall A B C D B' C',
 Parallelogram A B C D ->
 Out A B B' ->
 Out D C C' ->
 Cong A B' D C' ->
 Parallelogram A B' C' D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Parallelogram_strict Tn A B' C' D *)
(* Goal: @Parallelogram Tn A B' C' D *)
apply (plgs_out_plgs _ B C).
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply (plgf_out_plgf _ B C).
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.


Lemma same_dir_sym : forall A B C D, Same_dir A B C D -> Same_dir C D A B.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.

(* Goal: @Same_dir Tn A B D C *)
induction (eq_dec_points A B).
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
apply same_dir_null in H.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: @Same_dir Tn C D A B *)
unfold Same_dir in *.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D')) *)
assert(HH:=vector_construction C D A).
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D')) *)
ex_and HH B'.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D')) *)
exists B'.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold EqV in H1.
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold EqV in H2.
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold Out in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H1; induction H2.


(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
subst B'.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.
(* Goal: False *)
apply H2.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plgf_sym in H2.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plgf_trivial_neq in H2.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Bet Tn A B' B *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply (plg_plg_bet C D _ _ D').
(* Goal: False *)
apply H2.
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Bet Tn A B B' *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply (plg_plg_bet C D' _ _ D).
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.


Lemma same_dir_trans : forall A B C D E F, Same_dir A B C D -> Same_dir C D E F -> Same_dir A B E F.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Same_dir Tn C D A B *)
unfold Same_dir in *.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H; induction H0; spliter.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
ex_and H0 F'.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
apply null_vector in H2.
subst F'.
(* Goal: or (@Bet Tn Q P P') (@Bet Tn Q P' P) *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
unfold Out in H0.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @EqV Tn C C E F *)
subst F.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
ex_and H0 F'.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.


(* Goal: @Same_dir Tn A B D C *)
induction(eq_dec_points A B).
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
apply null_vector in H1.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

assert(HH:=vector_construction A B E).
ex_and HH F''.
exists F''.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.

(* Goal: @eq (@Tpoint Tn) A B *)
2: auto.
assert(C <> D /\ C <> D' /\ E <> F /\ E <> F').
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold Out in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
repeat split;
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H1; induction H2; induction H4.
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold Out in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
induction H10; induction H12.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
subst F''.

(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply plgf_sym in H4.
apply plgf_trivial_neq in H4.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
assert(Bet E F' F'').

(* Goal: @Bet Tn A B' B *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply (plg_plg_bet C D _ _ D').
(* Goal: False *)
apply H2.
(* Goal: @OS Tn B C C' D *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply H12.

assert(Parallelogram C D' F'' E \/ C = D' /\ B = A /\ E = F'' /\ C = E).

apply(plg_pseudo_trans C D' B A E F'').
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H13.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
2:tauto.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
apply (between_exchange4 _ _ F').
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
subst F''.
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply plgf_sym in H4.
apply plgf_trivial_neq in H4.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

assert(Bet E F'' F').
(* Goal: @Bet Tn A B B' *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply (plg_plg_bet C D' _ _ D).
(* Goal: False *)
3: apply H2.
(* Goal: @OS Tn B C C' D *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
2:apply H12.

assert(Parallelogram C D' F'' E \/ C = D' /\ B = A /\ E = F'' /\ C = E).
apply plg_pseudo_trans.
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H13.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
apply (l5_3 _ _ _ F').
(* Goal: @Parallelogram_strict Tn C D Q P *)
(* Goal: @Out Tn D C C' *)
(* Goal: @Out Tn Q P P' *)
(* Goal: @Cong Tn D C' Q P' *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
apply H10.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
subst F''.
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply plgf_sym in H4.
apply plgf_trivial_neq in H4.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

assert(Bet E F' F'').
(* Goal: @Bet Tn A B' B *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply (plg_plg_bet C D _ _ D').
(* Goal: False *)
apply H2.
(* Goal: @OS Tn B C C' D *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
apply H12.
assert(Parallelogram C D' F'' E \/ C = D' /\ B = A /\ E = F'' /\ C = E).
apply plg_pseudo_trans.
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H13.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
apply (l5_1 _ F').
(* Goal: @Bet Tn B C D' *)
(* Goal: or (@Bet Tn A B C) (@Bet Tn A C B) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H8.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
subst F''.
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply plgf_sym in H4.
apply plgf_trivial_neq in H4.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

assert(Bet E F'' F').
(* Goal: @Bet Tn A B B' *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply (plg_plg_bet C D' _ _ D).
(* Goal: False *)
3: apply H2.
(* Goal: @OS Tn B C C' D *)
(* Goal: @OS Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
2: apply H12.

assert(Parallelogram C D' F'' E \/ C = D' /\ B = A /\ E = F'' /\ C = E).
apply plg_pseudo_trans.
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

(* Goal: @Bet Tn A B D *)
(* Goal: @Bet Tn B B B *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H13.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
apply (between_exchange4 _ _ F').
apply H13.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma same_dir_comm : forall A B C D, Same_dir A B C D -> Same_dir B A D C.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.

(* Goal: @Same_dir Tn C D A B *)
unfold Same_dir in *.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
split; auto.

(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: or (and (@eq (@Tpoint Tn) C D) (@eq (@Tpoint Tn) A B)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A B D') (@EqV Tn C D A D'))) *)
ex_and H D'.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
assert(A <> B).
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @eq (@Tpoint Tn) B C *)
apply null_vector in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.

assert(HH:=vector_construction B A D).
ex_and HH C'.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
exists C'.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @eq (@Tpoint Tn) A B *)
2: auto.

(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold Out in *.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @EqV Tn A C A' C' *)
unfold EqV in *.

(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
apply eqv_sym in H2.
apply null_vector in H2.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.

(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
induction H0; induction H2;try tauto.

assert(Parallelogram C D' D C' \/ C = D' /\ B = A /\ C' = D /\ C = C').

apply(plg_pseudo_trans C D' B A C' D).
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H5.

assert(Parallelogram_flat C D' D C').
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
induction H5.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
apply plgs_par_strict in H5.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Bet Tn A B D' *)
(* Goal: @Bet Tn B D' C *)
(* Goal: not (@eq (@Tpoint Tn) B D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply H5.
(* Goal: @ex (@Tpoint Tn) (fun T : @Tpoint Tn => and (@Col Tn T D A) (@Bet Tn C T C')) *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
exists D.
apply bet_col in H4.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: @Parallelogram_strict Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
unfold Parallelogram_flat in H6.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

apply (col_cong2_bet1 D').
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
2:Between.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
Cong.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
Cong.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.
(* Goal: False *)
apply H2.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plgf_sym in H2.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plgf_trivial_neq in H2.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.


(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
induction H0; induction H2;try tauto.

(* Goal: @Bet Tn D C C' *)
induction(eq_dec_points C C').
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.

assert(Parallelogram C D' D C' \/ C = D' /\ B = A /\ C' = D /\ C = C').

apply(plg_pseudo_trans C D' B A C' D).
(* Goal: @Parallelogram Tn C D' B A *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_sym.
(* Goal: @Parallelogram Tn B A C D' *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply plg_comm2.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
induction H6.

assert(Parallelogram_flat C D' D C').
induction H6.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply plgs_par_strict in H6.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: False *)
(* Goal: @Col Tn B C C *)
(* Goal: @Out Tn C C' D *)
(* Goal: @Bet Tn D C C' *)
apply H6.
(* Goal: @ex (@Tpoint Tn) (fun T : @Tpoint Tn => and (@Col Tn T D A) (@Bet Tn C T C')) *)
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
exists D.
apply bet_col in H4.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.

assert(HH:= H7).
unfold Parallelogram_flat in H7.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

apply plgf_bet in HH.
(* Goal: @Parallelogram_strict Tn B C C' B' *)
(* Goal: @Bet Tn D C C' *)
induction HH.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.

(* Goal: False *)
(* Goal: or (@Bet Tn C C' D) (@Bet Tn C D C') *)
(* Goal: @Bet Tn D C C' *)
apply H3.
apply (between_equality _ _ D).
(* Goal: @Bet Tn B A C *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
apply between_symmetry.
apply H13.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
induction H12.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

assert(D = D').
(* Goal: @eq (@Tpoint Tn) A B *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply (between_equality _ _ C).
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: or (@Out Tn A A C) (and (@eq (@Tpoint Tn) A A) (@eq (@Tpoint Tn) A C)) *)
subst D'.

apply cong_identity in H10.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.

induction H12.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
eBetween.

(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
eBetween.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma bet_same_dir1 : forall A B C, A <> B -> B <> C -> Bet A B C -> Same_dir A B A C.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
subst C.
(* Goal: False *)
(* Goal: not (@eq (@Tpoint Tn) B A) *)
(* Goal: or (@Bet Tn A C B) (@Bet Tn A B C) *)
(* Goal: @EqV Tn A B A B *)
apply between_identity in H1.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @EqV Tn A B A B *)
apply eqv_refl.
Qed.

Lemma bet_same_dir2 : forall A B C, A <> B -> B <> C -> Bet A B C -> Same_dir A B B C.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
assert(HH:=vector_construction A B B).
ex_and HH C'.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
exists C'.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @eq (@Tpoint Tn) A B *)
2: auto.
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold EqV in H2.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
2:tauto.

(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.
apply plgs_par_strict in H2.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: or (@Bet Tn C C' D) (@Bet Tn C D C') *)
(* Goal: @Bet Tn D C C' *)
apply H3.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
assert(HH:= H2).
unfold Parallelogram_flat in HH.
apply plgf_bet in H2.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
apply cong_identity in H5.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
contradiction.

(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.

assert(Bet B A B).
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
apply (outer_transitivity_between2 _ C').
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H7.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
apply between_identity in H8.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.

assert(Bet B A B).
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
apply (outer_transitivity_between _ _ C').
(* Goal: False *)
apply H2.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H7.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
apply between_identity in H8.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: False *)
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H2.

assert( A = C' \/ Midpoint B A C').
(* Goal: or (@eq (@Tpoint Tn) A D') (@Midpoint Tn B A D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply l7_20.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
Cong.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H7.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
unfold Midpoint in H8.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply (l5_2 A); auto.

assert( A = C' \/ Midpoint B A C').
(* Goal: or (@eq (@Tpoint Tn) A D') (@Midpoint Tn B A D') *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
apply l7_20.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: @Cong Tn B A B D' *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
(* Goal: or (@Out Tn A B C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A C)) *)
Cong.
(* Goal: @Parallelogram_strict Tn A B P Q *)
(* Goal: @Parallelogram_flat Tn A B' C' D *)
induction H8.
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
(* Goal: @ex (@Tpoint Tn) (fun M : @Tpoint Tn => and (@Bet Tn A M D) (@Bet Tn B M C)) *)
induction H7.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
unfold Midpoint in H8.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
apply (l5_2 A); auto.
Qed.

Lemma plg_opp_dir : forall A B C D, Parallelogram A B C D -> Same_dir A B D C.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.

(* Goal: @Same_dir Tn A B D C *)
induction(eq_dec_points A B).
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @Same_dir Tn A A D C *)
(* Goal: @Same_dir Tn A B D C *)
apply plgs_sym in H.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn D C D') (@EqV Tn A B D D')) *)
exists C.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Out Tn D C C *)
(* Goal: @EqV Tn A B D C *)
apply out_trivial.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_sym in H.
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply plgf_trivial_neq in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D')))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D'))))) *)
unfold EqV.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma same_dir_dec : forall A B C D,
  Same_dir A B C D \/ ~ Same_dir A B C D.
Proof.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D')))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (@EqV Tn A B C D'))))) *)
unfold EqV.
elim (eq_dec_points A B); intro HAB;
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
elim (eq_dec_points C D); intro HCD; try tauto.

(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  right; intro HFalse.
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  elim HFalse; clear HFalse; intro HFalse.

(* Goal: False *)
    spliter; intuition.

(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    destruct HFalse as [E [HFalse HElim]].
(* Goal: False *)
    elim HElim; clear HElim; intro HElim.

(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
      subst.
(* Goal: False *)
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
      apply plg_cong in HElim.
(* Goal: False *)
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
      destruct HElim as [HCong1 HCong2].
(* Goal: False *)
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
      treat_equalities.
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
      apply out_diff2 in HFalse; intuition.

(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
      destruct HElim as [Hclear HCE]; clear Hclear; subst.
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
      apply out_diff2 in HFalse; intuition.

(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  right; intro HFalse.

(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  elim HFalse; clear HFalse; intro HFalse.

(* Goal: False *)
    spliter; intuition.

(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    destruct HFalse as [E [HFalse Hclear]]; clear Hclear.
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    subst.
(* Goal: False *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    apply out_diff1 in HFalse; intuition.

(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  assert (H := plg_existence B A C).
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  assert (HPar : B <> A) by finish.
(* Goal: @EqV Tn B D0 F E *)
  apply H in HPar; clear H.
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  destruct HPar as [E HPar].
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
  elim (out_dec C D E); intro Hout.

(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    left.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
    right.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    exists E.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
    split; try assumption.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    left.
(* Goal: @Parallelogram Tn A B E C *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
    apply plg_comm2 in HPar.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
    assumption.

(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
    right.
(* Goal: not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) *)
    intro H.
(* Goal: not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) *)
    elim H; clear H; intro H.

(* Goal: False *)
(* Goal: False *)
      spliter; subst; intuition.

(* Goal: False *)
      destruct H as [F [Hout' HElim]].
(* Goal: False *)
      elim HElim; clear HElim; intro HElim.

(* Goal: False *)
(* Goal: False *)
        apply plg_comm2 in HElim.
(* Goal: False *)
(* Goal: False *)
        assert (HEF := plg_uniqueness B A C E F HPar HElim).
(* Goal: False *)
(* Goal: False *)
        subst; intuition.

(* Goal: False *)
        spliter; intuition.
Qed.

Lemma same_or_opp_dir : forall A B C D, Par A B C D -> Same_dir A B C D \/ Opp_dir A B C D.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
induction (same_dir_dec A B C D).
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : @Opp_dir Tn A B C D), not (@Same_dir Tn A B C D) *)
unfold Opp_dir.

(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
assert(HH:= vector_construction A B D).
ex_and HH C'.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => and (@Col Tn X A B) (@Col Tn X C D)) *)
(* Goal: @Bet Tn D C C' *)
(* Goal: @Bet Tn D C C' *)
exists C'.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @eq (@Tpoint Tn) A B *)
2:auto.
(* Goal: @Out Tn A B B' *)
(* Goal: @EqV Tn C D A B' *)
unfold EqV in H1.

induction (eq_dec_points B C').
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.

(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgs_permut in H1.
apply plgs_sym in H1.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply plgf_permut in H1.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgf_trivial_neq in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
split; Col.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: or (@Bet Tn A B B') (@Bet Tn A B' B) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
induction H4.
(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
repeat split; auto.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @Same_dir Tn C D A B *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply same_dir_sym.
(* Goal: @eq (@Tpoint Tn) A B *)
apply bet_same_dir2; auto.
(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) B C *)
subst A.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
apply par_distinct in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.

(* Goal: @Bet Tn D C C' *)
assert(Col C' C D /\ Col D C D).
apply plg_par in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.

(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
apply(parallel_uniqueness A B C D C' D D); Col.
apply par_distinct in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
clear H4.

(* Goal: @Out Tn A C B *)
(* Goal: @EqV Tn A B A B *)
unfold Out.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
repeat split.
apply par_distinct in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply plgf_sym in H1.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgf_trivial_neq in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
apply par_distinct in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.

(* Goal: @eq (@Tpoint Tn) A B *)
induction H3.
(* Goal: or (@Parallelogram Tn A B E C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C E)) *)
(* Goal: or (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D')))))) (not (or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn C D D') (or (@Parallelogram Tn A B D' C) (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D'))))))) *)
left.
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H3.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.

assert(Same_dir A B D C').
apply plg_opp_dir.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.

assert(Same_dir C D D C').
apply bet_same_dir2.
apply par_distinct in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
subst C'.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
induction H1.
(* Goal: @Parallelogram Tn A B D' C *)
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H1.
(* Goal: @Col Tn C A C *)
(* Goal: False *)
(* Goal: @EqV Tn A B D C *)
Col.
apply plgf_sym in H1.
(* Goal: False *)
(* Goal: @Bet Tn D C C' *)
apply plgf_trivial_neq in H1.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
apply par_distinct in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
apply (same_dir_trans _ _ D C').
(* Goal: @Bet Tn C D' D *)
(* Goal: @Parallelogram Tn C D B' A *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: and (not (@eq (@Tpoint Tn) B A)) (and (not (@eq (@Tpoint Tn) B' A)) (or (@Bet Tn A B B') (@Bet Tn A B' B))) *)
(* Goal: @EqV Tn C D A B' *)
apply H4.
(* Goal: @Same_dir Tn C D A B *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply same_dir_sym.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
apply par_distinct in H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma same_dir_id : forall A B, Same_dir A B B A -> A = B.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Same_dir in H.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @eq (@Tpoint Tn) A B *)
ex_and H C.
(* Goal: @eq (@Tpoint Tn) A B *)
apply eqv_mid in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Midpoint in H0.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Out in H.
(* Goal: @eq (@Tpoint Tn) A B *)
spliter.
(* Goal: @eq (@Tpoint Tn) A B *)
induction H3.
(* Goal: @eq (@Tpoint Tn) A B *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply (between_equality _ _ C).
(* Goal: @Bet Tn A B C *)
(* Goal: @Bet Tn B A C *)
(* Goal: @eq (@Tpoint Tn) A B *)
apply H0.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @eq (@Tpoint Tn) A B *)
apply False_ind.
(* Goal: False *)
apply H2.
(* Goal: @eq (@Tpoint Tn) C B *)
apply (between_equality _ _ A).
(* Goal: @Bet Tn C B A *)
(* Goal: @Bet Tn B C A *)
Between.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma opp_dir_id : forall A B, Opp_dir A B A B -> A = B.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
unfold Opp_dir in H.
(* Goal: @eq (@Tpoint Tn) A B *)
apply same_dir_id in H.
(* Goal: @eq (@Tpoint Tn) A B *)
auto.
Qed.


Lemma same_dir_to_null : forall A B C D, Same_dir A B C D -> Same_dir A B D C -> A = B /\ C = D.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.

(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
assert(Same_dir C D D C).
(* Goal: @Same_dir Tn C D D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply (same_dir_trans _ _ A B).
(* Goal: @Same_dir Tn C D A B *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply same_dir_sym.
(* Goal: @Same_dir Tn A B C D *)
(* Goal: @Same_dir Tn A B D C *)
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply H.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
apply same_dir_id in H1.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C D) *)
subst D.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
apply same_dir_sym in H.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
apply same_dir_null in H.
(* Goal: and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) C C) *)
subst B.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
Qed.

Lemma opp_dir_to_null : forall A B C D, Opp_dir A B C D -> Opp_dir A B D C -> A = B /\ C = D.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : @Opp_dir Tn A B C D), not (@Same_dir Tn A B C D) *)
unfold Opp_dir.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @eq (@Tpoint Tn) A B *)
apply same_dir_to_null; auto.
Qed.

Lemma same_not_opp_dir : forall A B C D, A <> B -> Same_dir A B C D -> ~ Opp_dir A B C D.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
apply same_dir_to_null in H0.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma opp_not_same_dir : forall A B C D, A <> B -> Opp_dir A B C D -> ~ Same_dir A B C D.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : @Opp_dir Tn A B C D), not (@Same_dir Tn A B C D) *)
unfold Opp_dir.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: not (@Same_dir Tn A B C D) *)
intro.
(* Goal: False *)
apply same_dir_to_null in H0.
(* Goal: False *)
(* Goal: @Same_dir Tn A B C D *)
tauto.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
Qed.

Lemma vector_same_dir_cong : forall A B C D, A <> B -> C <> D -> exists X, exists Y, Same_dir A B X Y /\ Cong X Y C D.
(* Goal: forall (A B C D : @Tpoint Tn) (_ : not (@eq (@Tpoint Tn) A B)) (_ : not (@eq (@Tpoint Tn) C D)), @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
intros.
(* Goal: @ex (@Tpoint Tn) (fun X : @Tpoint Tn => @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B X Y) (@Cong Tn X Y C D))) *)
exists A.
(* Goal: @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B A Y) (@Cong Tn A Y C D)) *)
assert(HH:=segment_construction_3 A B C D H H0).
(* Goal: @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B A Y) (@Cong Tn A Y C D)) *)
ex_and HH P.
(* Goal: @ex (@Tpoint Tn) (fun Y : @Tpoint Tn => and (@Same_dir Tn A B A Y) (@Cong Tn A Y C D)) *)
exists P.
(* Goal: and (@Same_dir Tn A B A P) (@Cong Tn A P C D) *)
split; auto.
(* Goal: @Same_dir Tn A B A P *)
unfold Same_dir.
(* Goal: or (and (@eq (@Tpoint Tn) A B) (@eq (@Tpoint Tn) A P)) (@ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D'))) *)
right.
(* Goal: @ex (@Tpoint Tn) (fun D' : @Tpoint Tn => and (@Out Tn A P D') (@EqV Tn A B A D')) *)
exists B.
(* Goal: and (@Out Tn A P B) (@EqV Tn A B A B) *)
split.
(* Goal: @Out Tn A P B *)
(* Goal: @EqV Tn A B A B *)
apply l6_6.
(* Goal: @Out Tn A B P *)
(* Goal: @EqV Tn A B A B *)
assumption.
(* Goal: @EqV Tn A B A B *)
apply eqv_refl.
Qed.

End Vectors.
