arislople

Lean 4 AI slop

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  64. 64
  65. 65
  66. 66
  67. 67
  68. 68
  69. 69
  70. 70
  71. 71
  72. 72
  73. 73
  74. 74
  75. 75
  76. 76
  77. 77
  78. 78
  79. 79
  80. 80
  81. 81
  82. 82
  83. 83
  84. 84
  85. 85
  86. 86
  87. 87
  88. 88
  89. 89
  90. 90
  91. 91
  92. 92
  93. 93
  94. 94
  95. 95
  96. 96
  97. 97
  98. 98
  99. 99
  100. 100
  101. 101
  102. 102
  103. 103
  104. 104
  105. 105
  106. 106
  107. 107
  108. 108
  109. 109
  110. 110
  111. 111
  112. 112
  113. 113
  114. 114
  115. 115
  116. 116
  117. 117
  118. 118
  119. 119
  120. 120
  121. 121
  122. 122
  123. 123
  124. 124
  125. 125
  126. 126
  127. 127
  128. 128
  129. 129
  130. 130
  131. 131
  132. 132
  133. 133
  134. 134
  135. 135
  136. 136
  137. 137
  138. 138
  139. 139
  140. 140
  141. 141
  142. 142
  143. 143
  144. 144
  145. 145
  146. 146
  147. 147
  148. 148
  149. 149
  150. 150
  151. 151
  152. 152
  153. 153
  154. 154
  155. 155
  156. 156
  157. 157
  158. 158
  159. 159
  160. 160
  161. 161
  162. 162
  163. 163
  164. 164
  165. 165
  166. 166
  167. 167
  168. 168
  169. 169
  170. 170
  171. 171
  172. 172
  173. 173
  174. 174
  175. 175
  176. 176
  177. 177
  178. 178
  179. 179
  180. 180
  181. 181
  182. 182
  183. 183
  184. 184
  185. 185
  186. 186
  187. 187
  188. 188
  189. 189
  190. 190
  191. 191
  192. 192
  193. 193
  194. 194
  195. 195
  196. 196
  197. 197
  198. 198
  199. 199
  200. 200
  201. 201
  202. 202
  203. 203
  204. 204
  205. 205
  206. 206
  207. 207
  208. 208
  209. 209
  210. 210
  211. 211
  212. 212
  213. 213
  214. 214
  215. 215
  216. 216
  217. 217
  218. 218
  219. 219
  220. 220
  221. 221
  222. 222
  223. 223
  224. 224
  225. 225
  226. 226
  227. 227
  228. 228
  229. 229
  230. 230
  231. 231
  232. 232
  233. 233
  234. 234
  235. 235
  236. 236
  237. 237
  238. 238
  239. 239
  240. 240
  241. 241
  242. 242
  243. 243
  244. 244
  245. 245
  246. 246
  247. 247
  248. 248
  249. 249
  250. 250
  251. 251
  252. 252
  253. 253
  254. 254
  255. 255
  256. 256
  257. 257
  258. 258
  259. 259
  260. 260
  261. 261
  262. 262
  263. 263
  264. 264
  265. 265
  266. 266
  267. 267
  268. 268
  269. 269
  270. 270
  271. 271
  272. 272
  273. 273
  274. 274
  275. 275
  276. 276
  277. 277
  278. 278
  279. 279
  280. 280
  281. 281
  282. 282
  283. 283
  284. 284
  285. 285
  286. 286
  287. 287
  288. 288
  289. 289
  290. 290
  291. 291
  292. 292
  293. 293
  294. 294
  295. 295
  296. 296
  297. 297
/-
This file was edited by Aristotle.

Lean version: leanprover/lean4:v4.24.0
Mathlib version: f897ebcf72cd16f89ab4577d0c826cd14afaafc7
This project request had uuid: eedeabe9-b440-4963-9d51-df6cf6bda648

The following was proved by Aristotle:

- lemma A2_weyl_group_card : Nat.card (CoxeterMatrix.Aₙ 2).Group = 6
-/

import Mathlib


noncomputable section AristotleLemmas

#check PresentedGroup.toGroup
#check (CoxeterMatrix.Aₙ 2).Group
#synth Group (DihedralGroup 3)

/-
Homomorphism from A2 to D3.
-/
def f_A2_to_D3 (i : Fin 2) : DihedralGroup 3 :=
  if i.val = 0 then DihedralGroup.sr 0 else DihedralGroup.sr 1

theorem f_A2_to_D3_rels :  r  (CoxeterMatrix.Aₙ 2).relationsSet,
    (FreeGroup.lift f_A2_to_D3) r = 1 := by
      intro r;
      intro hr;
      cases hr ; aesop;
      fin_cases fst <;> fin_cases snd <;> simp +decide [ CoxeterMatrix.Aₙ ]

def hom_A2_to_D3 : (CoxeterMatrix.Aₙ 2).Group * DihedralGroup 3 :=
  PresentedGroup.toGroup f_A2_to_D3_rels

#check CoxeterMatrix.simple
#check CoxeterMatrix.Group
#print CoxeterMatrix.simple

/-
Generators and relations for A2.
-/
def s0 : (CoxeterMatrix.Aₙ 2).Group := @CoxeterMatrix.simple (Fin 2) (CoxeterMatrix.Aₙ 2) 0
def s1 : (CoxeterMatrix.Aₙ 2).Group := @CoxeterMatrix.simple (Fin 2) (CoxeterMatrix.Aₙ 2) 1

lemma s0_sq : s0 * s0 = 1 := by
  convert QuotientGroup.eq.mpr _;
  convert Subgroup.normalClosure_mono _ _;
  exact { ( FreeGroup.of 0 ) * ( FreeGroup.of 0 ) };
  · simp +decide [ CoxeterMatrix.relationsSet ];
  · exact Subgroup.inv_mem _ ( Subgroup.subset_normalClosure ( Set.mem_singleton _ ) )
lemma s1_sq : s1 * s1 = 1 := by
  erw [ QuotientGroup.eq_one_iff ];
  refine' Subgroup.subset_normalClosure _;
  exact  1, by simp +decide 
lemma s0s1_pow3 : (s0 * s1) ^ 3 = 1 := by
  apply QuotientGroup.eq.mpr;
  norm_num +zetaDelta at *;
  exact Subgroup.subset_normalClosure ( Set.mem_setOf.mpr <| by exact  ( 0, 1 ), by simp +decide [ pow_succ ]  )

/-
Braid relation for A2.
-/
lemma braid_rel : s0 * s1 * s0 = s1 * s0 * s1 := by
  -- From $(s_0 s_1)^3 = 1$, we have $s_0 s_1 s_0 s_1 s_0 s_1 = 1$.
  have h_braid : s0 * s1 * s0 * s1 * s0 * s1 = 1 := by
    convert s0s1_pow3 using 1;
  -- From $(s_0 s_1)^3 = 1$, we have $s_0 s_1 s_0 = (s_1 s_0 s_1)^{-1}$.
  have h_inv : s0 * s1 * s0 = (s1 * s0 * s1)⁻¹ := by
    exact eq_inv_of_mul_eq_one_left ( by simpa [ mul_assoc ] using h_braid );
  -- Since $s_0^2 = 1$ and $s_1^2 = 1$, they are their own inverses.
  have h_inv_self : s0⁻¹ = s0  s1⁻¹ = s1 := by
    exact  inv_eq_of_mul_eq_one_right ( by simpa [ mul_assoc ] using s0_sq ), inv_eq_of_mul_eq_one_right ( by simpa [ mul_assoc ] using s1_sq ) ;
  aesop

/-
Commutation lemmas for s0 and s0s1.
-/
lemma s0s1_inv : (s0 * s1)⁻¹ = s1 * s0 := by
  -- Since $s0$ and $s1$ are involutions, we have $s0⁻¹ = s0$ and $s1⁻¹ = s1$.
  have h_inv : s0⁻¹ = s0  s1⁻¹ = s1 := by
    simp ( config := { decide := Bool.true } ) [ inv_eq_iff_mul_eq_one, s0_sq, s1_sq ];
  rw [ mul_inv_rev, h_inv.1, h_inv.2 ]

lemma s0s1_mul_s0 : (s0 * s1) * s0 = s0 * (s0 * s1)⁻¹ := by
  have h_inv : s0⁻¹ = s0  s1⁻¹ = s1 := by
    simp ( config := { decide := Bool.true } ) [ inv_eq_iff_mul_eq_one, s0_sq, s1_sq ];
  simp ( config := { decide := Bool.true } ) [ h_inv, mul_assoc ]

lemma s0s1_pow_mul_s0 (n : ) : (s0 * s1) ^ n * s0 = s0 * (s0 * s1)⁻¹ ^ n := by
  induction n <;> simp_all ( config := { decide := Bool.true } ) [ pow_succ, mul_assoc ];
  simp_all ( config := { decide := Bool.true } ) [  mul_assoc ];
  simp_all ( config := { decide := Bool.true } ) [ mul_assoc, inv_eq_of_mul_eq_one_right ( show s0 * s0 = 1 from s0_sq ), inv_eq_of_mul_eq_one_right ( show s1 * s1 = 1 from s1_sq ) ]

lemma s0s1_zpow_mul_s0 (z : ) : (s0 * s1) ^ z * s0 = s0 * (s0 * s1)⁻¹ ^ z := by
  induction z using Int.induction_on <;> aesop;
  · simp_all ( config := { decide := Bool.true } ) [ zpow_add, mul_assoc ];
    simp_all ( config := { decide := Bool.true } ) [  mul_assoc ];
    -- Using the fact that $s0$ and $s1$ are inverses of themselves, we can simplify the expression.
    have h_inv : s0⁻¹ = s0  s1⁻¹ = s1 := by
      exact  inv_eq_of_mul_eq_one_right ( by simpa [ mul_assoc ] using s0_sq ), inv_eq_of_mul_eq_one_right ( by simpa [ mul_assoc ] using s1_sq ) ;
    simp_all ( config := { decide := Bool.true } ) [ mul_assoc ];
  · simp_all +decide [ zpow_sub, mul_assoc ];
    simp_all +decide [  mul_assoc ];
    simp +decide [  a, mul_assoc ];
    simp_all +decide [  mul_assoc, s0_sq, s1_sq ];
    exact inv_eq_of_mul_eq_one_right ( by rw [ s1_sq ] )

/-
Powers of s0s1 depend only on exponent mod 3.
-/
lemma s0s1_pow_eq_pow_mod_3 (n : ) : (s0 * s1) ^ n = (s0 * s1) ^ (n % 3) := by
  rw [  Nat.mod_add_div n 3, pow_add, pow_mul ] ; aesop;
  -- Since $(s0 * s1)^3 = 1$, raising both sides to the power of $(n / 3)$ gives us $((s0 * s1)^3)^{n / 3} = 1^{n / 3} = 1$.
  have h_s0s1_pow3 : (s0 * s1) ^ 3 = 1 := by
    exact?
  rw [h_s0s1_pow3]
  simp

lemma s0s1_zpow_eq_zpow_mod_3 (z : ) : (s0 * s1) ^ z = (s0 * s1) ^ (z % 3) := by
  -- Since $(s0 * s1)^3 = 1$, we can reduce any exponent modulo 3.
  have h_exp_mod : (s0 * s1) ^ 3 = 1 := by
    exact?;
  exact?

/-
Powers of s0s1 depend only on exponent mod 3.
-/
lemma s0s1_pow_mod_3 (n : ) : (s0 * s1) ^ n = (s0 * s1) ^ (n % 3) := by
  exact?

lemma s0s1_zpow_mod_3 (z : ) : (s0 * s1) ^ z = (s0 * s1) ^ (z % 3) := by
  exact?

#print s0s1_pow_eq_pow_mod_3
#print s0s1_zpow_eq_zpow_mod_3

/-
Map definition and commutation lemma.
-/
def map_D3_to_A2_fun : DihedralGroup 3  (CoxeterMatrix.Aₙ 2).Group
| DihedralGroup.r k => (s0 * s1) ^ (k.val : )
| DihedralGroup.sr k => s0 * (s0 * s1) ^ (k.val : )

lemma s0_comm_zpow (z : ) : s0 * (s0 * s1) ^ z * s0 = (s0 * s1) ^ (-z) := by
  rw [mul_assoc, s0s1_zpow_mul_s0,  mul_assoc, s0_sq, one_mul]
  rw [inv_zpow, zpow_neg]

/-
Arithmetic lemmas for ZMod 3 values.
-/
lemma zmod3_add_val (i j : ZMod 3) : ((i.val : ) + (j.val : )) % 3 = ((i + j).val : ) % 3 := by
  fin_cases i <;> fin_cases j <;> simp [ZMod.val, Fin.val] <;> rfl

lemma zmod3_sub_val (i j : ZMod 3) : ((j.val : ) - (i.val : )) % 3 = ((j - i).val : ) % 3 := by
  fin_cases i <;> fin_cases j <;> simp [ZMod.val, Fin.val] <;> rfl

/-
Helper lemma for D3 to A2 map multiplication.
-/
lemma s0s1_zpow_val_eq_zpow_val_sub (i j : ZMod 3) :
  (s0 * s1) ^ (j.val : ) * (s0 * s1) ^ (-(i.val : )) = (s0 * s1) ^ ((j - i).val : ) := by
    -- By combining the exponents, we get $(s0 * s1)^{j.val - i.val}$.
    have h_combined : (s0 * s1) ^ (j.val : ) * (s0 * s1) ^ (-(i.val : )) = (s0 * s1) ^ ((j.val - i.val) : ) := by
      group;
    -- By definition of exponentiation, we can rewrite the exponents as integers modulo 3.
    have h_mod3 : (j.val - i.val : ) % 3 = (j - i : ZMod 3).val := by
      fin_cases i <;> fin_cases j <;> trivial;
    rw [ h_combined,  h_mod3,  Int.emod_add_ediv ( ( j.val :  ) - i.val ) 3 ] ; norm_num [ zpow_add, zpow_mul ] ;
    erw [ s0s1_pow3 ] ; norm_num;

/-
Map from D3 to A2 is a homomorphism.
-/
lemma map_D3_to_A2_map_one : map_D3_to_A2_fun 1 = 1 := by
  aesop

lemma map_D3_to_A2_map_mul (x y : DihedralGroup 3) :
  map_D3_to_A2_fun (x * y) = map_D3_to_A2_fun x * map_D3_to_A2_fun y := by
    cases' x with x x <;> cases' y with y y <;> simp ( config := { decide := Bool.true } ) [ * ];
    · -- Using the properties of exponents in the group, we can combine the terms.
      have h_exp : (s0 * s1) ^ (x.val : ) * (s0 * s1) ^ (y.val : ) = (s0 * s1) ^ ((x.val + y.val) : ) := by
        rw [ zpow_add ];
      norm_num +zetaDelta at *;
      convert h_exp.symm using 1;
      exact s0s1_zpow_eq_zpow_mod_3 _  by fin_cases x <;> fin_cases y <;> rfl;
    · -- Using the commutation relation, we can simplify the expression.
      have h_comm : (s0 * s1) ^ (x.val : ) * s0 = s0 * (s0 * s1) ^ (-(x.val : )) := by
        have h_comm : s0 * (s0 * s1) ^ (x.val : ) * s0 = (s0 * s1) ^ (-(x.val : )) := by
          convert s0_comm_zpow x.val using 1;
        rw [  h_comm, mul_assoc ];
        simp ( config := { decide := Bool.true } ) [  mul_assoc, s0_sq ];
      -- Using the commutation relation, we can simplify the expression further.
      have h_comm_simplified : s0 * (s0 * s1) ^ (-(x.val : )) * (s0 * s1) ^ (y.val : ) = s0 * (s0 * s1) ^ ((y - x).val : ) := by
        rw [ mul_assoc,  zpow_add ];
        rw [ show ( - ( x.val :  ) + y.val :  ) = ( y - x : ZMod 3 ).val + 3 * ( ( - ( x.val :  ) + y.val :  ) / 3 ) by linarith [ Int.emod_add_ediv ( - ( x.val :  ) + y.val ) 3, show ( y - x : ZMod 3 ).val = ( - ( x.val :  ) + y.val :  ) % 3 by fin_cases x <;> fin_cases y <;> trivial ] ] ; norm_num [ zpow_add, zpow_mul ];
        erw [ s0s1_pow3 ] ; norm_num;
      unfold map_D3_to_A2_fun; aesop;
      grind;
    · -- By definition of multiplication in the group, we have:
      have h_mul : s0 * (s0 * s1) ^ (x.val + y.val : ) = s0 * (s0 * s1) ^ (x.val : ) * (s0 * s1) ^ (y.val : ) := by
        group;
      aesop;
      convert h_mul using 1;
      convert rfl;
      exact congr_arg _ ( s0s1_zpow_eq_zpow_mod_3 _ );
    · -- Using the lemma s0_comm_zpow, we can rewrite the left-hand side.
      have h_lhs : s0 * (s0 * s1) ^ (x.val : ) * (s0 * (s0 * s1) ^ (y.val : )) = (s0 * s1) ^ (-(x.val : )) * (s0 * s1) ^ (y.val : ) := by
        have := s0_comm_zpow x.val; simp_all ( config := { decide := Bool.true } ) [ mul_assoc, mul_left_comm ] ;
        simp ( config := { decide := Bool.true } ) [  this, mul_assoc ];
      convert h_lhs.symm using 1;
      convert s0s1_zpow_val_eq_zpow_val_sub x y |> Eq.symm using 1;
      group

#check hom_A2_to_D3
#check map_D3_to_A2_map_mul

/-
Inverse homomorphism and verification on generators.
-/
def hom_D3_to_A2 : DihedralGroup 3 * (CoxeterMatrix.Aₙ 2).Group where
  toFun := map_D3_to_A2_fun
  map_one' := map_D3_to_A2_map_one
  map_mul' := map_D3_to_A2_map_mul

lemma hom_comp_r1 : hom_A2_to_D3 (hom_D3_to_A2 (DihedralGroup.r 1)) = DihedralGroup.r 1 := by
  decide +kernel

lemma hom_comp_sr0 : hom_A2_to_D3 (hom_D3_to_A2 (DihedralGroup.sr 0)) = DihedralGroup.sr 0 := by
  decide +kernel

lemma hom_comp_s0 : hom_D3_to_A2 (hom_A2_to_D3 s0) = s0 := by
  exact?

lemma hom_comp_s1 : hom_D3_to_A2 (hom_A2_to_D3 s1) = s1 := by
  unfold hom_D3_to_A2; aesop;
  -- Since $s1$ is a generator in the Coxeter group, applying the homomorphism $hom_A2_to_D3$ to $s1$ gives us $sr 1$ in the Dihedral group.
  have h_hom_s1 : (hom_A2_to_D3 s1) = DihedralGroup.sr 1 := by
    decide +kernel;
  unfold map_D3_to_A2_fun; aesop;
  -- By simplifying, we can see that $s0 * (s0 * s1) ^ 1 = s0 * s0 * s1 = s1$.
  have h_simp : s0 * (s0 * s1) ^ 1 = s0 * s0 * s1 := by
    simp +decide [ mul_assoc ];
  exact h_simp.trans ( by simp +decide [ s0_sq ] )

/-
Simplification lemmas for hom_A2_to_D3.
-/
lemma hom_A2_to_D3_s0 : hom_A2_to_D3 s0 = DihedralGroup.sr 0 := by
  -- By definition of $hom_A2_to_D3$, we know that it maps $s0$ to $sr0$ because $s0$ is a generator of the group.
  apply PresentedGroup.toGroup.of

lemma hom_A2_to_D3_s1 : hom_A2_to_D3 s1 = DihedralGroup.sr 1 := by
  exact?

/-
Isomorphism between A2 and D3.
-/
def iso_A2_D3 : (CoxeterMatrix.Aₙ 2).Group * DihedralGroup 3 where
  toFun := hom_A2_to_D3
  invFun := hom_D3_to_A2
  left_inv := by
    intro g;
    induction g using QuotientGroup.induction_on';
    induction FreeGroup ( Fin 2 )  using FreeGroup.induction_on ; aesop;
    · rename_i i; fin_cases i <;> simp +decide [ hom_A2_to_D3, hom_D3_to_A2 ] ;
      · exact?;
      · convert hom_comp_s1;
    · aesop;
    · aesop
  right_inv := by
    decide +revert
  map_mul' := hom_A2_to_D3.map_mul

#check iso_A2_D3

/-
Isomorphism between A2 and D3.
-/
def iso_A2_D3_final : (CoxeterMatrix.Aₙ 2).Group * DihedralGroup 3 where
  toFun := hom_A2_to_D3
  invFun := hom_D3_to_A2
  left_inv := by
    -- To prove the left inverse property, we use the fact that the composition of the two homomorphisms is the identity.
    apply iso_A2_D3.left_inv
  right_inv := by
    -- By definition of hom_D3_to_A2, we know that applying hom_A2_to_D3 to any element in DihedralGroup 3 gives back the original element.
    apply iso_A2_D3.right_inv
  map_mul' := hom_A2_to_D3.map_mul

end AristotleLemmas

lemma A2_weyl_group_card : Nat.card (CoxeterMatrix.Aₙ 2).Group = 6 := by
  convert Nat.card_congr iso_A2_D3_final.toEquiv;
  simp +decide [ DihedralGroup ]