lean-golf Lean 4 proof leaderboard

IMO1962 P2

540 characters · @rpinho ·

Compfiles · Imo · Apache-2.0
Copyright (c) 2024 David Renshaw. All rights reserved. Authors: David Renshaw

Statement

import Mathlib.Tactic
theorem _root_.LeanGolf.compfiles.imo1962_p2 (x : ℝ) :
    x ∈ SolutionSet ↔
    x ≤ 3 ∧ -1 ≤ x ∧ 1/2 < √(3 - x) - √(x + 1)
Trusted statement context
noncomputable section

namespace Imo1962P2

noncomputable abbrev SolutionSet : Set ℝ := Set.Ico (-1) (1 - √31 / 8)

Record proof

import Mathlib.Tactic

theorem _root_.LeanGolf.compfiles.imo1962_p2 (x : ℝ) :
    x ∈ SolutionSet ↔
    x ≤ 3 ∧ -1 ≤ x ∧ 1/2 < √(3 - x) - √(x + 1) := by
  let r := √(31 : ℝ)
  let t := 1 - r/8
  have hr : r^2 = 31 := Real.sq_sqrt (by norm_num)
  have hp : 1 ≤ r := by nlinarith [Real.sqrt_nonneg 31]
  have ha : √(3-t) = (r+1)/4 := by
    rw [show 3-t = ((r+1)/4)^2 by dsimp [t]; nlinarith, Real.sqrt_sq (by linarith)]
  have hb : √(t+1) = (r-1)/4 := by
    rw [show t+1 = ((r-1)/4)^2 by dsimp [t]; nlinarith, Real.sqrt_sq (by linarith)]
  have ht : t ≤ 3 := by dsimp [t]; linarith
  change (-1 ≤ x ∧ x < t) ↔ _
  constructor
  · rintro ⟨hl,h⟩
    have : √(3-t) - √(t+1) < √(3-x) - √(x+1) := by gcongr <;> linarith
    exact ⟨by linarith, hl, by linarith⟩
  · rintro ⟨_,hl,h⟩
    refine ⟨hl, ?_⟩
    by_contra! H
    have : √(3-x) - √(x+1) ≤ √(3-t) - √(t+1) := by gcongr
    linarith

Record card (SVG)

Record history

HolderCharactersDate
@rpinho540