import Mathlib.Algebra.FreeAlgebra import Mathlib.RingTheory.Congruence.Hom import Mathlib.GroupTheory.FinitelyPresentedGroup import Mathlib.Basic.Complex.Basic namespace OAI /-! Section 2 bridge. All algebras here are associative, unital, and may be noncommutative. The defining congruence is generated by finitely many equations in a free associative algebra; no commutative finite-presentation API is used. -/ noncomputable section namespace LittleFinitistic.GroupAlgebraPresentation variable (R : Type*) [CommRing R] (α : Type*) /-- A representative word, chosen only to turn a group relator into a polynomial. -/ def word (g : FreeGroup α) : List (α × Bool) := Classical.choose (Quot.exists_rep g) theorem word_spec (g : FreeGroup α) : FreeGroup.mk (word α g) = g := Classical.choose_spec (Quot.exists_rep g) def polynomial (g : FreeGroup α) : FreeAlgebra R (α × Bool) := ((word α g).map (FreeAlgebra.ι R)).prod variable {α R} theorem eval_polynomial {A : Type*} [Ring A] [Algebra R A] (f : α → Aˣ) (F : FreeAlgebra R (α × Bool) →ₐ[R] A) (hf : ∀ a b, F (FreeAlgebra.ι R (a,b)) = ↑(if b then f a else (f a)⁻¹)) (g : FreeGroup α) : F (polynomial R α g) = ↑(FreeGroup.lift f g) := by conv_rhs => rw [← word_spec α g] simp only [polynomial, map_list_prod, List.map_map, FreeGroup.lift_mk] induction word α g with | nil => simp | cons a l ih => rcases a with ⟨a,b⟩ simp only [List.map_cons, List.prod_cons, Function.comp_apply, Units.val_mul] rw [hf, ih] cases b <;> rfl variable (R α) (rels : Set (FreeGroup α)) abbrev Letter := α × Bool abbrev EquationIndex := (α × Bool) ⊕ rels /-- Two inverse equations per generator, and one polynomial per group relator. -/ def equation : EquationIndex α rels → FreeAlgebra R (Letter α) | .inl (a,b) => FreeAlgebra.ι R (a,b) * FreeAlgebra.ι R (a,!b) | .inr r => polynomial R α r def relations : RingCon (FreeAlgebra R (Letter α)) := ringConGen (fun x y => ∃ i : EquationIndex α rels, x = equation R α rels i ∧ y = 1) abbrev PresentedAlgebra := (relations R α rels).Quotient def quotientMap : FreeAlgebra R (Letter α) →ₐ[R] PresentedAlgebra R α rels := (relations R α rels).mkₐ R theorem equation_holds (i : EquationIndex α rels) : quotientMap R α rels (equation R α rels i) = 1 := by exact (relations R α rels).eq.mpr (RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩) def generatorUnit (a : α) : (PresentedAlgebra R α rels)ˣ where val := quotientMap R α rels (FreeAlgebra.ι R (a,true)) inv := quotientMap R α rels (FreeAlgebra.ι R (a,false)) val_inv := by simpa [equation, map_mul] using equation_holds R α rels (.inl (a,true)) inv_val := by simpa [equation, map_mul] using equation_holds R α rels (.inl (a,false)) theorem quotient_letter (a : α) (b : Bool) : quotientMap R α rels (FreeAlgebra.ι R (a,b)) = ↑(if b then generatorUnit R α rels a else (generatorUnit R α rels a)⁻¹) := by cases b <;> rfl theorem unit_relator (r : FreeGroup α) (hr : r ∈ rels) : FreeGroup.lift (generatorUnit R α rels) r = 1 := by apply Units.ext rw [← eval_polynomial _ _ (quotient_letter R α rels)] exact equation_holds R α rels (.inr ⟨r,hr⟩) def groupToUnits : PresentedGroup rels →* (PresentedAlgebra R α rels)ˣ := PresentedGroup.toGroup (unit_relator R α rels) def fromGroupAlgebra : MonoidAlgebra R (PresentedGroup rels) →ₐ[R] PresentedAlgebra R α rels := MonoidAlgebra.lift R _ _ ((Units.coeHom _).comp (groupToUnits R α rels)) def groupAlgebraUnit (a : α) : (MonoidAlgebra R (PresentedGroup rels))ˣ := (MonoidAlgebra.of R (PresentedGroup rels)).toHomUnits (PresentedGroup.of a) def evaluation : FreeAlgebra R (Letter α) →ₐ[R] MonoidAlgebra R (PresentedGroup rels) := FreeAlgebra.lift R (fun (a,b) => ↑(if b then groupAlgebraUnit R α rels a else (groupAlgebraUnit R α rels a)⁻¹)) theorem evaluation_polynomial (r : FreeGroup α) : evaluation R α rels (polynomial R α r) = MonoidAlgebra.of R _ (PresentedGroup.mk rels r) := by rw [eval_polynomial (groupAlgebraUnit R α rels) _ (by intros; simp [evaluation])] have h : FreeGroup.lift (groupAlgebraUnit R α rels) = (MonoidAlgebra.of R (PresentedGroup rels)).toHomUnits.comp (PresentedGroup.mk rels) := by apply FreeGroup.ext_hom intro a simp [groupAlgebraUnit, PresentedGroup.of] rw [h] rfl theorem evaluation_equation (i : EquationIndex α rels) : evaluation R α rels (equation R α rels i) = 1 := by rcases i with ⟨a,b⟩ | ⟨r,hr⟩ · cases b <;> simp [equation, evaluation] · rw [equation, evaluation_polynomial] have h : PresentedGroup.mk rels r = 1 := by exact PresentedGroup.one_of_mem hr rw [h, map_one] def toGroupAlgebra : PresentedAlgebra R α rels →ₐ[R] MonoidAlgebra R (PresentedGroup rels) := (relations R α rels).liftₐ (evaluation R α rels) (RingCon.ringConGen_le.mpr (by rintro x y ⟨i,rfl,rfl⟩ exact (evaluation_equation R α rels i).trans (map_one _).symm)) @[simp] theorem toGroupAlgebra_quotient (x : FreeAlgebra R (Letter α)) : toGroupAlgebra R α rels (quotientMap R α rels x) = evaluation R α rels x := rfl @[simp] theorem fromGroupAlgebra_of (a : α) : fromGroupAlgebra R α rels (MonoidAlgebra.of R _ (PresentedGroup.of a)) = quotientMap R α rels (FreeAlgebra.ι R (a,true)) := by simp [fromGroupAlgebra, groupToUnits, generatorUnit] @[simp] theorem fromGroupAlgebra_inv_of (a : α) : fromGroupAlgebra R α rels (MonoidAlgebra.of R _ (PresentedGroup.of a)⁻¹) = quotientMap R α rels (FreeAlgebra.ι R (a,false)) := by simp [fromGroupAlgebra, groupToUnits, generatorUnit] @[simp] theorem from_to_letter (a : α) (b : Bool) : fromGroupAlgebra R α rels (evaluation R α rels (FreeAlgebra.ι R (a,b))) = quotientMap R α rels (FreeAlgebra.ι R (a,b)) := by cases b · simpa only [evaluation, FreeAlgebra.lift_ι_apply, Bool.false_eq_true, ite_false, groupAlgebraUnit, ← map_inv, MonoidHom.coe_toHomUnits] using fromGroupAlgebra_inv_of R α rels a · simpa only [evaluation, FreeAlgebra.lift_ι_apply, ite_true, groupAlgebraUnit, MonoidHom.coe_toHomUnits] using fromGroupAlgebra_of R α rels a theorem from_to : (fromGroupAlgebra R α rels).comp (toGroupAlgebra R α rels) = AlgHom.id R (PresentedAlgebra R α rels) := by have h : ((fromGroupAlgebra R α rels).comp (toGroupAlgebra R α rels)).comp (quotientMap R α rels) = quotientMap R α rels := by apply FreeAlgebra.hom_ext funext ⟨a,b⟩ exact from_to_letter R α rels a b apply AlgHom.ext intro x obtain ⟨p,rfl⟩ := (relations R α rels).mkₐ_surjective (α := R) x exact DFunLike.congr_fun h p theorem to_from : (toGroupAlgebra R α rels).comp (fromGroupAlgebra R α rels) = AlgHom.id R (MonoidAlgebra R (PresentedGroup rels)) := by apply (MonoidAlgebra.lift R _ _).symm.injective have hext (f g : PresentedGroup rels →* MonoidAlgebra R (PresentedGroup rels)) (h : ∀ a, f (PresentedGroup.of a) = g (PresentedGroup.of a)) : f = g := by have hh : f.comp (PresentedGroup.mk rels) = g.comp (PresentedGroup.mk rels) := FreeGroup.ext_hom _ _ h apply MonoidHom.ext intro x obtain ⟨r,rfl⟩ := PresentedGroup.mk_surjective rels x exact DFunLike.congr_fun hh r apply hext intro a change toGroupAlgebra R α rels (fromGroupAlgebra R α rels (MonoidAlgebra.of R _ (PresentedGroup.of a))) = _ rw [fromGroupAlgebra_of, toGroupAlgebra_quotient] simp [evaluation, groupAlgebraUnit] /-- Explicit free associative algebra quotient presenting the group algebra. -/ def quotientEquiv : PresentedAlgebra R α rels ≃ₐ[R] MonoidAlgebra R (PresentedGroup rels) := AlgEquiv.ofAlgHom (toGroupAlgebra R α rels) (fromGroupAlgebra R α rels) (to_from R α rels) (from_to R α rels) /-- A finite presentation in the category of associative unital R-algebras. The finite generating set is not required to commute. A ring congruence is closed under multiplication on either side; these are two-sided equations. -/ def HasFinitePresentation (A : Type*) [Ring A] [Algebra R A] : Prop := ∃ (ι κ : Type) (_ : Finite ι) (_ : Finite κ) (lhs rhs : κ → FreeAlgebra R ι), Nonempty ((ringConGen (fun x y => ∃ i, x = lhs i ∧ y = rhs i)).Quotient ≃ₐ[R] A) variable {R} in /-- Transport of a finite noncommutative presentation along an algebra equivalence. -/ theorem HasFinitePresentation.of_equiv {A B : Type*} [Ring A] [Ring B] [Algebra R A] [Algebra R B] (h : HasFinitePresentation R A) (e : A ≃ₐ[R] B) : HasFinitePresentation R B := by obtain ⟨ι,κ,hι,hκ,lhs,rhs,⟨q⟩⟩ := h exact ⟨ι,κ,hι,hκ,lhs,rhs,⟨q.trans e⟩⟩ /-- Finitely many group generators and relators give finitely many algebra letters and equations, and the explicit quotient is the group algebra. -/ theorem presentedGroup_hasFinitePresentation (ι : Type) [Finite ι] (s : Set (FreeGroup ι)) [Finite s] : HasFinitePresentation R (MonoidAlgebra R (PresentedGroup s)) := by exact ⟨Letter ι, EquationIndex ι s, inferInstance, inferInstance, equation R ι s, fun _ => 1, ⟨quotientEquiv R ι s⟩⟩ /-- General Section 2 bridge, with no commutativity assumption on the group or its group algebra and no finite-presentation assumption on the algebra. -/ theorem groupAlgebra_hasFinitePresentation (G : Type*) [Group G] [Group.IsFinitelyPresented G] : HasFinitePresentation R (MonoidAlgebra R G) := by obtain ⟨n,s,hs,⟨e⟩⟩ := Group.IsFinitelyPresented.exists_mulEquiv_presentedGroup (G := G) let : Finite s := hs exact (presentedGroup_hasFinitePresentation R (Fin n) s).of_equiv (MonoidAlgebra.domCongr R R e.symm) /-- Polynomial zero relations for the same explicit presentation. -/ def zeroRelations : RingCon (FreeAlgebra R (Letter α)) := ringConGen (fun x y => ∃ i : EquationIndex α rels, x = equation R α rels i - 1 ∧ y = 0) /-- Writing each equation p = 1 as p - 1 = 0 does not change the quotient. This matches the manuscript notation k⟨x₁,...,x_d⟩/(p₁,...,p_t). -/ theorem relations_eq_zeroRelations : relations R α rels = zeroRelations R α rels := by apply le_antisymm · apply RingCon.ringConGen_le.mpr rintro x y ⟨i,rfl,rfl⟩ have h : zeroRelations R α rels (equation R α rels i - 1) 0 := RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩ have hh := (zeroRelations R α rels).add h ((zeroRelations R α rels).refl 1) simpa only [sub_add_cancel, zero_add] using hh · apply RingCon.ringConGen_le.mpr rintro x y ⟨i,rfl,rfl⟩ have h : relations R α rels (equation R α rels i) 1 := RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩ have hh := (relations R α rels).add h ((relations R α rels).refl (-1)) simpa only [← sub_eq_add_neg, sub_self] using hh /-- The explicit presentation is also a quotient by finitely many polynomial zero relations, in the exact form used by Section 3 of the manuscript. -/ def zeroQuotientEquiv : (zeroRelations R α rels).Quotient ≃ₐ[R] MonoidAlgebra R (PresentedGroup rels) := relations_eq_zeroRelations R α rels ▸ quotientEquiv R α rels end LittleFinitistic.GroupAlgebraPresentation end end OAI