Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit ff830d7

Browse files
committed
feat(ring_theory/witt_vector): redefine subtraction using witt_sub polynomial (#5405)
1 parent 656b1bb commit ff830d7

File tree

3 files changed

+26
-45
lines changed

3 files changed

+26
-45
lines changed

src/ring_theory/witt_vector/basic.lean

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ lemma one : map_fun f (1 : 𝕎 R) = 1 := by map_fun_tac
8888

8989
lemma add : map_fun f (x + y) = map_fun f x + map_fun f y := by map_fun_tac
9090

91+
lemma sub : map_fun f (x - y) = map_fun f x - map_fun f y := by map_fun_tac
92+
9193
lemma mul : map_fun f (x * y) = map_fun f x * map_fun f y := by map_fun_tac
9294

9395
lemma neg : map_fun f (-x) = -map_fun f x := by map_fun_tac
@@ -108,9 +110,11 @@ do fn ← to_expr ```(%%fn : fin _ → ℕ → R),
108110
to_expr ```(witt_structure_int_prop p (%%φ : mv_polynomial (fin %%k) ℤ) n) >>= note `aux none >>=
109111
apply_fun_to_hyp ```(aeval (uncurry %%fn)) none,
110112
`[simp only [aeval_bind₁] at aux,
111-
simp only [pi.zero_apply, pi.one_apply, pi.add_apply, pi.mul_apply, pi.neg_apply, ghost_fun],
113+
simp only [pi.zero_apply, pi.one_apply, pi.add_apply, pi.sub_apply, pi.mul_apply, pi.neg_apply,
114+
ghost_fun],
112115
convert aux using 1; clear aux;
113-
simp only [alg_hom.map_zero, alg_hom.map_one, alg_hom.map_add, alg_hom.map_mul, alg_hom.map_neg,
116+
simp only [alg_hom.map_zero, alg_hom.map_one, alg_hom.map_add,
117+
alg_hom.map_sub, alg_hom.map_mul, alg_hom.map_neg,
114118
aeval_X, aeval_rename]; refl]
115119
end tactic
116120

@@ -137,6 +141,9 @@ private lemma ghost_fun_one : ghost_fun (1 : 𝕎 R) = 1 := by ghost_fun_tac 1 !
137141
private lemma ghost_fun_add : ghost_fun (x + y) = ghost_fun x + ghost_fun y :=
138142
by ghost_fun_tac (X 0 + X 1) ![x.coeff, y.coeff]
139143

144+
private lemma ghost_fun_sub : ghost_fun (x - y) = ghost_fun x - ghost_fun y :=
145+
by ghost_fun_tac (X 0 - X 1) ![x.coeff, y.coeff]
146+
140147
private lemma ghost_fun_mul : ghost_fun (x * y) = ghost_fun x * ghost_fun y :=
141148
by ghost_fun_tac (X 0 * X 1) ![x.coeff, y.coeff]
142149

@@ -172,18 +179,18 @@ include hp
172179

173180
local attribute [instance]
174181
private def comm_ring_aux₁ : comm_ring (𝕎 (mv_polynomial R ℚ)) :=
175-
(ghost_equiv' p (mv_polynomial R ℚ)).injective.comm_ring (ghost_fun)
176-
ghost_fun_zero ghost_fun_one ghost_fun_add ghost_fun_mul ghost_fun_neg
182+
(ghost_equiv' p (mv_polynomial R ℚ)).injective.comm_ring_sub (ghost_fun)
183+
ghost_fun_zero ghost_fun_one ghost_fun_add ghost_fun_mul ghost_fun_neg ghost_fun_sub
177184

178185
local attribute [instance]
179186
private def comm_ring_aux₂ : comm_ring (𝕎 (mv_polynomial R ℤ)) :=
180-
(map_fun.injective _ $ map_injective (int.cast_ring_hom ℚ) int.cast_injective).comm_ring _
181-
(map_fun.zero _) (map_fun.one _) (map_fun.add _) (map_fun.mul _) (map_fun.neg _)
187+
(map_fun.injective _ $ map_injective (int.cast_ring_hom ℚ) int.cast_injective).comm_ring_sub _
188+
(map_fun.zero _) (map_fun.one _) (map_fun.add _) (map_fun.mul _) (map_fun.neg _) (map_fun.sub _)
182189

183190
/-- The commutative ring structure on `𝕎 R`. -/
184191
instance : comm_ring (𝕎 R) :=
185-
(map_fun.surjective _ $ counit_surjective _).comm_ring (map_fun $ mv_polynomial.counit _)
186-
(map_fun.zero _) (map_fun.one _) (map_fun.add _) (map_fun.mul _) (map_fun.neg _)
192+
(map_fun.surjective _ $ counit_surjective _).comm_ring_sub (map_fun $ mv_polynomial.counit _)
193+
(map_fun.zero _) (map_fun.one _) (map_fun.add _) (map_fun.mul _) (map_fun.neg _) (map_fun.sub _)
187194

188195
variables {p R}
189196

src/ring_theory/witt_vector/defs.lean

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ witt_structure_int p 1
104104
def witt_add : ℕ → mv_polynomial (fin 2 × ℕ) ℤ :=
105105
witt_structure_int p (X 0 + X 1)
106106

107-
/-- The polynomials used for describing the subtraction of the ring of Witt vectors.
108-
Note that `a - b` is defined as `a + -b`.
109-
See `witt_vector.sub_coeff` for a proof that subtraction is precisely
110-
given by these polynomials `witt_vector.witt_sub` -/
107+
/-- The polynomials used for describing the subtraction of the ring of Witt vectors. -/
111108
def witt_sub : ℕ → mv_polynomial (fin 2 × ℕ) ℤ :=
112109
witt_structure_int p (X 0 - X 1)
113110

@@ -153,6 +150,9 @@ instance : has_one (𝕎 R) :=
153150
instance : has_add (𝕎 R) :=
154151
⟨λ x y, eval (witt_add p) ![x, y]⟩
155152

153+
instance : has_sub (𝕎 R) :=
154+
⟨λ x y, eval (witt_sub p) ![x, y]⟩
155+
156156
instance : has_mul (𝕎 R) :=
157157
⟨λ x y, eval (witt_mul p) ![x, y]⟩
158158

@@ -281,6 +281,9 @@ variables {p R}
281281
lemma add_coeff (x y : 𝕎 R) (n : ℕ) :
282282
(x + y).coeff n = peval (witt_add p n) ![x.coeff, y.coeff] := rfl
283283

284+
lemma sub_coeff (x y : 𝕎 R) (n : ℕ) :
285+
(x - y).coeff n = peval (witt_sub p n) ![x.coeff, y.coeff] := rfl
286+
284287
lemma mul_coeff (x y : 𝕎 R) (n : ℕ) :
285288
(x * y).coeff n = peval (witt_mul p n) ![x.coeff, y.coeff] := rfl
286289

@@ -293,6 +296,10 @@ lemma witt_add_vars (n : ℕ) :
293296
(witt_add p n).vars ⊆ finset.univ.product (finset.range (n + 1)) :=
294297
witt_structure_int_vars _ _ _
295298

299+
lemma witt_sub_vars (n : ℕ) :
300+
(witt_sub p n).vars ⊆ finset.univ.product (finset.range (n + 1)) :=
301+
witt_structure_int_vars _ _ _
302+
296303
lemma witt_mul_vars (n : ℕ) :
297304
(witt_mul p n).vars ⊆ finset.univ.product (finset.range (n + 1)) :=
298305
witt_structure_int_vars _ _ _

src/ring_theory/witt_vector/is_poly.lean

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -617,37 +617,4 @@ attribute [ghost_simps]
617617
nat.succ_ne_zero nat.add_sub_cancel nat.succ_eq_add_one
618618
if_true eq_self_iff_true if_false forall_true_iff forall_2_true_iff forall_3_true_iff
619619

620-
/-!
621-
### Subtraction of Witt vectors
622-
623-
In Lean, subtraction in a ring is by definition equal to `x + -y`.
624-
For Witt vectors, this means that subtraction is not defined in terms of
625-
the polynomials `witt_sub p`.
626-
627-
As a demonstration of some of the techniques developed in this file,
628-
we show by a computation that evaluating `witt_sub p` on the coefficients of `x` and `y`
629-
gives the coefficients of `x - y`.
630-
631-
For a more powerful demonstration, see `ring_theory/witt_vector/identities.lean`.
632-
-/
633-
634-
lemma sub_eq (x y : 𝕎 R) :
635-
x - y = eval (witt_sub p) ![x, y] :=
636-
begin
637-
apply is_poly₂.ext ((add_is_poly₂).comp_right
638-
(neg_is_poly)) ⟨witt_sub p, by intros; refl⟩ _ _ x y,
639-
unfreezingI { clear_dependent R }, introsI R _Rcr x y n,
640-
simp only [←sub_eq_add_neg, ring_hom.map_sub],
641-
symmetry,
642-
have := witt_structure_int_prop p (X 0 - X 1 : mv_polynomial (fin 2) ℤ) n,
643-
apply_fun (aeval (function.uncurry ![x.coeff, y.coeff])) at this,
644-
simp only [aeval_bind₁, alg_hom.map_sub, bind₁_X_right] at this,
645-
simp only [aeval_eq_eval₂_hom, eval₂_hom_rename] at this,
646-
exact this,
647-
end
648-
649-
lemma sub_coeff (x y : 𝕎 R) (n : ℕ) :
650-
(x - y).coeff n = peval (witt_sub p n) ![x.coeff, y.coeff] :=
651-
by { rw [sub_eq], refl }
652-
653620
end witt_vector

0 commit comments

Comments
 (0)