Lean4
/-- The equivalence between `AddCircle p` and the quotient of `[a, a + p]` by the relation
identifying the endpoints. -/
def equivIccQuot : 𝕋 ≃ Quot (EndpointIdent p a)
where
toFun x := Quot.mk _ <| inclusion Ico_subset_Icc_self (equivIco _ _ x)
invFun
x :=
Quot.liftOn x (↑) <| by
rintro _ _ ⟨_⟩
exact (coe_add_period p a).symm
left_inv := (equivIco p a).symm_apply_apply
right_inv :=
Quot.ind <| by
rintro ⟨x, hx⟩
rcases ne_or_eq x (a + p) with (h | rfl)
· revert x
dsimp only
intro x hx h
congr
ext1
apply congr_arg Subtype.val ((equivIco p a).right_inv ⟨x, hx.1, hx.2.lt_of_ne h⟩)
· rw [← Quot.sound EndpointIdent.mk]
dsimp only
congr
ext1
apply congr_arg Subtype.val ((equivIco p a).right_inv ⟨a, le_refl a, lt_add_of_pos_right a hp.out⟩)