Commit 2026-10-28 15:03 4ec03747
View on Github →refactor: FreeMonoid as a one-field structure (#45212)
Implement the second point in https://github.com/leanprover-community/mathlib4/pull/36934#discussion_r4345214702:
structure FreeMonoid (α : Type*) where
/-- Convert a `List α` to a `FreeMonoid α`. -/
ofList ::
/-- The underlying list -/
toList : List α
mulRecOn and the two following lemmas about it were filled in by GPT-6.1 Sol. Their names, as well as the current mulCasesOn, were changed because now that FreeMonoid is a structure, FreeMonoid.rec(On) and FreeMonoid.casesOn are auto-generated.
Declarations about FreeMonoid.length/mem/reverse are all deprecated. Use list membership and List.reverse on toList-converted FreeMonoid objects and the StarMul instance in Mathlib.Algebra.Star.Free instead.
New declarations are FreeMonoid.toListEquiv and Cardinal.mk_freeMonoid_eq_mk_list.