Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OutcastsMathLab.lean
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import OutcastsMathLab.Problems.P000_VerifierSmoke.Proof
import OutcastsMathLab.Problems.P001_ErdosStraus1201.Verification
import OutcastsMathLab.Problems.P001_ErdosStraus1201.Proof
56 changes: 56 additions & 0 deletions OutcastsMathLab/Problems/P001_ErdosStraus1201/Proof.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Std
import OutcastsMathLab.Problems.P001_ErdosStraus1201.Statement

namespace OutcastsMathLab.P001

theorem solution_yields_factor_pair : SolutionYieldsFactorPair := by
intro c M y z hc hM hy hyz heq
dsimp
have hz : 0 < z := by omega

have ha_pos : 0 < c * y - M := by
by_cases ha : 0 < c * y - M
· exact ha
· have hle : c * y - M ≤ 0 := by omega
have hz0 : 0 ≤ z := by omega
have hle_prod : (c * y - M) * z ≤ 0 := Int.mul_nonpos_of_nonpos_of_nonneg hle hz0
have h_sub : (c * y - M) * z = M * y := by grind
rw [h_sub] at hle_prod
have hpos_prod : 0 < M * y := Int.mul_pos hM hy
omega

have ha_le_M : c * y - M ≤ M := by
by_cases hle : c * y ≤ 2 * M
· omega
· have hgt : 2 * M < c * y := by omega
have h_diff_pos : 0 < c * y - 2 * M := by omega
have h_prod_pos : 0 < (c * y - 2 * M) * z := Int.mul_pos h_diff_pos hz
have h_id : (c * y - 2 * M) * z = M * (y - z) := by grind
have h_yz_nonpos : y - z ≤ 0 := by omega
have hM_nonneg : 0 ≤ M := by omega
have h_prod_nonpos : M * (y - z) ≤ 0 := Int.mul_nonpos_of_nonneg_of_nonpos hM_nonneg h_yz_nonpos
rw [h_id] at h_prod_pos
omega

have hab : (c * y - M) * (c * z - M) = M ^ 2 := by
have hid : (c * y - M) * (c * z - M) - M ^ 2 = c * (c * y * z - M * (y + z)) := by grind
rw [heq] at hid
have : c * (M * (y + z) - M * (y + z)) = 0 := by grind
rw [this] at hid
omega

have h_dvd_a : c ∣ (c * y - M) + M := by
have : (c * y - M) + M = c * y := by omega
rw [this]
exact ⟨y, rfl⟩

have h_dvd_b : c ∣ (c * z - M) + M := by
have : (c * z - M) + M = c * z := by omega
rw [this]
exact ⟨z, rfl⟩

exact ⟨ha_pos, ha_le_M, hab, h_dvd_a, h_dvd_b⟩

#print axioms solution_yields_factor_pair

end OutcastsMathLab.P001
21 changes: 21 additions & 0 deletions OutcastsMathLab/Problems/P001_ErdosStraus1201/Statement.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Std

namespace OutcastsMathLab.P001

/-- 固定した最初の分母に対する、解から因数対への変換。 -/
def SolutionYieldsFactorPair : Prop :=
∀ (c M y z : Int),
0 < c →
0 < M →
0 < y →
y ≤ z →
c * y * z = M * (y + z) →
let a : Int := c * y - M
let b : Int := c * z - M
0 < a ∧
a ≤ M ∧
a * b = M ^ 2 ∧
c ∣ a + M ∧
c ∣ b + M

end OutcastsMathLab.P001