Compfiles/Imo2020P4.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
30 declarations, 0 contain sorry, 0 declared as axioms
International Mathematical Olympiad 2020, Problem 4
There is an integer n > 1. There are n² stations on a slope of a mountain, all at different altitudes. Each of two cable car companies, A and B, operates k cable cars; each cable car provides a transfer from one of the stations to a higher one (with no intermediate stops). The k cable cars of A have k different starting points and k different finishing points, and a cable car which starts higher also finishes higher. The same conditions hold for B. We say that two stations are linked by a company if one can start from the lower station and reach the higher one by using one or more cars of that company (no other movements between stations are allowed). Determine the smallest positive integer k for which one can guarantee that there are two stations that are linked by both companies.
Imports (2)
Imported by 1 file
- structure
Imo2020P4.CarA cable car's starting and finishing points line 40 sourceSource documentation
A cable car's starting and finishing points.
standard axioms: propext what this means
Statement uses:
Natstructure Car (n : ℕ) : Type where …
- structure
Imo2020P4.CompanyThe cable cars of a company line 48 sourceSource documentation
The cable cars of a company.
standard axioms: propext what this means
Statement uses:
Natstructure Company (n k : ℕ) : Type where …
- structure
Imo2020P4.Company.linkageA linkage between two stations line 56 sourceSource documentation
A linkage between two stations.
standard axioms: propext what this means
Statement uses:
Nat, Imo2020P4.Companystructure Company.linkage {n k : ℕ} (c : Company n k) : Type where …Mentions: Imo2020P4.Company
- def
Imo2020P4.Company.linkage.startThe first station in a linkage line 63 sourceSource documentation
The first station in a linkage.
standard axioms: propext what this means
Statement uses:
Nat, Imo2020P4.Company, Imo2020P4.Company.linkage,Fin,HPow.hPow,OfNat.ofNatProof uses:
Imo2020P4.Car.start,Imo2020P4.Company.cars,List.head,Imo2020P4.Company.linkage.cars,Imo2020P4.Company.linkage.nonempty5 instances, coercions and auxiliary constants left out.
def Company.linkage.start {n k : ℕ} {c : Company n k} (x : c.linkage) : Fin (n ^ 2) := …Mentions: Imo2020P4.Company
- def
Imo2020P4.Company.linkage.finishThe last station in a linkage line 67 sourceSource documentation
The last station in a linkage.
standard axioms: propext what this means
Statement uses:
Nat, Imo2020P4.Company, Imo2020P4.Company.linkage,Fin,HPow.hPow,OfNat.ofNatProof uses:
Imo2020P4.Car.finish,Imo2020P4.Company.cars,List.getLast,Imo2020P4.Company.linkage.cars,Imo2020P4.Company.linkage.nonempty5 instances, coercions and auxiliary constants left out.
def Company.linkage.finish {n k : ℕ} {c : Company n k} (x : c.linkage) : Fin (n ^ 2) := …Mentions: Imo2020P4.Company
- def
Imo2020P4.Company.linkedThe property of two stations being linked (in the given order) line 71 sourceSource documentation
The property of two stations being linked (in the given order).
standard axioms: propext what this means
Statement uses:
Nat, Imo2020P4.Company,Fin,HPow.hPow,OfNat.ofNatProof uses:
Exists, Imo2020P4.Company.linkage,And,Eq, Imo2020P4.Company.linkage.start, Imo2020P4.Company.linkage.finish10 instances, coercions and auxiliary constants left out.
def Company.linked {n k : ℕ} (c : Company n k) (l h : Fin (n ^ 2)) : Prop := …Mentions: Imo2020P4.Company, h
- instance
Imo2020P4.instFintypeEdgeSetOfFiniteFintype G.edgeSetpreviously resolved via a noncomputable instance derived from finiteness of the vertex type (as still happens forSetLiketypes such asConnectedComponent) line 82 sourceSource comment
`Fintype G.edgeSet` previously resolved via a noncomputable instance derived from finiteness of the vertex type (as still happens for `SetLike` types such as `ConnectedComponent`). Recent mathlib only provides a computable instance requiring `[DecidableRel G.Adj]`, so we supply the noncomputable instance locally.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Finite,SimpleGraph,Fintype,Sym2,SimpleGraph.edgeSetProof uses:
Fintype.ofFinite3 instances, coercions and auxiliary constants left out.
noncomputable instance instFintypeEdgeSetOfFinite {V : Type*} [Finite V] (G : SimpleGraph V) : Fintype G.edgeSet := Fintype.ofFinite _ - lemma
Imo2020P4.Sym2.exists_mkline 85 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Sym2,Exists,Eq,Sym2.mkProof uses:
Membership.mem,Prod.fst,Quot.out,Prod,Sym2.Rel,Sym2.out_fst_mem,Exists.intro,Eq.mp,congrArg,propext,Sym2.mem_iff_exists2 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.SimpleGraph.sum_card_connectedComponent_eq_cardline 90 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fintype,SimpleGraph,Eq,Nat,Finset.sum,SimpleGraph.ConnectedComponent,Finset.univ,Nat.card,Subtype,Membership.mem,Fintype.cardProof uses:
Set.ncard,SimpleGraph.ConnectedComponent.supp,Finset.sum_congr,rfl,Finset,Eq.mpr,id,congrArg,Eq.symm,SetLike.coe_sort_coe,Nat.card_coe_set_eq,Set,Eq.rec,Eq.refl,SetLike,Set.Finite,Set.toFinite,Pairwise,Function.onFun,Disjointand 10 more21 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.SimpleGraph.sum_card_edgeFinset_toSimpleGraph_connectedComponent_eq_edgeFinset_cardline 108 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fintype,DecidableEq,SimpleGraph,Eq,Nat,Finset.sum,SimpleGraph.ConnectedComponent,Finset.univ,Finset.card,Sym2,Subtype,Membership.mem,SimpleGraph.edgeFinset,SimpleGraph.ConnectedComponent.toSimpleGraphProof uses:
Finset,Finset.image,Sym2.map,rfl,Finset.sum_congr,Eq.mpr,id,congrArg,Eq.symm,Finset.card_image_of_injective,Sym2.map.injective,Subtype.val_injective,Set.PairwiseDisjoint,Set,Ne,Function.onFun,Disjoint,Function.onFun.eq_1,Mathlib.Tactic.Contrapose.contrapose₂,Notand 39 more26 instances, coercions and auxiliary constants left out.
Tactic trace: 77 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.SimpleGraph.card_connectedComponent_add_card_edge_eq_card_vertex_of_acyclicline 182 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fintype,DecidableEq,SimpleGraph,SimpleGraph.IsAcyclic,Eq,Nat,HAdd.hAdd,Fintype.card,SimpleGraph.ConnectedComponent,Finset.card,Sym2,SimpleGraph.edgeFinsetProof uses:
Membership.mem,Finset,Finset.univ,Subtype,SimpleGraph.ConnectedComponent.toSimpleGraph,OfNat.ofNat,Nat.card,Eq.mpr,SimpleGraph.edgeSet,id,congrArg,Eq.symm,And.right,SimpleGraph.Connected,Iff.mp,SimpleGraph.IsTree,And,SimpleGraph.isTree_iff_connected_and_card,SimpleGraph.IsAcyclic.isTree_connectedComponent,HAddand 14 more25 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
- def
Imo2020P4.Company.graphline 196 sourcestandard axioms: Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,SimpleGraph,Fin,HPow.hPow,OfNat.ofNatProof uses:
SimpleGraph.mk,Exists,Eq,Sym2,Sym2.mk,Imo2020P4.Car.start,Imo2020P4.Company.cars,Imo2020P4.Car.finish12 instances, coercions and auxiliary constants left out.
Tactic trace: 14 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.Company.graph_edgeFinset_cardline 213 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,Eq,Finset.card,Sym2,Fin,HPow.hPow,OfNat.ofNat,SimpleGraph.edgeFinset, Imo2020P4.Company.graphProof uses:
Sym2.mk,Imo2020P4.Car.start,Imo2020P4.Company.cars,Imo2020P4.Car.finish,rfl,Finset,Finset.image,Finset.univ,Finset.ext,Exists,Iff,Membership.mem, Imo2020P4.Sym2.exists_mk,Eq.mpr,And,id,congrArg,propext,Finset.mem_image,Setand 32 more34 instances, coercions and auxiliary constants left out.
Tactic trace: 34 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.Company.graph_isAcyclicline 246 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,SimpleGraph.IsAcyclic,Fin,HPow.hPow,OfNat.ofNat, Imo2020P4.Company.graphProof uses:
SimpleGraph.Walk,SimpleGraph.Walk.IsCycle,Ne,List,SimpleGraph.Walk.support,List.nil,SimpleGraph.Walk.support_ne_nil,List.min,Eq,rfl,Membership.mem,LE.le,And,False,Iff.mp,List.min_eq_iff,Set.ncard,SimpleGraph.Subgraph.neighborSet,SimpleGraph.Walk.toSubgraph,SimpleGraph.Walk.IsCycle.ncard_neighborSet_toSubgraph_eq_twoand 45 more31 instances, coercions and auxiliary constants left out.
Tactic trace: 44 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.Company.low_le_of_mem_pathline 293 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,Fin,HPow.hPow,OfNat.ofNat,LT.lt,SimpleGraph.Walk, Imo2020P4.Company.graph,SimpleGraph.Walk.IsPath,Membership.mem,List,SimpleGraph.Walk.support,LE.leProof uses:
Ne,List.nil,SimpleGraph.Walk.support_ne_nil,List.min,Eq,rfl,And,Iff.mp,List.min_eq_iff,SimpleGraph.Walk.getVert,SimpleGraph.Walk.length,Exists,SimpleGraph.Walk.mem_support_iff_exists_getVert,dite,Eq.trans_le,Eq.mp,congrArg,SimpleGraph.Walk.getVert_zero,Not,lt_of_le_of_neand 49 more40 instances, coercions and auxiliary constants left out.
Tactic trace: 56 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.Company.le_high_of_mem_pathline 351 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,Fin,HPow.hPow,OfNat.ofNat,LT.lt,SimpleGraph.Walk, Imo2020P4.Company.graph,SimpleGraph.Walk.IsPath,Membership.mem,List,SimpleGraph.Walk.support,LE.leProof uses:
Ne,List.nil,SimpleGraph.Walk.support_ne_nil,List.max,Eq,rfl,And,Iff.mp,List.max_eq_iff,SimpleGraph.Walk.getVert,SimpleGraph.Walk.length,Exists,SimpleGraph.Walk.mem_support_iff_exists_getVert,dite,LE.le.trans_eq,Eq.symm,Eq.mp,congrArg,SimpleGraph.Walk.getVert_length,Notand 49 more40 instances, coercions and auxiliary constants left out.
Tactic trace: 57 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.Company.linked_of_graph_reachableline 410 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,Fin,HPow.hPow,OfNat.ofNat,SimpleGraph.Reachable, Imo2020P4.Company.graph,LT.lt, Imo2020P4.Company.linkedProof uses:
SimpleGraph.Walk,SimpleGraph.Walk.IsPath,Exists,SimpleGraph.Reachable.exists_isPath,SimpleGraph.Walk.rec,SimpleGraph.Walk.nil,Mathlib.Tactic.Contrapose.contrapose₁,Eq.mpr,Not,LE.le,id,Eq,implies_congr,Eq.refl,le_refl,SimpleGraph.Adj,SimpleGraph.Walk.cons,Membership.mem,List,SimpleGraph.Walk.supportand 55 more29 instances, coercions and auxiliary constants left out.
Tactic trace: 61 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.Company.lt_of_linkedline 475 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,Fin,HPow.hPow,OfNat.ofNat, Imo2020P4.Company.linked,LT.ltProof uses: Imo2020P4.Company.linkage,
And,Eq, Imo2020P4.Company.linkage.start, Imo2020P4.Company.linkage.finish,Exists,Eq.mp,congrArg,Imo2020P4.Company.linked.eq_1,List,Ne,List.nil,List.IsChain,Imo2020P4.Car.finish,Imo2020P4.Company.cars,Imo2020P4.Car.start,Imo2020P4.Company.linkage.mk,List.rec,Mathlib.Tactic.Contrapose.contrapose₂,Eq.mprand 29 more24 instances, coercions and auxiliary constants left out.
Tactic trace: 34 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.aux_succline 508 sourcestandard axioms: propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat,Eq,HAdd.hAdd,HSub.hSub,Membership.mem,SetProof uses:
Subtype.property,Nat.sub_add_cancel,le_of_lt,Eq.mp,LT.lt,congrArg,propext,Set.mem_Ioi15 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.aux_powline 514 sourcestandard axioms: propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat,Eq,HMul.hMul,Membership.mem,Set,HPow.hPowProof uses:
Eq.mpr,id,congrArg,pow_two,Eq.refl25 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.aux_Aline 517 sourcestandard axioms: propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat,Eq,HSub.hSub,HMul.hMul,Membership.mem,SetProof uses:
Eq.mpr,id,congrArg,Nat.sub_mul,one_mul,Eq.refl23 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.aux_Bline 520 sourcestandard axioms: propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat,Eq,HSub.hSub,HMul.hMul,Membership.mem,SetProof uses:
Eq.mpr,id,congrArg,Nat.mul_sub,mul_one,Eq.refl23 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- def
Imo2020P4.constructCompanyAline 523 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat, Imo2020P4.Company,Membership.mem,Set,HSub.hSub,HMul.hMulProof uses:
Imo2020P4.Company.mk,Fin,Imo2020P4.Car.mk,Fin.cast,HPow.hPow, Imo2020P4.aux_pow,Fin.mkDivMod,HAdd.hAdd, Imo2020P4.aux_succ,Fin.castSucc,Fin.divNat, Imo2020P4.aux_A,Fin.modNat,Fin.succ28 instances, coercions and auxiliary constants left out.
Tactic trace: 45 steps
Open to load the checked before-and-after goal states.
- def
Imo2020P4.constructCompanyBline 578 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat, Imo2020P4.Company,Membership.mem,Set,HSub.hSub,HMul.hMulProof uses:
Imo2020P4.Company.mk,Fin,Imo2020P4.Car.mk,Fin.cast,HPow.hPow, Imo2020P4.aux_pow,Fin.mkDivMod,Fin.divNat, Imo2020P4.aux_B,HAdd.hAdd, Imo2020P4.aux_succ,Fin.castSucc,Fin.modNat,Fin.succ28 instances, coercions and auxiliary constants left out.
Tactic trace: 45 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.cast_modNat_eq_of_linked_constructCompanyAline 633 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat,Fin,HPow.hPow,Membership.mem,Set, Imo2020P4.Company.linked,HSub.hSub,HMul.hMul, Imo2020P4.constructCompanyA,Eq,Fin.modNat,Fin.cast,Eq.symm, Imo2020P4.aux_powProof uses: Imo2020P4.Company.linkage,
And, Imo2020P4.Company.linkage.start, Imo2020P4.Company.linkage.finish,Exists,Eq.mp,congrArg,Imo2020P4.Company.linked.eq_1,List,Ne,List.nil,List.IsChain,Imo2020P4.Car.finish,Imo2020P4.Company.cars,Imo2020P4.Car.start,Imo2020P4.Company.linkage.mk,List.rec,Mathlib.Tactic.Contrapose.contrapose₂,id,Notand 34 more37 instances, coercions and auxiliary constants left out.
Tactic trace: 37 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.cast_divNat_eq_of_linked_constructCompanyBline 670 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat,Fin,HPow.hPow,Membership.mem,Set, Imo2020P4.Company.linked,HSub.hSub,HMul.hMul, Imo2020P4.constructCompanyB,Eq,Fin.divNat,Fin.cast,Eq.symm, Imo2020P4.aux_powProof uses: Imo2020P4.Company.linkage,
And, Imo2020P4.Company.linkage.start, Imo2020P4.Company.linkage.finish,Exists,Eq.mp,congrArg,Imo2020P4.Company.linked.eq_1,List,Ne,List.nil,List.IsChain,Imo2020P4.Car.finish,Imo2020P4.Company.cars,Imo2020P4.Car.start,Imo2020P4.Company.linkage.mk,List.rec,Mathlib.Tactic.Contrapose.contrapose₂,id,Notand 34 more37 instances, coercions and auxiliary constants left out.
Tactic trace: 37 steps
Open to load the checked before-and-after goal states.
- def
Imo2020P4.Company.subCompanyline 707 sourcestandard axioms: propext what this means
Statement uses:
Nat, Imo2020P4.Company,LE.leProof uses:
Imo2020P4.Company.mk,Fin,Imo2020P4.Company.cars,Fin.castLE5 instances, coercions and auxiliary constants left out.
Tactic trace: 15 steps
Open to load the checked before-and-after goal states.
- lemma
Imo2020P4.Company.linked_of_subCompany_linkedline 728 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat, Imo2020P4.Company,LE.le,Fin,HPow.hPow,OfNat.ofNat, Imo2020P4.Company.linked, Imo2020P4.Company.subCompanyProof uses:
Eq.mpr,Exists, Imo2020P4.Company.linkage,And,Eq, Imo2020P4.Company.linkage.start, Imo2020P4.Company.linkage.finish,id,congrArg,Imo2020P4.Company.linked.eq_1,Eq.mp,Exists.intro,Imo2020P4.Company.linkage.mk,List.map,Fin.castLE,Imo2020P4.Company.linkage.cars,Ne,List,List.nil,propextand 19 more18 instances, coercions and auxiliary constants left out.
Tactic trace: 23 steps
Open to load the checked before-and-after goal states.
- determine
Imo2020P4.answerline 759 sourceno axioms what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNatProof uses:
HAdd.hAdd,HSub.hSub,HMul.hMul,Membership.mem,Set14 instances, coercions and auxiliary constants left out.
- problem
Imo2020P4.imo2020_p4line 761 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Nat,Set.Ioi,OfNat.ofNat,IsLeast,Set.ofPred, Imo2020P4.Company,Membership.mem,Set,Exists,Fin,HPow.hPow,And, Imo2020P4.Company.linked, Imo2020P4.answerProof uses:
Subtype.property,Eq.mpr,HAdd.hAdd,HSub.hSub,HMul.hMul,id,Eq,congrArg,Imo2020P4.answer.eq_1,lowerBounds,IsLeast.eq_1,LE.le,lowerBounds.eq_1,And.intro,Fintype.card,SimpleGraph.ConnectedComponent, Imo2020P4.Company.graph,Finset.card,Sym2,SimpleGraph.edgeFinsetand 73 more62 instances, coercions and auxiliary constants left out.
Tactic trace: 75 steps
Open to load the checked before-and-after goal states.