Compfiles/Imo1995P6.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
28 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 1995, Problem 6
Let p be an odd prime number. How many p-element subsets A of {1, 2, ..., 2p} are there, the sum of whose elements is divisible by p?
Imports (6)
Imported by 1 file
- def
Imo1995P6.shiftThe cyclic shiftx ↦ x + 1on{1, ..., p}(sendingpback to1), extended by the identity on all other natural numbers line 34 sourceSource documentation
The cyclic shift
x ↦ x + 1on{1, ..., p}(sendingpback to1), extended by the identity on all other natural numbers.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
NatProof uses:
ite,Membership.mem,Finset,Finset.Icc,OfNat.ofNat,HAdd.hAdd,HMod.hMod11 instances, coercions and auxiliary constants left out.
def shift (p x : ℕ) : ℕ := if x ∈ Finset.Icc 1 p then x % p + 1 else x
- def
Imo1995P6.shiftSetThe action ofshift pon sets of naturals: the elements ofAlying in{1, ..., p}are cyclically shifted and all other elements stay fixed line 38 sourceSource documentation
The action of
shift pon sets of naturals: the elements ofAlying in{1, ..., p}are cyclically shifted and all other elements stay fixed.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,FinsetProof uses:
Finset.image, Imo1995P6.shift1 instances, coercions and auxiliary constants left out.
def shiftSet (p : ℕ) (A : Finset ℕ) : Finset ℕ := A.image (shift p)
Mentions: Imo1995P6.shift
- theorem
Imo1995P6.shiftSet_eqline 40 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Eq, Imo1995P6.shiftSet,Finset.image, Imo1995P6.shiftProof uses:
rfl1 instances, coercions and auxiliary constants left out.
- theorem
Imo1995P6.shift_of_memline 42 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Membership.mem,Finset,Finset.Icc,OfNat.ofNat,Eq, Imo1995P6.shift,HAdd.hAdd,HMod.hModProof uses:
ite_eq_left20 instances, coercions and auxiliary constants left out.
- theorem
Imo1995P6.shift_of_not_memline 44 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Not,Membership.mem,Finset,Finset.Icc,OfNat.ofNat,Eq, Imo1995P6.shiftProof uses:
ite_eq_right,HAdd.hAdd,HMod.hMod16 instances, coercions and auxiliary constants left out.
- theorem
Imo1995P6.shift_mem_Iccline 46 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Membership.mem,Finset,Finset.Icc, Imo1995P6.shiftProof uses:
Eq,HAdd.hAdd,HMod.hMod,ite_eq_left,Eq.mpr,And,LE.le,id,congrArg,propext,Finset.mem_Icc,Nat.mod_lt20 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shift_mem_iffline 54 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Iff,Membership.mem,Finset,Finset.Icc, Imo1995P6.shiftProof uses:
Iff.intro,dite,Not,Eq.mpr,id,Eq,congrArg, Imo1995P6.shift_of_not_mem,absurd, Imo1995P6.shift_mem_Icc14 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shift_injectiveline 63 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Function.Injective, Imo1995P6.shiftProof uses:
Eq,dite,Membership.mem,Finset,Finset.Icc,HAdd.hAdd,HMod.hMod,ite_eq_left,Eq.mp,congrArg,Eq.mpr,id,Eq.symm,Nat.mod_self,Eq.refl,Dvd.dvd,Nat.dvd_of_mod_eq_zero,LE.le,Nat.le_of_dvd,Andand 7 more24 instances, coercions and auxiliary constants left out.
Tactic trace: 58 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shift_iterate_mem_Iccline 107 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Membership.mem,Finset,Finset.Icc,Eq,Nat.iterate, Imo1995P6.shift,HAdd.hAdd,HMod.hMod,HSub.hSubProof uses:
Nat.recAux,id,Eq.mpr,congrArg,Nat.mod_eq_of_lt,Eq.mp,And,LE.le,propext,Finset.mem_Icc,Nat.sub_add_cancel,And.left,Eq.refl,Nat.mod_lt,Nat.succ,Function.iterate_succ_apply',ite_eq_left,Nat.mod_add_mod,Iff.mp,HAddand 1 more30 instances, coercions and auxiliary constants left out.
Tactic trace: 15 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shift_iterate_not_memline 127 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Not,Membership.mem,Finset,Finset.Icc,OfNat.ofNat,Eq,Nat.iterate, Imo1995P6.shiftProof uses:
Nat.recAux,Eq.refl,Eq.mpr,HAdd.hAdd,id,congrArg,Nat.succ,Function.iterate_succ_apply',ite_eq_right,HMod.hMod16 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shift_iterate_mem_Icc'line 133 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Membership.mem,Finset,Finset.Icc,Nat.iterate, Imo1995P6.shiftProof uses:
Eq.mpr,HAdd.hAdd,HMod.hMod,HSub.hSub,id,Eq,congrArg, Imo1995P6.shift_iterate_mem_Icc,And,LE.le,propext,Finset.mem_Icc,Nat.mod_lt20 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shift_iterate_pline 140 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Nat.iterate, Imo1995P6.shiftProof uses:
dite,Membership.mem,Finset,Finset.Icc,Eq.mpr,HAdd.hAdd,HMod.hMod,HSub.hSub,id,congrArg, Imo1995P6.shift_iterate_mem_Icc,Nat.add_mod_right,Nat.mod_eq_of_lt,Eq.mp,And,LE.le,propext,Finset.mem_Icc,Nat.sub_add_cancel,And.leftand 3 more18 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shiftSet_iterateline 147 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Finset,Eq,Nat.iterate, Imo1995P6.shiftSet,Finset.image, Imo1995P6.shiftProof uses:
Nat.recAux,Eq.mpr,OfNat.ofNat,id,congrArg,Function.iterate_zero,Finset.image_id,id_eq,Eq.refl,HAdd.hAdd,Nat.succ,Function.iterate_succ_apply',Function.comp,Function.iterate_succ',Finset.image_image5 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shiftSet_iterate_pline 156 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Eq,Nat.iterate, Imo1995P6.shiftSetProof uses:
Eq.mpr,Finset.image, Imo1995P6.shift,id,congrArg, Imo1995P6.shiftSet_iterate,funext, Imo1995P6.shift_iterate_p,Finset.image_id,Eq.refl5 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shiftSet_injectiveline 159 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Function.Injective,Finset, Imo1995P6.shiftSetProof uses:
Finset.image_injective, Imo1995P6.shift, Imo1995P6.shift_injective5 instances, coercions and auxiliary constants left out.
- theorem
Imo1995P6.sum_shiftSetThe key congruence: shifting a set once increases its sum by the number of its elements lying in{1, ..., p}, modulopline 164 sourceSource documentation
The key congruence: shifting a set once increases its sum by the number of its elements lying in
{1, ..., p}, modulop.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Nat.ModEq,Finset.sum, Imo1995P6.shiftSet,HAdd.hAdd,Finset.card,Finset.filter,Membership.mem,Finset.IccProof uses:
Eq.mpr,Finset.image, Imo1995P6.shift,id,Eq,congrArg, Imo1995P6.shiftSet_eq,Finset.sum_image,Set, Imo1995P6.shift_injective,Not,Eq.symm,Finset.sum_filter_add_sum_filter_not,HMod.hMod,ite_eq_left,And.right,Iff.mp,And,Finset.mem_filter,ite_eq_rightand 16 more47 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.
theorem sum_shiftSet {p : ℕ} (hp : 0 < p) (A : Finset ℕ) : ∑ x ∈ shiftSet p A, x ≡ ∑ x ∈ A, x + (A.filter (· ∈ Finset.Icc 1 p)).card [MOD p] := by …Mentions: Imo1995P6.shiftSet
- theorem
Imo1995P6.low_card_shiftSetline 189 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Eq,Finset.card,Finset.filter,Membership.mem,Finset.Icc, Imo1995P6.shiftSetProof uses:
Finset.image, Imo1995P6.shift,Finset.ext,Eq.mpr,Iff,And,Exists,id,congr,congrArg,Eq.trans,congrFun',funext,Iff.intro,Exists.intro,And.intro,Iff.mp, Imo1995P6.shift_mem_iff,rfl,Iff.mprand 3 more21 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.low_card_shiftSet_iterateline 202 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Eq,Finset.card,Finset.filter,Membership.mem,Finset.Icc,Nat.iterate, Imo1995P6.shiftSetProof uses:
Nat.recAux,Eq.mpr,id,congrArg,Function.iterate_zero,id_eq,Eq.refl,HAdd.hAdd,Nat.succ,Function.iterate_succ_apply', Imo1995P6.low_card_shiftSet18 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.sum_shiftSet_iterateline 208 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Nat.ModEq,Finset.sum,Nat.iterate, Imo1995P6.shiftSet,HAdd.hAdd,HMul.hMul,Finset.card,Finset.filter,Membership.mem,Finset.IccProof uses:
Nat.recAux,Eq.mpr,id,Eq,congrArg,Nat.zero_mul,Nat.ModEq.refl, Imo1995P6.sum_shiftSet,Nat.succ,Function.iterate_succ_apply',Nat.ModEq.trans,Eq.mp, Imo1995P6.low_card_shiftSet_iterate,Nat.ModEq.add,Mathlib.Tactic.Ring.of_eq,HPow.hPow,Nat.rawCast,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfland 18 more42 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shiftSet_iterate_memline 229 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Membership.mem,Finset.powersetCard,Finset.Icc,HMul.hMul,Nat.iterate, Imo1995P6.shiftSetProof uses:
Eq.mpr,And,LE.le,Eq,Finset.card,id,congrArg,propext,Finset.mem_powersetCard,Eq.mp,Finset.image, Imo1995P6.shift, Imo1995P6.shiftSet_iterate,And.intro,Exists,Iff.mp,Finset.mem_image,dite, Imo1995P6.shift_iterate_mem_Icc',Finset.mem_Iccand 6 more25 instances, coercions and auxiliary constants left out.
Tactic trace: 17 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shiftSet_iterate_Icc_leftline 246 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Finset,Nat.iterate, Imo1995P6.shiftSet,Finset.IccProof uses:
Eq.mpr,Finset.image, Imo1995P6.shift,id,congrArg, Imo1995P6.shiftSet_iterate,Finset.card,Finset.card_image_of_injective,Function.Injective.iterate, Imo1995P6.shift_injective,LE.le,Membership.mem,And,Exists,Iff.mp,Finset.mem_image, Imo1995P6.shift_iterate_mem_Icc',Finset.eq_of_subset_of_card_le,le_of_eq,Eq.symm17 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shiftSet_iterate_Icc_rightline 257 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset,Nat.iterate, Imo1995P6.shiftSet,Finset.Icc,HAdd.hAdd,OfNat.ofNat,HMul.hMulProof uses:
Eq.mpr,Finset.image, Imo1995P6.shift,id,congrArg, Imo1995P6.shiftSet_iterate,Finset.ext,Iff,Membership.mem,Exists,And,congrFun',Iff.intro, Imo1995P6.shift_iterate_not_mem,Not,LE.le,propext,Finset.mem_Icc,Eq.mp,Iff.mprand 2 more23 instances, coercions and auxiliary constants left out.
Tactic trace: 18 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.shiftSet_iterate_mem_Uline 272 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Membership.mem,SDiff.sdiff,Finset.powersetCard,Finset.Icc,HMul.hMul,Insert.insert,Singleton.singleton,HAdd.hAdd,Nat.iterate, Imo1995P6.shiftSetProof uses:
Eq.mpr,And,Not,id,Eq,congrArg,propext,Finset.mem_sdiff,Eq.mp,Or,Finset.mem_insert,Finset.mem_singleton,Ne,And.intro, Imo1995P6.shiftSet_iterate_mem,And.left,Function.Injective.iterate, Imo1995P6.shiftSet_injective, Imo1995P6.shiftSet_iterate_Icc_left,Eq.refland 2 more32 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
- theorem
Imo1995P6.low_card_boundsIfAis ap-element subset of{1, ..., 2p}different from the two "interval" subsets, thenA ∩ {1, ..., p}has between1andp - 1elements line 291 sourceSource documentation
If
Ais ap-element subset of{1, ..., 2p}different from the two "interval" subsets, thenA ∩ {1, ..., p}has between1andp - 1elements.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Finset,Membership.mem,SDiff.sdiff,Finset.powersetCard,Finset.Icc,HMul.hMul,Insert.insert,Singleton.singleton,HAdd.hAdd,And,LE.le,Finset.card,Finset.filter,HSub.hSubProof uses:
Eq,Ne,Eq.mp,Not,Or,congrArg,propext,Finset.mem_powersetCard,Finset.mem_singleton,Finset.mem_insert,Finset.mem_sdiff,And.right,Iff.mp,Finset.mem_filter,Trans.trans,Finset.card_le_card,Eq.mpr,id,Nat.card_Icc,Nat.add_sub_canceland 11 more52 instances, coercions and auxiliary constants left out.
Tactic trace: 38 steps
Open to load the checked before-and-after goal states.
theorem low_card_bounds {p : ℕ} (hp : 0 < p) {A : Finset ℕ} (hA : A ∈ (Finset.Icc 1 (2 * p)).powersetCard p \ {Finset.Icc 1 p, Finset.Icc (p + 1) (2 * p)}) : 1 ≤ (A.filter (· ∈ Finset.Icc 1 p)).card ∧ (A.filter (· ∈ Finset.Icc 1 p)).card ≤ p - 1 := by … - theorem
Imo1995P6.card_range_filter_eq_oneForAas above, among thepsetsA, σ A, ..., σ^{p-1} Aexactly one has sum divisible byp(hereσisshiftSet p) line 331 sourceSource documentation
For
Aas above, among thepsetsA, σ A, ..., σ^{p-1} Aexactly one has sum divisible byp(hereσisshiftSet p).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,Finset,Membership.mem,SDiff.sdiff,Finset.powersetCard,Finset.Icc,OfNat.ofNat,HMul.hMul,Insert.insert,Singleton.singleton,HAdd.hAdd,Eq,Finset.card,Finset.filter,Dvd.dvd,Finset.sum,Nat.iterate, Imo1995P6.shiftSet,Finset.rangeProof uses:
LT.lt,Nat.Prime.pos,NeZero,NeZero.mk,LT.lt.ne',Fact,Fact.mk,LE.le,HSub.hSub,And, Imo1995P6.low_card_bounds,Iff,ZMod,Nat.ModEq, Imo1995P6.sum_shiftSet_iterate,Eq.mpr,id,congrArg,Eq.symm,Nat.cast_sumand 30 more86 instances, coercions and auxiliary constants left out.
Tactic trace: 47 steps
Open to load the checked before-and-after goal states.
theorem card_range_filter_eq_one {p : ℕ} (hp : p.Prime) {A : Finset ℕ} (hA : A ∈ (Finset.Icc 1 (2 * p)).powersetCard p \ {Finset.Icc 1 p, Finset.Icc (p + 1) (2 * p)}) : ((Finset.range p).filter (fun i ↦ p ∣ ∑ x ∈ (shiftSet p)^[i] A, x)).card = 1 := by …Mentions: Imo1995P6.shiftSet
- theorem
Imo1995P6.card_U_filter_eqShiftingitimes is a bijection on the good subsets, so for each fixedithe number of goodAwithp ∣ ∑ σⁱ Aequals the number of goodBwithp ∣ ∑ Bline 392 sourceSource documentation
Shifting
itimes is a bijection on the good subsets, so for each fixedithe number of goodAwithp ∣ ∑ σⁱ Aequals the number of goodBwithp ∣ ∑ B.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,Membership.mem,Finset,Finset.range,Eq,Finset.card,Finset.filter,Dvd.dvd,Finset.sum,Nat.iterate, Imo1995P6.shiftSet,SDiff.sdiff,Finset.powersetCard,Finset.Icc,OfNat.ofNat,HMul.hMul,Insert.insert,Singleton.singleton,HAdd.hAddProof uses:
LT.lt,Nat.Prime.pos,Finset.card_bij,Eq.mpr,And,id,congrArg,propext,Finset.mem_filter,And.intro, Imo1995P6.shiftSet_iterate_mem_U,And.left,Eq.mp,And.right,Function.Injective.iterate, Imo1995P6.shiftSet_injective,LE.le,Nat.le_of_lt,Iff.mp,Finset.mem_rangeand 8 more38 instances, coercions and auxiliary constants left out.
Tactic trace: 22 steps
Open to load the checked before-and-after goal states.
theorem card_U_filter_eq {p : ℕ} (hp : p.Prime) (i : ℕ) (hi : i ∈ Finset.range p) : (((Finset.Icc 1 (2 * p)).powersetCard p \ {Finset.Icc 1 p, Finset.Icc (p + 1) (2 * p)}).filter (fun A ↦ p ∣ ∑ x ∈ (shiftSet p)^[i] A, x)).card = (((Finset.Icc 1 (2 * p)).powersetCard p \ {Finset.Icc 1 p, Finset.Icc (p + 1) (2 * p)}).filter (fun A ↦ p ∣ ∑ x ∈ A, x)).card := by …Mentions: Imo1995P6.shiftSet
- determine
Imo1995P6.solutionline 419 sourceno axioms what this means
Statement uses:
NatProof uses:
HAdd.hAdd,OfNat.ofNat,HDiv.hDiv,HSub.hSub,Nat.choose,HMul.hMul9 instances, coercions and auxiliary constants left out.
- problem
Imo1995P6.imo1995_p6line 421 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Nat.Prime,Odd,Eq,Finset.card,Finset,Finset.filter,Dvd.dvd,Finset.sum,Finset.powersetCard,Finset.Icc,OfNat.ofNat,HMul.hMul, Imo1995P6.solutionProof uses:
LT.lt,Nat.Prime.pos,Membership.mem,Eq.mpr,And,LE.le,id,congrArg,propext,Finset.mem_powersetCard,And.intro,Finset.Icc_subset_Icc,le_refl,HSub.hSub,HAdd.hAdd,Nat.card_Icc,Nat.add_sub_cancel,Eq.refl,Ne,Eq.recand 95 more104 instances, coercions and auxiliary constants left out.
Tactic trace: 105 steps
Open to load the checked before-and-after goal states.