File size: 2,105 Bytes
1c3ffd8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import Mathlib

open Real
set_option linter.unusedVariables.analyzeTactics true


theorem imo_1962_p2
  (x : ℝ)
  (h₀ : 0  3 - x)
  (h₁ : 0 ≤ x + 1)
  (h₂ : 1 / 2 < Real.sqrt (3 - x) - Real.sqrt (x + 1)) :
  -1 ≤ x ∧ x < 1 - Real.sqrt 31 / 8 := by
  constructor
  . exact neg_le_iff_add_nonneg.mpr h₁
  have h₃: (2 *sqrt (3 - x) * sqrt (x + 1)) ^ 2 < (4 - 1 / 4) ^ 2 := by
    refine' pow_lt_pow_left₀ _ _ (by norm_num)
    . refine lt_tsub_iff_left.mpr ?_
      refine lt_tsub_iff_right.mp ?_
      suffices g₀: 4 - 2 * sqrt (3 - x) * sqrt (x + 1) = (sqrt (3 - x) - sqrt (x + 1)) ^ 2
      . rw [g₀]
        have g₁:  (1:ℝ) / 4 = (1/2)^2 := by norm_num
        rw [g₁]
        exact pow_lt_pow_left₀ h₂ (by norm_num) (by norm_num)
      rw [sub_sq]
      rw [sq_sqrt h₀, sq_sqrt h₁]
      ring_nf
    . refine' mul_nonneg _ _
      . refine mul_nonneg (by norm_num) ?_
        exact sqrt_nonneg (3 - x)
      . exact sqrt_nonneg (x + 1)
  have h₄: 4 * (x + 1) * (3 - x) < 225 / 16 := by
    norm_num at h₃
    suffices g₀: 4 * (x + 1) * (3 - x) = (2 * sqrt (3 - x) * sqrt (x + 1)) ^ 2
    . exact Eq.trans_lt g₀ h₃
    . rw [mul_pow, mul_pow, sq_sqrt h₀, sq_sqrt h₁]
      norm_num
      exact mul_right_comm 4 (x + 1) (3 - x)
  have hx1: x < 1 := by
    suffices g₀: x + 1 < 3 - x
    . linarith
    . rw [← sq_sqrt h₀, ← sq_sqrt h₁]
      refine' pow_lt_pow_left₀ _ _ (by norm_num)
      . linarith
      exact sqrt_nonneg (x + 1)
  have h₅: x < 1 - sqrt 31 / 8  1 + sqrt 31 / 8 < x := by
    ring_nf at h₄
    have g₀: 0 < x * x + -2 * x + 33 / 64 := by linarith
    let a:ℝ := sqrt 31 / 8
    have g₁: x * x + -2 * x + 33 / 64 = (x - (1 + a)) * (x - (1 - a)) := by
      simp
      ring_nf
      norm_num
      linarith
    rw [g₁] at g₀
    by_cases g₂: (x - (1 - a)) < 0
    . left
      exact sub_neg.mp g₂
    push_neg at g₂
    right
    have g₃: 0 < (x - (1 + a)) := by exact pos_of_mul_pos_left g₀ g₂
    exact sub_pos.mp g₃
  cases h₅ with
  | inl h₅ => exact h₅
  | inr h₅ => linarith