Compfiles/Usa1990P1.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
9 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 1990, Problem 1
A license plate has six digits from 0 to 9 and may have leading zeros. If two plates must always differ in at least two places, what is the largest number of plates that is possible?
Imports (5)
Imported by 1 file
- abbrev
Usa1990P1.PlateA license plate: six digits, each from 0 to 9 (leading zeros allowed) line 32 sourceSource documentation
A license plate: six digits, each from 0 to 9 (leading zeros allowed). We model digits as elements of
ZMod 10so that digit sums modulo ten are available for the checksum argument.no axioms what this means
Proof uses:
Fin,OfNat.ofNat,Nat,ZMod1 instances, coercions and auxiliary constants left out.
abbrev Plate := Fin 6 → ZMod 10
- def
Usa1990P1.IsValidA collection of plates is valid if any two distinct plates in it differ in at least two places line 36 sourceSource documentation
A collection of plates is valid if any two distinct plates in it differ in at least two places.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset, Usa1990P1.PlateProof uses:
Membership.mem,Ne,LE.le,Nat,OfNat.ofNat,hammingDist,Fin,ZMod6 instances, coercions and auxiliary constants left out.
def IsValid (S : Finset Plate) : Prop := …
Mentions: S, Usa1990P1.Plate
- def
Usa1990P1.extendThe checksum construction: given five digitsf : Fin 5 → ZMod 10, build a six-digit plate whose last digit makes the total digit sum congruent to zero modulo ten line 44 sourceSource documentation
The checksum construction: given five digits
f : Fin 5 → ZMod 10, build a six-digit plate whose last digit makes the total digit sum congruent to zero modulo ten.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fin,OfNat.ofNat,Nat,ZMod, Usa1990P1.PlateProof uses:
HAdd.hAdd,Fin.lastCases,Neg.neg,Finset.sum,Finset.univ16 instances, coercions and auxiliary constants left out.
def extend (f : Fin 5 → ZMod 10) : Plate := …
Mentions: f, Usa1990P1.Plate
- theorem
Usa1990P1.sum_extendThe digit sum of a plate built byextendis zero modulo ten line 48 sourceSource documentation
The digit sum of a plate built by
extendis zero modulo ten.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fin,OfNat.ofNat,Nat,ZMod,Eq,Finset.sum,Finset.univ, Usa1990P1.extendProof uses:
Eq.mpr,HAdd.hAdd,Fin.castSucc,Fin.last,id,congrArg,Fin.sum_univ_castSucc,Fin.lastCases,Neg.neg,Fin.lastCases_last,congrFun',Finset.sum_congr,Eq.refl,Finset,Membership.mem,Fin.lastCases_castSucc,add_neg_cancel35 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
theorem sum_extend (f : Fin 5 → ZMod 10) : ∑ j, extend f j = 0 := by …
Mentions: f, Usa1990P1.extend
- theorem
Usa1990P1.extend_injectiveThe first five digits determine a plate built byextendline 56 sourceSource documentation
The first five digits determine a plate built by
extend.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Function.Injective,Fin,OfNat.ofNat,Nat,ZMod, Usa1990P1.Plate, Usa1990P1.extendProof uses:
Eq,funext,Fin.castSucc,congrFun,Eq.mp,congr,congrArg,Fin.lastCases_castSucc,HAdd.hAdd,Neg.neg,Finset.sum,Finset.univ16 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
theorem extend_injective : Function.Injective extend := by …
Mentions: Usa1990P1.extend
- theorem
Usa1990P1.hammingDist_ge_two_of_sum_eqTwo plates with the same digit sum modulo ten cannot differ in exactly one place; hence distinct plates of equal sum differ in at least two places line 65 sourceSource documentation
Two plates with the same digit sum modulo ten cannot differ in exactly one place; hence distinct plates of equal sum differ in at least two places.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,ZMod,OfNat.ofNat,Eq,Finset.sum,Finset.univ,Ne,LE.le,hammingDistProof uses:
Finset.card,Finset.filter,Finset,Singleton.singleton,Exists,False,Iff.mp,Finset.card_eq_one,Membership.mem,Eq.rec,Finset.mem_singleton_self,Eq.symm,And.right,And,Finset.mem_filter,HSub.hSub,Eq.mpr,id,congrArg,Finset.sum_sub_distriband 14 more45 instances, coercions and auxiliary constants left out.
Tactic trace: 22 steps
Open to load the checked before-and-after goal states.
theorem hammingDist_ge_two_of_sum_eq {n : ℕ} {p q : Fin n → ZMod 10} (hsum : ∑ i, p i = ∑ i, q i) (hne : p ≠ q) : 2 ≤ hammingDist p q := by … - theorem
Usa1990P1.card_le_of_validUpper bound: a valid collection of plates has at most10 ^ 5members line 99 sourceSource documentation
Upper bound: a valid collection of plates has at most
10 ^ 5members. Indeed, two plates agreeing on the first five digits differ in at most one place, so the "first five digits" map is injective on any valid collection, whose codomain has size10 ^ 5.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finset, Usa1990P1.Plate, Usa1990P1.IsValid,LE.le,Nat,Finset.card,HPow.hPow,OfNat.ofNatProof uses:
Set.InjOn,Fin,ZMod,Fin.castSucc,Membership.mem,Set,Eq,Decidable.byContradiction,Not,hammingDist,Iff.mp,Finset.mem_coe,Finset.filter,Ne,Finset.univ,Singleton.singleton,HAdd.hAdd,Fin.last,Iff.mpr,Finset.mem_singletonand 22 more36 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.
theorem card_le_of_valid {S : Finset Plate} (hS : IsValid S) : S.card ≤ 10 ^ 5 := by …Mentions: S, Usa1990P1.Plate, Usa1990P1.IsValid
- determine
Usa1990P1.answerline 123 sourcestandard axioms: propext what this means
Statement uses:
NatProof uses:
HPow.hPow,OfNat.ofNat5 instances, coercions and auxiliary constants left out.
- problem
Usa1990P1.usa1990_p1line 125 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
IsGreatest,Nat,Set.ofPred,Exists,Finset, Usa1990P1.Plate,And,Eq,Finset.card, Usa1990P1.IsValid, Usa1990P1.answerProof uses:
And.intro,Membership.mem,Set,upperBounds,Exists.intro,Finset.image,Fin,OfNat.ofNat,ZMod, Usa1990P1.extend,Finset.univ,id,Eq.mpr,HPow.hPow,congrArg,Finset.card_image_of_injOn,Function.Injective.injOn, Usa1990P1.extend_injective,Fintype.card,Finset.card_univand 18 more28 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.