Compfiles/Usa2020P4.lean
Explanation legend Lean4 Domain Explanation Language (L4DEL)
L4DEL explanations are a separate layer. They do not change the Lean source. Intuition is explanatory prose; numbered items are a reading path; sources link the wording back to evidence.
- L4DEL
- Lean4 Domain Explanation Language
Credit: The upstream authors and contributors retain credit for the project and mathematics. lean4-explainer only renders their pinned source and adds the separately disclosed explanation layer.
Project sources: Pinned compfiles documentation, Pinned compfiles corpus index
12 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2020, Problem 4
Suppose that (a₁, b₁), (a₂, b₂), ..., (a₁₀₀, b₁₀₀) are distinct ordered pairs of nonnegative integers. Let N denote the number of pairs of integers (i, j) satisfying 1 ≤ i < j ≤ 100 and |aᵢbⱼ − aⱼbᵢ| = 1. Determine the largest possible value of N over all possible choices of the 100 ordered pairs.
Imports (8)
Imported by 1 file
- def
Usa2020P4.detThe determinantaᵢ bⱼ − aⱼ bᵢof two ordered pairs of nonnegative integers, viewed as an integer line 35 sourceSource documentation
The determinant
aᵢ bⱼ − aⱼ bᵢof two ordered pairs of nonnegative integers, viewed as an integer.no axioms what this means
Statement uses:
Prod,Nat,IntProof uses:
HSub.hSub,HMul.hMul,Prod.fst,Prod.snd6 instances, coercions and auxiliary constants left out.
def det (P Q : ℕ × ℕ) : ℤ := (P.1 : ℤ) * (Q.2 : ℤ) - (Q.1 : ℤ) * (P.2 : ℤ)
Mentions: P
- determine
Usa2020P4.answerline 37 sourceno axioms what this means
Statement uses:
NatProof uses:
OfNat.ofNat1 instances, coercions and auxiliary constants left out.
- def
Usa2020P4.goodSetsThe good two-element subsets of a set of points: those{P, Q}with|det P Q| = 1line 65 sourceSource documentation
The good two-element subsets of a set of points: those
{P, Q}with|det P Q| = 1.private def goodSets (S : Finset (ℕ × ℕ)) : Finset (Finset (ℕ × ℕ)) := …
Mentions: S
- def
Usa2020P4.goodPairsThe good index pairs of a choicevof 100 points line 69 sourceSource documentation
The good index pairs of a choice
vof 100 points.private def goodPairs (v : Fin 100 → ℕ × ℕ) : Finset (Fin 100 × Fin 100) := …
- lemma
Usa2020P4.det_swapline 72 source - lemma
Usa2020P4.eq_zero_of_eq_add_mulIf(u, v) = (u', v') + t • (a, b)witht ≥ 1, all ofu' v' a bnonnegative, andu² + v² ≤ a² + b², then(u', v') = (0, 0)line 76 sourceSource documentation
If
(u, v) = (u', v') + t • (a, b)witht ≥ 1, all ofu' v' a bnonnegative, andu² + v² ≤ a² + b², then(u', v') = (0, 0).private lemma eq_zero_of_eq_add_mul {u v u' v' a b t : ℤ} (ha : 0 ≤ a) (hb : 0 ≤ b) (hu' : 0 ≤ u') (hv' : 0 ≤ v') (ht : 1 ≤ t) (huu : u = u' + t * a) (hvv : v = v' + t * b) (hn : u ^ 2 + v ^ 2 ≤ a ^ 2 + b ^ 2) : u' = 0 ∧ v' = 0 := by … - lemma
Usa2020P4.eq_of_det_eq_of_leTwo points of the first quadrant having the same determinant of absolute value1with a primitive pointP, and both at most as far from the origin asP, must coincide line 110 sourceSource documentation
Two points of the first quadrant having the same determinant of absolute value
1with a primitive pointP, and both at most as far from the origin asP, must coincide.private lemma eq_of_det_eq_of_le {P Q₁ Q₂ : ℕ × ℕ} (hP : Nat.Coprime P.1 P.2) (hdet : det P Q₁ = det P Q₂) (habs : |det P Q₁| = 1) (hn₁ : Q₁.1 ^ 2 + Q₁.2 ^ 2 ≤ P.1 ^ 2 + P.2 ^ 2) (hn₂ : Q₂.1 ^ 2 + Q₂.2 ^ 2 ≤ P.1 ^ 2 + P.2 ^ 2) : Q₁ = Q₂ := by …Mentions: P, Usa2020P4.det
- lemma
Usa2020P4.gcd_dvd_detThe gcd of the coordinates ofPdivides every determinantdet P Qline 166 sourceSource documentation
The gcd of the coordinates of
Pdivides every determinantdet P Q.private lemma gcd_dvd_det (P Q : ℕ × ℕ) : (Nat.gcd P.1 P.2 : ℤ) ∣ det P Q := by …
Mentions: P, Usa2020P4.det
- lemma
Usa2020P4.card_partners_le_twoA farthest pointPofSforms good pairs with at most two points ofSline 174 sourceSource documentation
A farthest point
PofSforms good pairs with at most two points ofS.private lemma card_partners_le_two {S : Finset (ℕ × ℕ)} {P : ℕ × ℕ} (hmax : ∀ Q ∈ S, Q.1 ^ 2 + Q.2 ^ 2 ≤ P.1 ^ 2 + P.2 ^ 2) : ((S.erase P).filter fun Q => |det P Q| = 1).card ≤ 2 := by …Mentions: S, P, Usa2020P4.det
- lemma
Usa2020P4.card_goodSets_leA set ofn ≥ 2points determines at most2 * n - 3good pairs line 212 sourceSource documentation
A set of
n ≥ 2points determines at most2 * n - 3good pairs.private lemma card_goodSets_le : ∀ n : ℕ, 2 ≤ n → ∀ S : Finset (ℕ × ℕ), S.card = n → (goodSets S).card ≤ 2 * n - 3 := by …Mentions: S, Usa2020P4.goodSets
- lemma
Usa2020P4.card_goodPairs_eqFor an injective choicevof points, the good index pairs and the good two-element subsets of the image are equinumerous line 273 sourceSource documentation
For an injective choice
vof points, the good index pairs and the good two-element subsets of the image are equinumerous.private lemma card_goodPairs_eq {v : Fin 100 → ℕ × ℕ} (hv : Function.Injective v) : (goodPairs v).card = (goodSets (Finset.univ.image v)).card := by …Mentions: Usa2020P4.goodPairs, Usa2020P4.goodSets
- problem
Usa2020P4.usa2020_p4USA Mathematical Olympiad 2020, Problem 4 line 343 sourceSource documentation
USA Mathematical Olympiad 2020, Problem 4
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
IsGreatest,Nat,Set.ofPred,Exists,Fin,OfNat.ofNat,Prod,And,Function.Injective,Eq,Finset.card,Finset.filter,LT.lt,Prod.fst,Prod.snd,Int,abs, Usa2020P4.det,Finset.univ, Usa2020P4.answerProof uses:
And.intro,Membership.mem,Set,upperBounds,Exists.intro,ite,Prod.mk,of_decide_eq_true,id,Bool,Decidable.decide,Bool.true,Eq.refl,LE.le,Eq.mpr,congrArg,Finset,Finset.image,Finset.card_image_of_injective,Fintype.cardand 10 more50 instances, coercions and auxiliary constants left out.
Tactic trace: 16 steps
Open to load the checked before-and-after goal states.
problem usa2020_p4 : IsGreatest {N : ℕ | ∃ v : Fin 100 → ℕ × ℕ, Function.Injective v ∧ N = (Finset.univ.filter fun p : Fin 100 × Fin 100 => p.1 < p.2 ∧ |det (v p.1) (v p.2)| = 1).card} answer := by …Mentions: Usa2020P4.det, Usa2020P4.answer