💎 Reusable layer
← all 82R0002

Wolstenholme's inequality, defect form

showcase

Use this theorem

  1. Create a project

    Shell
    lake +leanprover/lean4:v4.35.0 new myproject std.toml
    cd myproject

    Standard template, not math: the math template adds its own Mathlib requirement pinned to the Lean release tag, not to the Mathlib commit this package is built and tested with, so you would get a second, different Mathlib. Mathlib comes in through this package. Skip this step in an existing project with the same Lean and Mathlib.

  2. Add the dependency to lakefile.toml

    TOML
    [[require]]
    name = "formalizations"
    git = "https://github.com/karlesmarin/formalizations"
    rev = "v0.15.0"
  3. Import the minimal module

    Lean 4
    import Formalizations.Reusable.Geometry

    In a file of the project, e.g. Example.lean.

  4. Paste the example

    Lean 4
    open Formalizations.Reusable Matrix Real
    
    /-- Wolstenholme's inequality, from the defect identity. -/
    example (x y z A B C : ℝ) (h : A + B + C = π) :
        2 * y * z * Real.cos A + 2 * z * x * Real.cos B + 2 * x * y * Real.cos C
          ≤ x ^ 2 + y ^ 2 + z ^ 2 := by
      have := wolstenholme_defect_eq_sq_add_sq x y z A B C h
      nlinarith [sq_nonneg (x - z * Real.cos B - y * Real.cos C),
        sq_nonneg (z * Real.sin B - y * Real.sin C)]

    Steps 3 and 4 together are a complete Lean file:FormalizationsTest/ReusableGeometryExample.lean at v0.15.0, compiled by the CI.

  5. Fetch and check

    Shell
    lake update
    lake lean Example.lean

    lake update fetches this package and Mathlib, and Mathlib's update hook downloads the compiled Mathlib (lake exe cache get). lake lean Example.lean builds the imports of the file (steps 3 and 4) and checks it. If the file belongs to a lean_lib of your project, lake build <lib> does the same. Avoid a bare lake build in a project from the standard template: its default target is the executable, whose link compiles every imported Mathlib module to native code. Same versions required: Lean v4.35.0, Mathlib f0b4c81.

Alternative: import Formalizations.Reusable imports the whole layer (all areas).

If A + B + C = π, then x² + y² + z² − (2yz cos A + 2zx cos B + 2xy cos C) = (x − z cos B − y cos C)² + (z sin B − y sin C)² for all real x, y, z; hence Wolstenholme's inequality.

Lean statement

Lean 4
theorem wolstenholme_defect_eq_sq_add_sq (x y z A B C : ℝ) (h : A + B + C = Real.pi) :
    x ^ 2 + y ^ 2 + z ^ 2 - (2 * y * z * Real.cos A + 2 * z * x * Real.cos B
        + 2 * x * y * Real.cos C) =
      (x - z * Real.cos B - y * Real.cos C) ^ 2 + (z * Real.sin B - y * Real.sin C) ^ 2
Name
Formalizations.Reusable.wolstenholme_defect_eq_sq_add_sq
Import
import Formalizations.Reusable.Geometry
Version
formalizations 0.15.0Lean v4.35.0Mathlib f0b4c81
Role
showcase a classical theorem, to consult
Provenance
WolstenholmeInequality.sub_eq_sq_add_sq in Formalizations.Geometry.Euclidean.WolstenholmeInequality
Paper: none
Classical reference
J. Wolstenholme, A Book of Mathematical Problems, Macmillan, 1867
Trust
standard axioms only propext, Classical.choice, Quot.sound
#print axioms in FormalizationsTest/Axioms.lean, audited by scripts/check_axioms.sh (2758 results), which the CI build workflow runs and passed at this commit.
Status
reusable not an upstream candidate
Area
Geometry

Links

Lean docstring

Wolstenholme's inequality, defect form. If A + B + C = π then for all real x, y, z, x² + y² + z² − (2yz cos A + 2zx cos B + 2xy cos C) = (x − z cos B − y cos C)² + (z sin B − y sin C)². In particular 2yz cos A + 2zx cos B + 2xy cos C ≤ x² + y² + z² (Wolstenholme's inequality, archive WolstenholmeInequality.cos_le). No sign condition on the angles is needed.

  • Archive: WolstenholmeInequality.sub_eq_sq_add_sq (Formalizations.Geometry.Euclidean.WolstenholmeInequality); no research paper.
  • Classical reference: J. Wolstenholme, A Book of Mathematical Problems, Macmillan, 1867.
  • Example: wolstenholme_defect_eq_sq_add_sq 1 1 1 (π/3) (π/3) (π/3) h for the equilateral triangle, with h : π/3 + π/3 + π/3 = π.

Upstream

an olympiad-style identity with a six-line proof; Mathlib's Archive at most

Depends on, in this repository

None besides the archive module (repo_dependencies = []).