Skip to content

Commit

Permalink
some simplifications suggested by tryAtEachStep
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Dec 11, 2024
1 parent 6d0dc1c commit a14d999
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
3 changes: 1 addition & 2 deletions Compfiles/Imo1962P1.lean
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ theorem no_smaller_solutions (n : ℕ) (h1 : ProblemPredicate n) : n ≥ 153846
· exfalso; exact case_4_digit h h2
· have h4 : c = 15384 := case_5_digit h h2
have h5 : n = 10 * 15384 + 6 := h4 ▸ h2.left
norm_num at h5
exact h5.ge
exact Nat.le_of_eq h5.symm

snip end

Expand Down
3 changes: 1 addition & 2 deletions Compfiles/Imo2023P4.lean
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ theorem imo2023_p4_generalized
obtain ⟨aa, haa, haa2, haa3⟩ := ha
simp only [e] at haa3
rw [← haa3]
simp only [Subtype.mk_le_mk]
omega
exact Subtype.mk_le_mk.mpr haa
· intro ha
simp only [Finset.univ_eq_attach, Finset.mem_filter, Finset.mem_attach,
true_and] at ha
Expand Down
16 changes: 3 additions & 13 deletions Compfiles/Iran1998P9.lean
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ problem iran1998_p9

have hv₁ : ‖v₁‖ = Real.sqrt (x + y + z) := by
have hn := compute_norm v₁
have h1: ((∑ i : Fin 3, ((v₁ i) ^ 2)) : ℝ) = (v₁ 0)^2 + (v₁ 1)^2 + (v₁ 2)^2 := by
rw[Fin.sum_univ_succ, Fin.sum_univ_succ, Fin.sum_univ_one]
ring_nf
norm_cast

rw [h1] at hn
rw [Fin.sum_univ_three] at hn
have hv1 : v₁ 0 = Real.sqrt x := rfl
have hv2 : v₁ 1 = Real.sqrt y := rfl
have hv3 : v₁ 2 = Real.sqrt z := rfl
Expand All @@ -86,11 +81,7 @@ problem iran1998_p9

have hv₂ : ‖v₂‖ = 1 := by
have hn := compute_norm v₂
have h2: ((∑ i : Fin 3, ((v₂ i) ^ 2)) : ℝ) = (v₂ 0)^2 + (v₂ 1)^2 + (v₂ 2)^2 := by
rw[Fin.sum_univ_succ, Fin.sum_univ_succ, Fin.sum_univ_one]
ring_nf
norm_cast
rw [h2] at hn
rw [Fin.sum_univ_three] at hn
have hv1 : v₂ 0 = Real.sqrt ((x-1)/x) := rfl
have hv2 : v₂ 1 = Real.sqrt ((y-1)/y) := rfl
have hv3 : v₂ 2 = Real.sqrt ((z-1)/z) := rfl
Expand All @@ -117,8 +108,7 @@ problem iran1998_p9
have hinner :=
calc ((inner v₁ v₂): ℝ)
= ∑ i : Fin 3, v₁ i * v₂ i := rfl
_ = v₁ 0 * v₂ 0 + v₁ 1 * v₂ 1 + v₁ 2 * v₂ 2 :=
by rw[Fin.sum_univ_succ, Fin.sum_univ_succ, Fin.sum_univ_one]; ring_nf; simp
_ = v₁ 0 * v₂ 0 + v₁ 1 * v₂ 1 + v₁ 2 * v₂ 2 := Fin.sum_univ_three _
_ = Real.sqrt x * Real.sqrt ((x - 1) / x) +
Real.sqrt y * Real.sqrt ((y - 1) / y) +
Real.sqrt z * Real.sqrt ((z - 1) / z) := rfl
Expand Down
4 changes: 1 addition & 3 deletions Compfiles/Usa2015P1.lean
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ problem usa2015_p1 (x y : ℤ) :
rw [this, ht4] at ht
have : y = 3 := by linarith only [ht]
simp [*]; use 1; simp
· have : t - 20 := by intro; apply ht4; linarith
have hn := abc (by positivity) ht3
obtain ⟨d, hd⟩ := hn
· obtain ⟨d, hd⟩ := abc (sub_ne_zero_of_ne ht4) ht3
have Odd_dd : Odd (d ^ 2) := by
rw [←hd]; apply Even.add_one; apply Even.mul_right; exact Int.even_iff.mpr rfl
have Odd_d : Odd d := (Int.odd_pow' (by positivity)).mp Odd_dd
Expand Down

0 comments on commit a14d999

Please sign in to comment.