Live2D

Bonus -「A. Algebra」你一定要这么定义群吗?那我问你。

\[\mathscr{Lorain~y~w~la~Lora~blea.} \newcommand{\DS}[0]{\displaystyle} % operators alias \newcommand{\opn}[1]{\operatorname{#1}} \newcommand{\card}[0]{\opn{card}} \newcommand{\lcm}[0]{\opn{lcm}} \newcommand{\char}[0]{\opn{char}} \newcommand{\Char}[0]{\opn{Char}} \newcommand{\Min}[0]{\opn{Min}} \newcommand{\rank}[0]{\opn{rank}} \newcommand{\Hom}[0]{\opn{Hom}} \newcommand{\End}[0]{\opn{End}} \newcommand{\im}[0]{\opn{im}} \newcommand{\tr}[0]{\opn{tr}} \newcommand{\diag}[0]{\opn{diag}} \newcommand{\coker}[0]{\opn{coker}} \newcommand{\id}[0]{\opn{id}} \newcommand{\sgn}[0]{\opn{sgn}} \newcommand{\Res}[0]{\opn{Res}} \newcommand{\cent}[0]{\u{\degree C}} % symbols alias \newcommand{\E}[0]{\exist} \newcommand{\A}[0]{\forall} \newcommand{\l}[0]{\left} \newcommand{\r}[0]{\right} \newcommand{\eps}[0]{\varepsilon} \newcommand{\Ra}[0]{\Rightarrow} \newcommand{\Eq}[0]{\Leftrightarrow} \newcommand{\d}[0]{\mathrm{d}} \newcommand{\e}[0]{\mathrm{e}} \newcommand{\i}[0]{\mathrm{i}} \newcommand{\j}[0]{\mathrm{j}} \newcommand{\k}[0]{\mathrm{k}} \newcommand{\Ex}[0]{\mathbb{E}} \newcommand{\D}[0]{\mathbb{D}} \newcommand{\oo}[0]{\infty} \newcommand{\tto}[0]{\rightrightarrows} \newcommand{\mmap}[0]{\hookrightarrow} \newcommand{\emap}[0]{\twoheadrightarrow} \newcommand{\lin}[0]{\lim_{n\to\oo}} \newcommand{\linf}[0]{\liminf_{n\to\oo}} \newcommand{\lsup}[0]{\limsup_{n\to\oo}} \newcommand{\ser}[0]{\sum_{n=1}^\oo} \newcommand{\isoto}[0]{\overset\sim\to} \newcommand{\F}[0]{\mathbb F} \newcommand{\x}[0]{\times} \newcommand{\M}[0]{\mathbf{M}} \newcommand{\T}[0]{\intercal} % symbols with parameters \newcommand{\der}[1]{\frac{\d}{\d #1}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\br}[1]{\l(#1\r)} \newcommand{\bk}[1]{\l[#1\r]} \newcommand{\ev}[1]{\l.#1\r|} \newcommand{\abs}[1]{\l|#1\r|} \newcommand{\bs}[1]{\boldsymbol{#1}} \newcommand{\env}[2]{\begin{#1}#2\end{#1}} % why not? \newcommand{\pmat}[1]{\env{pmatrix}{#1}} \newcommand{\dary}[2]{\l|\begin{array}{#1}#2\end{array}\r|} \newcommand{\pary}[2]{\l(\begin{array}{#1}#2\end{array}\r)} \newcommand{\pblk}[4]{\l(\begin{array}{c|c}{#1}&{#2}\\\hline{#3}&{#4}\end{array}\r)} \newcommand{\u}[1]{\mathrm{#1}} \newcommand{\lix}[1]{\lim_{x\to #1}} \newcommand{\ops}[1]{#1\cdots #1} \newcommand{\seq}[3]{{#1}_{#2}\ops,{#1}_{#3}} \newcommand{\dedu}[2]{\u{(#1)}\Ra\u{(#2)}} \]

  先放一段笔记内容:

定义 11.1.1

  群是资料 \((G,\cdot)\), 其中 \(G\) 非空, \(\cdot:G\x G\to G\) 满足:

  • 结合律. \(\A x,y,z\in G,~(x\cdot y)\cdot z=x\cdot(y\cdot z)\).
  • 幺元存在. \(\E 1_G\in G,~\A x\in G,~1_G\cdot x=x\cdot 1_G=x\).
  • 逆元存在. \(\A x\in G,~\E x^{-1}\in G,~x\cdot x^{-1}=x^{-1}\cdot x=1_G\).
  • (进一步成为交换群 / Abel 群) 交换律. \(\A x,y\in G,~x\cdot y=y\cdot x\).

  直接的结论 (例如消去律, 幺元唯一, 逆元唯一, ...) 就不写了叭.

  在逆元唯一性证明中, lww 创新性地引入了 \(x^{\text{负一}}\) 作为记号用来与 \(x^{-1}\) 区分, 值得研究学习. Rainy7 进一步指出还能使用记号 \(\frac{1}{x}\), 此神来之笔也.

  称 \(G=\{1_G\}\) 为平凡群, \(|G|\) 为群的阶数. 在公理中, 删去逆元存在性, 可得到幺半群结构, 再删去幺元存在性可以得到半群. 例如, 记号 \(x^n\) 在半群, 幺半群, 群里分别能对 \(n\in\Z_{>0}\), \(n\in\Z_{\ge 0}\), \(n\in\Z\) 定义.

Bonus.

  以上定义直接要求了左右幺元 (逆元) 存在且相等, 这个条件似乎很强, 我们不禁怀疑其是否有些冗余. 我尝试枚举了一些情况:

  • 逆元存在性改为 "(各自) 存在左逆或右逆", 不等价, 反例:

    \[\lang\texttt (,\texttt)\mid \texttt{()}=\varnothing\rang. \]

  • 逆元存在性改为 "(都) 存在左逆 (或都存在右逆)", 等价:

    \[x^{-1}x=1\land (x^{-1})^{-1}x^{-1}=1\Ra (x^{-1})^{-1}x^{-1}x=x=(x^{-1})^{-1}. \]

  • 逆元存在性改为 "存在左逆和右逆", 等价:

    \[x^{-1}_Lx=xx_R^{-1}=1\Ra x_L^{-1}xx_R^{-1}=x_L^{-1}=x_R^{-1}. \]

  • 幺元存在性改为 "存在右幺元 (或存在左幺元)", 不良定, 反例:

    \[(G,\opn{const}). \]

    (回忆 \(\opn{const}:x\mapsto y\mapsto x\), \(G\) 满足结合律, 但所有元素都是右幺元.)

  • 幺元存在性改为 "存在左幺元且存在右幺元 (逆元定义时不妨取左幺元)", 等价:

    \[1_L\cdot 1_R=1_L=1_R. \]

  • 幺元存在性改为 "存在唯一左幺元 (或存在唯一右幺元)", 等价:

    \[x^{-1}\cdot x=x\cdot x^{-1}=1_L\Ra x\cdot (x^{-1}\cdot x)=x\cdot 1_L=1_L\cdot x=x. \]

  总的来说, 在所有等价描述中, 定义 11.1.1 确实是 "字数最少" 的说法之一, 这下放心了. 当然加上交换律后又有一堆情况讨论, 我们确信自己会做!


  以上是笔记内容, 因为心血来潮给 bonus 里的所有等价性证明写了 Agda 所以放出来, 才不是因为 lww 的 \(x^{\text{负一}}\).

  你说 "群是单对象且逆态射存在的范畴" 才是字数最少的定义? 那我问你, 定义范畴资料需不需要写字? 定义单位态射需不需要写字? 定义态射结合律需不需要写字? 定义逆态射需不需要写字? 回答我! Look in my eyes!

  好了以下是为上述四个等价定义写的形式化证明. "不等价性" 估计需要炫酷的 ∃-syntax⊥-elim 之类的家伙, 很不熟悉这些东西, 就不折磨自己了 qwq.

import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; _≢_; refl; trans; sym; cong; cong-app; subst)
open Eq.≡-Reasoning using (begin_; _∎)

infixr 2 _≡⟨⟩_ _≡⟨_⟩_

_≡⟨⟩_ : ∀ {ℓ} {A : Set ℓ} (x : A) {y : A} → x ≡ y → x ≡ y
x ≡⟨⟩ refl = refl

_≡⟨_⟩_ : ∀ {ℓ} {A : Set ℓ} (x : A) {y z : A} → x ≡ y → y ≡ z → x ≡ z
x ≡⟨ refl ⟩ refl = refl

record Group {A : Set} (_*_ : A → A → A) : Set where
  field
    e : A
    inv : A → A
    assoc : ∀ x y z → (x * y) * z ≡ x * (y * z)
    identᴸ : ∀ x → e * x ≡ x
    identᴿ : ∀ x → x * e ≡ x
    invertᴸ : ∀ x → inv x * x ≡ e
    invertᴿ : ∀ x → x * inv x ≡ e
open Group

module Left-Inversion-Always-Exists where
  record Group' {A : Set} (_*_ : A → A → A) : Set where
    field
      e : A
      invᴸ : A → A
      assoc : ∀ x y z → (x * y) * z ≡ x * (y * z)
      identᴸ : ∀ x → e * x ≡ x
      identᴿ : ∀ x → x * e ≡ x
      invertᴸ : ∀ x → invᴸ x * x ≡ e
  open Group'

  Group'≡Group : {A : Set} {_*_ : A → A → A} (G' : Group' _*_) → Group _*_
  Group'≡Group {A} {_*_} G' = G
    where
      G : Group _*_
      G .e = G' .e
      G .inv = G' .invᴸ
      G .assoc = G' .assoc
      G .identᴸ = G' .identᴸ
      G .identᴿ = G' .identᴿ
      G .invertᴸ = G' .invertᴸ
      G .invertᴿ x =
        begin
          x * G .inv x
        ≡⟨ sym (G. identᴸ (x * G .inv x)) ⟩
          G .e * (x * G .inv x)
        ≡⟨ cong (_* (x * G .inv x)) (sym (G .invertᴸ (G .inv x))) ⟩
          (G .inv (G .inv x) * G .inv x) * (x * G .inv x)
        ≡⟨ G .assoc (G .inv (G .inv x)) (G .inv x) (x * G .inv x) ⟩
          G .inv (G .inv x) * (G .inv x * (x * G .inv x))
        ≡⟨ cong (G .inv (G .inv x) *_) (sym (G .assoc (G .inv x) x (G .inv x))) ⟩
          G .inv (G .inv x) * ((G .inv x * x) * G .inv x)
        ≡⟨ cong (λ t → G .inv (G .inv x) * (t * G .inv x)) (G .invertᴸ x) ⟩
          G .inv (G .inv x) * (G .e * G .inv x)
        ≡⟨ cong (G .inv (G .inv x) *_) (G .identᴸ (G .inv x)) ⟩
          G .inv (G .inv x) * G .inv x
        ≡⟨ G .invertᴸ (G .inv x) ⟩
          G .e
        ∎

--------------------------

module Has-Left-And-Right-Inversion where
  record Group' {A : Set} (_*_ : A → A → A) : Set where
    field
      e : A
      invᴸ : A → A
      invᴿ : A → A
      assoc : ∀ x y z → (x * y) * z ≡ x * (y * z)
      identᴸ : ∀ x → e * x ≡ x
      identᴿ : ∀ x → x * e ≡ x
      invertᴸ : ∀ x → invᴸ x * x ≡ e
      invertᴿ : ∀ x → x * invᴿ x ≡ e
  open Group'

  Group'≡Group : {A : Set} {_*_ : A → A → A} (G' : Group' _*_) → Group _*_
  Group'≡Group {A} {_*_} G' = G
    where
      G : Group _*_
      G .e = G' .e
      G .inv = G' .invᴸ
      G .assoc = G' .assoc
      G .identᴸ = G' .identᴸ
      G .identᴿ = G' .identᴿ
      G .invertᴸ = G' .invertᴸ
      G .invertᴿ x =
        begin
          x * G .inv x
        ≡⟨ cong (x *_) (sym (G .identᴿ (G .inv x))) ⟩
          x * (G .inv x * G .e)
        ≡⟨ cong (λ t → x * (G .inv x * t)) (sym (G' .invertᴿ x)) ⟩
          x * (G .inv x * (x * G' .invᴿ x))
        ≡⟨ cong (x *_) (sym (G .assoc (G .inv x) x (G' .invᴿ x))) ⟩
          x * ((G .inv x * x) * G' .invᴿ x)
        ≡⟨ cong (λ t → x * (t * G' .invᴿ x)) (G .invertᴸ x) ⟩
          x * (G .e * G' .invᴿ x)
        ≡⟨ cong (x *_) (G .identᴸ (G' .invᴿ x)) ⟩
          x * G' .invᴿ x
        ≡⟨ G' .invertᴿ x ⟩
          G .e
        ∎

--------------------------

module Has-Left-And-Right-One where
  record Group' {A : Set} (_*_ : A → A → A) : Set where
    field
      eᴸ : A
      eᴿ : A
      inv : A → A
      assoc : ∀ x y z → (x * y) * z ≡ x * (y * z)
      identᴸ : ∀ x → eᴸ * x ≡ x
      identᴿ : ∀ x → x * eᴿ ≡ x
      invertᴸ : ∀ x → inv x * x ≡ eᴸ
      invertᴿ : ∀ x → x * inv x ≡ eᴸ
  open Group'

  Group'≡Group : {A : Set} {_*_ : A → A → A} (G' : Group' _*_) → Group _*_
  Group'≡Group {A} {_*_} G' = G
    where
      G : Group _*_
      G .e = G' .eᴸ
      G .inv = G' .inv
      G .assoc = G' .assoc
      G .identᴸ = G' .identᴸ
      G .invertᴸ = G' .invertᴸ
      G .invertᴿ = G' .invertᴿ
      G .identᴿ x =
        begin
          x * G .e
        ≡⟨ cong (x *_) (sym (G' .identᴿ (G .e))) ⟩
          x * (G .e * G' .eᴿ)
        ≡⟨ cong (x *_) (G. identᴸ (G' .eᴿ)) ⟩
          x * G' .eᴿ
        ≡⟨ G' .identᴿ x ⟩
          x
        ∎

--------------------------

module Has-Unique-Left-One where
  record Group' {A : Set} (_*_ : A → A → A) : Set where
    field
      eᴸ : A
      inv : A → A
      assoc : ∀ x y z → (x * y) * z ≡ x * (y * z)
      identᴸ : ∀ x → eᴸ * x ≡ x
      invertᴸ : ∀ x → inv x * x ≡ eᴸ
      invertᴿ : ∀ x → x * inv x ≡ eᴸ
  open Group'

  Group'≡Group : {A : Set} {_*_ : A → A → A} (G' : Group' _*_) → Group _*_
  Group'≡Group {A} {_*_} G' = G
    where
      G : Group _*_
      G .e = G' .eᴸ
      G .inv = G' .inv
      G .assoc = G' .assoc
      G .identᴸ = G' .identᴸ
      G .invertᴸ = G' .invertᴸ
      G .invertᴿ = G' .invertᴿ
      G .identᴿ x =
        begin
          x * G .e
        ≡⟨ cong (x *_) (sym (G .invertᴸ x)) ⟩
          x * (G .inv x * x)
        ≡⟨ sym (G .assoc x (G .inv x) x) ⟩
          (x * G .inv x) * x
        ≡⟨ cong (_* x) (G .invertᴿ x) ⟩
          G .e * x
        ≡⟨ G .identᴸ x ⟩
          x
        ∎

  我去这个代码高亮引擎什么时候支持 Agda 的语法高亮了?!

posted @ 2025-04-05 19:43  Rainybunny  阅读(186)  评论(2)    收藏  举报