Compfiles/Usa2021P2.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
55 declarations, 0 contain sorry, 0 declared as axioms
USA Mathematical Olympiad 2021, Problem 2
The Planar National Park is a subset of the Euclidean plane consisting of several trails which meet at junctions. Every trail has its two endpoints at two different junctions, whereas each junction is the endpoint of exactly three trails. Trails only intersect at junctions (in particular, trails only meet at endpoints). Finally, no trails begin and end at the same two junctions.
A visitor walks through the park as follows: she begins at a junction and starts walking along a trail. At the end of that first trail, she enters a junction and turns left. On the next junction she turns right, and so on, alternating left and right turns at each junction. She does this until she gets back to the junction where she started. What is the largest possible number of times she could have entered any junction during her walk, over all possible layouts of the park?
Formalization notes
A park is axiomatized below as a finite simple 3-regular graph equipped with a
rotation system (Park). The example park Park.wangPark is the example of
Danielle Wang from the official solution.
Imports (4)
Imported by 1 file
- structure
Usa2021P2.ParkDocumented declaration: Park line 53 sourceSource documentation
A park: the combinatorial data of the Planar National Park, namely a finite simple graph (the junctions and trails) that is 3-regular (each junction is the endpoint of exactly three trails), together with a rotation system
rotgiving the cyclic order of the three trails at each junction (as provided by a planar layout;rot vsends each neighbour ofvto the next one clockwise).Turning "left" at a junction
v, having arrived fromu, means leaving towardsrot v u; turning "right" means leaving towardsrot v (rot v u).standard axioms: Classical.choice, Quot.sound, propext what this means
structure Park where …
- instance
Usa2021P2.Park.(instance at line 70)line 70 source - instance
Usa2021P2.Park.(instance at line 71)line 71 source - instance
Usa2021P2.Park.(instance at line 72)line 72 source - def
Usa2021P2.Park.turnLeaving junctionv(having arrived fromu) by the trail on the left (p = true) or on the right (p = false) line 78 sourceSource documentation
Leaving junction
v(having arrived fromu) by the trail on the left (p = true) or on the right (p = false).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Usa2021P2.Park.V,BoolProof uses:
cond,Usa2021P2.Park.rotdef turn (v u : P.V) (p : Bool) : P.V := …
- lemma
Usa2021P2.Park.turn_adjline 81 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Usa2021P2.Park.V,SimpleGraph.Adj,Usa2021P2.Park.G,Bool, Usa2021P2.Park.turnProof uses:
Eq,Bool.false,Usa2021P2.Park.rot_adj,Usa2021P2.Park.rot,Eq.symm,Bool.true,Eq.refl2 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.rot_inv_neline 87 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Usa2021P2.Park.V,SimpleGraph.Adj,Usa2021P2.Park.G,Ne,Usa2021P2.Park.rotProof uses:
Eq,Usa2021P2.Park.rot_inv,Usa2021P2.Park.rot_ne,Eq.mp,congrArgTactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.turn_neThe visitor never leaves a junction by the trail she arrived on line 94 sourceSource documentation
The visitor never leaves a junction by the trail she arrived on.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Usa2021P2.Park.V,SimpleGraph.Adj,Usa2021P2.Park.G,Bool,Ne, Usa2021P2.Park.turnProof uses:
Eq,Bool.false, Usa2021P2.Park.rot_inv_ne,Eq.symm,Bool.true,Usa2021P2.Park.rot_ne,Eq.refl2 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
lemma turn_ne {u v : P.V} (h : P.G.Adj v u) (p : Bool) : P.turn v u p ≠ u := by …Mentions: h
- lemma
Usa2021P2.Park.turn_inv_turnTurning one way and then, from the same junction, the other way undoes the turn:rotandrot ∘ rotare inverse 3-cycles on the neighbours line 101 sourceSource documentation
Turning one way and then, from the same junction, the other way undoes the turn:
rotandrot ∘ rotare inverse 3-cycles on the neighbours.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Usa2021P2.Park.V,SimpleGraph.Adj,Usa2021P2.Park.G,Bool,Eq, Usa2021P2.Park.turn,Bool.notProof uses:
Bool.false,Usa2021P2.Park.rot_inv,Eq.symm,Bool.true,Eq.refl2 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
lemma turn_inv_turn {u v : P.V} (h : P.G.Adj v u) (p : Bool) : P.turn v (P.turn v u p) (!p) = u := by …Mentions: h
- lemma
Usa2021P2.Park.turn_injline 105 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Usa2021P2.Park.V,SimpleGraph.Adj,Usa2021P2.Park.G,Bool,Eq, Usa2021P2.Park.turnProof uses:
Bool.not,congrArg,Eq.mp, Usa2021P2.Park.turn_inv_turnTactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.turn_not_two_cycleA turn and its mirror image cannot both be turns in the same direction: the 3-cycleturn v · phas no 2-cycle line 113 sourceSource documentation
A turn and its mirror image cannot both be turns in the same direction: the 3-cycle
turn v · phas no 2-cycle.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Usa2021P2.Park.V,SimpleGraph.Adj,Usa2021P2.Park.G,Bool,Eq, Usa2021P2.Park.turn,FalseProof uses:
Bool.false,Usa2021P2.Park.rot,Eq.mpr,id,congrArg,Eq.refl,Usa2021P2.Park.rot_inv,Usa2021P2.Park.rot_ne,Eq.mp,Eq.symm,Bool.true, Usa2021P2.Park.rot_inv_ne2 instances, coercions and auxiliary constants left out.
Tactic trace: 19 steps
Open to load the checked before-and-after goal states.
lemma turn_not_two_cycle {a c v : P.V} (ha : P.G.Adj v a) (p : Bool) (hac : P.turn v a p = c) (hca : P.turn v c p = a) : False := by … - def
Usa2021P2.Park.ValidThe states of the visitor that occur in a walk: the junction she came from and the junction she has just entered are joined by a trail line 136 sourceSource documentation
The states of the visitor that occur in a walk: the junction she came from and the junction she has just entered are joined by a trail. The last component is the direction of her next turn (
true= left).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,BoolProof uses:
SimpleGraph.Adj,Usa2021P2.Park.G,Prod.fst,Prod.snddef Valid (σ : P.V × P.V × Bool) : Prop := P.G.Adj σ.2.1 σ.1
- instance
Usa2021P2.Park.(instance at line 138)line 138 source - def
Usa2021P2.Park.stepOne step of the walk: turn at the current junction and traverse the chosen trail; the next turn has the opposite direction line 143 sourceSource documentation
One step of the walk: turn at the current junction and traverse the chosen trail; the next turn has the opposite direction.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,BoolProof uses:
Prod.mk,Prod.fst,Prod.snd, Usa2021P2.Park.turn,Bool.notdef step (σ : P.V × P.V × Bool) : P.V × P.V × Bool := …
- def
Usa2021P2.Park.stepInvThe inverse step: the process is deterministic in both directions line 147 sourceSource documentation
The inverse step: the process is deterministic in both directions.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,BoolProof uses:
Prod.mk, Usa2021P2.Park.turn,Prod.fst,Prod.snd,Bool.notdef stepInv (σ : P.V × P.V × Bool) : P.V × P.V × Bool := …
- lemma
Usa2021P2.Park.valid_stepline 150 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid, Usa2021P2.Park.stepProof uses:
SimpleGraph.Adj.symm,Usa2021P2.Park.G,Prod.fst,Prod.snd, Usa2021P2.Park.turn, Usa2021P2.Park.turn_adj - lemma
Usa2021P2.Park.valid_stepInvline 153 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid, Usa2021P2.Park.stepInvProof uses: Usa2021P2.Park.turn_adj,
Prod.fst,Prod.snd,SimpleGraph.Adj.symm,Usa2021P2.Park.G - lemma
Usa2021P2.Park.stepInv_stepline 156 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Eq, Usa2021P2.Park.stepInv, Usa2021P2.Park.stepProof uses:
Prod.mk,Prod.ext, Usa2021P2.Park.turn_inv_turn,Prod.fst,Prod.snd,rfl,Bool.not_not1 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.step_stepInvline 161 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Eq, Usa2021P2.Park.step, Usa2021P2.Park.stepInvProof uses:
Prod.mk,Prod.ext,rfl,Prod.fst,Prod.snd, Usa2021P2.Park.turn_inv_turn,SimpleGraph.Adj.symm,Usa2021P2.Park.G,Bool.not_not1 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.step_injectiveline 166 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Eq, Usa2021P2.Park.stepProof uses:
Eq.mpr, Usa2021P2.Park.stepInv,id,congrArg,Eq.symm, Usa2021P2.Park.stepInv_step,Eq.reflTactic trace: 1 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.valid_walkline 170 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Nat,Nat.iterate, Usa2021P2.Park.stepProof uses:
Nat.recAux,Eq.mpr,HAdd.hAdd,OfNat.ofNat,id,Eq,congrArg,Nat.succ,Function.iterate_succ_apply', Usa2021P2.Park.valid_step3 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.parity_walkThe direction of the turns alternates between left and right line 177 sourceSource documentation
The direction of the turns alternates between left and right.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool,Nat,Eq,Prod.snd,Nat.iterate, Usa2021P2.Park.step,ite,Even,Bool.notProof uses:
Nat.recAux,of_eq_true,OfNat.ofNat,Eq.trans,True,congrArg,ite_eq_left_of_eq_true,eq_self,Eq.mpr,HAdd.hAdd,id,Nat.succ,Function.iterate_succ_apply',dite,ite_eq_left,ite_eq_right,Not,False,eq_true,not_true_eq_falseand 4 more10 instances, coercions and auxiliary constants left out.
Tactic trace: 12 steps
Open to load the checked before-and-after goal states.
lemma parity_walk (σ₀ : P.V × P.V × Bool) (k : ℕ) : (P.step^[k] σ₀).2.2 = if Even k then σ₀.2.2 else !σ₀.2.2 := by … - lemma
Usa2021P2.Park.stepInv_iterateline 189 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Nat,LE.le,Eq,Nat.iterate, Usa2021P2.Park.stepInv, Usa2021P2.Park.step,HSub.hSubProof uses:
Nat.recAux,OfNat.ofNat,Eq.refl,HAdd.hAdd,Eq.mpr,id,Eq.rec,Eq.trans,congrArg,Nat.succ,Function.iterate_succ_apply', Usa2021P2.Park.stepInv_step, Usa2021P2.Park.valid_walk,Function.iterate_succ_apply12 instances, coercions and auxiliary constants left out.
Tactic trace: 13 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.eq_of_walk_eqIf two iterates of the walk agree, the orbit has closed up with periodj - iline 206 sourceSource documentation
If two iterates of the walk agree, the orbit has closed up with period
j - i.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Nat,LE.le,Eq,Nat.iterate, Usa2021P2.Park.step,HSub.hSubProof uses: Usa2021P2.Park.stepInv, Usa2021P2.Park.stepInv_iterate,
le_rfl,Eq.mp,OfNat.ofNat,congrArg,Nat.sub_self8 instances, coercions and auxiliary constants left out.
Tactic trace: 6 steps
Open to load the checked before-and-after goal states.
lemma eq_of_walk_eq {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) {i j : ℕ} (hij : i ≤ j) (h : P.step^[i] σ₀ = P.step^[j] σ₀) : P.step^[j - i] σ₀ = σ₀ := by …Mentions: h
- lemma
Usa2021P2.Park.exists_periodThe walk is periodic: some positive iterate returns to the initial state line 216 sourceSource documentation
The walk is periodic: some positive iterate returns to the initial state.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Exists,Nat,And,GT.gt,OfNat.ofNat,Eq,Nat.iterate, Usa2021P2.Park.stepProof uses:
Membership.mem,Finset,Finset.range,HAdd.hAdd,Fintype.card,Subtype,Ne,Subtype.mk, Usa2021P2.Park.valid_walk,Finset.exists_ne_map_eq_of_card_lt_of_maps_to,Finset.univ,Eq.mpr,LT.lt,Finset.card,id,congrArg,Finset.card_range,Set,Finset.mem_univ,LE.leand 7 more28 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
lemma exists_period {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) : ∃ T > 0, P.step^[T] σ₀ = σ₀ := by … - def
Usa2021P2.Park.periodThe (minimal) period of the walk fromσ₀line 232 sourceSource documentation
The (minimal) period of the walk from
σ₀.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,NatProof uses:
Nat.find,And,GT.gt,OfNat.ofNat,Eq,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.exists_period7 instances, coercions and auxiliary constants left out.
noncomputable def period {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) : ℕ := … - lemma
Usa2021P2.Park.period_posline 235 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,LT.lt,Nat,OfNat.ofNat, Usa2021P2.Park.periodProof uses:
And.left,GT.gt,Nat.find,And,Eq,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.exists_period,Nat.find_spec9 instances, coercions and auxiliary constants left out.
- lemma
Usa2021P2.Park.period_eqline 238 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Eq,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.periodProof uses:
And.right,GT.gt,Nat,Nat.find,And,OfNat.ofNat, Usa2021P2.Park.exists_period,Nat.find_spec7 instances, coercions and auxiliary constants left out.
- lemma
Usa2021P2.Park.period_ne_of_ltline 242 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Nat,LT.lt,OfNat.ofNat, Usa2021P2.Park.period,Ne,Nat.iterate, Usa2021P2.Park.stepProof uses:
Eq,LE.le,Nat.find_min',And,GT.gt, Usa2021P2.Park.exists_period,And.intro11 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.walk_inj_of_lt_periodThe iterates of the walk within one period are pairwise distinct line 249 sourceSource documentation
The iterates of the walk within one period are pairwise distinct.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Nat,LT.lt, Usa2021P2.Park.period,Eq,Nat.iterate, Usa2021P2.Park.stepProof uses:
LE.le,Or,le_total,eq_or_lt_of_le,Eq.refl,absurd,HSub.hSub, Usa2021P2.Park.eq_of_walk_eq, Usa2021P2.Park.period_ne_of_lt,Eq.symm16 instances, coercions and auxiliary constants left out.
Tactic trace: 17 steps
Open to load the checked before-and-after goal states.
lemma walk_inj_of_lt_period {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) {i j : ℕ} (hi : i < P.period h₀) (hj : j < P.period h₀) (h : P.step^[i] σ₀ = P.step^[j] σ₀) : i = j := by …Mentions: h
- lemma
Usa2021P2.Park.one_lt_periodThe period is at least two: one step never returns to the initial state line 261 sourceSource documentation
The period is at least two: one step never returns to the initial state.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,LT.lt,Nat,OfNat.ofNat, Usa2021P2.Park.periodProof uses: Usa2021P2.Park.period_pos,
Decidable.byContradiction,Not,Eq,Eq.mp,LE.le,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.period_eq,False,Prod.mk,congrArg,Prod.fst,SimpleGraph.Adj.ne,Usa2021P2.Park.G,Prod.snd12 instances, coercions and auxiliary constants left out.
Tactic trace: 10 steps
Open to load the checked before-and-after goal states.
lemma one_lt_period {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) : 1 < P.period h₀ := by … - lemma
Usa2021P2.Park.return_at_period_sub_oneThe walk enters the starting junction again one step before the period line 273 sourceSource documentation
The walk enters the starting junction again one step before the period.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,And,LT.lt,Nat,OfNat.ofNat,HSub.hSub, Usa2021P2.Park.period,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.stepProof uses: Usa2021P2.Park.one_lt_period,
And.intro, Usa2021P2.Park.period_eq,Eq.mp,Nat.succ,congrArg,Function.iterate_succ_apply',HAdd.hAdd, Usa2021P2.Park.stepInv, Usa2021P2.Park.step_injective, Usa2021P2.Park.valid_walk, Usa2021P2.Park.valid_stepInv,Eq.trans,Eq.symm, Usa2021P2.Park.step_stepInv,Eq.mpr,id,Eq.refl12 instances, coercions and auxiliary constants left out.
Tactic trace: 11 steps
Open to load the checked before-and-after goal states.
lemma return_at_period_sub_one {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) : 0 < P.period h₀ - 1 ∧ (P.step^[P.period h₀ - 1] σ₀).2.1 = σ₀.1 := by … - lemma
Usa2021P2.Park.exists_returnThe visitor always gets back to the junction where she started line 289 sourceSource documentation
The visitor always gets back to the junction where she started.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Exists,Nat,And,GT.gt,OfNat.ofNat,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.stepProof uses:
Exists.intro,HSub.hSub, Usa2021P2.Park.period,And.intro,And.left,LT.lt, Usa2021P2.Park.return_at_period_sub_one,And.right6 instances, coercions and auxiliary constants left out.
lemma exists_return {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) : ∃ k > 0, (P.step^[k] σ₀).2.1 = σ₀.1 := … - def
Usa2021P2.Park.retTimeThe first time (> 0) at which the walk re-enters the starting junction line 294 sourceSource documentation
The first time (
> 0) at which the walk re-enters the starting junction.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,NatProof uses:
Nat.find,And,GT.gt,OfNat.ofNat,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.exists_return5 instances, coercions and auxiliary constants left out.
noncomputable def retTime {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) : ℕ := … - lemma
Usa2021P2.Park.retTime_posline 297 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,LT.lt,Nat,OfNat.ofNat, Usa2021P2.Park.retTimeProof uses:
And.left,GT.gt,Nat.find,And,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.exists_return,Nat.find_spec7 instances, coercions and auxiliary constants left out.
- lemma
Usa2021P2.Park.retTime_eqline 300 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.retTimeProof uses:
And.right,GT.gt,Nat,Nat.find,And,OfNat.ofNat, Usa2021P2.Park.exists_return,Nat.find_spec5 instances, coercions and auxiliary constants left out.
- lemma
Usa2021P2.Park.retTime_minline 304 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Nat,LT.lt,OfNat.ofNat, Usa2021P2.Park.retTime,Ne,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.stepProof uses:
Eq,LE.le,Nat.find_min',And,GT.gt, Usa2021P2.Park.exists_return,And.intro9 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.retTime_le_period_sub_oneline 310 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,LE.le,Nat, Usa2021P2.Park.retTime,HSub.hSub, Usa2021P2.Park.period,OfNat.ofNatProof uses:
Nat.find_min',And,GT.gt,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.exists_return, Usa2021P2.Park.return_at_period_sub_one11 instances, coercions and auxiliary constants left out.
- def
Usa2021P2.Park.entriesDocumented declaration: entries line 317 sourceSource documentation
The number of times the visitor enters junction
vduring her walk, from the initial stateσ₀until she gets back to the starting junction (the final re-entry into the starting junction counts, the departure from it does not).standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,NatProof uses:
HAdd.hAdd,Finset.card,Finset.filter,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step,Finset.range, Usa2021P2.Park.retTime,ite,OfNat.ofNat4 instances, coercions and auxiliary constants left out.
noncomputable def entries (σ₀ : P.V × P.V × Bool) (h₀ : P.Valid σ₀) (v : P.V) : ℕ := …
- theorem
Usa2021P2.Park.no_mirrorThe key lemma: a trajectory never contains a turn and its mirror image, i.e. turnsa → b → candc → b → athrough the same junction line 325 sourceSource documentation
The key lemma: a trajectory never contains a turn and its mirror image, i.e. turns
a → b → candc → b → athrough the same junction. Otherwise the turns adjacent to them atcwould again be mirror images of each other, with a strictly smaller gap — an infinite descent.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Nat,LE.le,OfNat.ofNat,Eq,Nat.iterate, Usa2021P2.Park.step,Prod.mk,HAdd.hAdd, Usa2021P2.Park.turn,FalseProof uses:
Nat.strongRecOn,LT.lt,SimpleGraph.Adj,Usa2021P2.Park.G, Usa2021P2.Park.valid_walk,Eq.mp,congrArg,Eq.rec, Usa2021P2.Park.turn_adj,GE.ge,Or,Nat.lt_or_ge,Prod.fst,Nat.succ,Function.iterate_succ_apply',SimpleGraph.Adj.ne,Bool.not,dite,False.elim, Usa2021P2.Park.turn_not_two_cycle and 32 more25 instances, coercions and auxiliary constants left out.
Tactic trace: 68 steps
Open to load the checked before-and-after goal states.
theorem no_mirror {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) : ∀ n : ℕ, ∀ (i : ℕ) (a b c : P.V) (p q : Bool), 1 ≤ n → P.step^[i] σ₀ = (a, (b, p)) → P.step^[i + n] σ₀ = (c, (b, q)) → P.turn b a p = c → P.turn b c q = a → False := by … - theorem
Usa2021P2.Park.arrivals_le_threeDocumented declaration: arrivals_le_three line 390 sourceSource documentation
In one period of the walk, any junction is entered at most three times: the (at most six) turns at
vpair up into three mirror pairs, of which at most one turn each can occur byno_mirror.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,LE.le,Nat,Finset.card,Finset.filter,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step,Finset.range, Usa2021P2.Park.period,OfNat.ofNatProof uses:
Finset,Eq.mpr,id,congrArg,rfl,Prod.mk,SProd.sprod,SimpleGraph.Adj,Usa2021P2.Park.G,Finset.univ,HMul.hMul,Finset.card_product,Usa2021P2.Park.decidableAdj,Usa2021P2.Park.fintypeV,Usa2021P2.Park.cubic,Fintype.card,Finset.card_univ,Fintype.card_bool,Eq.refl,Set.MapsToand 54 more49 instances, coercions and auxiliary constants left out.
Tactic trace: 119 steps
Open to load the checked before-and-after goal states.
theorem arrivals_le_three {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) (v : P.V) : ((Finset.range (P.period h₀)).filter fun k ↦ (P.step^[k] σ₀).2.1 = v).card ≤ 3 := by … - theorem
Usa2021P2.Park.entries_le_threeThe visitor enters any junction at most three times during her walk line 517 sourceSource documentation
The visitor enters any junction at most three times during her walk.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park,
Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,LE.le,Nat, Usa2021P2.Park.entries,OfNat.ofNatProof uses:
id,dite,HAdd.hAdd,Finset.card,Finset.filter,Eq,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step,Finset.range, Usa2021P2.Park.retTime,ite,Eq.mpr,congrArg,ite_eq_left,Finset,EmptyCollection.emptyCollection,Not,Membership.memand 31 more20 instances, coercions and auxiliary constants left out.
Tactic trace: 20 steps
Open to load the checked before-and-after goal states.
theorem entries_le_three {σ₀ : P.V × P.V × Bool} (h₀ : P.Valid σ₀) (v : P.V) : P.entries σ₀ h₀ v ≤ 3 := by … - def
Usa2021P2.Park.wangEdgesDocumented declaration: wangEdges line 546 sourceSource documentation
The example of Danielle Wang from the official solution: a park with ten junctions
A, B, ..., J(numbered0through9) in which the visitor enters junctionA = 0three times. (This rotation system is planar — it has seven faces, so10 - 15 + 7 = 2— hence it really comes from a planar layout, though the formal statement does not require this.)standard axioms: propext what this means
Statement uses:
List,Prod,Fin,OfNat.ofNat,NatProof uses:
List.cons,Prod.mk,List.nil4 instances, coercions and auxiliary constants left out.
def wangEdges : List (Fin 10 × Fin 10) := …
- def
Usa2021P2.Park.wangAdjline 550 sourcestandard axioms: propext what this means
Statement uses:
Fin,OfNat.ofNat,NatProof uses:
Or,Membership.mem,Prod,List, Usa2021P2.Park.wangEdges,Prod.mk3 instances, coercions and auxiliary constants left out.
- instance
Usa2021P2.Park.(instance at line 552)line 552 source - def
Usa2021P2.Park.wangGline 555 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
SimpleGraph,Fin,OfNat.ofNat,NatProof uses:
SimpleGraph.mk, Usa2021P2.Park.wangAdj4 instances, coercions and auxiliary constants left out.
Tactic trace: 3 steps
Open to load the checked before-and-after goal states.
- instance
Usa2021P2.Park.(instance at line 562)line 562 source - def
Usa2021P2.Park.wangRotNThe cyclic order of the trails at each junction ofwangParkline 566 sourceSource documentation
The cyclic order of the trails at each junction of
wangPark.no axioms what this means
Statement uses:
NatProof uses:
Usa2021P2.Park.wangRotN.match_1,Unit,OfNat.ofNat1 instances, coercions and auxiliary constants left out.
def wangRotN : ℕ → ℕ → ℕ | 0, 1 => 2 | 0, 2 => 7 | 0, 7 => 1 | 1, 0 => 9 | 1, 3 => 0 | 1, 9 => 3 | 2, 0 => 3 | 2, 3 => 4 | 2, 4 => 0 | 3, 1 => 6 | 3, 2 => 1 | 3, 6 => 2 | 4, 2 => 5 | 4, 5 => 7 | 4, 7 => 2 | 5, 4 => 6 | 5, 6 => 8 | 5, 8 => 4 | 6, 3 => 9 | 6, 5 => 3 | 6, 9 => 5 | 7, 0 => 4 | 7, 4 => 8 | 7, 8 => 0 | 8, 5 => 9 | 8, 7 => 5 | 8, 9 => 7 | 9, 1 => 8 | 9, 6 => 1 | 9, 8 => 6 | _, _ => 0
- def
Usa2021P2.Park.wangRotline 579 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Fin,OfNat.ofNat,NatProof uses:
Fin.mk,HMod.hMod, Usa2021P2.Park.wangRotN6 instances, coercions and auxiliary constants left out.
Tactic trace: 1 steps
Open to load the checked before-and-after goal states.
- def
Usa2021P2.Park.wangParkline 582 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park
Proof uses:
Usa2021P2.Park.mk,Fin,OfNat.ofNat,Nat,inferInstance,Fintype,DecidableEq, Usa2021P2.Park.wangG,DecidableRel,SimpleGraph.Adj, Usa2021P2.Park.wangRot8 instances, coercions and auxiliary constants left out.
Tactic trace: 4 steps
Open to load the checked before-and-after goal states.
- lemma
Usa2021P2.Park.wang_validline 594 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses: Usa2021P2.Park.Valid, Usa2021P2.Park.wangPark,
Prod.mk,Fin,OfNat.ofNat,Nat,Prod,Bool,Bool.trueProof uses:
id,of_decide_eq_true, Usa2021P2.Park.wangAdj,Eq,Decidable.decide,Eq.refl7 instances, coercions and auxiliary constants left out.
Tactic trace: 2 steps
Open to load the checked before-and-after goal states.
- theorem
Usa2021P2.Park.wang_entriesDocumented declaration: wang_entries line 601 sourceSource documentation
Starting from junction
C = 2along the trail toA = 0, the visitor's walk isC A H I F G D B A H E F G J B A C: she gets back toCafter 16 trails, having entered junctionAthree times.standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Eq,Nat, Usa2021P2.Park.entries, Usa2021P2.Park.wangPark,Prod.mk,Fin,OfNat.ofNat,Prod,Bool,Bool.true, Usa2021P2.Park.wang_validProof uses: Usa2021P2.Park.retTime,
Iff.mpr,Nat.find,And,GT.gt,Usa2021P2.Park.V,Prod.fst,Prod.snd,Nat.iterate, Usa2021P2.Park.step, Usa2021P2.Park.exists_return,LT.lt,Not,Nat.find_eq_iff,And.intro,of_decide_eq_true,id,Decidable.decide,Eq.refl,Eq.mprand 9 more15 instances, coercions and auxiliary constants left out.
Tactic trace: 5 steps
Open to load the checked before-and-after goal states.
theorem wang_entries : wangPark.entries ((2, 0, true) : Fin 10 × Fin 10 × Bool) wang_valid (0 : Fin 10) = 3 := by …Mentions: Usa2021P2.Park.wang_valid
- def
Usa2021P2.numberOfEntriesThe set of all possible numbers of times the visitor could have entered a junction during her walk, over all parks and all choices of starting junction and first trail line 615 sourceSource documentation
The set of all possible numbers of times the visitor could have entered a junction during her walk, over all parks and all choices of starting junction and first trail.
standard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
Set,NatProof uses:
Set.ofPred,Exists, Usa2021P2.Park,Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Eq, Usa2021P2.Park.entriesdef numberOfEntries : Set ℕ := …
- determine
Usa2021P2.solutionline 619 sourceno axioms what this means
Statement uses:
NatProof uses:
OfNat.ofNat1 instances, coercions and auxiliary constants left out.
- problem
Usa2021P2.usa2021_p2line 621 sourcestandard axioms: Classical.choice, Quot.sound, propext what this means
Statement uses:
IsGreatest,Nat, Usa2021P2.numberOfEntries, Usa2021P2.solutionProof uses:
And.intro,Membership.mem,Set,upperBounds,Exists.intro, Usa2021P2.Park,Exists,Prod,Usa2021P2.Park.V,Bool, Usa2021P2.Park.Valid,Eq, Usa2021P2.Park.entries, Usa2021P2.Park.wangPark,Prod.mk,Fin,OfNat.ofNat,Bool.true, Usa2021P2.Park.wang_valid, Usa2021P2.Park.wang_entries and 2 more8 instances, coercions and auxiliary constants left out.
Tactic trace: 7 steps
Open to load the checked before-and-after goal states.