Require Export GeoCoq.Elements.OriginalProofs.lemma_samesidereflexive.
Require Export GeoCoq.Elements.OriginalProofs.lemma_sameside2.
Require Export GeoCoq.Elements.OriginalProofs.lemma_samesidesymmetric.
Require Export GeoCoq.Elements.OriginalProofs.proposition_12.
Require Export GeoCoq.Elements.OriginalProofs.lemma_8_7.

Section Euclid.

Context `{Ax:euclidean_neutral_ruler_compass}.

Lemma lemma_notperp : 
   forall A B C P, 
   BetS A C B -> nCol A B P ->
   exists X, nCol A B X /\ OS X P A B /\ ~ Per A C X.
Proof.
(* Goal: forall (A B C P : @Point Ax0) (_ : @BetS Ax0 A C B) (_ : @nCol Ax0 A B P), @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
intros.
(* Goal: False *)
assert (neq C B) by (forward_using lemma_betweennotequal).
(* Goal: False *)
assert (neq B C) by (conclude lemma_inequalitysymmetric).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (~ eq C P).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
 {
(* Goal: not (@neq Ax0 B E) *)
 intro.
(* Goal: False *)
 assert (nCol A B C) by (conclude cn_equalitysub).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
 assert (Col A C B) by (conclude_def Col ).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
 assert (Col A B C) by (forward_using lemma_collinearorder).
(* Goal: False *)
 contradict.
 }
let Tf:=fresh in
assert (Tf:exists Q, (BetS B C Q /\ Cong C Q C P)) by (conclude lemma_extension);destruct Tf as [Q];spliter.
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (~ eq P Q).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
 {
(* Goal: not (@neq Ax0 B E) *)
 intro.
(* Goal: False *)
 assert (Col B C Q) by (conclude_def Col ).
(* Goal: False *)
 assert (Col B C P) by (conclude cn_equalitysub).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
 assert (Col A C B) by (conclude_def Col ).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
 assert (Col C B A) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (Col C B P) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (Col B A P) by (conclude lemma_collinear4).
(* Goal: False *)
 assert (Col A B P) by (forward_using lemma_collinearorder).
(* Goal: False *)
 contradict.
 }
let Tf:=fresh in
assert (Tf:exists M, (BetS P M Q /\ Cong M P M Q)) by (conclude proposition_10);destruct Tf as [M];spliter.
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Col A C B) by (conclude_def Col ).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Col C B A) by (forward_using lemma_collinearorder).
(* Goal: False *)
assert (neq C B) by (forward_using lemma_betweennotequal).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Col C B Q) by (conclude_def Col ).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Col B A Q) by (conclude lemma_collinear4).
(* Goal: False *)
assert (Col A B Q) by (forward_using lemma_collinearorder).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (neq A B) by (forward_using lemma_betweennotequal).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (OS P P A B) by (conclude lemma_samesidereflexive).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (neq Q P) by (conclude lemma_inequalitysymmetric).
(* Goal: False *)
assert (BetS Q M P) by (conclude axiom_betweennesssymmetry).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Out Q P M) by (conclude lemma_ray4).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Col A Q B) by (forward_using lemma_collinearorder).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (OS P M A B) by (conclude lemma_sameside2).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (OS M P A B) by (forward_using lemma_samesidesymmetric).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (~ Col A B M).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
 {
(* Goal: not (@neq Ax0 B E) *)
 intro.
(* Goal: False *)
 assert (Col B M Q) by (conclude lemma_collinear4).
(* Goal: False *)
 assert (Col P M Q) by (conclude_def Col ).
(* Goal: False *)
 assert (Col M Q P) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (Col M Q B) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (neq M Q) by (forward_using lemma_betweennotequal).
(* Goal: False *)
 assert (Col Q P B) by (conclude lemma_collinear4).
(* Goal: False *)
 assert (Col Q B P) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (Col Q B A) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (neq B Q) by (forward_using lemma_betweennotequal).
(* Goal: False *)
 assert (neq Q B) by (conclude lemma_inequalitysymmetric).
(* Goal: False *)
 assert (Col B P A) by (conclude lemma_collinear4).
(* Goal: False *)
 assert (Col A B P) by (forward_using lemma_collinearorder).
(* Goal: False *)
 contradict.
 }
let Tf:=fresh in
assert (Tf:exists R, Perp_at M R A B R) by (conclude proposition_12);destruct Tf as [R];spliter.
let Tf:=fresh in
assert (Tf:exists E, (Col M R R /\ Col A B R /\ Col A B E /\ Per E R M)) by (conclude_def Perp_at );destruct Tf as [E];spliter.
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Per M R E) by (conclude lemma_8_2).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (~ eq M R).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
 {
(* Goal: not (@neq Ax0 B E) *)
 intro.
(* Goal: False *)
 assert (Col A B M) by (conclude cn_equalitysub).
(* Goal: False *)
 contradict.
 }
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (neq A C) by (forward_using lemma_betweennotequal).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (Col A B C) by (forward_using lemma_collinearorder).
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
assert (~ Per A C M).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
 {
(* Goal: not (@neq Ax0 B E) *)
 intro.
(* Goal: False *)
 assert (~ neq R C).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
  {
(* Goal: not (@neq Ax0 B E) *)
  intro.
(* Goal: False *)
  assert (Col B A C) by (forward_using lemma_collinearorder).
(* Goal: False *)
  assert (Col B A R) by (forward_using lemma_collinearorder).
(* Goal: False *)
  assert (neq B A) by (conclude lemma_inequalitysymmetric).
(* Goal: False *)
  assert (Col A C R) by (conclude lemma_collinear4).
(* Goal: False *)
  assert (Per R C M) by (conclude lemma_collinearright).
(* Goal: False *)
  assert (~ Per M R C) by (conclude lemma_8_7).
(* Goal: False *)
  assert (Per E R M) by (conclude lemma_8_2).
(* Goal: False *)
  assert (Col B C R) by (conclude lemma_collinear4).
(* Goal: False *)
  assert (Col B C E) by (conclude lemma_collinear4).
(* Goal: False *)
  assert (neq C B) by (forward_using lemma_betweennotequal).
(* Goal: False *)
  assert (neq B C) by (conclude lemma_inequalitysymmetric).
(* Goal: False *)
  assert (Col C R E) by (conclude lemma_collinear4).
(* Goal: False *)
  assert (Col E R C) by (forward_using lemma_collinearorder).
(* Goal: False *)
  assert (neq C R) by (conclude lemma_inequalitysymmetric).
(* Goal: False *)
  assert (Per C R M) by (conclude lemma_collinearright).
(* Goal: False *)
  assert (Per M R C) by (conclude lemma_8_2).
(* Goal: False *)
  contradict.
  }
(* Goal: False *)
 assert (~ eq M C).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
  {
(* Goal: not (@neq Ax0 B E) *)
  intro.
(* Goal: False *)
  assert (Col A B M) by (conclude cn_equalitysub).
(* Goal: False *)
  contradict.
  }
(* Goal: False *)
 assert (Cong Q C P C) by (forward_using lemma_congruenceflip).
(* Goal: False *)
 assert (BetS Q M P) by (conclude axiom_betweennesssymmetry).
(* Goal: False *)
 assert (Cong Q M P M) by (forward_using lemma_doublereverse).
(* Goal: False *)
 assert (Per Q M C) by (conclude_def Per ).
(* Goal: False *)
 assert (neq C Q) by (forward_using lemma_betweennotequal).
(* Goal: False *)
 assert (neq Q C) by (conclude lemma_inequalitysymmetric).
(* Goal: False *)
 assert (Per E R M) by (conclude lemma_8_2).
(* Goal: False *)
 assert (neq Q R) by (conclude cn_equalitysub).
(* Goal: False *)
 assert (Col B C Q) by (conclude_def Col ).
(* Goal: False *)
 assert (Col C B Q) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (Col Q B C) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (Col B E R) by (conclude lemma_collinear4).
(* Goal: False *)
 assert (Col B E Q) by (conclude lemma_collinear4).
(* Goal: False *)
 assert (~ neq B E).
(* Goal: not (@neq Ax0 B E) *)
(* Goal: False *)
  {
(* Goal: not (@neq Ax0 B E) *)
  intro.
(* Goal: False *)
  assert (Col E R Q) by (conclude lemma_collinear4).
(* Goal: False *)
  assert (Per Q R M) by (conclude lemma_collinearright).
(* Goal: False *)
  assert (Per Q C M) by (conclude cn_equalitysub).
(* Goal: False *)
  assert (Per M C Q) by (conclude lemma_8_2).
(* Goal: False *)
  assert (~ Per Q M C) by (conclude lemma_8_7).
(* Goal: False *)
  contradict.
  }
(* Goal: False *)
 assert (Col A E R) by (conclude cn_equalitysub).
(* Goal: False *)
 assert (Col A B Q) by (forward_using lemma_collinearorder).
(* Goal: False *)
 assert (Col A E Q) by (conclude cn_equalitysub).
(* Goal: False *)
 assert (neq A E) by (conclude cn_equalitysub).
(* Goal: False *)
 assert (Col E R Q) by (conclude lemma_collinear4).
(* Goal: False *)
 assert (Per Q R M) by (conclude lemma_collinearright).
(* Goal: False *)
 assert (Per Q C M) by (conclude cn_equalitysub).
(* Goal: False *)
 assert (Per M C Q) by (conclude lemma_8_2).
(* Goal: False *)
 assert (~ Per Q M C) by (conclude lemma_8_7).
(* Goal: False *)
 contradict.
 }
(* Goal: @ex (@Point Ax0) (fun X : @Point Ax0 => and (@nCol Ax0 A B X) (and (@OS Ax0 X P A B) (not (@Per Ax0 A C X)))) *)
exists M;close.
Qed.

End Euclid.


