diff --git a/EasyLean/Basic.lean b/EasyLean/Basic.lean index 305e1ca..4911340 100644 --- a/EasyLean/Basic.lean +++ b/EasyLean/Basic.lean @@ -1,12 +1,2 @@ -import Mathlib.Data.Real.Basic -import Mathlib.Tactic.Linarith - -theorem mathd_algebra_513 - (a b : ℝ) - (h₀ : 3 * a + 2 * b = 5) - (h₁ : a + b = 2) : - a = 1 ∧ b = 1 := by - sorry - -theorem eq_four : ∀ a b c d : Nat, a = b → a = d → a = c → c = b := by - sorry +import EasyLean.Theorems.mathd_algebra_513 +import EasyLean.Theorems.eq_four diff --git a/EasyLean/Theorems/eq_four.lean b/EasyLean/Theorems/eq_four.lean new file mode 100644 index 0000000..2ba14f0 --- /dev/null +++ b/EasyLean/Theorems/eq_four.lean @@ -0,0 +1,5 @@ +import Mathlib + +theorem eq_four : ∀ a b c d : Nat, a = b → a = d → a = c → c = b := by + intro a b c d hab had hac + exact hac.symm.trans hab diff --git a/EasyLean/Theorems/mathd_algebra_513.lean b/EasyLean/Theorems/mathd_algebra_513.lean new file mode 100644 index 0000000..1b35a43 --- /dev/null +++ b/EasyLean/Theorems/mathd_algebra_513.lean @@ -0,0 +1,23 @@ +import Mathlib + +theorem mathd_algebra_513 + (a b : Real) + (h0 : 3 * a + 2 * b = 5) + (h1 : a + b = 2) : + a = 1 ∧ b = 1 := by + -- Subtract 2*(a+b) from h0 and then use h1 to simplify the right-hand side + have hsub : (3 * a + 2 * b) - 2 * (a + b) = (5 : Real) - 2 * 2 := by + have h := congrArg (fun x : Real => x - 2 * (a + b)) h0 + simpa [h1] using h + -- Expand and normalize to get a = 1 + have ha : a = 1 := by + have hsub' : (3 * a + 2 * b) - (2 * a + 2 * b) = (5 : Real) - 2 * 2 := by + simpa [mul_add] using hsub + have hnorm := hsub' + ring_nf at hnorm + exact hnorm + -- Get b from a + b = 2 + have hb : b = 1 := by + have h1' : 1 + b = 2 := by simpa [ha] using h1 + linarith [h1'] + exact ⟨ha, hb⟩