A Rocq-Based Formalization of Hilbert’s Geometry: Building a Reusable Foundation for 3D Perpendicularity Theory and Verification
Abstract
1. Introduction
2. Hilbert’s Axioms and Formalizations
2.1. Group I
- Parameter Point Line Plane : Set.
- Parameter Incid : Point -> Line -> Prop. (* Point-line incidence *)
- Parameter Incid_P_F : Point -> Plane -> Prop. (* Point-plane incidence *)
- (* Line-plane incidence: a line lies on a plane if all its points do *)
- Definition Incid_L_F (l : Line) (f : Plane) : Prop :=
- forall A, Incid A l -> Incid_P_F A f.
- Definition ColH (A B C : Point) : Prop :=
- exists l, Incid A l /\ Incid B l /\ Incid C l.
- Definition Cof A B C D := exists f, Incid_P_F A f /\
- Incid_P_F B f /\ Incid_P_F C f /\ Incid_P_F D f.
- Axiom Incid_1 : forall A B, A<>B -> exists l, Incid A l /\ Incid B l.
- Axiom Incid_2 : forall A B l1 l2, A<>B ->
- Incid A l1 -> Incid B l1 ->Incid A l2 -> Incid B l2 -> l1=l2.
- Axiom Incid_3_1 : forall l, exists A B, A<>B /\ Incid A l /\ Incid B l.
- Axiom Incid_3_2 : exists A B C, ~ ColH A B C.
- Axiom Incid_4_1 : forall A B C, ~ ColH A B C -> exists! f,
- Incid_P_F A f /\ Incid_P_F B f /\ Incid_P_F C f.
- Axiom Incid_4_2 : forall f, exists A, Incid_P_F A f.
- Axiom Incid_6 : forall l f A B, A<>B -> Incid A l -> Incid B l ->
- Incid_P_F A f -> Incid_P_F B f -> Incid_L_F l f.
- Axiom Incid_7 : forall A f1 f2, f1<>f2 -> Incid_P_F A f1 -> Incid_P_F A f2 ->
- exists B, A<>B /\ Incid_P_F B f1 /\ Incid_P_F B f2.
- Axiom Incid_8 : exists A B C D, ~ Cof A B C D.
2.2. Group II
- Parameter BetH : Point -> Point -> Point -> Prop. (* B is between A and C *)
- Axiom BetH_1_1 : forall A B C, BetH A B C -> ColH A B C.
- Axiom BetH_1_2 : forall A B C, BetH A B C -> A <> C.
- Axiom BetH_1_3 : forall A B C, BetH A B C -> BetH C B A.
- Axiom BetH_2 : forall A B, A <> B -> exists C, BetH A B C.
- Axiom BetH_3 : forall A B C, BetH A B C -> ~ BetH B C A.
- (* line l intersects segment AB *)
- Definition cut (l : Line) (A B : Point) :=
- ~ Incid A l /\ ~ Incid B l /\ exists I, Incid I l /\ BetH A I B.
- (* Pasch’s Axiom *)
- Axiom BetH_4: forall A B C l (H: ~ ColH A B C),
- (forall D, Incid D l -> Cof A B C D) ->
- ~ Incid C l -> cut l A B -> cut l A C \/ cut l B C.
- (* Points A and A’ are on the same side of Point O *)
- Definition Ipsilateral_P A A’ O :=
- A <> O /\ A’ <> O /\ ColH A O A’ /\ ~ BetH A O A’.
- (* Points A and B are on the different sides of Point O *)
- Definition Heteromeral_P A B O := BetH A O B.
- (* Points A and A’ are on the same side of line l *)
- Definition Ipsilateral_L A A’ l := exists P, cut l A P /\ cut l A’ P.
- (* Points A and B are on the different sides of line l *)
- Definition Heteromeral_L A B l := cut l A B.
- (* Points C and D are on the same side of line AB *)
- Definition Ipsilateral_S A B C D := A<>B /\
- forall l, Incid A l -> Incid B l -> Ipsilateral_L C D l.
- (* Points C and D are on the different sides of line AB *)
- Definition Heteromeral_S A B C D := A<>B /\
- forall l, Incid A l -> Incid B l -> cut l C D.
- (* Points A and B are on the same side of flat f *)
- Definition Ipsilateral_f A A’ f := ~ Incid_P_F A f /\ ~ Incid_P_F A’ f /\
- ~ (exists P, BetH A P A’ /\ Incid_P_F P f).
- (* Points A and B are on the different sides of flat f *)
- Definition Heteromeral_f A B f := ~ Incid_P_F A f /\ ~ Incid_P_F B f /\
- (exists P, BetH A P B /\ Incid_P_F P f).
- Definition Ipl_S_Hil A A’ l f := Incid_P_F A f /\ Incid_P_F A’ f /\
- Incid_L_F l f /\ ~ Incid A l /\ ~ Incid A’ l /\ ~ cut l A A’.
2.3. Group III
2.3.1. Congruence of Segments
- Parameter CongH : Point -> Point -> Point -> Point -> Prop.
- Axiom CongH_1 : forall A B A’ P, A<>B -> A’<>P ->
- exists B’, Ipsilateral_P B’ P A’ /\ CongH A B A’ B’.
- Axiom CongH_2 : forall A B C D E F, A<>B -> C<>D -> E<>F ->
- CongH A B E F -> CongH C D E F -> CongH A B C D.
- Axiom CongH_3 : forall A B C A’ B’ C’, BetH A B C->
- BetH A’ B’ C’ -> CongH A B A’ B’ -> CongH B C B’ C’-> CongH A C A’ C’.
- (* Reflexivity *)
- Corollary CongH_self : forall A B, A<>B -> CongH A B A B.
- (* Symmetry *)
- Corollary CongH_symmetry : forall A B C D, A<>B -> C<>D ->
- CongH A B C D -> CongH C D A B.
- (* Transitivity *)
- Corollary CongH_transitivity : forall A B C D E F, A<>B ->
- C<>D -> E<>F -> CongH A B C D -> CongH C D E F -> CongH A B E F.
- Axiom CongH_exc34 : forall A B C D, A<>B -> C<>D ->
- CongH A B C D -> CongH A B D C.
2.3.2. Congruence of Angles
- Parameter CongaH : Point -> Point -> Point -> Point -> Point -> Point -> Prop.
- Axiom CongH_4_exists : forall A B C P’ A’ B’, ~ ColH A B C -> ~ ColH A’ B’ P’ ->
- exists C’, Ipsilateral_S A’ B’ C’ P’ /\ CongaH A B C A’ B’ C’.
- Axiom CongH_4_unique : forall A B C P’ A’ B’ C’ D’, ~ ColH A B C ->
- ~ ColH A’ B’ P’ -> Ipsilateral_S A’ B’ C’ P’ -> Ipsilateral_S A’ B’ D’ P’ ->
- CongaH A B C A’ B’ C’ -> CongaH A B C A’ B’ D’ -> Ipsilateral_P C’ D’ B’.
- Axiom CongH_4_self : forall A B C, ~ ColH A B C -> CongaH A B C A B C.
- Axiom CongH_4_exc : forall A B C D E F, CongaH A B C D E F ->
- CongaH A B C F E D /\ CongaH C B A D E F /\ CongaH C B A F E D.
- (* Congruence is preserved under extension of the angle’s sides *)
- Axiom CongH_4_CongaH : forall A B C D E F A’ C’ D’ F’, ~ ColH A B C ->
- ~ ColH D E F -> CongaH A B C D E F -> Ipsilateral_P A A’ B ->
- Ipsilateral_P C C’ B -> Ipsilateral_P D D’ E ->
- Ipsilateral_P F F’ E -> CongaH A’ B C’ D’ E F’.
2.3.3. The Side-Angle-Side (SAS) Axiom
- Axiom CongH_5 : forall A B C A’ B’ C’, ~ ColH A B C ->
- ~ ColH A’ B’ C’ -> CongH A B A’ B’ -> CongH A C A’ C’ ->
- CongaH B A C B’ A’ C’ -> CongaH A B C A’ B’ C’.
3. Formalization of Elementary Consequences
3.1. Key Lemmas About Order and Congruence
3.1.1. Original Lemmas for Spatial Order
- Lemma exists_He : forall A B C P, Cof A B C P -> ~ ColH A B C ->
- ~ ColH A B P -> exists P’, ColH A C P’ /\ Heteromeral_S A B P P’.
- Lemma exists_uncof : forall f A B D P, ~ Incid_P_F D f
- -> ~ Incid_P_F P f -> Incid_P_F A f -> ~ Cof A B D P
- -> exists Q, Cof A B D Q /\ Heteromeral_f Q P f.
3.1.2. Strengthening the Congruence Axioms
- Corollary CongH_1_unique : forall A B A’ P B’ B’’, A <> B -> A’ <> P ->
- Ipsilateral_P B’ P A’ -> Ipsilateral_P B’’ P A’->
- CongH A B A’ B’ -> CongH A B A’ B’’ -> B’=B’’.
- Corollary CongH_3_BetH : forall A B C A’ B’ C’, BetH A B C -> BetH A’ B’ C’ ->
- CongH A C A’ C’ -> CongH A B A’ B’ -> CongH B C B’ C’.
- Corollary CongH_3_exists_Ips : forall A B C A’ B’, Ipsilateral_P B C A ->
- B<>C -> A’<>B’ -> CongH A B A’ B’ -> exists C’, Ipsilateral_P B’ C’ A’ /\
- CongH A C A’ C’ /\ CongH B C B’ C’ /\ C’<>B’.
3.2. Hilbert’s Key Theorems
3.2.1. Theorems on Triangle Congruence
- Definition CongtH A B C A’ B’ C’ := ~ ColH A B C /\ ~ ColH A’ B’ C’ /\
- CongH A B A’ B’ /\ CongH A C A’ C’ /\
- CongH B C B’ C’ /\ CongaH B A C B’ A’ C’ /\
- CongaH A B C A’ B’ C’ /\ CongaH A C B A’ C’ B’.
- Theorem Theorem12 : forall A B C A’ B’ C’, ~ ColH A B C -> ~ ColH A’ B’ C’ ->
- CongH A B A’ B’ -> CongH A C A’ C’ ->
- CongaH B A C B’ A’ C’ -> CongtH A B C A’ B’ C’.
- Theorem Theorem13 : forall A B C A’ B’ C’, ~ ColH A B C -> ~ ColH A’ B’ C’ ->
- CongH A B A’ B’ -> CongaH B A C B’ A’ C’ ->
- CongaH A B C A’ B’ C’ -> CongtH A B C A’ B’ C’.
- Theorem Theorem18 : forall A B C A’ B’ C’, ~ ColH A B C -> ~ ColH A’ B’ C’ ->
- CongH A B A’ B’ -> CongH A C A’ C’ ->
- CongH B C B’ C’ -> CongtH A B C A’ B’ C’.
3.2.2. Theorem on Angles and Midpoints
- Definition Right_angle A B C := ~ ColH A B C /\
- forall C’, BetH C B C’ -> CongaH A B C A B C’.
- Theorem Theorem21 : forall A B C A’ B’ C’, Right_angle A B C ->
- Right_angle A’ B’ C’ -> CongaH A B C A’ B’ C’.
- Corollary Cor_Theorem21 : forall A B C A’ B’ C’, ~ ColH A’ B’ C’ ->
- CongaH A B C A’ B’ C’ -> Right_angle A B C -> Right_angle A’ B’ C’.
- Theorem Theorem14 : forall A B C D A’ B’ C’ D’, ~ ColH A B C ->
- ~ ColH A’ B’ C’ -> BetH A B D -> BetH A’ B’ D’ ->
- CongaH A B C A’ B’ C’ -> CongaH C B D C’ B’ D’.
- Corollary Cor1_Theorem14 : forall A B C A’ C’, ~ ColH A B C ->
- BetH A B A’ -> BetH C B C’-> CongaH C’ B A’ A B C.
- Corollary Cor2_Theorem14 : exists A B C, Right_angle A B C.
- Theorem Theorem19 : forall H O K H’ O’ K’ H’’ O’’ K’’, ~ ColH H O K ->
- ~ ColH H’ O’ K’ -> ~ ColH H’’ O’’ K’’ -> CongaH H’ O’ K’ H O K ->
- CongaH H’’ O’’ K’’ H O K -> CongaH H’ O’ K’ H’’ O’’ K’’.
- Corollary CongaH_symmetry : forall A B C A’ B’ C’, ~ ColH A B C ->
- ~ ColH A’ B’ C’ -> CongaH A B C A’ B’ C’ -> CongaH A’ B’ C’ A B C.
- Corollary CongaH_trans : forall A B C A’ B’ C’ A’’ B’’ C’’, ~ ColH A B C ->
- ~ ColH A’ B’ C’ -> ~ ColH A’’ B’’ C’’ -> CongaH A B C A’ B’ C’ ->
- CongaH A’ B’ C’ A’’ B’’ C’’ -> CongaH A B C A’’ B’’ C’’.
- Definition MidPoint C A B := BetH A C B /\ CongH A C B C.
- Theorem Theorem26 : forall A B, A<>B -> exists C, MidPoint C A B.
3.3. Advanced Lemmas on Congruence and Configuration
- Definition diff_th (A B C : Point) := A<>B /\ A<>C /\ B<>C.
- Lemma Cong_colh : forall A B C A’ B’ C’, diff_th A B C -> CongH A B A’ B’ ->
- CongH A C A’ C’ -> CongH B C B’ C’ -> ColH A B C -> ColH A’ B’ C’.
- Lemma Cong_uncolh : forall A B C A’ B’ C’, diff_th A’ B’ C’ -> CongH A B A’ B’ ->
- CongH A C A’ C’ -> CongH B C B’ C’ -> ~ ColH A B C -> ~ ColH A’ B’ C’.
- Lemma Cong_bet : forall A B C A’ B’ C’, A’<>B’ -> A’<>C’ -> CongH A B A’ B’ ->
- CongH A C A’ C’ -> CongH B C B’ C’ -> BetH A B C -> BetH A’ B’ C’.
- Lemma Cong_Ips : forall A B C A’ B’ C’, A <> B -> A’<>B’ ->
- A’<>C’ -> B’<>C’ -> CongH A B A’ B’-> CongH A C A’ C’ ->
- CongH B C B’ C’ -> Ipsilateral_P A B C -> Ipsilateral_P A’ B’ C’.
- Lemma CongH_colh : forall A B C P A’ B’ C’ P’, P<>C -> B<>P ->
- B’<>P’ -> A<>C -> B<>C -> A’<>C’ -> B’<>C’ ->
- Ipsilateral_P B P A -> Ipsilateral_P B’ P’ A’ ->
- ColH A B C -> CongH C A C’ A’ -> CongH C B C’ B’->
- CongH A B A’ B’ -> CongH A P A’ P’ ->
- CongH B P B’ P’ -> CongH C P C’ P’
- Lemma CongH_col : forall A B C P A’ B’ C’ P’,
- ~ ColH A B C -> diff_th A’ B’ C’ ->
- CongH A B A’ B’ -> CongH A C A’ C’ -> CongH B C B’ C’ ->
- ColH A B P -> A<>P -> B<>P -> A’<>P’ -> B’<>P’->
- CongH A P A’ P’ -> CongH B P B’ P’ -> CongH C P C’ P’.
- Lemma Midpoint_Conga : forall A A’ B B’ C C’ M, ~ ColH A B C ->
- MidPoint M A A’ -> MidPoint M B B’ ->
- MidPoint M C C’ -> CongaH A B C A’ B’ C’.
- Lemma Mid_Cong_BetH : forall A O B A’ B’ P Q, ~ ColH A O B ->
- BetH A O A’ -> BetH B O B’ ->
- CongH O A O B -> CongH O A’ O B’ ->
- MidPoint P A B -> MidPoint Q A’ B’ -> BetH P O Q.
4. Establishment of Perpendicularity Theory in Hilbert’s System
4.1. Foundation Definitions and Planar Propositions
- Line–Line Perpendicularity: Given a right angle , we can say that the line is perpendicular to the line , with B as the intersection point. is also referred to as the perpendicular to .
- Line–Plane Perpendicularity: If point A lies outside the plane f, and B is a point on f, such that for any other point C on the plane f, angle is a right angle, we say that the line is perpendicular to the plane f, with B as the foot of the perpendicular. The line is also called the perpendicular to f.
4.2. Key Properties About Line–Line Perpendicularity
4.3. Key Properties About Line–Plane Perpendicularity
4.4. Formalization Summary
- Proposition Per_Mid : forall A B C P, ~ ColH P B A ->
- MidPoint B A C -> CongH P A P C -> Right_angle P B A.
- Proposition Mid_Per : forall A B C P, MidPoint B A C ->
- Right_angle P B A -> CongH P A P C.
- Proposition ColH_Right : forall A B C D, Cof A B C D ->
- Right_angle A B C -> Right_angle A B D -> ColH B C D.
- Proposition Right_exists : forall A B P, ~ ColH A B P ->
- exists C, Right_angle A B C /\ Ipsilateral_S A B C P.
- Proposition Right_exists_to_line : forall l C, ~ Incid C l ->
- exists X, Incid X l /\
- (forall X’, X’ <>X -> Incid X’ l -> Right_angle X’ X C).
- Proposition Conga_flat : forall A B C A’ B’ C’, ~ ColH B A C ->
- Ipsilateral_S A A’ B B’ -> Ipsilateral_S A A’ C C’ ->
- Right_angle B A A’ -> Right_angle A A’ B’ ->
- Right_angle C A A’ -> Right_angle A A’ C’ ->
- CongaH B A C B’ A’ C’.
- Proposition Perp_flat : forall A B C D E, Right_angle A B C ->
- Right_angle A B D -> ~ ColH B C D -> B<>E ->
- Cof B C D E -> Right_angle A B E.
- Proposition Per_move : forall A B C P Q P’ Q’, ~ ColH A B C ->
- Cof A B C Q -> Cof A B C Q’ -> Cof Q Q’ P P’ ->
- (forall D, D<>Q -> Cof A B C D -> Right_angle P Q D) ->
- Right_angle P’ Q’ Q ->
- (forall D, D<>Q’ -> Cof A B C D -> Right_angle P’ Q’ D).
- Proposition Per_flat_exists : forall A B C P, ~ Cof A B C P ->
- exists D, Cof A B C D /\ (forall E, Cof A B C E ->
- E<>D -> Right_angle E D P).
5. Applications of the Perpendicularity Theory
5.1. The Formalization of the Definitions
- Require Import micromega.Lia.
- Require Export Coq.Lists.List.
- Definition dP : Point.
- Proof.
- ...
- Defined.
- Class graph_f :={
- gr_fun : list Point;
- gr_Cof : exists f, forall A, In A gr_fun -> Incid_P_F A f;
- gr_noteq : forall n m, n<>m -> n < length gr_fun ->
- m < length gr_fun -> (nth n gr_fun dP) <> (nth m gr_fun dP)
- }
- gr_fun: Represents a list of points, forming a finite set of points , , , …, in a plane figure.
- gr_Cof: Declares the existence of a plane f, on which all points in the list gr_fun lie. The function In, defined in Rocq’s Lists.List library, is used to denote that elements are present in a list.
- gr_noteq: Indicates that the points in gr_fun are pairwise distinct.
- Definition CongH_L (L1 L2 : list Point) : Prop := length L1 = length L2 /\
- (forall m1 m2, m1<>m2 -> m1 < length L1 -> m2 < length L1 ->
- CongH (nth m1 L1 dP) (nth m2 L1 dP) (nth m1 L2 dP) (nth m2 L2 dP)) /\
- (forall m0 m1 m2, m0 < length L1 -> m1 < length L1 -> m2 < length L1 ->
- ~ ColH (nth m0 L1 dP) (nth m1 L1 dP) (nth m2 L1 dP) ->
- CongaH (nth m0 L1 dP) (nth m1 L1 dP) (nth m2 L1 dP)
- (nth m0 L2 dP) (nth m1 L2 dP) (nth m2 L2 dP)).
- Definition CongH_gf x y: Prop := CongH_L (@gr_fun x) (@gr_fun y).
- Class graph := {
- g_fun : list Point;
- g_noteq : forall n m, n<>m -> n < length g_fun -> m < length g_fun ->
- (nth n g_fun dP) <> (nth m g_fun dP)
- }.
- Definition CongH_g x y: Prop := CongH_L (@g_fun x) (@g_fun y).
5.2. The Congruence Theorem for Plane Figures
- Theorem Hil_T28 : forall x y P, CongH_gf x y->
- (forall A B C, In A (@gr_fun x) -> In B (@gr_fun x) ->
- In C (@gr_fun x) -> Cof A B C P) ->
- (forall Q, In Q (@gr_fun x) -> P<>Q) ->
- (exists A B C, In A (@gr_fun x) /\ In B (@gr_fun x) /\
- In C (@gr_fun x) /\ ~ ColH A B C) ->
- exists! P’,
- (exists f, forall A’, In A’ ((@gr_fun y)++[P’]) -> Incid_P_F A’ f) /\
- (forall n m, n<>m -> n<length ((@gr_fun y)++[P’]) ->
- m < length ((@gr_fun y)++[P’])->
- nth n ((@gr_fun y)++[P’]) dP <> nth m ((@gr_fun y)++[P’]) dP) /\
- CongH_L ((@gr_fun x)++[P]) ((@gr_fun y)++[P’]).
- Case 1: There are two points A and B in the figure which are collinear with P.
- Case 2: P does not lie on the same line with any two points in the figure , and , , , are not all collinear.
- Case 3: All points of the figure lie on a line, and P is outside this line.
5.2.1. Proof and Formalization for Case 1 in Theorem 1
- Lemma L1_T28 : forall x y P, CongH_gf x y ->
- (forall Q, In Q (@gr_fun x) -> P<>Q) ->
- (exists A B, In A (@gr_fun x) /\ In B (@gr_fun x) /\
- A<>B /\ ColH A B P) ->
- exists! P’,
- (exists f, forall A’, In A’ ((@gr_fun y)++[P’]) -> Incid_P_F A’ f) /\
- (forall n m, n<>m -> n < length ((@gr_fun y)++[P’]) ->
- m < length ((@gr_fun y)++[P’])->
- nth n ((@gr_fun y)++[P’]) dP <> nth m ((@gr_fun y)++[P’]) dP) /\
- CongH_L ((@gr_fun x)++[P]) ((@gr_fun y)++[P’]).
5.2.2. Proof and Formalization for Case 2 in Theorem 1
- Lemma exc_Cong : forall L1 L2 P P1 P’ P1’,
- (forall Q, In Q L1 -> P1 <> Q) ->
- (forall Q, In Q (L1++[P1]) -> P <> Q) ->
- (forall n m, n<>m -> n < length ((L2++[P1’])++[P’]) ->
- m <length ((L2++[P1’])++[P’]) ->
- nth n ((L2++[P1’])++[P’]) dP <> nth m ((L2++[P1’])++[P’]) dP) ->
- CongH_L ((L1++[P1])++[P]) ((L2++[P1’])++[P’]) ->
- CongH_L ((L1++[P])++[P1])((L2++[P’])++[P1’]).
- Lemma remove_Cong_simpl : forall L1 L2 P P1,
- CongH_L (L1++[P]) (L2++[P’]) ->
- CongH_L L1 L2.
- Lemma L2_T28: forall x y P, CongH_gf x y ->
- (forall Q, In Q (@gr_fun x) -> P<>Q) ->
- (exists A B C, In A (@gr_fun x) /\ In B (@gr_fun x) /\
- In C (@gr_fun x) /\ ~ ColH A B C /\ Cof A B C P) ->
- (forall A B, In A (@gr_fun x) ->In B (@gr_fun x) ->
- A<>B -> ~ ColH A B P) ->
- exists! P’,
- (exists f, forall A’, In A’ ((@gr_fun y)++[P’]) -> Incid_P_F A’ f) /\
- (forall n m, n<>m -> n < length ((@gr_fun y)++[P’]) ->
- m < length ((@gr_fun y)++[P’])->
- nth n ((@gr_fun y)++[P’]) dP <> nth m ((@gr_fun y)++[P’]) dP) /\
- CongH_L ((@gr_fun x)++[P]) ((@gr_fun y)++[P’]).
5.2.3. Proof and Formalization for Case 3 in Theorem 1
- Lemma L3_T28 : forall x y P, CongH_gf x y ->
- (forall Q, In Q (@gr_fun x) -> P<>Q) ->
- (forall A B C, In A (@gr_fun x) -> In B (@gr_fun x) ->
- In C (@gr_fun x) -> ColH A B C) ->
- (forall A B, In A (@gr_fun x) -> In B (@gr_fun x) ->
- A<>B -> ~ ColH A B P) ->
- exists P’,
- (exists f, forall A’, In A’ ((@gr_fun y)++[P’]) ->
- Incid_P_F A’ f) /\
- (forall n m, n<>m -> n<length ((@gr_fun y)++[P’]) ->
- m < length ((@gr_fun y)++[P’])->
- nth n ((@gr_fun y)++[P’]) dP <> nth m ((@gr_fun y)++[P’]) dP) /\
- CongH_L ((@gr_fun x)++[P]) ((@gr_fun y)++[P’]).
5.3. The Congruence Theorem for Space Figures
- Theorem Hil_T29 : forall x y P, CongH_g x y ->
- (forall Q, In Q (@g_fun x) -> P<>Q) ->
- (exists A B C D, In A (@g_fun x) /\ In B (@g_fun x) /\
- In C (@g_fun x) /\ In D (@g_fun x) /\ ~ Cof A B C D) ->
- exists! P’,
- (forall n m, n<>m -> n < length ((@g_fun y)++[P’]) ->
- m < length ((@g_fun y)++[P’]) ->
- nth n ((@g_fun y)++[P’]) dP <> nth m ((@g_fun y)++[P’]) dP) /\
- CongH_L ((@g_fun x)++[P]) ((@g_fun y)++[P’]).
- Lemma L1_T29 : forall x y P, CongH_g x y ->
- (forall Q, In Q (@g_fun x) -> P<>Q) ->
- (exists A B C, In A (@g_fun x) /\ In B (@g_fun x) /\
- In C (@g_fun x) /\ ~ ColH A B C /\ Cof A B C P) ->
- exists! P’,
- (forall n m, n<>m -> n < length ((@g_fun y)++[P’]) ->
- m < length ((@g_fun y)++[P’]) ->
- nth n ((@g_fun y)++[P’]) dP <> nth m ((@g_fun y)++[P’]) dP) /\
- CongH_L ((@g_fun x)++[P]) ((@g_fun y)++[P’]).
- Lemma L2_T29 : forall x y P, CongH_g x y ->
- (forall Q, In Q (@g_fun x) -> P<>Q) ->
- ~ (exists A B C, In A (@g_fun x) /\ In B (@g_fun x) /\
- In C (@g_fun x) /\ ~ ColH A B C /\ Cof A B C P) ->
- (exists A B C D, In A (@g_fun x) /\ In B (@g_fun x) /\
- In C (@g_fun x) /\ In D (@g_fun x) /\ ~ Cof A B C D) ->
- exists! P’,
- (forall n m, n<>m ->n < length ((@g_fun y)++[P’]) ->
- m < length ((@g_fun y)++[P’]) ->
- nth n ((@g_fun y)++[P’]) dP <> nth m ((@g_fun y)++[P’]) dP) /\
- CongH_L ((@g_fun x)++[P]) ((@g_fun y)++[P’]).
- Lemma Cof_ConHg : forall x y m0 m1 m2 m3, CongH_g x y ->
- m0 < length (@g_fun x) -> m1 < length (@g_fun x) ->
- m2 < length (@g_fun x) -> m3 < length (@g_fun x) ->
- Cof (nth m0 (@g_fun x) dP) (nth m1 (@g_fun x) dP)
- (nth m2 (@g_fun x) dP) (nth m3 (@g_fun x) dP) ->
- Cof (nth m0 (@g_fun y) dP) (nth m1 (@g_fun y) dP)
- (nth m2 (@g_fun y) dP) (nth m3 (@g_fun y) dP).
- Lemma L3_T29 : forall x y P f, CongH_g x y ->
- (forall Q, In Q (@g_fun x) -> P<>Q) ->
- (forall A, In A (@g_fun x) -> Incid_P_F A f) ->
- ~ Incid_P_F P f ->
- (exists A B C, In A (@g_fun x) /\ In B (@g_fun x) /\
- In C (@g_fun x) /\ ~ColH A B C) ->
- exists P’,
- (forall n m, n<>m -> n < length ((@g_fun y)++[P’]) ->
- m < length ((@g_fun y)++[P’]) ->
- nth n ((@g_fun y)++[P’]) dP <> nth m ((@g_fun y)++[P’]) dP) /\
- CongH_L ((@g_fun x)++[P]) ((@g_fun y)++[P’]).
6. Technical Comparison with GeoCoq
6.1. Dimensional Extension Beyond Planar Constraints
6.2. Architectural Distinctions
6.3. Semantic Fidelity and Definitional Primitivity
- Definition Right_angle A B C := ~ ColH A B C /\
- forall C’, BetH C B C’ -> CongaH A B C A B C’.
- Definition Per A B C := exists C’, Midpoint B C C’ /\ Cong A C A C’.
- Proposition Mid_Per : forall A B C P, MidPoint B A C ->
- Right_angle P B A -> CongH P A P C.
7. Conclusions
- 1.
- Axiom Formalization and Foundational Theories: We began with a complete and careful formalization of Hilbert’s first three groups of axioms (Incidence, Order, and Congruence) in Rocq. Beyond merely restating the axioms, we derived an extensive library of fundamental geometric theories, including the classic triangle congruence theorems (SAS, ASA, SSS) and key properties of angles and midpoints. This library serves as a reusable foundation for future work in formalized geometry.
- 2.
- Theory of Spatial Perpendicularity: The core of our contribution lies in systematically constructing the theory of perpendicularity for lines and planes in space—a theory not fully developed by Hilbert himself. We introduced nine interconnected propositions, progressing from planar properties to sophisticated spatial theorems, such as the existence and uniqueness of perpendiculars from a point to a line or a plane. This theory filled a critical conceptual gap and provided the necessary tools for spatial reasoning.
- 3.
- Mechanized Proof of the Figures Congruence Theorem: Leveraging the perpendicularity theory, we achieved our ultimate goal: the formal proof of the congruence theorem for figures. The successful machine-checked proof conclusively demonstrates that all spatial congruence properties can be derived from Hilbert’s original, planar axioms, confirming the self-sufficiency of his system for three-dimensional space.
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviation
| CIC | Calculus of Inductive Constructions |
Appendix A. Introduction to Rocq Syntax
| Parameter | Declare axioms or parameters |
| Set | Represents types |
| Prop | Represents the proposition type |
| Definition | Define new concepts |
| Axiom | Declare an axiom |
| forall | Universal quantifier, meaning “for all” |
| exists | Existential quantifier, meaning “there exists” |
| -> | Implication, meaning “if…then” |
| \/ | Conjunction, meaning “and” |
| \/ | Disjunction, meaning “or” |
| ~ | Negation, meaning “not” |
| Theorem | Declare a theorem |
| Lemma | Declare a lemma |
| Corollary | Declare a corollary |
| Proposition | Declare a proposition |
| Proof … Qed | Proof start and end markers |
| Fixpoint | Declare a fixpoint function |
| Fact | Declare a fact |
| Hypothesis | Declare a hypothesis |
| Let | Declare a let-in expression |
References
- Mueller, I. Euclid’s Elements and the Axiomatic Method. Br. J. Philos. Sci. 1969, 20, 289–309. [Google Scholar] [CrossRef]
- Avigad, J.; Dean, E.; Mumma, J. A Formal System for Euclid’s Elements. Rev. Symb. Log. 2009, 2, 700–768. [Google Scholar] [CrossRef]
- Beeson, M.; Narboux, J.; Wiedijk, F. Proof-Checking Euclid. Ann. Math. Artif. Intell. 2019, 85, 213–257. [Google Scholar] [CrossRef]
- Hilbert, D. Foundations of Geometry, 2nd ed.; Translated from the 10th edition of the Grundlagen der Geometrie; Open Court Classics: Chicago, IL, USA, 1971. [Google Scholar]
- Wu, W.T. Mechanical Theorem Proving in Geometries: Basic Principles; Springer: Vienna, Austria, 1944. [Google Scholar]
- Birkhoff, G.; Bennett, M.K. Hilbert’s “Grundlagen der Geometrie”. Rend. Circ. Mat. Palermo 1987, 36, 343–389. [Google Scholar] [CrossRef]
- Weyl, H. David Hilbert and His Mathematical Work. Bull. Am. Math. Soc. 1944, 50, 612–654. [Google Scholar] [CrossRef]
- Chen, S.; Yu, W.; Dou, G.; Zhang, Q. A Review on Mechanical Proving and Formalization of Mathematical Theorems. IEEE Access 2025, 13, 50672–50686. [Google Scholar] [CrossRef]
- Wiedijk, F. Formal Proof–Getting Started. Not. AMS 2008, 55, 1408–1414. [Google Scholar]
- Hales, T.C. Formal Proof. Not. AMS 2008, 55, 1370–1380. [Google Scholar]
- Guo, D.; Yu, W. A Comprehensive Formalization of Propositional Logic in Coq: Deduction Systems, Meta-Theorems, and Automation Tactics. Mathematics 2023, 11, 2504. [Google Scholar] [CrossRef]
- Bertot, Y.; Castéran, P. Interactive Theorem Proving and Program Development: Coq’Art: The Calculus of Inductive Constructions; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2013. [Google Scholar]
- Pierce, B.C.; Amorim, A.A.; Casinghino, C.; Gaboardi, M.; Greenberg, M.; Hriţcu, C.; Sjöberg, V.; Yorgey, B. Software Foundations (Version 6.7). Available online: http://softwarefoundations.cis.upenn.edu/ (accessed on 25 August 2024).
- The Coq Development Team. The Coq Proof Assistant Reference Manual (Version 8.13.2). 2021. Available online: https://rocq-prover.org/doc/V8.13.2/refman/ (accessed on 14 October 2025).
- Nipow, T.; Paulson, L.; Wenzel, M. Isabelle/HOL: A Proof Assistant for Higher-Order Logic; Springer: Berlin/Heidelberg, Germany, 2002. [Google Scholar]
- Harrison, J. The HOL Light Theorem Prover. Available online: http://www.cl.cam.ac.uk/~jrh13/hol-light/ (accessed on 18 May 2018).
- Avigad, J.; de Moura, L.; Kong, S. Theorem Proving in Lean. Release 2015, 3, 1–4. [Google Scholar]
- de Moura, L.; Ullrich, S. The Lean 4 Theorem Prover and Programming Language. In Proceedings of the Automated Deduction–CADE 28: 28th International Conference on Automated Deduction, Virtual Event, 12–15 July 2021; Proceedings 28; Springer: Berlin/Heidelberg, Germany, 2021; pp. 625–635. [Google Scholar]
- Avigad, J.; Harrison, J. Formally Verified Mathematics. Commun. ACM 2014, 57, 66–75. [Google Scholar] [CrossRef]
- Gonthier, G. Formal Proof–the Four-Color Theorem. Not. AMS 2008, 55, 1382–1393. [Google Scholar]
- Gonthier, G.; Asperti, A.; Avigad, J.; Bertot, Y.; Cohen, C.; Garillot, F.; Le Roux, S.; Mahboubi, A.; O’Connor, R.; Ould Biha, S. A Machine-Checked Proof of the Odd Order Theorem. In Proceedings of the 4th International Conference on Interactive Theorem Proving, ITP 2013, Rennes, France, 22–26 July 2013; Springer: Berlin/Heidelberg, Germany, 2013; pp. 163–179. [Google Scholar]
- Hales, T.; Adams, M.; Bauer, G.; Dang, T.D.; Harrison, J.; Le Truong, H.; Kaliszyk, C.; Magron, V.; McLaughlin, S.; Nguyen, T.T. A Formal Proof of the Kepler Conjecture. In Proceedings of the Forum of Mathematics, Pi; Cambridge University Press: Cambridge, UK, 2017; Volume 5, p. e2. [Google Scholar]
- Castelvecchi, D. Mathematicians Welcome Computer-Assisted Proof in ‘Grand Unification’ Theory. Nature 2021, 595, 18–19. [Google Scholar] [CrossRef]
- Coxeter, H.S.M. Projective Geometry, 2nd ed.; Springer Science & Business Media: New York, NY, USA, 2003. [Google Scholar]
- Magaud, N.; Narboux, J.; Schreck, P. A Case Study in Formalizing Projective Geometry in Coq: Desargues Theorem. Comput. Geom. 2012, 45, 406–424. [Google Scholar] [CrossRef]
- Braun, D.; Magaud, N.; Schreck, P. An Equivalence Proof Between Rank Theory and Incidence Projective Geometry. In Proceedings of Automated Deduction in Geometry (ADG 2016); Springer: Berlin, Germany, 2016; pp. 62–77. [Google Scholar]
- Coghetto, R. Pascal’s Theorem in Real Projective Plane. Formaliz. Math. 2017, 25, 107–119. [Google Scholar] [CrossRef][Green Version]
- Coghetto, R. Duality Notions in Real Projective Plane. Formaliz. Math. 2021, 29, 161–173. [Google Scholar] [CrossRef]
- Marić, F.; Petrović, D. Formalizing Complex Plane Geometry. Ann. Math. Artif. Intell. 2015, 74, 271–308. [Google Scholar] [CrossRef]
- Fleuriot, J. Theorem Proving in Infinitesimal Geometry. Logic J. IGPL 2001, 9, 447–474. [Google Scholar] [CrossRef]
- Fleuriot, J. Nonstandard Geometric Proofs. In Automated Deduction in Geometry (ADG 2000); Richter-Gebert, J., Wang, D., Eds.; Springer: Berlin/Heidelberg, Germany, 2001; pp. 246–267. [Google Scholar]
- Magaud, N.; Chollet, A.; Fuchs, L. Formalizing a Discrete Model of the Continuum in Coq from a Discrete Geometry Perspective. Ann. Math. Artif. Intell. 2015, 74, 309–332. [Google Scholar] [CrossRef]
- Fleuriot, J. Exploring the Foundations of Discrete Analytical Geometry in Isabelle/HOL. In Automated Deduction in Geometry (ADG 2010); Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2010; Volume 6877, pp. 34–50. [Google Scholar]
- Dehlinger, C.; Dufourd, J.; Schreck, P. Higher-order Intuitionistic Formalization and Proofs in Hilbert’s Elementary Geometry. In Proceedings of the Automated Deduction in Geometry, Zurich, Switzerland, 25–27 September 2000; Springer: Berlin/Heidelberg, Germany, 2001; pp. 306–323. [Google Scholar]
- Iwama, F.; Takahashi, T. On the Proof of the Theorems of Foundations of Geometry Using Isabelle/HOL. J. Comput. Innov. Anal. 2022, 1, 45–69. [Google Scholar]
- Iwama, F. Foundation of Geometry in Planes, And Some Complements: Excluding the Parallel Axioms. Arch. Formal Proofs 2021. Available online: https://isa-afp.org/entries/Foundation_of_geometry.html (accessed on 14 October 2025).
- Meikle, L.I.; Fleuriot, J.D. Formalizing Hilbert’s Grundlagen in Isabelle/Isar. In Proceedings of the Theorem Proving in Higher Order Logics; Springer: Berlin/Heidelberg, Germany, 2003; pp. 319–335. [Google Scholar]
- Scott, P. Mechanising Hilbert’s Foundations of Geometry in Isabelle. Master’s Thesis, University of Edinburgh, Edinburgh, UK, 2008. [Google Scholar]
- Scott, P. Ordered Geometry in Hilbert’s Grundlagen der Geometrie. Ph.D. Thesis, University of Edinburgh, Edinburgh, UK, 2015. [Google Scholar]
- Richter, W. Formalizing Rigorous Hilbert Axiomatic Geometry Proofs in the Proof Assistant HOL Light. Available online: https://github.com/a-qmeng/papers/blob/main/Richter-HOLlight.pdf (accessed on 4 February 2026).
- Schwabhäuser, W.; Szmielew, W.; Tarski, A. Metamathematische Methoden in der Geometrie; Springer: Berlin/Heidelberg, Germany, 2013. [Google Scholar]
- Beeson, M.; Boutry, P.; Braun, G.; Gries, C.; Narboux, J. GeoCoq. 2018. Available online: https://github.com/GeoCoq/GeoCoq (accessed on 14 October 2025).
- Boutry, P. On the Formalization of Foundations of Geometry. Ph.D. Thesis, University of Strasbourg, Strasbourg, Frnace, 2018. [Google Scholar]
- Braun, G.; Boutry, P.; Narboux, J. From Hilbert to Tarski. In Proceedings of the Automated Deduction in Geometry, Strasbourg, France, 26–28 June 2016; Springer: Berlin/Heidelberg, Germany, 2016; p. 19. [Google Scholar]
- Braun, G.; Narboux, J. From Tarski to Hilbert. In Proceedings of the Automated Deduction in Geometry; Springer: Berlin/Heidelberg, Germany, 2013; pp. 89–109. [Google Scholar]
- Beeson, M.; Wos, L. Finding Proofs in Tarskian Geometry. J. Autom. Reason. 2017, 58, 181–207. [Google Scholar] [CrossRef]
- Grabowski, A.; Coghetto, R. Tarski’s Geometry and the Euclidean Plane in Mizar. In Proceedings of the 6th International Conference on Mathematical Software (ICMS 2016); Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2016; pp. 189–198. [Google Scholar]
- Coghetto, R.; Grabowski, A. Tarski Geometry Axioms. Part II. Formaliz. Math. 2016, 24, 157–166. [Google Scholar] [CrossRef]
- Coghetto, R.; Grabowski, A. Tarski Geometry Axioms. Part III. Formaliz. Math. 2017, 25, 289–313. [Google Scholar] [CrossRef]
- Coghetto, R.; Grabowski, A. Tarski Geometry Axioms. Part IV—Right Angle. Formaliz. Math. 2019, 27, 75–85. [Google Scholar] [CrossRef]
- Coghetto, R.; Grabowski, A. Tarski Geometry Axioms. Part V—Half-planes and Planes. Formaliz. Math. 2023, 31, 325–339. [Google Scholar] [CrossRef]
- Zhang, Q.; Yu, W. A Case Study in Formalizing Hilbert’s Foundations of Geometry in Coq: Establishing Key Properties of Lines in Hilbert’s Axiom System. In Proceedings of the 2023 China Automation Congress (CAC), Chongqing, China, 17–19 November 2023; IEEE: New York, NY, USA, 2024; pp. 1926–1930. [Google Scholar]
- Besson, F. Fast Reflexive Arithmetic Tactics the Linear Case and Beyond. In Proceedings of the International Workshop on Types for Proofs and Programs (TYPES 2006); Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2007; Volume 4502, pp. 48–62. [Google Scholar]


Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Zhang, Q.; Yu, W. A Rocq-Based Formalization of Hilbert’s Geometry: Building a Reusable Foundation for 3D Perpendicularity Theory and Verification. Math. Comput. Appl. 2026, 31, 25. https://doi.org/10.3390/mca31010025
Zhang Q, Yu W. A Rocq-Based Formalization of Hilbert’s Geometry: Building a Reusable Foundation for 3D Perpendicularity Theory and Verification. Mathematical and Computational Applications. 2026; 31(1):25. https://doi.org/10.3390/mca31010025
Chicago/Turabian StyleZhang, Qimeng, and Wensheng Yu. 2026. "A Rocq-Based Formalization of Hilbert’s Geometry: Building a Reusable Foundation for 3D Perpendicularity Theory and Verification" Mathematical and Computational Applications 31, no. 1: 25. https://doi.org/10.3390/mca31010025
APA StyleZhang, Q., & Yu, W. (2026). A Rocq-Based Formalization of Hilbert’s Geometry: Building a Reusable Foundation for 3D Perpendicularity Theory and Verification. Mathematical and Computational Applications, 31(1), 25. https://doi.org/10.3390/mca31010025
