Compfiles/Usa2017P2.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
56 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2017, Problem 2
Let $m_1, m_2, \ldots, m_n$ be a collection of $n$ positive integers, not necessarily distinct. For any sequence of integers $A = (a_1, \ldots, a_n)$ and any permutation $w = w_1 w_2 \cdots w_n$ of $m_1, \ldots, m_n$, define an $A$-inversion of $w$ to be a pair of entries $w_i, w_j$ with $i < j$ for which one of the following conditions holds:
- $a_i \ge w_i > w_j$,
- $w_j > a_i \ge w_i$, or
- $w_i > w_j > a_i$.
Show that, for any two sequences of integers $A = (a_1, \ldots, a_n)$ and $B = (b_1, \ldots, b_n)$, and for any positive integer $k$, the number of permutations of $m_1, \ldots, m_n$ having exactly $k$ A-inversions is equal to the number of permutations of $m_1, \ldots, m_n$ having exactly $k$ B-inversions.
Imports (6)
Imported by 1 file
- def
Usa2017P2.invPairTheA-inversion relation on a pair of entries:xis the left entry (at positioni, with thresholdc = a_i) andyis the right entry line 55 sourceSource documentation
The
A-inversion relation on a pair of entries:xis the left entry (at positioni, with thresholdc = a_i) andyis the right entry.no axioms what this means
Statement uses:
IntProof uses:
Or,And,LE.le,LT.lt2 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
def invPair (c x y : ℤ) : Prop := (x ≤ c ∧ y < x) ∨ (c < y ∧ x ≤ c) ∨ (y < x ∧ c < y)
- instance
Usa2017P2.(instance at line 57)line 57 source - def
Usa2017P2.ainvCountThe number ofA-inversions of the permutationσline 61 sourceSource documentation
The number of
A-inversions of the permutationσ.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Equiv.PermProof uses:
Finset.sum,Finset.univ,ite,And,LT.lt, Usa2017P2.invPair,OfNat.ofNat10 instances, coercions and auxiliary constants left out.
def ainvCount {n : ℕ} (m : Fin n → ℤ) (A : Fin n → ℤ) (σ : Perm (Fin n)) : ℕ := … - def
Usa2017P2.genFunThe generating function∑ σ, X ^ (ainvCount m A σ)of theA-inversion statistic line 65 sourceSource documentation
The generating function
∑ σ, X ^ (ainvCount m A σ)of theA-inversion statistic.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,PolynomialProof uses:
Finset.sum,Equiv.Perm,Finset.univ,HPow.hPow,Polynomial.X, Usa2017P2.ainvCount11 instances, coercions and auxiliary constants left out.
noncomputable def genFun {n : ℕ} (m : Fin n → ℤ) (A : Fin n → ℤ) : ℤ[X] := … - def
Usa2017P2.qqThe geometric sum1 + X + ⋯ + X^(t-1)line 69 sourceSource documentation
The geometric sum
1 + X + ⋯ + X^(t-1).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Polynomial,IntProof uses:
Finset.sum,Finset.range,HPow.hPow,Polynomial.X8 instances, coercions and auxiliary constants left out.
noncomputable def qq (t : ℕ) : ℤ[X] := ∑ s ∈ range t, X ^ s
- def
Usa2017P2.valMulThe multiset of values of the entries line 72 sourceSource documentation
The multiset of values of the entries.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,MultisetProof uses:
Multiset.map,Finset.val,Finset.univ1 instances, coercions and auxiliary constants left out.
def valMul {n : ℕ} (m : Fin n → ℤ) : Multiset ℤ := Finset.univ.val.map m - def
Usa2017P2.eCntThe multiplicity of the valuevamong the entries line 75 sourceSource documentation
The multiplicity of the value
vamong the entries.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,IntProof uses:
Multiset.count, Usa2017P2.valMul1 instances, coercions and auxiliary constants left out.
def eCnt {n : ℕ} (m : Fin n → ℤ) (v : ℤ) : ℕ := (valMul m).count vMentions: Usa2017P2.valMul
- def
Usa2017P2.cntPThe number of entries satisfyingpline 78 sourceSource documentation
The number of entries satisfying
p.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,DecidablePredProof uses:
Multiset.countP, Usa2017P2.valMuldef cntP {n : ℕ} (m : Fin n → ℤ) (p : ℤ → Prop) [DecidablePred p] : ℕ := … - def
Usa2017P2.frontContribThe number of inversions contributed by the first position when it has entryxand thresholdc, over the remaining entrieswline 83 sourceSource documentation
The number of inversions contributed by the first position when it has entry
xand thresholdc, over the remaining entriesw.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Int,FinProof uses:
Finset.sum,Finset.univ,ite, Usa2017P2.invPair,OfNat.ofNat4 instances, coercions and auxiliary constants left out.
def frontContrib {t : ℕ} (c x : ℤ) (w : Fin t → ℤ) : ℕ := … - def
Usa2017P2.skipEmbThe embeddingFin n ↪ Fin (n+1)whose range is everything exceptp, as used inEquiv.Perm.decomposeFinline 88 sourceSource documentation
The embedding
Fin n ↪ Fin (n+1)whose range is everything exceptp, as used inEquiv.Perm.decomposeFin.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Function.EmbeddingProof uses:
Function.Embedding.mk,Equiv.Perm,Equiv.swap,Fin.succ13 instances, coercions and auxiliary constants left out.
def skipEmb {n : ℕ} (p : Fin (n + 1)) : Fin n ↪ Fin (n + 1) where … - lemma
Usa2017P2.invPair_iffCompact characterization ofinvPair: the pair is an inversion iff the truth values "clies in the half-open interval between the entries" and "x > y" differ line 94 sourceSource documentation
Compact characterization of
invPair: the pair is an inversion iff the truth values "clies in the half-open interval between the entries" and "x > y" differ.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Int,Iff, Usa2017P2.invPair,Or,And,LT.lt,LE.leProof uses:
id5 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
lemma invPair_iff (c x y : ℤ) : invPair c x y ↔ (y < x ∧ (x ≤ c ∨ c < y)) ∨ (x ≤ y ∧ x ≤ c ∧ c < y) := by …Mentions: Usa2017P2.invPair
- lemma
Usa2017P2.frontContrib_leline 98 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Int,Fin,LE.le,Eq, Usa2017P2.frontContrib,HAdd.hAdd,Finset.sum,Finset.univ,ite,LT.lt,OfNat.ofNatProof uses:
id,Eq.mpr, Usa2017P2.invPair,congrArg,Eq.symm,Finset.sum_add_distrib,Finset.sum_congr,rfl,Finset,Membership.mem,Iff,Or,And,propext, Usa2017P2.invPair_iff,dite,False.elim,Not,ite_eq_left,Iff.mprand 7 more25 instances, coercions and auxiliary constants left out.
Tactic trace: 21 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.frontContrib_gtline 114 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Int,Fin,LT.lt,Eq, Usa2017P2.frontContrib,Finset.sum,Finset.univ,ite,And,OfNat.ofNatProof uses:
id,Finset.sum_congr, Usa2017P2.invPair,rfl,Finset,Membership.mem,Iff,Eq.mpr,Or,LE.le,congrArg,propext, Usa2017P2.invPair_iff,if_congr17 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.skipEmb_neline 122 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Ne,Function.Embedding, Usa2017P2.skipEmbProof uses:
Equiv.Perm,Equiv.swap,Fin.succ,Eq,Fin.succ_ne_zero,Equiv.injective,Eq.mp,congrArg,Equiv.swap_apply_left15 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.sum_univ_add_skipEmbSplitting a sum overFin (n+1)into the term atpand the rest line 128 sourceSource documentation
Splitting a sum over
Fin (n+1)into the term atpand the rest.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,AddCommMonoid,Fin,HAdd.hAdd,OfNat.ofNat,Eq,Finset.sum,Finset.univ,Function.Embedding, Usa2017P2.skipEmbProof uses:
Finset,Finset.image,Finset.erase,Finset.ext,Iff.intro,Membership.mem,And,Exists,Iff.mp,Finset.mem_image,Iff.mpr,Ne,Finset.mem_erase,And.intro, Usa2017P2.skipEmb_ne,Finset.mem_univ,Equiv.Perm,Equiv.swap,Equiv.injective,Eq.transand 15 more35 instances, coercions and auxiliary constants left out.
Tactic trace: 21 steps
Open to load the checked before-and-after goal states.
lemma sum_univ_add_skipEmb {n : ℕ} {M : Type*} [AddCommMonoid M] (p : Fin (n + 1)) (g : Fin (n + 1) → M) : ∑ i, g i = g p + ∑ i : Fin n, g (skipEmb p i) := by …Mentions: Usa2017P2.skipEmb
- lemma
Usa2017P2.ainvCount_compRelabeling the entries by a permutation does not change the number ofA-inversions (thresholds are positional) line 151 sourceSource documentation
Relabeling the entries by a permutation does not change the number of
A-inversions (thresholds are positional).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv.Perm,Fin,Int,Eq, Usa2017P2.ainvCount,Function.comp,HMul.hMulProof uses:
rfl8 instances, coercions and auxiliary constants left out.
lemma ainvCount_comp {n : ℕ} (e : Perm (Fin n)) (m : Fin n → ℤ) (A : Fin n → ℤ) (σ : Perm (Fin n)) : ainvCount (m ∘ e) A σ = ainvCount m A (e * σ) := rflMentions: Usa2017P2.ainvCount
- lemma
Usa2017P2.genFun_compline 154 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv.Perm,Fin,Int,Eq,Polynomial, Usa2017P2.genFun,Function.compProof uses:
id,Finset.sum,Finset.univ,HPow.hPow,Polynomial.X, Usa2017P2.ainvCount,Equiv.sum_comp,Equiv.mulLeft18 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.ainvCount_decomposeDocumented declaration: ainvCount_decompose line 163 sourceSource documentation
The first-position decomposition of the inversion count: under
Equiv.Perm.decomposeFin, theA-inversions split into the pairs involving the first position (frontContrib) and the inversions of the remaining permutation.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Equiv.Perm,Eq, Usa2017P2.ainvCount,Equiv,Prod,Nat.succ,Equiv.symm,Equiv.Perm.decomposeFin,Prod.mk, Usa2017P2.frontContrib,Function.comp,Function.Embedding, Usa2017P2.skipEmb,Fin.succProof uses:
Equiv.Perm.decomposeFin_symm_apply_zero,Equiv.Perm.decomposeFin_symm_apply_succ,id,Finset.sum,Finset.univ,ite,And,LT.lt, Usa2017P2.invPair,Eq.mpr,congrArg,Fin.sum_univ_succ,HAdd,Eq.rec,Eq.refl,ite_eq_right,lt_irrefl,And.left,zero_add,Eq.symmand 19 more40 instances, coercions and auxiliary constants left out.
Tactic trace: 37 steps
Open to load the checked before-and-after goal states.
lemma ainvCount_decompose {n : ℕ} (m : Fin (n + 1) → ℤ) (A : Fin (n + 1) → ℤ) (p : Fin (n + 1)) (π : Perm (Fin n)) : ainvCount m A (Equiv.Perm.decomposeFin.symm (p, π)) = frontContrib (A 0) (m p) (m ∘ skipEmb p) + ainvCount (m ∘ skipEmb p) (A ∘ Fin.succ) π := by …Mentions: Usa2017P2.ainvCount, Usa2017P2.frontContrib, Usa2017P2.skipEmb
- lemma
Usa2017P2.genFun_recThe first-position recurrence for the generating function line 207 sourceSource documentation
The first-position recurrence for the generating function.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Eq,Polynomial, Usa2017P2.genFun,Finset.sum,Finset.univ,HMul.hMul,HPow.hPow,Polynomial.X, Usa2017P2.frontContrib,Function.comp,Function.Embedding, Usa2017P2.skipEmb,Fin.succProof uses:
id,Eq.mpr,Equiv.Perm, Usa2017P2.ainvCount,Prod,Nat.succ,Equiv,Equiv.symm,Equiv.Perm.decomposeFin,congrArg,Eq.symm,Equiv.sum_comp,Prod.mk,Fintype.sum_prod_type,Finset.sum_congr,rfl,Finset,Membership.mem,Finset.mul_sum, Usa2017P2.ainvCount_decompose and 2 more55 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
lemma genFun_rec {n : ℕ} (m : Fin (n + 1) → ℤ) (A : Fin (n + 1) → ℤ) : genFun m A = ∑ p : Fin (n + 1), X ^ frontContrib (A 0) (m p) (m ∘ skipEmb p) * genFun (m ∘ skipEmb p) (A ∘ Fin.succ) := by …Mentions: Usa2017P2.genFun, Usa2017P2.frontContrib, Usa2017P2.skipEmb
- lemma
Usa2017P2.sum_if_eq_countline 219 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Eq,Finset.sum,Finset.univ,ite,OfNat.ofNat,Multiset.count, Usa2017P2.valMulProof uses:
Eq.mpr,Finset.card,Finset.filter,id,congrArg,Eq.symm,Finset.card_filter,Finset,Finset.filter_congr,Membership.mem,eq_comm,Multiset.countP,Multiset.map,Finset.val,Multiset.card,Multiset.filter,Multiset.countP_map,Eq.refl10 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.sum_if_eq_cntPline 229 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,DecidablePred,Eq,Finset.sum,Finset.univ,ite,OfNat.ofNat, Usa2017P2.cntPProof uses:
Eq.mpr,Finset.card,Finset.filter,id,congrArg,Eq.symm,Finset.card_filter,Multiset.countP,Multiset.map,Finset.val,Multiset.card,Multiset.filter,Multiset.countP_map,Eq.refl6 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.eCnt_eq_card_filterline 236 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Eq, Usa2017P2.eCnt,Finset.card,Finset.filter,Finset.univProof uses:
Eq.mpr,Finset.sum,ite,OfNat.ofNat,id,congrArg,Finset.card_filter,Eq.symm,Multiset.count, Usa2017P2.valMul, Usa2017P2.sum_if_eq_count6 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.valMul_comp_skipEmbDeleting one occurrence of a value from the entry multiset line 242 sourceSource documentation
Deleting one occurrence of a value from the entry multiset.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Eq,Multiset, Usa2017P2.valMul,Function.comp,Function.Embedding, Usa2017P2.skipEmb,Multiset.eraseProof uses:
Multiset.count,ite,Finset.sum,Finset.univ, Usa2017P2.sum_univ_add_skipEmb,rfl,Eq.mpr,id,congrArg,Eq.mp, Usa2017P2.sum_if_eq_count,add_comm,Eq.refl,Iff.mpr,Multiset.ext,dite,HSub.hSub,Multiset.count_erase_self,ite_eq_left,Notand 3 more23 instances, coercions and auxiliary constants left out.
Tactic trace: 20 steps
Open to load the checked before-and-after goal states.
lemma valMul_comp_skipEmb {n : ℕ} (m : Fin (n + 1) → ℤ) (p : Fin (n + 1)) : valMul (m ∘ skipEmb p) = (valMul m).erase (m p) := by …Mentions: Usa2017P2.valMul, Usa2017P2.skipEmb
- lemma
Usa2017P2.exists_perm_of_valMul_eqTwo entry functions with the same multiset of values differ by a permutation of the indices line 266 sourceSource documentation
Two entry functions with the same multiset of values differ by a permutation of the indices.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Eq,Multiset, Usa2017P2.valMul,Exists,Equiv.Perm,Function.compProof uses:
Nat.recAux,OfNat.ofNat,Exists.intro,funext,Fin.elim0,HAdd.hAdd,Membership.mem,Eq.mpr,id,congrArg,Iff.mpr,Multiset.map,Finset.val,Finset.univ,And,Multiset.mem_map,And.intro,Finset,Finset.mem_val,Finset.mem_univand 23 more23 instances, coercions and auxiliary constants left out.
Tactic trace: 27 steps
Open to load the checked before-and-after goal states.
lemma exists_perm_of_valMul_eq {n : ℕ} : ∀ {m₁ m₂ : Fin n → ℤ}, valMul m₁ = valMul m₂ → ∃ e : Perm (Fin n), m₂ = m₁ ∘ e := by …Mentions: Usa2017P2.valMul
- lemma
Usa2017P2.genFun_eq_of_valMul_eqThe generating function only depends on the multiset of values line 296 sourceSource documentation
The generating function only depends on the multiset of values.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Eq,Multiset, Usa2017P2.valMul,Polynomial, Usa2017P2.genFunProof uses:
Equiv.Perm,Function.comp,Exists, Usa2017P2.exists_perm_of_valMul_eq,Eq.symm, Usa2017P2.genFun_comp7 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
lemma genFun_eq_of_valMul_eq {n : ℕ} {m₁ m₂ : Fin n → ℤ} (h : valMul m₁ = valMul m₂) (A : Fin n → ℤ) : genFun m₁ A = genFun m₂ A := by …Mentions: h, Usa2017P2.valMul, Usa2017P2.genFun
- lemma
Usa2017P2.frontContrib_evalExplicit evaluation offrontContribin terms of the full entry multiset line 302 sourceSource documentation
Explicit evaluation of
frontContribin terms of the full entry multiset.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Eq, Usa2017P2.frontContrib,Function.comp,Function.Embedding, Usa2017P2.skipEmb,ite,LE.le, Usa2017P2.cntP,LT.lt,AndProof uses:
dite,Eq.mpr,id,congrArg,ite_eq_left,Finset.sum,Finset.univ, Usa2017P2.frontContrib_le,HAdd,Eq.rec,Eq.refl, Usa2017P2.sum_univ_add_skipEmb, Usa2017P2.sum_if_eq_cntP,congrFun',Finset.sum_congr,Finset,Membership.mem,Eq.symm,Eq.mp,zero_addand 9 more39 instances, coercions and auxiliary constants left out.
Tactic trace: 26 steps
Open to load the checked before-and-after goal states.
lemma frontContrib_eval {n : ℕ} (m : Fin (n + 1) → ℤ) (c : ℤ) (p : Fin (n + 1)) : frontContrib c (m p) (m ∘ skipEmb p) = if m p ≤ c then cntP m (· < m p) + cntP m (c < ·) else cntP m (fun y => c < y ∧ y < m p) := by …Mentions: Usa2017P2.frontContrib, Usa2017P2.skipEmb, Usa2017P2.cntP
- def
Usa2017P2.gcThe contribution of the first position, as a function of its value line 333 sourceSource documentation
The contribution of the first position, as a function of its value.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,IntProof uses:
ite,LE.le,HAdd.hAdd, Usa2017P2.cntP,LT.lt,And7 instances, coercions and auxiliary constants left out.
def gc {n : ℕ} (m : Fin n → ℤ) (c v : ℤ) : ℕ := … - lemma
Usa2017P2.qq_addline 338 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Polynomial,Int, Usa2017P2.qq,HAdd.hAdd,HMul.hMul,HPow.hPow,Polynomial.XProof uses:
id,Eq.mpr,Finset.sum,Finset.range,congrArg,Finset.sum_range_add,Finset.mul_sum,HAdd,Eq.rec,Eq.refl,Finset.sum_congr,rfl,Finset,Membership.mem,pow_add41 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.block_teleline 346 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Nat,Eq,Polynomial,Int,Finset.sum,Finset.range,List.length,HMul.hMul,HPow.hPow,Polynomial.X,List.sum,List.take, Usa2017P2.qq,GetElem?.getElem!,LT.ltProof uses:
List.rec,of_eq_true,List.nil,OfNat.ofNat,Eq.trans,True,congrFun',congrArg,EmptyCollection.emptyCollection,Finset,funext,congr,List.take_nil,pow_zero,getElem!_neg,Not,False,not_false_eq_true,MulZeroClass.mul_zero,Finset.sum_const_zeroand 24 more72 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.pureIdline 361 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Nat,LE.le,List.length,Eq,Polynomial,Int,HAdd.hAdd,HMul.hMul,HPow.hPow,Polynomial.X,HSub.hSub,List.sum,List.take,Finset.sum,Finset.range, Usa2017P2.qq,GetElem?.getElem!,LT.lt,Finset.IcoProof uses:
Eq.mpr,Min.min,id,congrArg,List.length_take,Nat.min_eq_left,Eq.refl,HAppend.hAppend,List.drop,List.take_append_drop,List.sum_append,OfNat.ofNat,Nat.le_add_right,List.take_take,Option.getD,GetElem?.getElem?,Inhabited.default,List.getElem!_eq_getElem?_getD,Option,List.getElem?_take_of_ltand 72 more134 instances, coercions and auxiliary constants left out.
Tactic trace: 50 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.multiset_card_filter_finset_sumThe cardinality of a filter of a finite sum of multisets line 426 sourceSource documentation
The cardinality of a filter of a finite sum of multisets.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
DecidableEq,Finset,Multiset,Int,DecidablePred,Eq,Nat,Multiset.card,Multiset.filter,Finset.sumProof uses:
Finset.induction,of_eq_true,OfNat.ofNat,eq_self,Not,Membership.mem,Eq.mpr,Insert.insert,HAdd.hAdd,id,congrArg,Finset.sum_insert,Multiset.filter_add,Multiset.card_add,Eq.refl17 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma multiset_card_filter_finset_sum {ι : Type*} [DecidableEq ι] (s : Finset ι) (f : ι → Multiset ℤ) (p : ℤ → Prop) [DecidablePred p] : Multiset.card (Multiset.filter p (∑ v ∈ s, f v)) = ∑ v ∈ s, Multiset.card (Multiset.filter p (f v)) := by …Mentions: f
- lemma
Usa2017P2.multiset_filter_replicateFiltering a replicated multiset line 437 sourceSource documentation
Filtering a replicated multiset.
standard axioms: Quot.sound, propext what this means
Statement uses:
Int,DecidablePred,Nat,Eq,Multiset,Multiset.filter,Multiset.replicate,ite,OfNat.ofNatProof uses:
Nat.recAux,of_eq_true,Eq.trans,True,congrArg,ite_self,eq_self,Eq.mpr,HAdd.hAdd,Multiset.cons,id,Multiset.replicate_succ,Singleton.singleton,Multiset.filter_cons,dite,congr,Decidable,ite_eq_left,Multiset.singleton_add,Eq.refland 3 more9 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
lemma multiset_filter_replicate (p : ℤ → Prop) [DecidablePred p] (k : ℕ) (v : ℤ) : Multiset.filter p (Multiset.replicate k v) = if p v then Multiset.replicate k v else 0 := by … - lemma
Usa2017P2.list_map_sum_eq_sum_rangeReindexing the sum of a mapped list as a sum overrangeline 450 sourceSource documentation
Reindexing the sum of a mapped list as a sum over
range.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Inhabited,AddCommMonoid,List,Eq,List.sum,List.map,Finset.sum,Nat,Finset.range,List.length,GetElem?.getElem!,LT.ltProof uses:
List.rec,of_eq_true,List.nil,Eq.trans,OfNat.ofNat,True,congr,congrArg,List.map_nil,EmptyCollection.emptyCollection,Finset,HSMul.hSMul,Finset.card,Inhabited.default,funext,getElem!_neg,Not,False,not_false_eq_true,Finset.sum_constand 17 more36 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
lemma list_map_sum_eq_sum_range {α : Type*} {β : Type*} [Inhabited α] [AddCommMonoid β] (l : List α) (f : α → β) : (l.map f).sum = ∑ t ∈ Finset.range l.length, f l[t]! := by …Mentions: f
- lemma
Usa2017P2.list_sum_eq_sum_rangeThe sum of a list of naturals as a sum overrangeline 467 sourceSource documentation
The sum of a list of naturals as a sum over
range.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Nat,Eq,List.sum,Finset.sum,Finset.range,List.length,GetElem?.getElem!,LT.ltProof uses:
List.map,id, Usa2017P2.list_map_sum_eq_sum_range,Eq.mp,congrArg,List.map_id18 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma list_sum_eq_sum_range (l : List ℕ) : l.sum = ∑ t ∈ Finset.range l.length, l[t]! := by … - lemma
Usa2017P2.list_sum_take_eq_sum_rangeThe sum of an initial segment of a list of naturals line 474 sourceSource documentation
The sum of an initial segment of a list of naturals.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Nat,LE.le,List.length,Eq,List.sum,List.take,Finset.sum,Finset.range,GetElem?.getElem!,LT.ltProof uses:
Eq.mpr,id,congrArg, Usa2017P2.list_sum_eq_sum_range,Min.min,List.length_take,Nat.min_eq_left,Finset.sum_congr,rfl,Finset,Membership.mem,Eq.mp,propext,Finset.mem_range,GetElem.getElem,getElem!_pos,Nat.lt_of_lt_of_le,List.length_take_le',List.getElem_take,Eq.refl24 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
lemma list_sum_take_eq_sum_range (l : List ℕ) {j : ℕ} (hj : j ≤ l.length) : (l.take j).sum = ∑ t ∈ Finset.range j, l[t]! := by … - lemma
Usa2017P2.sorted_filter_eq_takeIn a sorted list of integers, the elements≤ cform an initial segment line 487 sourceSource documentation
In a sorted list of integers, the elements
≤ cform an initial segment.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Int,List.Pairwise,LE.le,Eq,List.filter,Decidable.decide,List.take,List.lengthProof uses:
List.rec,List.nil,of_eq_true,Eq.trans,True,congrArg,List.take_nil,OfNat.ofNat,Nat,eq_self,List.cons,Membership.mem,And,Eq.mp,propext,List.pairwise_cons,dite,Eq.mpr,id,List.filter_cons_of_posand 19 more16 instances, coercions and auxiliary constants left out.
Tactic trace: 19 steps
Open to load the checked before-and-after goal states.
lemma sorted_filter_eq_take (l : List ℤ) (c : ℤ) (hp : l.Pairwise (· ≤ ·)) : l.filter (· ≤ c) = l.take (l.filter (· ≤ c)).length := by … - lemma
Usa2017P2.sorted_get_lt_iffA sorted list of distinct integers is strictly increasing line 510 sourceSource documentation
A sorted list of distinct integers is strictly increasing.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Int,List.Pairwise,LE.le,List.Nodup,Fin,List.length,Iff,LT.lt,List.getProof uses:
Iff.intro,Decidable.byContradiction,Not,Eq,Or,False,eq_or_lt_of_le,Eq.mp,congrArg,propext,not_lt,absurd,lt_irrefl,Iff.mpr,List.Pairwise.rel_get_of_lt,Ne,Iff.mp,List.Nodup.get_inj_iff,ne_of_lt,lt_of_le_of_ne18 instances, coercions and auxiliary constants left out.
Tactic trace: 15 steps
Open to load the checked before-and-after goal states.
lemma sorted_get_lt_iff {l : List ℤ} (hp : l.Pairwise (· ≤ ·)) (hn : l.Nodup) (s t : Fin l.length) : l.get s < l.get t ↔ s < t := by … - lemma
Usa2017P2.sorted_getElem!_lt_iffgetElem!version ofsorted_get_lt_iffline 526 sourceSource documentation
getElem!version ofsorted_get_lt_iff.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Int,List.Pairwise,LE.le,List.Nodup,Nat,LT.lt,List.length,Iff,GetElem?.getElem!Proof uses:
Eq,List.get,Fin.mk,Eq.mpr,Option.getD,GetElem?.getElem?,Inhabited.default,id,congrArg,List.getElem!_eq_getElem?_getD,Option.some,GetElem.getElem,Option,List.getElem?_eq_getElem,Option.getD_some,Fin.isLt,List.get_eq_getElem,Eq.refl,Fin,propextand 2 more13 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
lemma sorted_getElem!_lt_iff {l : List ℤ} (hp : l.Pairwise (· ≤ ·)) (hn : l.Nodup) {s t : ℕ} (hs : s < l.length) (ht : t < l.length) : l[s]! < l[t]! ↔ s < t := by … - lemma
Usa2017P2.sorted_getElem!_le_iffIn a sorted list of distinct integers, the elements at positions< kare exactly those≤ c, wherekis the number of elements≤ cline 537 sourceSource documentation
In a sorted list of distinct integers, the elements at positions
< kare exactly those≤ c, wherekis the number of elements≤ c.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Int,List.Pairwise,LE.le,List.Nodup,Nat,LT.lt,List.length,Iff,GetElem?.getElem!,List.filter,Decidable.decideProof uses:
Eq,List.get,Fin.mk,Eq.mpr,Option.getD,GetElem?.getElem?,Inhabited.default,id,congrArg,List.getElem!_eq_getElem?_getD,Option.some,GetElem.getElem,Option,List.getElem?_eq_getElem,Option.getD_some,Fin.isLt,List.get_eq_getElem,Eq.refl,List.take, Usa2017P2.sorted_filter_eq_take and 26 more26 instances, coercions and auxiliary constants left out.
Tactic trace: 34 steps
Open to load the checked before-and-after goal states.
lemma sorted_getElem!_le_iff {l : List ℤ} (hp : l.Pairwise (· ≤ ·)) (hn : l.Nodup) (c : ℤ) {t : ℕ} (ht : t < l.length) : l[t]! ≤ c ↔ t < (l.filter (· ≤ c)).length := by … - lemma
Usa2017P2.sum_image_eq_sort_map_sumA sum over the image finset reindexed as a list sum over the sorted distinct values line 572 sourceSource documentation
A sum over the image finset reindexed as a list sum over the sorted distinct values.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,AddCommMonoid,Fin,Int,Eq,Finset.sum,Finset.image,Finset.univ,List.sum,List.map,Finset.sort,LE.leProof uses:
Multiset,Finset.val,Finset.sort_eq,id,Eq.mpr,Multiset.sum,Multiset.map,congrArg,Eq.symm,Multiset.map_coe,Multiset.sum_coe,Eq.refl36 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
lemma sum_image_eq_sort_map_sum {n : ℕ} {β : Type*} [AddCommMonoid β] (m : Fin n → ℤ) (G : ℤ → β) : ∑ v ∈ univ.image m, G v = (((univ.image m).sort (· ≤ ·)).map G).sum := by … - lemma
Usa2017P2.valMul_eq_sum_eCntline 582 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Eq,Multiset, Usa2017P2.valMul,Finset.sum,Finset.image,Finset.univ,HSMul.hSMul, Usa2017P2.eCnt,Singleton.singletonProof uses:
Iff,Membership.mem,Finset,of_eq_true,Eq.trans,Exists,True,congr,congrArg,List,List.ofFn,congrFun',Fin.univ_val_map,And,funext,true_and,iff_self,Iff.mpr,Multiset.count,Multiset.extand 24 more35 instances, coercions and auxiliary constants left out.
Tactic trace: 23 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.cntP_eq_sum_eCntline 606 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,DecidablePred,Eq, Usa2017P2.cntP,Finset.sum,Finset.image,Finset.univ,ite, Usa2017P2.eCnt,OfNat.ofNatProof uses:
id,Eq.mpr,Multiset.countP, Usa2017P2.valMul,Multiset.card,Multiset.filter,congrArg,Multiset.countP_eq_card_filter,Multiset,HSMul.hSMul,Singleton.singleton, Usa2017P2.valMul_eq_sum_eCnt, Usa2017P2.multiset_card_filter_finset_sum,Finset.sum_congr,rfl,Finset,Membership.mem,Multiset.replicate,Multiset.nsmul_singleton, Usa2017P2.multiset_filter_replicate and 11 more19 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.pureId_valueThe pure polynomial identity in value form: the key combinatorial input behind both the ratio identity and the main induction line 622 sourceSource documentation
The pure polynomial identity in value form: the key combinatorial input behind both the ratio identity and the main induction. Proven by writing the value multiset as a sorted list of distinct values
vswith multiplicity listesand split pointk = #(values ≤ c), evaluating the counts viacntP_eq_sum_eCnt, and telescoping withpureId.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Eq,Polynomial,Finset.sum,Finset.image,Finset.univ,HMul.hMul,HPow.hPow,Polynomial.X, Usa2017P2.gc, Usa2017P2.qq, Usa2017P2.eCntProof uses:
List,Finset.sort,LE.le,rfl,List.map,List.length,List.filter,Decidable.decide,List.Pairwise,Finset.pairwise_sort,List.Nodup,Finset.sort_nodup,of_eq_true,Eq.trans,True,congrFun',congrArg,List.length_map,eq_self,List.length_filter_leand 86 more112 instances, coercions and auxiliary constants left out.
Tactic trace: 161 steps
Open to load the checked before-and-after goal states.
lemma pureId_value {n : ℕ} (m : Fin (n + 1) → ℤ) (c : ℤ) : ∑ v ∈ univ.image m, X ^ gc m c v * qq (eCnt m v) = qq (n + 1) := by …Mentions: Usa2017P2.gc, Usa2017P2.qq, Usa2017P2.eCnt
- lemma
Usa2017P2.sum_eq_sum_image_cardGrouping a sum over positions by the value of the entry line 781 sourceSource documentation
Grouping a sum over positions by the value of the entry.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Polynomial,Eq,Finset.sum,Finset.univ,Finset.image,HMul.hMul, Usa2017P2.eCntProof uses:
Finset.filter,Eq.symm,Finset.sum_image',congrFun,Membership.mem,Finset,rfl,Eq.mpr,id,congrArg,Finset.sum_congr,And.right,Iff.mp,And,Finset.mem_filter,Eq.refl,HSMul.hSMul,Finset.card,Finset.sum_const, Usa2017P2.eCnt_eq_card_filter and 1 more38 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
lemma sum_eq_sum_image_card {n : ℕ} (m : Fin (n + 1) → ℤ) (H : Fin (n + 1) → ℤ[X]) (K : ℤ → ℤ[X]) (hHK : ∀ q, H q = K (m q)) : ∑ q, H q = ∑ v ∈ univ.image m, (eCnt m v : ℤ[X]) * K v := by …Mentions: Usa2017P2.eCnt
- lemma
Usa2017P2.genFun_zeroline 791 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fin,OfNat.ofNat,Nat,Int,Eq,Polynomial, Usa2017P2.genFunProof uses:
id,Equiv.Perm, Usa2017P2.ainvCount,Finset.sum_eq_zero,Finset.univ,Finset.sum,ite,And,LT.lt, Usa2017P2.invPair,Membership.mem,Finset,Fin.elim0,Eq.mpr,HPow.hPow,Polynomial.X,congrArg,Finset.sum_congr,rfl,pow_zeroand 13 more49 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.genFun_oneline 799 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fin,OfNat.ofNat,Nat,Int,Eq,Polynomial, Usa2017P2.genFunProof uses:
id,Equiv.Perm, Usa2017P2.ainvCount,Finset.sum_eq_zero,Finset.univ,Finset.sum,ite,And,LT.lt, Usa2017P2.invPair,Membership.mem,Finset,Subsingleton.elim,ite_eq_right,lt_irrefl,Eq.rec,And.left,Eq.mpr,HPow.hPow,Polynomial.Xand 17 more47 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.image_skipEmbThe image ofskipEmb pis everything exceptpline 811 sourceSource documentation
The image of
skipEmb pis everything exceptp.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Eq,Finset,Finset.image,Function.Embedding, Usa2017P2.skipEmb,Finset.univ,Finset.eraseProof uses:
Finset.ext,Iff.intro,Membership.mem,And,Exists,Iff.mp,Finset.mem_image,Iff.mpr,Ne,Finset.mem_erase,And.intro, Usa2017P2.skipEmb_ne,Finset.mem_univ,Equiv.Perm,Equiv.swap,Equiv.injective,Eq.trans,Equiv,Eq.symm,Equiv.swap_apply_rightand 7 more24 instances, coercions and auxiliary constants left out.
Tactic trace: 17 steps
Open to load the checked before-and-after goal states.
lemma image_skipEmb {n : ℕ} (p : Fin (n + 1)) : univ.image (skipEmb p) = univ.erase p := by …Mentions: Usa2017P2.skipEmb
- lemma
Usa2017P2.exists_skipEmb_eqline 827 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Ne,Exists,Eq,Function.Embedding, Usa2017P2.skipEmbProof uses:
Membership.mem,Finset,Finset.image,Finset.univ,Eq.mpr,Finset.erase,id,congrArg, Usa2017P2.image_skipEmb,Iff.mpr,And,Finset.mem_erase,And.intro,Finset.mem_univ,Iff.mp,Finset.mem_image,Exists.intro16 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- def
Usa2017P2.reprA chosen representative index for a value line 836 sourceSource documentation
A chosen representative index for a value.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,IntProof uses:
dite,Exists,Eq,Classical.choose,Not10 instances, coercions and auxiliary constants left out.
noncomputable def repr {n : ℕ} (m : Fin (n + 1) → ℤ) (v : ℤ) : Fin (n + 1) := … - lemma
Usa2017P2.repr_specline 839 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Exists,Eq, Usa2017P2.reprProof uses:
id,Eq.mpr,dite,Classical.choose,Not,congrArg,dite_eq_left,Classical.choose_spec10 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2017P2.eCnt_comp_skipEmb_of_neDeleting an index whose valuewdoes not match does not change the count ofwline 846 sourceSource documentation
Deleting an index whose value
wdoes not match does not change the count ofw.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Ne,Eq, Usa2017P2.eCnt,Function.comp,Function.Embedding, Usa2017P2.skipEmbProof uses:
Finset.sum,Finset.univ,ite, Usa2017P2.sum_univ_add_skipEmb,rfl,Eq.symm,Multiset.count, Usa2017P2.valMul,Eq.mp,congrArg,zero_add,ite_eq_right, Usa2017P2.sum_if_eq_count22 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma eCnt_comp_skipEmb_of_ne {n : ℕ} (m : Fin (n + 1) → ℤ) (q : Fin (n + 1)) {w : ℤ} (h : m q ≠ w) : eCnt (m ∘ skipEmb q) w = eCnt m w := by …Mentions: h, Usa2017P2.eCnt, Usa2017P2.skipEmb
- lemma
Usa2017P2.genFun_skipEmb_congrDeleting two different indices with the same value gives the same generating function line 858 sourceSource documentation
Deleting two different indices with the same value gives the same generating function.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Eq,Polynomial, Usa2017P2.genFun,Function.comp,Function.Embedding, Usa2017P2.skipEmbProof uses: Usa2017P2.genFun_eq_of_valMul_eq,
Eq.mpr,Multiset, Usa2017P2.valMul,Multiset.erase,id,congrArg, Usa2017P2.valMul_comp_skipEmb,Eq.refl12 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
lemma genFun_skipEmb_congr {n : ℕ} (m : Fin (n + 1) → ℤ) {q r : Fin (n + 1)} (h : m q = m r) (A : Fin n → ℤ) : genFun (m ∘ skipEmb q) A = genFun (m ∘ skipEmb r) A := by …Mentions: h, Usa2017P2.genFun, Usa2017P2.skipEmb
- lemma
Usa2017P2.QLThe ratio identity, by induction onnline 884 sourceSource documentation
The ratio identity, by induction on
n.Proof plan (algebra verified on paper): induction on
n.- Base
n = 0:m : Fin 1 → ℤ;eCnt m (m p) = 1(viaeCnt_eq_card_filter, filter is everything bySubsingleton),genFun_one,genFun_zero,qq 1 = 1. - Step:
m : Fin (n+2) → ℤ,θ := m p,e := eCnt m θ. ExpandgenFun m 0bygenFun_rec(withA = 0; note(0 : Fin _ → ℤ) 0 = 0and0 ∘ Fin.succ = 0), rewrite eachfrontContrib 0 (m q) (m ∘ skipEmb q)asgc m 0 (m q)(frontContrib_eval+gcdef), then group by value withsum_eq_sum_image_cardusingK v := X ^ gc m 0 v * genFun (m ∘ skipEmb (repr v)) 0whererepr vis a chosen index with valuev(Classical.choose; thegenFunterm is independent of the choice bygenFun_eq_of_valMul_eq+valMul_comp_skipEmb). Multiply byqq e, split off thev = θterm (Finset.add_sum_erase), and forv ≠ θapply the IH twice (once tom ∘ skipEmb (repr v)at the index mapping top— exists becauseuniv.image (skipEmb q) = univ.erase q, cf. the proof ofsum_univ_add_skipEmb; once tom ∘ skipEmb pat the index mapping torepr v), usingeCnt (m ∘ skipEmb q) w = eCnt m wwhenm q ≠ w(prove viasum_univ_add_skipEmb+sum_if_eq_count) andMultiset.erase_comm+genFun_eq_of_valMul_eqto identify the double deletions. Everything becomese * genFun (m ∘ skipEmb p) 0times∑ v, X ^ gc m 0 v * qq (eCnt m v) = qq (n+2)(pureId_value).
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,HAdd.hAdd,OfNat.ofNat,Int,Eq,Polynomial,HMul.hMul, Usa2017P2.qq, Usa2017P2.eCnt, Usa2017P2.genFun,Function.comp,Function.Embedding, Usa2017P2.skipEmbProof uses:
Nat.recAux,Fin.fin_one_eq_zero,Eq.mpr,Finset.card,Finset.filter,Finset.univ,id,congrArg, Usa2017P2.eCnt_eq_card_filter,Finset,Finset.filter_true_of_mem,Membership.mem,congr_arg,of_eq_true,Eq.trans,True,congrFun',Singleton.singleton,Finset.univ_unique,Finset.card_singletonand 82 more95 instances, coercions and auxiliary constants left out.
Tactic trace: 70 steps
Open to load the checked before-and-after goal states.
lemma QL {n : ℕ} : ∀ (m : Fin (n + 1) → ℤ) (p : Fin (n + 1)), qq (eCnt m (m p)) * genFun m 0 = qq (n + 1) * (eCnt m (m p) : ℤ[X]) * genFun (m ∘ skipEmb p) 0 := by …Mentions: Usa2017P2.qq, Usa2017P2.eCnt, Usa2017P2.genFun, Usa2017P2.skipEmb
- Base
- lemma
Usa2017P2.PLThe main induction: theA-inversion generating function does not depend onAline 1013 sourceSource documentation
The main induction: the
A-inversion generating function does not depend onA.Proof plan: induction on
n. Basen = 0: both sides1(genFun_zero). Stepn+1: expandgenFun m AbygenFun_rec+frontContrib_eval(asgc m (A 0)), rewrite eachgenFun (m ∘ skipEmb p) (A ∘ Fin.succ)togenFun (m ∘ skipEmb p) 0by IH, group by value (sum_eq_sum_image_cardwith therepr-kernel as inQL), then: multiply byqq (n+1); useQLat each representative to rewriteqq (n+1) * eCnt m v * genFun (m ∘ skipEmb (repr v)) 0 = qq (eCnt m v) * genFun m 0; the sum becomesgenFun m 0 * ∑ v, X ^ gc m (A 0) v * qq (eCnt m v) = genFun m 0 * qq (n+1)bypureId_value; cancelqq (n+1) ≠ 0(mul_left_cancel₀;qq (n+1) ≠ 0since its constant coefficient is1).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Eq,Polynomial, Usa2017P2.genFun,OfNat.ofNatProof uses:
Nat.recAux,Eq.mpr,id,congrArg, Usa2017P2.genFun_zero,Eq.refl,HAdd.hAdd,Finset.sum,Finset.image,Finset.univ,HMul.hMul, Usa2017P2.eCnt,HPow.hPow,Polynomial.X, Usa2017P2.gc,Function.comp,Function.Embedding, Usa2017P2.skipEmb, Usa2017P2.repr, Usa2017P2.frontContrib and 69 more132 instances, coercions and auxiliary constants left out.
Tactic trace: 46 steps
Open to load the checked before-and-after goal states.
lemma PL {n : ℕ} : ∀ (m : Fin n → ℤ) (A : Fin n → ℤ), genFun m A = genFun m 0 := by …Mentions: Usa2017P2.genFun
- lemma
Usa2017P2.coeff_genFunThe coefficient ofX^kin the generating function counts permutations with exactlykA-inversions line 1074 sourceSource documentation
The coefficient of
X^kin the generating function counts permutations with exactlykA-inversions.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Int,Eq,Finsupp,Polynomial.coeff, Usa2017P2.genFun,Finset.card,Equiv.Perm,Finset.filter, Usa2017P2.ainvCount,Finset.univProof uses:
id,Finset,Finset.sum,Polynomial,HPow.hPow,Polynomial.X,map_sum,LinearMap,RingHom.id,RingHom,Polynomial.lcoeff,Eq.mpr,congrArg,ite,OfNat.ofNat,congrFun',Finset.sum_congr,Eq.refl,Membership.mem,Polynomial.coeff_X_powand 3 more52 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
lemma coeff_genFun {n : ℕ} (m : Fin n → ℤ) (A : Fin n → ℤ) (k : ℕ) : (genFun m A).coeff k = ((univ.filter (fun σ : Perm (Fin n) => ainvCount m A σ = k)).card : ℤ) := by …Mentions: Usa2017P2.genFun, Usa2017P2.ainvCount
- problem
Usa2017P2.usa2017_p2USA Mathematical Olympiad 2017, Problem 2 line 1098 sourceSource documentation
USA Mathematical Olympiad 2017, Problem 2. The number of permutations of
m₁, …, mₙwith exactlykA-inversions equals the number with exactlykB-inversions. Permutations are counted with multiplicity (as positional permutationsσ : Equiv.Perm (Fin n)), which is equivalent to the count over distinct arrangements: each distinct arrangement corresponds to the same positive number∏ (multiplicity)!of positional permutations, independently ofA,Bandk. Note: the positivity hypothesishmis actually not needed for the conclusion.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,LT.lt,OfNat.ofNat,Int,Eq,Finset.card,Equiv.Perm,Finset.filter, Usa2017P2.ainvCount,Finset.univProof uses:
Polynomial, Usa2017P2.genFun, Usa2017P2.PL,Finsupp,Polynomial.coeff, Usa2017P2.coeff_genFun,Iff.mp,Int.ofNat_inj,Eq.trans,Eq.symm,Eq.mp,congrArg23 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
problem usa2017_p2 {n : ℕ} (m : Fin n → ℕ) (_hm : ∀ i, 0 < m i) (A B : Fin n → ℤ) (k : ℕ) : (univ.filter (fun σ : Perm (Fin n) => ainvCount (fun i => (m i : ℤ)) A σ = k)).card = (univ.filter (fun σ : Perm (Fin n) => ainvCount (fun i => (m i : ℤ)) B σ = k)).card := by …Mentions: Usa2017P2.ainvCount