Compfiles/Imo2011P4.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
44 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 2011, Problem 4
Let n > 0 be an integer. We are given a balance and n weights of weight 2^0, 2^1, . . . , 2^(n−1). We are to place each of the n weights on the balance, one after another, in such a way that the right pan is never heavier than the left pan. At each step we choose one of the weights that has not yet been placed on the balance, and place it on either the left pan or the right pan, until all of the weights have been placed. Determine the number of ways in which this can be done.
Imports (12)
- Mathlib.Algebra.Order.BigOperators.Group.Finset
- Mathlib.Algebra.Order.Ring.Star
- Mathlib.Algebra.Ring.GeomSum
- Mathlib.AlgebraicTopology.SimplexCategory.Basic
- Mathlib.Data.Int.ConditionallyCompleteOrder
- Mathlib.Data.Int.Star
- Mathlib.Data.Nat.Factorial.DoubleFactorial
- Mathlib.Order.Lattice.Nat
- Mathlib.SetTheory.Cardinal.Finite
- Mathlib.Tactic.Linarith
- Mathlib.Tactic.Linarith.Lemmas
- ProblemExtraction
Imported by 1 file
- def
Imo2011P4.BalanceThe imbalance (left pan minus right pan) after a sequence of placements line 47 sourceSource documentation
The imbalance (left pan minus right pan) after a sequence of placements. A pair
(i, b)denotes one placement of the weight2^i; the boolean istrueif the weight is placed on the left pan andfalseif it is placed on the right pan.standard axioms: propext what this means
Statement uses:
List,Prod,Nat,Bool,IntProof uses:
List.sum,List.map,ite,Eq,Prod.snd,Bool.true,HPow.hPow,OfNat.ofNat,Prod.fst,Neg.neg11 instances, coercions and auxiliary constants left out.
def Balance (l : List (ℕ × Bool)) : ℤ := …
- def
Imo2011P4.ValidSeqA sequence of placements is valid if after every step the right pan is not heavier than the left pan line 52 sourceSource documentation
A sequence of placements is valid if after every step the right pan is not heavier than the left pan.
standard axioms: propext what this means
Statement uses:
List,Prod,Nat,BoolProof uses:
List.IsPrefix,LE.le,Int,OfNat.ofNat, Imo2011P4.Balance2 instances, coercions and auxiliary constants left out.
def ValidSeq (l : List (ℕ × Bool)) : Prop := …
- def
Imo2011P4.WaysDocumented declaration: Ways line 58 sourceSource documentation
The set of ways to carry out the process with the weights
2^0, 2^1, ..., 2^(n-1): sequences of placements in which every weight is used exactly once and the right pan is never heavier than the left pan.standard axioms: propext what this means
Statement uses:
NatProof uses:
Subtype,List,Prod,Bool,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeqdef Ways (n : ℕ) : Type := …
- lemma
Imo2011P4.balance_nilline 74 sourcestandard axioms: propext what this means
Statement uses:
Eq,Int, Imo2011P4.Balance,List.nil,Prod,Nat,Bool,OfNat.ofNatProof uses:
rfl1 instances, coercions and auxiliary constants left out.
- lemma
Imo2011P4.balance_consline 76 sourcestandard axioms: propext what this means
Statement uses:
Prod,Nat,Bool,List,Eq,Int, Imo2011P4.Balance,List.cons,HAdd.hAdd,ite,Prod.snd,Bool.true,HPow.hPow,OfNat.ofNat,Prod.fst,Neg.negProof uses:
of_eq_true,List.sum,List.map,Eq.trans,True,congrFun',congrArg,List.map_cons,eq_self21 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.balance_appendline 80 sourcestandard axioms: propext what this means
Statement uses:
List,Prod,Nat,Bool,Eq,Int, Imo2011P4.Balance,HAppend.hAppend,HAdd.hAddProof uses:
of_eq_true,List.sum,List.map,ite,Prod.snd,Bool.true,HPow.hPow,OfNat.ofNat,Prod.fst,Neg.neg,Eq.trans,True,congrFun',congrArg,List.map_append,List.sum_append,eq_self21 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.balance_map_succDoubling all weights doubles the imbalance line 85 sourceSource documentation
Doubling all weights doubles the imbalance.
standard axioms: Quot.sound, propext what this means
Statement uses:
List,Prod,Nat,Bool,Eq,Int, Imo2011P4.Balance,List.map,Prod.mk,HAdd.hAdd,Prod.fst,OfNat.ofNat,Prod.snd,HMul.hMulProof uses:
List.rec,of_eq_true,List.nil,Eq.trans,True,congr,congrArg,List.map_nil,MulZeroClass.mul_zero,eq_self,Eq.mpr,List.cons,ite,Bool.true,HPow.hPow,Neg.neg,id,List.map_cons, Imo2011P4.balance_cons,ite_congrand 52 more50 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma balance_map_succ (l : List (ℕ × Bool)) : Balance (l.map fun p : ℕ × Bool ↦ (p.1 + 1, p.2)) = 2 * Balance l := by …Mentions: Imo2011P4.Balance
- lemma
Imo2011P4.balance_map_predHalving all weights halves the imbalance (all weights here are even) line 94 sourceSource documentation
Halving all weights halves the imbalance (all weights here are even).
standard axioms: propext what this means
Statement uses:
List,Prod,Nat,Bool,Membership.mem,LE.le,OfNat.ofNat,Prod.fst,Eq,Int,HMul.hMul, Imo2011P4.Balance,List.map,Prod.mk,HSub.hSub,Prod.sndProof uses:
List.rec,List.nil,of_eq_true,Eq.trans,True,congrFun',congrArg,List.map_nil,MulZeroClass.mul_zero,eq_self,List.cons,List.mem_cons_self,List.mem_cons_of_mem,HPow.hPow,Eq.mpr,HAdd.hAdd,id,Eq.rec,Eq.refl,Eq.symmand 41 more58 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
lemma balance_map_pred (l : List (ℕ × Bool)) (h : ∀ p ∈ l, 1 ≤ p.1) : 2 * Balance (l.map fun p : ℕ × Bool ↦ (p.1 - 1, p.2)) = Balance l := by …Mentions: h, Imo2011P4.Balance
- lemma
Imo2011P4.balance_ne_zeroKey nonzero fact: a nonempty signed sum of distinct powers of two is nonzero line 110 sourceSource documentation
Key nonzero fact: a nonempty signed sum of distinct powers of two is nonzero.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Prod,Nat,Bool,Ne,List.nil,List.Nodup,List.map,Prod.fst,Int, Imo2011P4.Balance,OfNat.ofNatProof uses:
LE.le,abs,List.sum,HPow.hPow,List.rec,of_eq_true,Eq.trans,True,congr,congrArg,abs_zero,List.map_nil,Eq.mpr,List.cons,HAdd.hAdd,ite,Eq,Prod.snd,Bool.true,Neg.negand 127 more117 instances, coercions and auxiliary constants left out.
Tactic trace: 88 steps
Open to load the checked before-and-after goal states.
lemma balance_ne_zero {l : List (ℕ × Bool)} (hne : l ≠ []) (hnd : (l.map Prod.fst).Nodup) : Balance l ≠ 0 := by …Mentions: Imo2011P4.Balance
- lemma
Imo2011P4.prefix_append_casesA prefix of an append either lies in the first part or extends it line 205 sourceSource documentation
A prefix of an append either lies in the first part or extends it.
standard axioms: Quot.sound, propext what this means
Statement uses:
List,List.IsPrefix,HAppend.hAppend,Or,Exists,And,EqProof uses:
Iff.mp,List.append_eq_append_iff,Or.inl,Exists.intro,Eq.symm,Or.inr,And.intro7 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma prefix_append_cases {α : Type*} {pre X Y : List α} (h : pre <+: X ++ Y) : pre <+: X ∨ ∃ pre', pre = X ++ pre' ∧ pre' <+: Y := by …Mentions: h
- lemma
Imo2011P4.map_down_map_upline 212 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Prod,Nat,Bool,Eq,List.map,Prod.mk,HSub.hSub,Prod.fst,OfNat.ofNat,Prod.snd,HAdd.hAddProof uses:
List.rec,Eq.refl,List.nil,of_eq_true,List.cons,Eq.trans,True,congrFun',congrArg,List.map_cons,congr,add_tsub_cancel_right,Prod.mk.eta,Function.comp,List.map_map,id,Eq.mp,eq_self26 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.map_up_map_downline 218 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Prod,Nat,Bool,Membership.mem,LE.le,OfNat.ofNat,Prod.fst,Eq,List.map,Prod.mk,HAdd.hAdd,Prod.snd,HSub.hSubProof uses:
List.rec,List.nil,Eq.refl,List.cons,List.mem_cons_self,List.mem_cons_of_mem,Eq.mpr,And,id,Eq.trans,congrFun',congrArg,List.map_cons,List.cons.injEq,And.intro15 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.ways_lengthline 231 sourcestandard axioms: propext what this means
Statement uses:
Nat, Imo2011P4.Ways,Eq,List.length,Prod,Bool,List,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeqProof uses:
List.Perm.length_eq,And.left,Subtype.property,Eq.mp,congrArg,List.length_range,List.length_map2 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.ways_nodupline 235 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,List.Nodup,List.map,Prod,Bool,Prod.fst,List,And,List.Perm,List.range, Imo2011P4.ValidSeqProof uses:
Iff.mpr,List.Perm.nodup_iff,And.left,Subtype.property,List.nodup_range2 instances, coercions and auxiliary constants left out.
- abbrev
Imo2011P4.removeIdxThe position of the weight2^0in a valid sequence line 239 sourceSource documentation
The position of the weight
2^0in a valid sequence.standard axioms: propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNatProof uses:
List.findIdx,Prod,Bool,BEq.beq,Prod.fst,List,And,List.Perm,List.map,List.range, Imo2011P4.ValidSeq9 instances, coercions and auxiliary constants left out.
abbrev removeIdx {n : ℕ} (w : Ways (n + 1)) : ℕ := w.1.findIdx fun p ↦ p.1 == 0Mentions: Imo2011P4.Ways
- lemma
Imo2011P4.ways_findIdx_ltline 241 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,LT.lt,List.findIdx,Prod,Bool,BEq.beq,Prod.fst,List,And,List.Perm,List.map,List.range, Imo2011P4.ValidSeq,List.lengthProof uses:
Eq.mpr,Exists,Membership.mem,Eq,Bool.true,id,congrArg,propext,List.findIdx_lt_length,Iff.mpr,List.mem_range,Nat.succ_pos,List.Perm.mem_iff,And.left,Subtype.property,Iff.mp,List.mem_map,Exists.intro,And.intro,beq_iff_eq18 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- abbrev
Imo2011P4.removePanThe pan on which the weight2^0was placed line 250 sourceSource documentation
The pan on which the weight
2^0was placed.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,BoolProof uses:
Prod.snd,GetElem.getElem,List,Prod,LT.lt,List.length,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq, Imo2011P4.removeIdx, Imo2011P4.ways_findIdx_lt9 instances, coercions and auxiliary constants left out.
abbrev removePan {n : ℕ} (w : Ways (n + 1)) : Bool := …Mentions: Imo2011P4.Ways
- lemma
Imo2011P4.ways_getElem_fstline 253 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,Eq,Prod.fst,Bool,GetElem.getElem,List,Prod,LT.lt,List.length,And,List.Perm,List.map,List.range, Imo2011P4.ValidSeq,List.findIdx,BEq.beq, Imo2011P4.ways_findIdx_ltProof uses:
Bool.true,List.findIdx_getElem,Iff.mp,beq_iff_eq17 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.ways_splitA valid sequence splits around its2^0weight line 260 sourceSource documentation
A valid sequence splits around its
2^0weight.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,Eq,List,Prod,Bool,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq,HAppend.hAppend,List.take, Imo2011P4.removeIdx,List.cons,Prod.mk, Imo2011P4.removePan and 1 moreProof uses:
GetElem.getElem,LT.lt,List.length, Imo2011P4.ways_findIdx_lt,Prod.ext, Imo2011P4.ways_getElem_fst,rfl,Prod.snd,Eq.mpr,id,Eq.rec,Eq.refl,Eq.trans,congrArg,Eq.symm,List.take_append_drop,List.findIdx,BEq.beq,List.getElem_cons_drop16 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
lemma ways_split {n : ℕ} (w : Ways (n + 1)) : w.1 = w.1.take (removeIdx w) ++ (0, removePan w) :: w.1.drop (removeIdx w + 1) := by …Mentions: Imo2011P4.Ways, Imo2011P4.removeIdx, Imo2011P4.removePan
- lemma
Imo2011P4.ways_fst_posThe weights before and after the2^0weight are all even line 269 sourceSource documentation
The weights before and after the
2^0weight are all even.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,And,Prod,Bool,Membership.mem,List,List.take, Imo2011P4.removeIdx,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq,LE.le,List.dropProof uses:
List.Nodup,Iff.mpr,List.Perm.nodup_iff,And.left,Subtype.property,List.nodup_range,Not,List.cons,Ne,Eq.mp,Prod.mk, Imo2011P4.removePan,congrArg,propext,List.nodup_cons,HAppend.hAppend,List.nodup_append,List.map_cons,List.map_append, Imo2011P4.ways_split and 8 more15 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma ways_fst_pos {n : ℕ} (w : Ways (n + 1)) : (∀ p ∈ w.1.take (removeIdx w), 1 ≤ p.1) ∧ (∀ p ∈ w.1.drop (removeIdx w + 1), 1 ≤ p.1) := by …Mentions: Imo2011P4.Ways, Imo2011P4.removeIdx
- abbrev
Imo2011P4.removeListThe list of placements with the2^0weight removed and the remaining weights halved line 284 sourceSource documentation
The list of placements with the
2^0weight removed and the remaining weights halved.standard axioms: propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,List,Prod,BoolProof uses:
List.map,Prod.mk,HSub.hSub,Prod.fst,Prod.snd,HAppend.hAppend,List.take, Imo2011P4.removeIdx,And,List.Perm,List.range, Imo2011P4.ValidSeq,List.drop11 instances, coercions and auxiliary constants left out.
abbrev removeList {n : ℕ} (w : Ways (n + 1)) : List (ℕ × Bool) := …Mentions: Imo2011P4.Ways
- abbrev
Imo2011P4.insertListInserting a fresh2^0weight at positionkon panbinto a list of placements whose weights are all doubled line 289 sourceSource documentation
Inserting a fresh
2^0weight at positionkon panbinto a list of placements whose weights are all doubled.no axioms what this means
Statement uses:
List,Prod,Nat,BoolProof uses:
HAppend.hAppend,List.take,List.map,Prod.mk,HAdd.hAdd,Prod.fst,OfNat.ofNat,Prod.snd,List.cons,List.drop5 instances, coercions and auxiliary constants left out.
abbrev insertList (lr : List (ℕ × Bool)) (k : ℕ) (b : Bool) : List (ℕ × Bool) := …
- lemma
Imo2011P4.validSeq_removeDocumented declaration: validSeq_remove line 296 sourceSource documentation
Removing the weight
2^0and halving preserves validity: before the removed weight the imbalances are unchanged, and afterwards the (even) imbalance without the±1contribution can only drop by1, so it stays nonnegative.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Bool,List,Prod,Nat,Membership.mem,LE.le,OfNat.ofNat,Prod.fst, Imo2011P4.ValidSeq,HAppend.hAppend,List.cons,Prod.mk,List.map,HSub.hSub,Prod.sndProof uses:
List.IsPrefix,Or.elim,Iff.mp,Or,List.mem_append,Eq,List.take,List.length,List.prefix_iff_eq_take,Eq.mpr,id,congrArg,Eq.symm,List.map_take,Eq.refl,rfl,List.IsPrefix.subset,List.take_prefix,Int,HMul.hMuland 39 more42 instances, coercions and auxiliary constants left out.
Tactic trace: 39 steps
Open to load the checked before-and-after goal states.
lemma validSeq_remove {b : Bool} {l₁ l₂ : List (ℕ × Bool)} (hfst₁ : ∀ p ∈ l₁, 1 ≤ p.1) (hfst₂ : ∀ p ∈ l₂, 1 ≤ p.1) (hval : ValidSeq (l₁ ++ (0, b) :: l₂)) : ValidSeq ((l₁ ++ l₂).map fun p : ℕ × Bool ↦ (p.1 - 1, p.2)) := by …Mentions: Imo2011P4.ValidSeq
- lemma
Imo2011P4.removeList_permline 337 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,List.Perm,List.map,Prod,Bool,Prod.fst, Imo2011P4.removeList,List.rangeProof uses:
And,Membership.mem,List,List.take, Imo2011P4.removeIdx, Imo2011P4.ValidSeq,LE.le,List.drop, Imo2011P4.ways_fst_pos,HAppend.hAppend,List.erase,List.Perm.erase,And.left,Subtype.property,Not,Eq,Exists,False,Iff.mp,List.mem_mapand 26 more20 instances, coercions and auxiliary constants left out.
Tactic trace: 28 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.removeList_validline 369 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat, Imo2011P4.ValidSeq, Imo2011P4.removeListProof uses:
HAppend.hAppend,List,Prod,Bool,List.take, Imo2011P4.removeIdx,And,List.Perm,List.map,Prod.fst,List.range,List.cons,Prod.mk, Imo2011P4.removePan,List.drop,Eq.mpr,id,Eq,congrArg,Eq.symmand 8 more11 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.validSeq_insertDocumented declaration: validSeq_insert line 380 sourceSource documentation
Inserting the weight
2^0into a valid sequence of doubled weights preserves validity: prefixes before the insertion point keep their (nonnegative, doubled) imbalance; later prefixes have imbalance2d ± 1withd ≥ 0, and when the new weight goes on the right pan the insertion is not at the beginning, sod ≠ 0(a nonempty signed sum of distinct powers of two), henced ≥ 1.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
List,Prod,Nat,Bool,List.Nodup,List.map,Prod.fst, Imo2011P4.ValidSeq,LE.le,List.length,Eq,Bool.false,OfNat.ofNat, Imo2011P4.insertListProof uses:
id,List.IsPrefix,HAppend.hAppend,List.take,Prod.mk,HAdd.hAdd,Prod.snd,List.cons,List.drop,Exists,And,Or,Int, Imo2011P4.Balance, Imo2011P4.prefix_append_cases,List.IsPrefix.trans,List.take_prefix,Iff.mp,List.prefix_iff_eq_take,Eq.mprand 34 more33 instances, coercions and auxiliary constants left out.
Tactic trace: 58 steps
Open to load the checked before-and-after goal states.
lemma validSeq_insert {lr : List (ℕ × Bool)} (hnd : (lr.map Prod.fst).Nodup) (hval : ValidSeq lr) {k : ℕ} (hk : k ≤ lr.length) {b : Bool} (hb : b = false → 1 ≤ k) : ValidSeq (insertList lr k b) := by …Mentions: Imo2011P4.ValidSeq, Imo2011P4.insertList
- lemma
Imo2011P4.insertZero_permline 439 sourcestandard axioms: Quot.sound, propext what this means
Statement uses:
Nat,List,Prod,Bool,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.insertList,HAdd.hAdd,OfNat.ofNatProof uses:
Eq,Prod.mk,Prod.snd,Nat.succ,Eq.mpr,Function.comp,id,congrArg,List.map_map,Eq.rec,Eq.refl,Trans.trans,List.cons,HAppend.hAppend,List.take,List.drop,List.map_append,List.map_cons,List.perm_middle,List.take_append_dropand 4 more11 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- abbrev
Imo2011P4.IDataThe insertion data: where and on which pan the weight2^0is inserted line 464 sourceSource documentation
The insertion data: where and on which pan the weight
2^0is inserted.Sum.inl k(withk : Fin (n + 1)) inserts it on the left pan at positionk;Sum.inr k(withk : Fin n) inserts it on the right pan at positionk + 1(the right pan is forbidden at the very beginning).no axioms what this means
Statement uses:
NatProof uses:
Sum,Fin,HAdd.hAdd,OfNat.ofNat3 instances, coercions and auxiliary constants left out.
abbrev IData (n : ℕ) : Type := Fin (n + 1) ⊕ Fin n
- lemma
Imo2011P4.removePan_false_idxThe weight2^0cannot be the first placement if it goes on the right pan line 468 sourceSource documentation
The weight
2^0cannot be the first placement if it goes on the right pan.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,Eq,Bool, Imo2011P4.removePan,Bool.false,LE.le, Imo2011P4.removeIdxProof uses:
Decidable.byContradiction,Not,Eq.mp,LT.lt,List,Prod,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq,HAppend.hAppend,List.take,List.cons,Prod.mk,List.drop, Imo2011P4.ways_split,List.IsPrefix,List.niland 27 more38 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
lemma removePan_false_idx {n : ℕ} (w : Ways (n + 1)) (hp : removePan w = false) : 1 ≤ removeIdx w := by …Mentions: Imo2011P4.Ways, Imo2011P4.removePan, Imo2011P4.removeIdx
- def
Imo2011P4.removeZeroWaysThe valid sequence obtained by removing the weight2^0and halving line 480 sourceSource documentation
The valid sequence obtained by removing the weight
2^0and halving.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNatProof uses:
Subtype.mk,List,Prod,Bool,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq, Imo2011P4.removeList7 instances, coercions and auxiliary constants left out.
def removeZeroWays {n : ℕ} (w : Ways (n + 1)) : Ways n := …Mentions: Imo2011P4.Ways
- def
Imo2011P4.removeZeroDataThe insertion data describing where the weight2^0sits in a valid sequence line 485 sourceSource documentation
The insertion data describing where the weight
2^0sits in a valid sequence.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat, Imo2011P4.IDataProof uses:
dite,Eq,Bool, Imo2011P4.removePan,Bool.true,Sum.inl,Fin,Fin.mk, Imo2011P4.removeIdx,Not,Sum.inr,HSub.hSub11 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
def removeZeroData {n : ℕ} (w : Ways (n + 1)) : IData n := …Mentions: Imo2011P4.Ways, Imo2011P4.IData
- def
Imo2011P4.insertZeroWaysThe valid sequence obtained by inserting the weight2^0according to the given insertion data line 502 sourceSource documentation
The valid sequence obtained by inserting the weight
2^0according to the given insertion data.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways, Imo2011P4.IData,HAdd.hAdd,OfNat.ofNatProof uses:
Sum.rec,Fin,Sum,Subtype.mk,List,Prod,Bool,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq, Imo2011P4.insertList,Bool.true,Bool.false10 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
def insertZeroWays {n : ℕ} (w : Ways n) (d : IData n) : Ways (n + 1) := …Mentions: Imo2011P4.Ways, Imo2011P4.IData
- lemma
Imo2011P4.insertZeroWays_inl_valline 511 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,Fin,HAdd.hAdd,OfNat.ofNat,Eq,List,Prod,Bool,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq, Imo2011P4.insertZeroWays,Sum.inl, Imo2011P4.insertList,Bool.trueProof uses:
rfl9 instances, coercions and auxiliary constants left out.
- lemma
Imo2011P4.insertZeroWays_inr_valline 514 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,Fin,Eq,List,Prod,Bool,And,List.Perm,List.map,Prod.fst,List.range,HAdd.hAdd,OfNat.ofNat, Imo2011P4.ValidSeq, Imo2011P4.insertZeroWays,Sum.inr, Imo2011P4.insertList,Bool.falseProof uses:
rfl9 instances, coercions and auxiliary constants left out.
- lemma
Imo2011P4.insertList_removeListRemoval followed by insertion reconstructs the original sequence line 518 sourceSource documentation
Removal followed by insertion reconstructs the original sequence.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,Eq,List,Prod,Bool, Imo2011P4.insertList, Imo2011P4.removeList, Imo2011P4.removeIdx, Imo2011P4.removePan,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeqProof uses:
Membership.mem,List.take,LE.le,List.drop, Imo2011P4.ways_fst_pos,List.length,Eq.mpr,Min.min,id,congrArg,List.length_take,min_eq_left,le_of_lt, Imo2011P4.ways_findIdx_lt,HAppend.hAppend,Prod.mk,Prod.snd,List.cons,HSub.hSub, Imo2011P4.map_up_map_down and 11 more17 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
lemma insertList_removeList {n : ℕ} (w : Ways (n + 1)) : insertList (removeList w) (removeIdx w) (removePan w) = w.1 := by …Mentions: Imo2011P4.Ways, Imo2011P4.insertList, Imo2011P4.removeList, Imo2011P4.removeIdx, Imo2011P4.removePan
- lemma
Imo2011P4.insertList_getElemThe element of an inserted list at the insertion position is the new2^0weight line 536 sourceSource documentation
The element of an inserted list at the insertion position is the new
2^0weight.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,LE.le,List.length,Prod,Bool,List,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq,LT.lt, Imo2011P4.insertList,Eq,GetElem.getElem,Prod.mk,OfNat.ofNatProof uses:
id,Eq.mpr,HAppend.hAppend,List.take,HAdd.hAdd,Prod.snd,List.cons,List.drop,HSub.hSub,Min.min,congrFun',congrArg,Eq.trans,List.length_take,List.length_map,List.getElem_append_right,of_eq_true,True,GetElem.getElem.congr_simp,Eq.refland 1 more20 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
lemma insertList_getElem {n : ℕ} (w : Ways n) {k : ℕ} (hk : k ≤ w.1.length) (b : Bool) (h : k < (insertList w.1 k b).length) : (insertList w.1 k b)[k]'h = (0, b) := by …Mentions: Imo2011P4.Ways, h, Imo2011P4.insertList
- lemma
Imo2011P4.insertList_findIdxThe position of the2^0weight in an inserted list is exactly the insertion position line 546 sourceSource documentation
The position of the
2^0weight in an inserted list is exactly the insertion position.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2011P4.Ways,LE.le,List.length,Prod,Bool,List,And,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq,Eq,List.findIdx,BEq.beq,OfNat.ofNat, Imo2011P4.insertListProof uses:
HAdd.hAdd,id,Eq.mpr,HAppend.hAppend,List.take,Prod.mk,Prod.snd,List.cons,List.drop,congrArg,List.length_append,List.length_cons,Min.min,List.length_take,HSub.hSub,List.length_drop,List.length_map,LT.lt,Iff.mpr,GetElem.getElemand 17 more25 instances, coercions and auxiliary constants left out.
Tactic trace: 27 steps
Open to load the checked before-and-after goal states.
lemma insertList_findIdx {n : ℕ} (w : Ways n) {k : ℕ} (hk : k ≤ w.1.length) (b : Bool) : (insertList w.1 k b).findIdx (fun p ↦ p.1 == 0) = k := by …Mentions: Imo2011P4.Ways, Imo2011P4.insertList
- def
Imo2011P4.stepEquivThe key bijection: valid sequences forn + 1weights correspond to valid sequences fornweights together with insertion data for the weight2^0line 571 sourceSource documentation
The key bijection: valid sequences for
n + 1weights correspond to valid sequences fornweights together with insertion data for the weight2^0.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,Prod, Imo2011P4.IDataProof uses:
Equiv.mk,Prod.mk, Imo2011P4.removeZeroWays, Imo2011P4.removeZeroData, Imo2011P4.insertZeroWays,Prod.fst,Prod.snd8 instances, coercions and auxiliary constants left out.
Tactic trace: 111 steps
Open to load the checked before-and-after goal states.
def stepEquiv (n : ℕ) : Ways (n + 1) ≃ Ways n × IData n where …
Mentions: Imo2011P4.Ways, Imo2011P4.IData
- lemma
Imo2011P4.card_idataline 679 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Nat.card, Imo2011P4.IData,HAdd.hAdd,HMul.hMul,OfNat.ofNatProof uses:
id,Eq.mpr,Sum,Fin,congrArg,Nat.card_sum,Nat.card_fin,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,HPow.hPow,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.symm,Eq.refl,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNat,Mathlib.Tactic.Ring.Common.add_pf_add_gt,Mathlib.Tactic.Ring.Common.add_pf_add_zero,Mathlib.Tactic.Ring.Common.add_pf_add_ltand 13 more28 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.card_ways_zeroline 684 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Eq,Nat,Nat.card, Imo2011P4.Ways,OfNat.ofNatProof uses:
Eq.mpr,And,Subsingleton,Nonempty,id,congrArg,propext,Nat.card_eq_one_iff_unique,And.intro,Subsingleton.intro,Subtype.ext,List,Prod,Bool,List.Perm,List.map,Prod.fst,List.range, Imo2011P4.ValidSeq,List.niland 16 more6 instances, coercions and auxiliary constants left out.
Tactic trace: 19 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.card_ways_succline 702 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Nat.card, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,HMul.hMulProof uses:
Eq.mpr,Prod, Imo2011P4.IData,id,congrArg,Nat.card_congr, Imo2011P4.stepEquiv,Nat.card_prod, Imo2011P4.card_idata,Mathlib.Tactic.Ring.of_eq,HPow.hPow,Nat.rawCast,Mathlib.Tactic.Ring.Common.mul_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.symm,Eq.refl,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNatand 13 more26 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2011P4.card_waysline 707 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Nat.card, Imo2011P4.Ways,HAdd.hAdd,OfNat.ofNat,Nat.doubleFactorial,HMul.hMulProof uses:
Nat.recAux,Eq.mpr,id,congrArg, Imo2011P4.card_ways_succ, Imo2011P4.card_ways_zero,Eq.refl,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,HPow.hPow,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.mul_congr,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNat,Mathlib.Tactic.Ring.Common.atom_pf,rfl,Eq.symm,Mathlib.Tactic.Ring.Common.add_pf_add_gt,Mathlib.Tactic.Ring.Common.add_pf_add_zero,Mathlib.Tactic.Ring.Common.add_muland 12 more26 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- determine
Imo2011P4.solution_valueline 717 sourceno axioms what this means
Statement uses:
NatProof uses:
Nat.doubleFactorial,HSub.hSub,HMul.hMul,OfNat.ofNat5 instances, coercions and auxiliary constants left out.
- problem
Imo2011P4.imo2011_p4line 719 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LT.lt,OfNat.ofNat,Eq,Nat.card, Imo2011P4.Ways, Imo2011P4.solution_valueProof uses:
Nat.succ,Exists,Nat.exists_eq_succ_of_ne_zero,LT.lt.ne',id,HSub.hSub,HMul.hMul,HAdd.hAdd,Eq.mpr,Nat.doubleFactorial,congrArg, Imo2011P4.card_ways,Eq.symm14 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.