Skip to content

Commit 87e803a

Browse files
committed
feat(Combinatorics/SimpleGraph/Hamiltonian): p.support.get and p.getVert define equivalences with Fin (#30149)
1 parent dd476c7 commit 87e803a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ lemma IsHamiltonian.length_support (hp : p.IsHamiltonian) : p.support.length = F
7676

7777
end
7878

79+
/-- If a path `p` is Hamiltonian, then `p.support.get` defines an equivalence between
80+
`Fin p.support.length` and `α`. -/
81+
@[simps!]
82+
def IsHamiltonian.supportGetEquiv (hp : p.IsHamiltonian) : Fin p.support.length ≃ α :=
83+
p.support.getEquivOfForallCountEqOne hp
84+
85+
/-- If a path `p` is Hamiltonian, then `p.getVert` defines an equivalence between
86+
`Fin p.support.length` and `α`. -/
87+
@[simps]
88+
def IsHamiltonian.getVertEquiv (hp : p.IsHamiltonian) : Fin p.support.length ≃ α where
89+
toFun := p.getVert ∘ Fin.val
90+
invFun := hp.supportGetEquiv.invFun
91+
left_inv := p.getVert_comp_val_eq_get_support ▸ hp.supportGetEquiv.left_inv
92+
right_inv := p.getVert_comp_val_eq_get_support ▸ hp.supportGetEquiv.right_inv
93+
7994
theorem isHamiltonian_iff_support_get_bijective : p.IsHamiltonian ↔ p.support.get.Bijective :=
8095
p.support.get_bijective_iff.symm
8196

0 commit comments

Comments
 (0)