Compfiles/Imo1987P1.lean

GitHub source file

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

10 declarations, 0 contain sorry, 0 declared as axioms

International Mathematical Olympiad 1987, Problem 1

Let $p_{n, k}$ be the number of permutations of a set of cardinality n ≥ 1 that fix exactly k elements. Prove that $∑_{k=0}^n k p_{n,k}=n!$.

Imports (4)
Imported by 1 file
  1. def Imo1987P1.fiber Given α : Type* and k : ℕ, fiber α k is the set of permutations of α with exactly k fixed points line 33 source

    Source documentation

    Given α : Type* and k : ℕ, fiber α k is the set of permutations of α with exactly k fixed points.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Fintype, DecidableEq, Nat, Set, Equiv.Perm

    Proof uses: Set.ofPred, Eq, Fintype.card, Function.fixedPoints, Membership.mem

    7 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

    Open to load the checked before-and-after goal states.

    def fiber (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : Set (Equiv.Perm α) :=
    …
  2. instance Imo1987P1.(instance at line 36) line 36 source
  3. def Imo1987P1.p p α k is the number of permutations of α with exactly k fixed points line 40 source

    Source documentation

    p α k is the number of permutations of α with exactly k fixed points.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Fintype, DecidableEq, Nat

    Proof uses: Fintype.card, Equiv.Perm, Imo1987P1.fiber

    2 instances, coercions and auxiliary constants left out.

    def p (α : Type*) [Fintype α] [DecidableEq α] (k : ℕ) : ℕ := Fintype.card (fiber α k)
    …

    Mentions: Imo1987P1.fiber

  4. def Imo1987P1.fixedPointsEquiv The set of pairs (x : α, σ : Perm α) such that σ x = x is equivalent to the set of pairs (x : α, σ : Perm {x}ᶜ) line 68 source

    Source documentation

    The set of pairs (x : α, σ : Perm α) such that σ x = x is equivalent to the set of pairs (x : α, σ : Perm {x}ᶜ).

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: DecidableEq, Equiv, Subtype, Prod, Equiv.Perm, Eq, Prod.snd, Prod.fst, Sigma, Compl.compl, Set, Singleton.singleton

    Proof uses: Trans.trans, Membership.mem, Equiv.refl, Equiv.setProdEquivSigma, Equiv.sigmaCongrRight, Set.equivOfEq, Equiv.Set.compl

    17 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

    def fixedPointsEquiv : { σx : α × Perm α // σx.2 σx.1 = σx.1 } ≃ Σ x : α, Perm ({x}ᶜ : Set α) :=
    …
  5. theorem Imo1987P1.card_fixed_points line 76 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Fintype, DecidableEq, Eq, Nat, Fintype.card, Subtype, Prod, Equiv.Perm, Prod.snd, Prod.fst, HMul.hMul, Nat.factorial, HSub.hSub, OfNat.ofNat

    Proof uses: Eq.mpr, Finset.sum, Finset.univ, Compl.compl, Set, Singleton.singleton, Membership.mem, id, congrFun', congrArg, Eq.trans, Sigma, Fintype.card_congr, Imo1987P1.fixedPointsEquiv, Fintype.card_sigma, Finset.sum_congr, Eq.refl, Finset, Fintype.card_perm, of_eq_true and 6 more

    38 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

    Open to load the checked before-and-after goal states.

  6. theorem Imo1987P1.mem_fiber line 83 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Fintype, DecidableEq, Equiv.Perm, Nat, Iff, Membership.mem, Set, Imo1987P1.fiber, Eq, Fintype.card, Function.fixedPoints

    Proof uses: Iff.rfl

    8 instances, coercions and auxiliary constants left out.

  7. def Imo1987P1.fixedPointsEquiv' The set of triples (k ≤ card α, σ ∈ fiber α k, x ∈ fixedPoints σ) is equivalent to the set of pairs (x : α, σ : Perm α) such that σ x = x line 92 source

    Source documentation

    The set of triples (k ≤ card α, σ ∈ fiber α k, x ∈ fixedPoints σ) is equivalent to the set of pairs (x : α, σ : Perm α) such that σ x = x. The equivalence sends (k, σ, x) to (x, σ) and (x, σ) to (card (fixedPoints σ), σ, x).

    It is easy to see that the cardinality of the LHS is given by ∑ k : Fin (card α + 1), k * p α k.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Fintype, DecidableEq, Equiv, Sigma, Fin, HAdd.hAdd, Nat, Fintype.card, OfNat.ofNat, Equiv.Perm, Imo1987P1.fiber, Function.fixedPoints, Membership.mem, Set, Subtype, Prod, Eq, Prod.snd, Prod.fst

    Proof uses: Equiv.mk, Subtype.mk, Prod.mk, Sigma.fst, Sigma.snd, Sigma.mk, Fin.mk

    28 instances, coercions and auxiliary constants left out.

    Tactic trace: 3 steps

    Open to load the checked before-and-after goal states.

    def fixedPointsEquiv' :
        (Σ (k : Fin (card α + 1)) (σ : fiber α k), fixedPoints σ.1) ≃
          { σx : α × Perm α // σx.2 σx.1 = σx.1 } where
    …

    Mentions: Imo1987P1.fiber

  8. theorem Imo1987P1.main_fintype Main statement for any (α : Type*) [Fintype α] line 105 source

    Source documentation

    Main statement for any (α : Type*) [Fintype α].

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Fintype, DecidableEq, Eq, Nat, Finset.sum, Finset.range, HAdd.hAdd, Fintype.card, OfNat.ofNat, HMul.hMul, Imo1987P1.p, Nat.factorial, HSub.hSub

    Proof uses: Equiv.Perm, Imo1987P1.fiber, Function.fixedPoints, Membership.mem, Set, Subtype.property, Eq.mpr, Fin, Finset.univ, id, congrFun', congrArg, Eq.mp, Sigma, Subtype, Prod, Prod.snd, Prod.fst, congr, Eq.trans and 11 more

    40 instances, coercions and auxiliary constants left out.

    Tactic trace: 2 steps

    Open to load the checked before-and-after goal states.

    theorem main_fintype :
        ∑ k ∈ Finset.range (card α + 1), k * p α k = card α * (card α - 1)! := by
    …

    Mentions: Imo1987P1.p

  9. theorem Imo1987P1.main₀ Main statement for permutations of Fin n, a version that works for n = 0 line 112 source

    Source documentation

    Main statement for permutations of Fin n, a version that works for n = 0.

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, Eq, Finset.sum, Finset.range, HAdd.hAdd, OfNat.ofNat, HMul.hMul, Imo1987P1.p, Fin, Nat.factorial, HSub.hSub

    Proof uses: Eq.mp, Fintype.card, congr, congrArg, Finset.sum_congr, Finset, congrFun', Fintype.card_fin, Membership.mem, Eq.refl, Imo1987P1.main_fintype

    22 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.

    theorem main₀ (n : ℕ) : ∑ k ∈ Finset.range (n + 1), k * p (Fin n) k = n * (n - 1)! := by
    …

    Mentions: Imo1987P1.p

  10. problem Imo1987P1.imo1987_p1 line 118 source

    standard axioms: Classical.choice, Quot.sound, propext what this means

    Statement uses: Nat, LE.le, OfNat.ofNat, Eq, Finset.sum, Finset.range, HAdd.hAdd, HMul.hMul, Imo1987P1.p, Fin, Nat.factorial

    Proof uses: Eq.mpr, HSub.hSub, id, congrArg, Imo1987P1.main₀, Nat.mul_factorial_pred, Iff.mp, Ne, Nat.one_le_iff_ne_zero, Eq.refl

    20 instances, coercions and auxiliary constants left out.

    Tactic trace: 1 steps

    Open to load the checked before-and-after goal states.