W.06 Law I: Pythagoras’ Theorem & Right Triangle Invariants — Code

For any three non-collinear points A_1, A_2, A_3 over a field F (char F != 2) with non-null lines A_1 A_3 and A_2 A_3, the lines A_1 A_3 and A_2 A_3 are perpendicular (s_3 = 1) if and only if Q(A_2, A_3) + Q(A_1, A_3) = Q(A_1, A_2), in which case the hypotenuse midpoint M_3 is equidistant in quadrance (Q_3 / 4) from all three vertices.
t c (Q = 25/4) / A_3 F_3 / (Q = 144/25) A_1 = [0, 3] A_2 = [4, 0] A_3 = [0, 0] M_3 = [2, 3/2] F_3 = [36/25, 48/25] Q_1=16 + Q_2=9 = Q_3=25 s_3 = 1 A1A1 A2A2 A3A3 M3M3 F3F3 + − ⟲ Lbl Gde

Exact geometor.model SVG output of model.py for W.06 (Law I: Pythagoras’ Theorem & Right Triangle Invariants).

Symbolic Construction & Verification Script (model.py)

"""GEOMETOR Wildberger symbolic model and proof script for W.06: Law I: Pythagoras' Theorem & Right Triangle Invariants.

        Enunciation: For any three non-collinear points A_1, A_2, A_3 over a field F (char F != 2) with non-null lines A_1 A_3 and A_2 A_3, the lines A_1 A_3 and A_2 A_3 are perpendicular (s_3 = 1) if and only if Q(A_2, A_3) + Q(A_1, A_3) = Q(A_1, A_2), in which case the hypotenuse midpoint M_3 is equidistant in quadrance (Q_3 / 4) from all three vertices.
        """

        from __future__ import annotations

        import sys
        from pathlib import Path

        _ROOT_SRC = Path(__file__).resolve().parents[3] / "src"
        if str(_ROOT_SRC) not in sys.path:
            sys.path.insert(0, str(_ROOT_SRC))

        from geometor.wildberger.models import (  # noqa: E402
            TopicBuildResult,
            assert_zero_floats,
            build_principle_model,
        )
        from geometor.wildberger.render import render_svg  # noqa: E402


        def construct_w_06() -> TopicBuildResult:
            """Construct the exact symbolic model and verifications for W.06.

            Returns:
                Populated `TopicBuildResult` for W.06 (Law I: Pythagoras' Theorem & Right Triangle Invariants).
            """
            result = build_principle_model("W.06")
            assert_zero_floats(result.model)
            return result


        def main() -> None:
            """Execute W.06 symbolic construction, render `w-06.svg`, and print invariants."""
            here = Path(__file__).resolve().parent
            bundle = construct_w_06()
            svg_out = render_svg(
                bundle.model,
                here / "w-06.svg",
                extra_curves=bundle.extra_curves,
                annotations=bundle.annotations,
            )
            print("W.06: Law I: Pythagoras' Theorem & Right Triangle Invariants")
            print(f"  Elements in model: {len(bundle.model)}")
            print(f"  Rendered SVG:      {svg_out.name}")
            for label, val, status in bundle.verifications:
                print(f"  [OK] {label}: {val} ({status})")


        if __name__ == "__main__":
            main()