From 8776a52a0a2df9cd6a24a5209f3cab40d3432110 Mon Sep 17 00:00:00 2001 From: Jasper Lee Date: Thu, 11 Jul 2024 21:53:45 -0400 Subject: [PATCH 1/2] added lean fixes for batch19982005hard --- lean4/src/putnam_1998_a6.lean | 2 +- lean4/src/putnam_2002_a2.lean | 2 +- lean4/src/putnam_2003_a5.lean | 2 +- lean4/src/putnam_2003_b2.lean | 3 ++- lean4/src/putnam_2005_a2.lean | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lean4/src/putnam_1998_a6.lean b/lean4/src/putnam_1998_a6.lean index b9cc0768..83f15c3e 100644 --- a/lean4/src/putnam_1998_a6.lean +++ b/lean4/src/putnam_1998_a6.lean @@ -6,7 +6,7 @@ open Set Function Metric theorem putnam_1998_a6 (A B C : Fin 2 → ℝ) (hint : ∀ i : Fin 2, ∃ a b c : ℤ, A i = a ∧ B i = b ∧ C i = c) -(htriangle : A ≠ B ∧ B ≠ C ∧ A ≠ C ∧ ¬Collinear ℝ {A, B, C}) +(htriangle : A ≠ B ∧ A ≠ C ∧ B ≠ C) (harea : (Euclidean.dist A B + Euclidean.dist B C) ^ 2 < 8 * (MeasureTheory.volume (convexHull ℝ {A, B, C})).toReal + 1) (threesquare : (Fin 2 → ℝ) → (Fin 2 → ℝ) → (Fin 2 → ℝ) → Prop := fun P Q R ↦ Euclidean.dist Q P = Euclidean.dist Q R ∧ Matrix.dotProduct (P - Q) (R - Q) = 0) : (threesquare A B C ∨ threesquare B C A ∨ threesquare C A B) := diff --git a/lean4/src/putnam_2002_a2.lean b/lean4/src/putnam_2002_a2.lean index 7f6bdb92..9b4d2c9f 100644 --- a/lean4/src/putnam_2002_a2.lean +++ b/lean4/src/putnam_2002_a2.lean @@ -6,5 +6,5 @@ open Nat theorem putnam_2002_a2 (sphere : Set (Fin 3 → ℝ) := {P : Fin 3 → ℝ | Euclidean.dist 0 P = 1}) (hemi : (Fin 3 → ℝ) → Set (Fin 3 → ℝ) := fun V ↦ {P : Fin 3 → ℝ | Matrix.dotProduct P V ≥ 0}) -: (∀ (S : Set (Fin 3 → ℝ)), S ⊆ sphere ∧ S.encard = 5 → ∃ V : (Fin 3 → ℝ), V ≠ 0 ∧ (S ∩ hemi V).encard = 4) := +: (∀ (S : Set (Fin 3 → ℝ)), S ⊆ sphere ∧ S.encard = 5 → ∃ V : (Fin 3 → ℝ), V ≠ 0 ∧ (S ∩ hemi V).encard ≥ 4) := sorry diff --git a/lean4/src/putnam_2003_a5.lean b/lean4/src/putnam_2003_a5.lean index 75622f96..f2fb5253 100644 --- a/lean4/src/putnam_2003_a5.lean +++ b/lean4/src/putnam_2003_a5.lean @@ -9,6 +9,6 @@ theorem putnam_2003_a5 (dyckpath : (m : ℕ) → Set ((Fin (2 * m)) → ℤ) := fun m ↦ {p : Fin (2 * m) → ℤ | range p ⊆ {-1, 1} ∧ ∑ k : Fin (2 * m), p k = 0 ∧ ∀ j : Fin (2 * m), ∑ k : Fin (2 * m), ite (k ≤ j) (p k) 0 ≥ 0}) (noevenreturn : (m : ℕ) → Set ((Fin (2 * m)) → ℤ) := fun m ↦ {p : Fin (2 * m) → ℤ | - ¬∃ i j : Fin (2 * m), i < j ∧ p i = 1 ∧ ∀ k ∈ Ioc i j, p i = -1 ∧ Even (j.1 - i.1) ∧ ∑ k : Fin (2 * m), ite (k ≤ j) (p k) 0 = 0}) + ¬∃ i j : Fin (2 * m), i < j ∧ p i = 1 ∧ (∀ k ∈ Ioc i j, p i = -1) ∧ Even (j.1 - i.1) ∧ ∑ k : Fin (2 * m), ite (k ≤ j) (p k) 0 = 0}) : (∃ f : ((Fin (2 * n)) → ℤ) → (Fin (2 * (n - 1)) → ℤ), ∀ y ∈ dyckpath (n - 1), ∃! x, x ∈ dyckpath n ∩ noevenreturn n ∧ f x = y) := sorry diff --git a/lean4/src/putnam_2003_b2.lean b/lean4/src/putnam_2003_b2.lean index 31fa6b24..da894e19 100644 --- a/lean4/src/putnam_2003_b2.lean +++ b/lean4/src/putnam_2003_b2.lean @@ -3,11 +3,12 @@ open BigOperators open MvPolynomial Set +-- uses (ℕ → ℕ → ℚ) instead of (Fin n → Icc 1 n → ℚ) theorem putnam_2003_b2 (n : ℕ) (hn : n > 0) (seq : ℕ → ℕ → ℚ) (hinit : ∀ j ∈ Icc 1 n, seq 0 j = 1 / j) (havg : ∀ k ∈ Icc 1 (n - 1), ∀ j ∈ Icc 1 (n - k), seq k j = (seq (k - 1) j + seq (k - 1) (j + 1)) / 2) -: (seq (n - 1) 0 < 2 / n) := +: (seq (n - 1) 1 < 2 / n) := sorry diff --git a/lean4/src/putnam_2005_a2.lean b/lean4/src/putnam_2005_a2.lean index 44ff5857..ebeb5a66 100644 --- a/lean4/src/putnam_2005_a2.lean +++ b/lean4/src/putnam_2005_a2.lean @@ -3,6 +3,7 @@ open BigOperators open Nat Set +-- uses (ℕ → ℤ × ℤ) instead of (Icc 1 (3 * n) → ℤ × ℤ) abbrev putnam_2005_a2_solution : ℕ → ℕ := sorry -- fun n ↦ if n = 1 then 0 else 2 ^ (n - 2) theorem putnam_2005_a2 From ab9508f66c2306928de2fbac4c1ba0011a9021e4 Mon Sep 17 00:00:00 2001 From: Jasper Lee Date: Thu, 11 Jul 2024 22:50:43 -0400 Subject: [PATCH 2/2] added isabelle problems from batch19982005hard --- isabelle/putnam_1998_a2.thy | 19 +++++++++++++++++++ isabelle/putnam_1998_a6.thy | 15 +++++++++++++++ isabelle/putnam_2002_a2.thy | 12 ++++++++++++ isabelle/putnam_2003_a5.thy | 17 +++++++++++++++++ isabelle/putnam_2003_b2.thy | 14 ++++++++++++++ isabelle/putnam_2003_b5.thy | 13 +++++++++++++ isabelle/putnam_2004_a5.thy | 18 ++++++++++++++++++ isabelle/putnam_2004_b4.thy | 16 ++++++++++++++++ isabelle/putnam_2005_a2.thy | 19 +++++++++++++++++++ isabelle/putnam_2005_b5.thy | 22 ++++++++++++++++++++++ 10 files changed, 165 insertions(+) create mode 100644 isabelle/putnam_1998_a2.thy create mode 100644 isabelle/putnam_1998_a6.thy create mode 100644 isabelle/putnam_2002_a2.thy create mode 100644 isabelle/putnam_2003_a5.thy create mode 100644 isabelle/putnam_2003_b2.thy create mode 100644 isabelle/putnam_2003_b5.thy create mode 100644 isabelle/putnam_2004_a5.thy create mode 100644 isabelle/putnam_2004_b4.thy create mode 100644 isabelle/putnam_2005_a2.thy create mode 100644 isabelle/putnam_2005_b5.thy diff --git a/isabelle/putnam_1998_a2.thy b/isabelle/putnam_1998_a2.thy new file mode 100644 index 00000000..56b4e65c --- /dev/null +++ b/isabelle/putnam_1998_a2.thy @@ -0,0 +1,19 @@ +theory putnam_1998_a2 imports Complex_Main +"HOL-Analysis.Lebesgue_Measure" +begin + +theorem putnam_1998_a2: + fixes quadrant :: "(real^2) \ bool" + and isarc :: "(real^2) \ (real^2) \ bool" + and arc :: "(real^2) \ (real^2) \ ((real^2) set)" + and A :: "(real^2) \ (real^2) \ real" + and B :: "(real^2) \ (real^2) \ real" + defines "quadrant \ (\P::real^2. P$1 > 0 \ P$2 > 0 \ dist 0 P = 1)" + and "isarc \ (\P Q::real^2. quadrant P \ quadrant Q \ P$1 > Q$1)" + and "arc \ (\P Q::real^2. {R::real^2. quadrant R \ P$1 > R$1 \ R$1 > Q$1})" + and "A \ (\P Q::real^2. measure lebesgue {S::real^2. (\R\(arc P Q). R$1 = S$1 \ R$2 > S$2 \ S$2 > 0)})" + and "B \ (\P Q::real^2. measure lebesgue {S::real^2. (\R\(arc P Q). R$2 = S$2 \ R$1 > S$1 \ S$1 > 0)})" + shows "\f::real\real. \P Q::real^2. (isarc P Q \ A P Q + B P Q = f (arctan (Q$2/Q$1) - arctan (P$2/P$1)))" + sorry + +end diff --git a/isabelle/putnam_1998_a6.thy b/isabelle/putnam_1998_a6.thy new file mode 100644 index 00000000..a0eb4278 --- /dev/null +++ b/isabelle/putnam_1998_a6.thy @@ -0,0 +1,15 @@ +theory putnam_1998_a6 imports Complex_Main +"HOL-Analysis.Lebesgue_Measure" +begin + +theorem putnam_1998_a6: + fixes A B C :: "real^2" + and threesquare :: "(real^2) \ (real^2) \ (real^2) \ bool" + assumes hint: "\i\{1,2}. \a b c::int. A$i = a \ B$i = b \ C$i = c" + and htriangle: "A \ B \ A \ C \ B \ C" + and harea: "(dist A B + dist B C) ^ 2 < 8 * (measure lebesgue (convex hull {A, B, C})) + 1" + assumes "threesquare \ (\P Q R::real^2. dist Q P = dist Q R \ (P - Q) \ (R - Q) = 0)" + shows "threesquare A B C \ threesquare B C A \ threesquare C A B" + sorry + +end diff --git a/isabelle/putnam_2002_a2.thy b/isabelle/putnam_2002_a2.thy new file mode 100644 index 00000000..87e84caa --- /dev/null +++ b/isabelle/putnam_2002_a2.thy @@ -0,0 +1,12 @@ +theory putnam_2002_a2 imports Complex_Main +"HOL-Analysis.Finite_Cartesian_Product" +"HOL-Analysis.Linear_Algebra" +begin + +theorem putnam_2002_a2: + fixes hemi :: "(real^3) \ ((real^3) set)" + defines "hemi \ (\V::real^3. {P::real^3. P \ V \ 0})" + shows "\S::(real^3) set. ((S \ sphere 0 1 \ card S = 5) \ (\V::real^3. V \ 0 \ card (S \ hemi V) \ 4))" + sorry + +end diff --git a/isabelle/putnam_2003_a5.thy b/isabelle/putnam_2003_a5.thy new file mode 100644 index 00000000..a4a1f3f6 --- /dev/null +++ b/isabelle/putnam_2003_a5.thy @@ -0,0 +1,17 @@ +theory putnam_2003_a5 imports Complex_Main +begin + +(* uses (nat \ int) instead of (Fin (2*m) \ int) *) +theorem putnam_2003_a5: + fixes n :: nat + and dyckpath :: "nat \ ((nat \ int) set)" + and noevenreturn :: "nat \ ((nat \ int) set)" + assumes npos: "n > 0" + defines "dyckpath \ (\m::nat. {p::nat\int. (\k::nat\2*m. p k = 0) \ + p ` {0..(2*m-1)} \ {-1, 1} \ (\k::nat\{0..(2*m-1)}. p k) = 0 \ (\j::nat\{0..(2*m-1)}. (\k::nat\{0..j}. p k) \ 0)})" + and "noevenreturn \ (\m::nat. {p::nat\int. (\k::nat\2*m. p k = 0) \ + \(\i::nat\{0..(2*m-1)}. \j::nat\{0..(2*m-1)}. i < j \ p i = 1 \ (\k::nat\{(i+1)..j}. p i = -1) \ even (j - i) \ (\k::nat\{0..j}. p k) = 0)})" + shows "\f::(nat\int)\(nat\int). (\y\(dyckpath (n-1)). \!x::nat\int. x \ (dyckpath n \ noevenreturn n) \ f x = y)" + sorry + +end diff --git a/isabelle/putnam_2003_b2.thy b/isabelle/putnam_2003_b2.thy new file mode 100644 index 00000000..02d32de0 --- /dev/null +++ b/isabelle/putnam_2003_b2.thy @@ -0,0 +1,14 @@ +theory putnam_2003_b2 imports Complex_Main +begin + +(* uses (nat \ nat \ rat) instead of (Fin n \ {1..n} \ rat) *) +theorem putnam_2003_b2: + fixes n :: nat + and seq :: "nat \ nat \ rat" + assumes hn: "n > 0" + and hinit: "\j::nat\{1..n}. seq 0 j = 1 / (rat_of_nat j)" + and havg: "\k::nat\{1..(n-1)}. \j::nat\{1..(n-k)}. seq k j = (seq (k-1) j + seq (k-1) (j+1)) / 2" + shows "seq (n-1) 1 < 2 / (rat_of_nat n)" + sorry + +end diff --git a/isabelle/putnam_2003_b5.thy b/isabelle/putnam_2003_b5.thy new file mode 100644 index 00000000..8a45e93d --- /dev/null +++ b/isabelle/putnam_2003_b5.thy @@ -0,0 +1,13 @@ +theory putnam_2003_b5 imports Complex_Main +"HOL-Analysis.Lebesgue_Measure" +begin + +theorem putnam_2003_b5: + fixes A B C :: "real^2" + assumes hABC: "dist 0 A = 1 \ dist 0 B = 1 \ dist 0 C = 1 \ dist A B = dist A C \ dist A B = dist B C" + shows "\f::real\real. \P::real^2. dist 0 P < 1 \ (\X Y Z::real^2. + dist X Y = dist P A \ dist Y Z = dist P B \ dist X Z = dist P C \ + measure lebesgue (convex hull {X, Y, Z}) = f (dist 0 P))" + sorry + +end diff --git a/isabelle/putnam_2004_a5.thy b/isabelle/putnam_2004_a5.thy new file mode 100644 index 00000000..3234b021 --- /dev/null +++ b/isabelle/putnam_2004_a5.thy @@ -0,0 +1,18 @@ +theory putnam_2004_a5 imports Complex_Main +begin + +(* uses (nat \ nat) instead of (Fin m \ Fin n) *) +theorem putnam_2004_a5: + fixes m n :: nat + and adj :: "(nat \ nat) \ (nat \ nat) \ bool" + and connected :: "((nat \ nat) \ bool) \ (nat \ nat) \ (nat \ nat) \ bool" + and cmr :: "((nat \ nat) \ bool) \ nat" + assumes mnpos: "m * n > 0" + defines "adj \ (\(a::nat,b::nat)(c::nat,d::nat). a < m \ b < n \ c < m \ d < n \ ((a = c \ dist b d = 1) \ (b = d \ dist a c = 1)))" + and "connected \ (\(C::(nat\nat)\bool)(P::nat\nat)(Q::nat\nat). (\(S::(nat\nat) list). length S > 0 \ + S!0 = P \ last S = Q \ (\p::bool. \i::nat\{0..((length S)-1)}. C (S!i) = p) \ (\i::nat\{0..((length S)-2)}. adj (S!i) (S!(i+1)))))" + and "cmr \ (\C::(nat\nat)\bool. card {R::(nat\nat) set. (\P\R. fst P < m \ snd P < n \ (\Q::nat\nat. (Q \ R \ connected C P Q)))})" + shows "(\C\{C'::(nat\nat)\bool. (\i::nat\m. \j::nat\n. C (i,j) = False)}. cmr C) > (2 ^ (m*n)) * (m*n / 8)" + sorry + +end diff --git a/isabelle/putnam_2004_b4.thy b/isabelle/putnam_2004_b4.thy new file mode 100644 index 00000000..27e13959 --- /dev/null +++ b/isabelle/putnam_2004_b4.thy @@ -0,0 +1,16 @@ +theory putnam_2004_b4 imports Complex_Main +begin + +definition putnam_2004_b4_solution :: "nat \ complex \ complex" where "putnam_2004_b4_solution \ undefined" +(* (\(n::nat)(z::complex). z + n) *) +theorem putnam_2004_b4: + fixes n :: nat + and Rk :: "nat \ complex \ complex" + and R :: "nat \ complex \ complex" + assumes nge2: "n \ 2" + defines "Rk \ (\(k::nat)(Q::complex). k + exp (\ * 2 * pi / n) * (Q - k))" + assumes hR: "R 0 = id \ (\k::nat. R (k+1) = Rk (k+1) \ R k)" + shows "R n = putnam_2004_b4_solution n" + sorry + +end diff --git a/isabelle/putnam_2005_a2.thy b/isabelle/putnam_2005_a2.thy new file mode 100644 index 00000000..cd57c497 --- /dev/null +++ b/isabelle/putnam_2005_a2.thy @@ -0,0 +1,19 @@ +theory putnam_2005_a2 imports Complex_Main +begin + +(* uses (nat \ (int \ int)) instead of ({1..(3*n)} \ (int \ int)) *) +definition putnam_2005_a2_solution :: "nat \ nat" where "putnam_2005_a2_solution \ undefined" +(* (\n::nat. if n = 1 then 0 else 2 ^ (n - 2)) *) +theorem putnam_2005_a2: + fixes n :: nat + and S :: "(int \ int) set" + and unit :: "(int \ int) \ (int \ int) \ bool" + and rooktour :: "(nat \ (int \ int)) \ bool" + assumes npos: "n > 0" + defines "S \ {1..n} \ {1..3}" + and "unit \ (\(a::int,b::int)(c::int,d::int). (a = c \ \d - b\ = 1) \ (b = d \ \c - a\ = 1))" + and "rooktour \ (\p::nat\(int\int). (\P\S. \!i::nat\{1..(3*n)}. p i = P) \ (\i::nat\{1..(3*n-1)}. unit (p i) (p (i+1))) \ p 0 = (0, 0) \ (\i::nat>(3*n). p i = (0, 0)))" + shows "card {p::nat\(int\int). rooktour p \ p 1 = (1, 1) \ p (3*n) = (n, 1)} = putnam_2005_a2_solution n" + sorry + +end diff --git a/isabelle/putnam_2005_b5.thy b/isabelle/putnam_2005_b5.thy new file mode 100644 index 00000000..a07eaaca --- /dev/null +++ b/isabelle/putnam_2005_b5.thy @@ -0,0 +1,22 @@ +theory putnam_2005_b5 imports Complex_Main +"HOL-Analysis.Derivative" +begin + +theorem putnam_2005_b5: + fixes n :: nat + and P :: "('n::finite \ real) \ real" + and ispoly :: "(('n \ real) \ real) \ bool" + and P2deriv :: "'n \ ('n \ real) \ real" + and Psumsq :: "('n \ real) \ real" + assumes npos: "n > 0" + and pncard: "CARD('n) = n" + defines "ispoly \ (\P'::('n\real)\real. (\l::(real\('n\nat)) list. \x::'n\real. P' x = (\j::nat=0..((length l)-1). (fst (l!j)) * (\i::'n\UNIV. (x i) ^ ((snd (l!j)) i)))))" + assumes Ppoly: "ispoly P" + defines "P2deriv \ (\(i::'n)(x::'n\real). (deriv^^2) (\xi::real. P (\i'::'n \ if i' = i then xi else x i')) (x i))" + assumes hderiv: "\x::'n\real. (\i::'n\UNIV. P2deriv i x) = 0" + defines "Psumsq \ (\x::'n\real. (\i::'n\UNIV. (x i)^2))" + assumes hsumsq: "\Q::('n\real)\real. ispoly Q \ (\x::'n\real. (Psumsq x) * (Q x) = P x)" + shows "P = (\x::'n\real. 0)" + sorry + +end