(* Julien Narboux *)
(* Formalization of *)
(* Tarski's axiomatic *)
Require Export Ch02_congruence_properties.
(** Axiom 12 of Givant. *)
Proof with eTarski.
intros.
assert (exists x : Point, Bet A B x /\ Cong B x B B)...
DecompExAnd H x.
assert (B = x).
assert (Cong B B B x)...
congruence.
Qed.
Hint Resolve beetween_trivial : Tarski.
(** Axiom 14 of Givant. *)
Proof with eTarski.
intros.
assert (Bet B C C)...
assert (exists x, Bet B x B /\ Bet C x A)...
DecompExAnd H1 x.
assert (B=x)...
congruence.
Qed.
Hint Resolve between_symmetry : sTarski.
Hint Resolve beetween_trivial beetween_trivial2 : Tarski.
Proof with Tarski.
intros.
assert
(exists x : Point,
Bet B x B /\ Bet A x A).
eapply inner_pasch;eauto.
DecompExAnd H1 x.
assert (A = x)...
assert (B = x)...
rewrite <- H2 in H1.
assumption.
Qed.
Hint Resolve between_egality : Tarski.
(** Inner transitivity 'axiom' for betweenness. *)
Proof with eTarski.
intros.
assert (exists x,Bet B x B /\ Bet C x A)...
DecompExAnd H1 x.
apply between_symmetry.
assert (B=x)...
congruence.
Qed.
Hint Resolve between_exchange3 : Tarski.
Proof with eTarski.
intros.
assert (exists x, Bet A C x /\ Cong C x C D)...
DecompExAnd H2 x.
assert (Bet B C x)...
assert (x=D).
eapply construction_unicity;try apply H1...
subst x...
Qed.
Proof with eTarski.
intros.
cases_equality B C.
subst B...
eapply outer_transitivity_between2.
3:apply H1.
eapply between_inner_transitivity...
assumption.
Qed.
(** Axiom 16 of Givant. *)
Proof with eTarski.
intros.
eapply between_symmetry.
eapply between_exchange2;apply between_symmetry.
2:apply H.
eapply outer_transitivity_between2...
Qed.
Hint Resolve between_inner_transitivity : Tarski.
Hint Resolve between_exchange2 between_exchange3 between_exchange4 : Tarski.
Hint Resolve outer_transitivity_between outer_transitivity_between2 : Tarski.
Hint Resolve between_inner_transitivity
between_exchange2 between_exchange3 between_exchange4
outer_transitivity_between outer_transitivity_between2
between_symmetry : Between.
Ltac Between := eauto with Between.
(* Axiom 20.1 of Givant Lemma unique_triangle : forall A B C C' D, A <> B -> Cong A C A C' -> Cong B C B C' -> Bet B D C' -> (Bet A D C \/ Bet A C D) -> C=C'. Axiom 21 of Givant Lemma existence_triangle : forall A B A' B' C', Cong A B A' B' -> exists C X, Cong A C A' C' /\ Cong B C B' C' /\ Bet C X P /\ Col A B X. *)
(** We formalize $Bet_n$ only for n=4. *)
Definition Bet_4 := fun A1 A2 A3 A4 =>
Bet A1 A2 A3 /\ Bet A2 A3 A4 /\ Bet A1 A3 A4 /\ Bet A1 A2 A4.
(** There are two distinct points ! *)
(** This is the first use of the lower dimension axiom *)
Hint Resolve two_distinct_points : Tarski.
Proof with Tarski.
intros.
assert (exists x, exists y:Point, x <> y)...
DecompEx H U.
DecompEx H0 V.
assert (exists C, Bet A B C /\ Cong B C U V)...
DecompEx H0 C.
exists C.
intuition.
rewrite H1 in H2.
assert (U=V).
eapply cong_identity.
apply cong_symmetry.
eauto.
auto.
Qed.
Hint Resolve point_construction_different : Tarski.
(** Given a point, we can build another one which is different from the first one. *)
(** From the last two lemmas we can conclude that models of the first seven axioms are infinite *)

Lemma l3_17 : forall A B C A' B' P,
Bet A B C ->  Bet A' B' C ->  Bet A P A' ->
exists Q, Bet P Q C /\ Bet B Q B'.