Compfiles/Usa2010P2.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
USA Mathematical Olympiad 2010, Problem 2
There are $n$ students standing in a circle, one behind the other. The students have heights $h_1 < h_2 < \dots < h_n$. If a student with height $h_k$ is standing directly behind a student with height $h_{k-2}$ or less, the two students are permitted to switch places. Prove that it is not possible to make more than $\binom{n}{3}$ such switches before reaching a position in which no further switches are possible.
Imports (4)
Imported by 1 file
- def
Usa2010P2.LegalA sequence of permitted switches starting from configurationeline 55 sourceSource documentation
A sequence of permitted switches starting from configuration
e.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Fin,ZMod,List2 instances, coercions and auxiliary constants left out.
def Legal {n : ℕ} : (Fin n ≃ ZMod n) → List (ZMod n) → Prop | _, [] => True | e, p :: ps => (e.symm p).val + 2 ≤ (e.symm (p + 1)).val ∧ Legal (e.trans (Equiv.swap p (p + 1))) ps /-- The sequence of pairs of students that switch places: each entry is `(student in front, student behind)`, with front rank `<` behind rank. -/ - def
Usa2010P2.evPairsThe sequence of pairs of students that switch places: each entry is(student in front, student behind), with front rank<behind rank line 63 sourceSource documentation
The sequence of pairs of students that switch places: each entry is
(student in front, student behind), with front rank<behind rank.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Fin,ZMod,List,Prod2 instances, coercions and auxiliary constants left out.
def evPairs {n : ℕ} : (Fin n ≃ ZMod n) → List (ZMod n) → List (Fin n × Fin n) | _, [] => [] | e, p :: ps => (e.symm p, e.symm (p + 1)) :: evPairs (e.trans (Equiv.swap p (p + 1))) ps /-- The cyclic-order state of a triple of students: going backwards from `a` we meet `b` before meeting `c`. -/ - def
Usa2010P2.StateAThe cyclic-order state of a triple of students: going backwards fromawe meetbbefore meetingcline 70 sourceSource documentation
The cyclic-order state of a triple of students: going backwards from
awe meetbbefore meetingc.standard axioms: Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Fin,ZModProof uses:
LT.lt,ZMod.val,HSub.hSub11 instances, coercions and auxiliary constants left out.
def StateA {n : ℕ} (e : Fin n ≃ ZMod n) (a b c : Fin n) : Prop := … - instance
Usa2010P2.(instance at line 73)line 73 source - lemma
Usa2010P2.val_one'line 78 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Eq,ZMod.val,ZModProof uses:
NeZero,NeZero.mk,Eq.mpr,id,congrArg,Eq.symm,Nat.cast_one,ZMod.val_natCast_of_lt22 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.val_neg_one'line 83 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Eq,ZMod.val,Neg.neg,ZMod,HSub.hSubProof uses:
NeZero,NeZero.mk,Eq.mpr,id,congrArg,Nat.cast_sub,Nat.cast_one,ZMod.natCast_self,zero_sub,Eq.refl,ZMod.val_natCast_of_lt50 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.val_add_one'line 90 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,ZMod,Ne,Neg.neg,Eq,ZMod.val,HAdd.hAddProof uses:
NeZero,NeZero.mk,LT.lt,ZMod.val_lt,HSub.hSub,ZMod.val_injective,Eq.mpr,id,congrArg, Usa2010P2.val_neg_one',HMod.hMod,ZMod.val_add, Usa2010P2.val_one',Nat.mod_eq_of_lt,Eq.refl51 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.val_sub_one'line 99 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,ZMod,Ne,Eq,ZMod.val,HSub.hSubProof uses:
NeZero,NeZero.mk,Iff.mp,ZMod.val_eq_zero,LT.lt,ZMod.val_lt,Eq.mpr,HAdd.hAdd,Neg.neg,id,congrArg,sub_eq_add_neg,HMod.hMod,ZMod.val_add, Usa2010P2.val_neg_one',Nat.add_mod_right,Nat.mod_eq_of_lt,Eq.refl58 instances, coercions and auxiliary constants left out.
Tactic trace: 9 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.val_sub_ne_of_neline 110 sourcestandard axioms: Quot.sound, propext what this means
Statement uses:
Nat,NeZero,ZMod,Ne,ZMod.val,HSub.hSubProof uses:
Eq,Iff.mp,sub_left_inj,ZMod.val_injective18 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.val_sub_pos_of_neline 115 sourcestandard axioms: Quot.sound, propext what this means
Statement uses:
Nat,NeZero,ZMod,Ne,LE.le,OfNat.ofNat,ZMod.val,HSub.hSubProof uses:
sub_ne_zero_of_ne,Eq,Iff.mp,ZMod.val_eq_zero,Iff.mpr,Nat.one_le_iff_ne_zero29 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.eq_of_sub_eq_neg_oneline 121 sourcestandard axioms: Quot.sound, propext what this means
Statement uses:
Nat,ZMod,Eq,HSub.hSub,Neg.neg,OfNat.ofNat,HAdd.hAddProof uses:
Iff.mp,sub_eq_iff_eq_add,Eq.mpr,id,congrArg,Mathlib.Tactic.Ring.of_eq,HMul.hMul,HPow.hPow,Nat.rawCast,Mathlib.Tactic.Ring.Common.add_congr,Int.rawCast,inferInstance,Ring,Int.negOfNat,Mathlib.Tactic.Ring.Common.neg_congr,Mathlib.Tactic.Ring.cast_pos,Mathlib.Meta.NormNum.isNat_ofNat,Nat.cast_one,Mathlib.Tactic.Ring.Common.neg_add,Mathlib.Meta.NormNum.IsInt.to_raw_eqand 17 more59 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.stateA_of_pairL1: ifbis directly behinda, then going backwards fromawe meetbbefore any third studentcline 130 sourceSource documentation
L1: if
bis directly behinda, then going backwards fromawe meetbbefore any third studentc.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Fin,Equiv,ZMod,Eq,HAdd.hAdd,Ne, Usa2010P2.StateAProof uses:
NeZero,NeZero.mk,ZMod.val,HSub.hSub,Eq.mpr,id,congrArg,add_sub_cancel_left, Usa2010P2.val_one', Usa2010P2.val_sub_pos_of_ne,Eq.symm,Equiv.injective,ZMod.val_injective,Iff.mp,sub_eq_iff_eq_add,add_comm,Eq.refl,LT.lt51 instances, coercions and auxiliary constants left out.
Tactic trace: 20 steps
Open to load the checked before-and-after goal states.
lemma stateA_of_pair {n : ℕ} (hn : 2 ≤ n) {a b c : Fin n} {e : Fin n ≃ ZMod n} {p : ZMod n} (hea : e a = p) (heb : e b = p + 1) (hac : a ≠ c) (hbc : b ≠ c) : StateA e a b c := by …Mentions: Usa2010P2.StateA
- lemma
Usa2010P2.not_stateA_of_pairL2: ifbis directly behindc, the triple is not in state A line 152 sourceSource documentation
L2: if
bis directly behindc, the triple is not in state A.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Fin,Equiv,ZMod,Eq,HAdd.hAdd,Ne,Not, Usa2010P2.StateAProof uses:
NeZero,NeZero.mk,LT.lt,ZMod.val,HSub.hSub,Eq.mpr,id,congrArg,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,HMul.hMul,HPow.hPow,Int.rawCast,inferInstance,Ring,Int.negOfNat,Mathlib.Tactic.Ring.Common.sub_congr,Mathlib.Tactic.Ring.Common.add_congr,Mathlib.Tactic.Ring.Common.atom_pf,rfland 28 more68 instances, coercions and auxiliary constants left out.
Tactic trace: 15 steps
Open to load the checked before-and-after goal states.
lemma not_stateA_of_pair {n : ℕ} (hn : 2 ≤ n) {a b c : Fin n} {e : Fin n ≃ ZMod n} {p : ZMod n} (hec : e c = p) (heb : e b = p + 1) (hab : a ≠ b) : ¬ StateA e a b c := by …Mentions: Usa2010P2.StateA
- lemma
Usa2010P2.not_stateA_swapL3: afterb(behind) anda(front) switch, the triple is not in state A line 169 sourceSource documentation
L3: after
b(behind) anda(front) switch, the triple is not in state A.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Fin,Equiv,ZMod,Eq,HAdd.hAdd,Ne,Not, Usa2010P2.StateA,Equiv.trans,Equiv.swapProof uses:
NeZero,NeZero.mk,Eq.mpr,id,congrArg,Equiv.trans_apply,Equiv.swap_apply_left,Equiv.swap_apply_right,Equiv.injective,Eq.trans,Eq.symm,Equiv.Perm,Equiv.swap_apply_of_ne_of_ne,Eq.refl,HSub.hSub,Neg.neg,Mathlib.Tactic.Ring.of_eq,Int.rawCast,inferInstance,Ringand 38 more63 instances, coercions and auxiliary constants left out.
Tactic trace: 28 steps
Open to load the checked before-and-after goal states.
lemma not_stateA_swap {n : ℕ} (hn : 2 ≤ n) {a b c : Fin n} {e : Fin n ≃ ZMod n} {p : ZMod n} (hea : e a = p) (heb : e b = p + 1) (hca : c ≠ a) (hcb : c ≠ b) : ¬ StateA (e.trans (Equiv.swap p (p + 1))) a b c := by …Mentions: Usa2010P2.StateA
- lemma
Usa2010P2.stateA_swapL4: afterb(behind) andc(front) switch, the triple is in state A line 198 sourceSource documentation
L4: after
b(behind) andc(front) switch, the triple is in state A.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Fin,Equiv,ZMod,Eq,HAdd.hAdd,Ne, Usa2010P2.StateA,Equiv.trans,Equiv.swapProof uses:
NeZero,NeZero.mk,Eq.mpr,id,congrArg,Equiv.trans_apply,Equiv.swap_apply_left,Equiv.swap_apply_right,Equiv.injective,Eq.trans,Eq.symm,Equiv.Perm,Equiv.swap_apply_of_ne_of_ne,Eq.refl,LT.lt,ZMod.val,HSub.hSub,Mathlib.Tactic.Ring.of_eq,Nat.rawCast,HMul.hMuland 30 more61 instances, coercions and auxiliary constants left out.
Tactic trace: 22 steps
Open to load the checked before-and-after goal states.
lemma stateA_swap {n : ℕ} (hn : 2 ≤ n) {a b c : Fin n} {e : Fin n ≃ ZMod n} {p : ZMod n} (hec : e c = p) (heb : e b = p + 1) (hac : a ≠ c) (hab : a ≠ b) : StateA (e.trans (Equiv.swap p (p + 1))) a b c := by …Mentions: Usa2010P2.StateA
- lemma
Usa2010P2.stateA_swap_iffL5: a permitted switch that involves neither the pair(a, b)nor the pair(c, b)preserves the cyclic-order state of the triple{a, c, b}line 224 sourceSource documentation
L5: a permitted switch that involves neither the pair
(a, b)nor the pair(c, b)preserves the cyclic-order state of the triple{a, c, b}.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Fin,Equiv,ZMod,Eq,HAdd.hAdd,LT.lt,Equiv.symm,Ne,Prod,Prod.mk,Iff, Usa2010P2.StateA,Equiv.trans,Equiv.swapProof uses:
NeZero,NeZero.mk,Fin.isLt,Eq.mp,congrArg,lt_irrefl,ZMod.val,HSub.hSub, Usa2010P2.val_sub_ne_of_ne,Eq.symm,Equiv.injective, Usa2010P2.val_sub_pos_of_ne,Eq.mpr,id,rfl,Equiv.apply_symm_apply,dite,And,Prod.mk.injEq,And.introand 50 more89 instances, coercions and auxiliary constants left out.
Tactic trace: 246 steps (first 200 of 246)
Open to load the checked before-and-after goal states.
lemma stateA_swap_iff {n : ℕ} (hn : 2 ≤ n) {a b c : Fin n} {e : Fin n ≃ ZMod n} {p : ZMod n} (hc : c.val = a.val + 1) (hab : a.val + 2 ≤ b.val) (hcb : c.val < b.val) (hleg : (e.symm p).val + 2 ≤ (e.symm (p + 1)).val) (hJ : (e.symm p, e.symm (p + 1)) ≠ (a, b)) (hM : (e.symm p, e.symm (p + 1)) ≠ (c, b)) : StateA (e.trans (Equiv.swap p (p + 1))) a b c ↔ StateA e a b c := by …Mentions: Usa2010P2.StateA
- def
Usa2010P2.fsuccThe student of rank one higher thana(well-defined whenais not the tallest student) line 424 sourceSource documentation
The student of rank one higher than
a(well-defined whenais not the tallest student). Defined as a literal so that(fsucc a h).valis definitionallya.val + 1.no axioms what this means
Statement uses:
Nat,Fin,LT.lt,HAdd.hAdd,OfNat.ofNatProof uses:
Fin.mk10 instances, coercions and auxiliary constants left out.
def fsucc {n : ℕ} (a : Fin n) (h : a.val + 1 < n) : Fin n := ⟨a.val + 1, h⟩Mentions: h
- lemma
Usa2010P2.evPairs_leEvery recorded switch has front rank + 2 ≤ behind rank line 427 sourceSource documentation
Every recorded switch has front rank + 2 ≤ behind rank.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Fin,ZMod,List, Usa2010P2.Legal,Prod,Membership.mem, Usa2010P2.evPairs,LE.le,HAdd.hAdd,Prod.fst,OfNat.ofNat,Prod.sndProof uses:
List.rec,List.nil,False.elim,List.not_mem_nil,List.cons,Equiv.symm,Equiv.trans,Equiv.swap,And,Eq,Prod.mk,Or,Eq.mp,Eq.mpr,id,congrArg29 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
lemma evPairs_le {n : ℕ} {e : Fin n ≃ ZMod n} {ps : List (ZMod n)} (hL : Legal e ps) : ∀ pr ∈ evPairs e ps, pr.1.val + 2 ≤ pr.2.val := by …Mentions: Usa2010P2.Legal, Usa2010P2.evPairs
- lemma
Usa2010P2.evPairs_ltEvery recorded switch has front rank < behind rank line 442 sourceSource documentation
Every recorded switch has front rank < behind rank.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Fin,ZMod,List, Usa2010P2.Legal,Prod,Membership.mem, Usa2010P2.evPairs,LT.lt,Prod.fst,Prod.sndProof uses:
LE.le,HAdd.hAdd,OfNat.ofNat, Usa2010P2.evPairs_le,Iff.mpr,Fin.lt_def11 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
lemma evPairs_lt {n : ℕ} {e : Fin n ≃ ZMod n} {ps : List (ZMod n)} (hL : Legal e ps) : ∀ pr ∈ evPairs e ps, pr.1 < pr.2 := by …Mentions: Usa2010P2.Legal, Usa2010P2.evPairs
- lemma
Usa2010P2.length_evPairsline 448 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Fin,ZMod,List,Eq,List.length,Prod, Usa2010P2.evPairsProof uses:
List.rec,Eq.refl,List.nil,of_eq_true,List.cons,HAdd.hAdd,OfNat.ofNat,Eq.trans,True,congrFun',congrArg,Equiv.trans,Equiv.swap,eq_self14 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.length_eq_sum_countThe length of a list of pairs withfst < sndequals the sum of the counts over all such pairs line 456 sourceSource documentation
The length of a list of pairs with
fst < sndequals the sum of the counts over all such pairs.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,List,Prod,Fin,Membership.mem,LT.lt,Prod.fst,Prod.snd,Eq,List.length,Finset.sum,Finset.filter,Finset.univ,List.countProof uses:
List.rec,List.nil,of_eq_true,OfNat.ofNat,Eq.trans,True,congrArg,Finset.sum_const_zero,eq_self,List.cons,List.mem_cons_self,List.mem_cons_of_mem,Eq.mpr,HAdd.hAdd,id,List.length_cons,ite,Bool,BEq.beq,Bool.trueand 26 more50 instances, coercions and auxiliary constants left out.
Tactic trace: 25 steps
Open to load the checked before-and-after goal states.
lemma length_eq_sum_count {n : ℕ} (L : List (Fin n × Fin n)) (hL : ∀ pr ∈ L, pr.1 < pr.2) : L.length = ∑ pr ∈ (Finset.univ.filter (fun pr : Fin n × Fin n => pr.1 < pr.2)), L.count pr := by … - lemma
Usa2010P2.alternationThe key alternation lemma line 499 sourceSource documentation
The key alternation lemma. Along any legal sequence of switches, the switches of the pair
(a, b)and those of the pair(a+1, b)alternate, and every switch of(a, b)after the first one is preceded by a switch of(a+1, b). Consequently the two displayed inequalities hold (the first conjunct applies when the initial cyclic-order state is A, the second when it is not).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Fin,HAdd.hAdd,LT.lt,Equiv,ZMod,List, Usa2010P2.Legal,And, Usa2010P2.StateA, Usa2010P2.fsucc,List.count,Prod,Prod.mk, Usa2010P2.evPairs,NotProof uses:
NeZero,NeZero.mk,Fin.isLt,Ne,Eq,congrArg,Ne.symm,id,List.rec,List.nil,And.intro,Nat.zero_le,Nat.le_refl,List.cons,Equiv.symm,Equiv.trans,Equiv.swap,Equiv.apply_symm_apply,of_eq_true,eq_selfand 23 more54 instances, coercions and auxiliary constants left out.
Tactic trace: 88 steps
Open to load the checked before-and-after goal states.
lemma alternation {n : ℕ} (hn : 2 ≤ n) (a b : Fin n) (hab : a.val + 2 ≤ b.val) (ha : a.val + 1 < n) : ∀ (e : Fin n ≃ ZMod n) (ps : List (ZMod n)), Legal e ps → (StateA e a b (fsucc a ha) → (evPairs e ps).count (a, b) ≤ (evPairs e ps).count (fsucc a ha, b) + 1 ∧ (evPairs e ps).count (fsucc a ha, b) ≤ (evPairs e ps).count (a, b)) ∧ (¬ StateA e a b (fsucc a ha) → (evPairs e ps).count (a, b) ≤ (evPairs e ps).count (fsucc a ha, b) ∧ (evPairs e ps).count (fsucc a ha, b) ≤ (evPairs e ps).count (a, b) + 1) := by …Mentions: Usa2010P2.Legal, Usa2010P2.StateA, Usa2010P2.fsucc, Usa2010P2.evPairs
- lemma
Usa2010P2.count_boundThe number of times a fixed pair of students(a, b)can switch is at mostb.val - a.val - 1line 596 sourceSource documentation
The number of times a fixed pair of students
(a, b)can switch is at mostb.val - a.val - 1. Proof by induction on the difference of the ranks, using the alternation lemma.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,LE.le,OfNat.ofNat,Fin,Equiv,ZMod,List, Usa2010P2.Legal,Eq,HSub.hSub,List.count,Prod,Prod.mk, Usa2010P2.evPairsProof uses:
Nat.recAux,Eq.mpr,Not,Membership.mem,id,congrArg,propext,List.count_eq_zero,Ord.compare,HAdd.hAdd, Usa2010P2.evPairs_le,le_refl,GT.gt,Or,Nat.eq_zero_or_pos,Eq.symm,Nat.succ,Exists,Nat.exists_eq_succ_of_ne_zero,Nat.ne_of_gtand 12 more42 instances, coercions and auxiliary constants left out.
Tactic trace: 37 steps
Open to load the checked before-and-after goal states.
lemma count_bound {n : ℕ} (hn : 2 ≤ n) (d : ℕ) : ∀ (a b : Fin n) (e : Fin n ≃ ZMod n) (ps : List (ZMod n)), Legal e ps → b.val - a.val = d → (evPairs e ps).count (a, b) ≤ d - 1 := by …Mentions: Usa2010P2.Legal, Usa2010P2.evPairs
- lemma
Usa2010P2.sum_range_choose_twoline 630 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Finset.range,Nat.choose,OfNat.ofNatProof uses:
Nat.recAux,Eq.refl,Eq.mpr,HAdd.hAdd,id,congrArg,Finset.sum_range_succ,Nat.choose_succ_succ',add_comm13 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.inner_sumline 636 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Finset.range,HSub.hSub,OfNat.ofNat,Nat.chooseProof uses:
Finset.sum_congr,rfl,Finset,Membership.mem,Finset.sum_range_reflect,Eq.mpr,id,congrArg,HDiv.hDiv,HMul.hMul,Finset.sum_range_id,Nat.choose_two_right,Eq.refl15 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.sum_Iio_valline 644 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Fin,Eq,Finset.sum,Finset.Iio,HSub.hSub,OfNat.ofNat,Nat.chooseProof uses:
Eq.mpr,Finset.range,id,congrArg,Eq.symm, Usa2010P2.inner_sum,Finset,Finset.map,Fin.valEmbedding,Fin.map_valEmbedding_Iio,Nat.Iio_eq_range,Function.Embedding,Finset.sum_map,Finset.sum_congr,rfl,Membership.mem,Eq.refl24 instances, coercions and auxiliary constants left out.
Tactic trace: 8 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2010P2.pair_sum_choose3line 654 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Eq,Finset.sum,Prod,Fin,Finset.filter,LT.lt,Prod.fst,Prod.snd,Finset.univ,HSub.hSub,OfNat.ofNat,Nat.chooseProof uses:
Finset.Iio,Eq.mpr,ite,id,congrArg,Finset.sum_filter,SProd.sprod,Finset,Eq.symm,Finset.univ_product_univ,Prod.mk,Finset.sum_product,Finset.sum_comm,Finset.sum_congr,rfl,Membership.mem,Finset.ext,of_eq_true,Iff,Eq.transand 11 more33 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
- problem
Usa2010P2.usa2010_p2USAMO 2010 Problem 2 line 688 sourceSource documentation
USAMO 2010 Problem 2. There are
nstudents standing in a circle, one behind the other, with heightsh₁ < h₂ < ⋯ < hₙ. If a student with heighthₖis standing directly behind a student with heighthₖ₋₂or less, the two students are permitted to switch places. Then it is not possible to make more thanC(n, 3)such switches.We model the circle by positions in
ZMod n(positionp + 1is directly behind positionp), the students by their height ranks inFin n, and a sequence of switches by the list of positions at which they occur;Legalasserts that every switch is permitted.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Equiv,Fin,ZMod,List, Usa2010P2.Legal,LE.le,List.length,Nat.choose,OfNat.ofNatProof uses:
LT.lt,Or,lt_or_ge,Eq,List.nil,Nat.zero_le,Eq.symm,List.cons,False.elim,HAdd.hAdd,Equiv.symm,Equiv.trans,Equiv.swap,And,False,Fin.isLt,Eq.refl,Eq.mpr,Prod, Usa2010P2.evPairs and 24 more49 instances, coercions and auxiliary constants left out.
Tactic trace: 20 steps
Open to load the checked before-and-after goal states.
problem usa2010_p2 {n : ℕ} (e : Fin n ≃ ZMod n) (ps : List (ZMod n)) (h : Legal e ps) : ps.length ≤ n.choose 3 := by …Mentions: h, Usa2010P2.Legal