Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 17,066 Bytes
4365a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
import algebra.group_power
import ring_theory.ideal_operations
import ring_theory.subring

import for_mathlib.rings
import for_mathlib.equiv

import valuation.linear_ordered_comm_group_with_zero

/-!

# The basics of valuation theory.

The basic theory of valuations (non-archimedean norms) on a commutative ring,
following T. Wedhorn's unpublished notes β€œAdic Spaces” ([Wedhorn])

The definition of a valuation we use here is Definition 1.22 of [Wedhorn]. `valuation R Ξ“β‚€`
is the type of valuations R β†’ Ξ“β‚€, with a coercion to the underlying
function. If v is a valuation from R to Ξ“β‚€ then the induced group
homomorphism units(R) β†’ Ξ“β‚€ is called `unit_map v`.

The equivalence "relation" `is_equiv v₁ vβ‚‚ : Prop` defined in [Wedhorn; 1.27] is not strictly
speaking a relation, because v₁ : valuation R Γ₁ and vβ‚‚ : valuation R Ξ“β‚‚ might
not have the same type. This corresponds in ZFC to the set-theoretic difficulty
that the class of all valuations (as Ξ“β‚€ varies) on a ring R is not a set.
The "relation" is however reflexive, symmetric and transitive in the obvious
sense. Note that we use 1.27(iii) as the definition of equivalence.

The trivial valuation associated to a prime ideal P of R is `trivial P : valuation R Ξ“β‚€`.

The support of a valuation v : valuation R Ξ“β‚€ is `supp v`. If J is an ideal of R
with `h : J βŠ† supp v` then the induced valuation
on R / J = `ideal.quotient J` is `on_quot v h`.

-/

local attribute [instance] classical.prop_decidable
noncomputable theory

local attribute [instance, priority 0] classical.DLO

open function ideal linear_ordered_structure

universes u uβ‚€ u₁ uβ‚‚ -- v is used for valuations

variables {R : Type uβ‚€} -- This will be a ring, assumed commutative in some sections

variables {Ξ“β‚€   : Type u}  [linear_ordered_comm_group_with_zero Ξ“β‚€]
variables {Ξ“'β‚€  : Type u₁} [linear_ordered_comm_group_with_zero Ξ“'β‚€]
variables {Ξ“''β‚€ : Type uβ‚‚} [linear_ordered_comm_group_with_zero Ξ“''β‚€]

set_option old_structure_cmd true

section
variables (R) (Ξ“β‚€) [ring R]

/-- The type of Ξ“β‚€-valued valuations on R. -/
structure valuation extends R β†’* Ξ“β‚€ :=
(map_zero' : to_fun 0 = 0)
(map_add' : βˆ€ x y, to_fun (x + y) ≀ max (to_fun x) (to_fun y))

end

namespace valuation

section basic
variables (R) (Ξ“β‚€) [ring R]

/-- A valuation is coerced to the underlying function R β†’ Ξ“β‚€. -/
instance : has_coe_to_fun (valuation R Ξ“β‚€) := { F := Ξ» _, R β†’ Ξ“β‚€, coe := valuation.to_fun }

/-- A valuation is coerced to a monoid morphism R β†’ Ξ“β‚€. -/
instance : has_coe (valuation R Ξ“β‚€) (R β†’* Ξ“β‚€) := ⟨valuation.to_monoid_hom⟩

variables {R} {Ξ“β‚€} (v : valuation R Ξ“β‚€) {x y z : R}

@[squash_cast, simp] lemma coe_coe : ((v : R β†’* Ξ“β‚€) : R β†’ Ξ“β‚€) = v := rfl

@[simp] lemma map_zero : v 0 = 0 := v.map_zero'
@[simp] lemma map_one  : v 1 = 1 := v.map_one'
@[simp] lemma map_mul  : βˆ€ x y, v (x * y) = v x * v y := v.map_mul'
@[simp] lemma map_add  : βˆ€ x y, v (x + y) ≀ max (v x) (v y) := v.map_add'

@[simp] lemma map_pow  : βˆ€ x (n:β„•), v (x^n) = (v x)^n :=
@is_monoid_hom.map_pow _ _ _ _ v (monoid_hom.is_monoid_hom v.to_monoid_hom)

@[ext] lemma ext {v₁ vβ‚‚ : valuation R Ξ“β‚€} (h : βˆ€ r, v₁ r = vβ‚‚ r) : v₁ = vβ‚‚ :=
by { cases v₁, cases vβ‚‚, congr, funext r, exact h r }

lemma ext_iff {v₁ vβ‚‚ : valuation R Ξ“β‚€} : v₁ = vβ‚‚ ↔ βˆ€ r, v₁ r = vβ‚‚ r :=
⟨λ h r, congr_arg _ h, ext⟩

-- The following definition is not an instance, because we have more than one v on a given R.
/-- A valuation gives a preorder on the underlying ring. -/
def to_preorder : preorder R := preorder.lift v (by apply_instance)

/-- If v is a valuation on a division ring then v(x) = 0 iff x = 0. -/
lemma zero_iff {K : Type uβ‚€} [division_ring K]
  (v : valuation K Ξ“β‚€) {x : K} : v x = 0 ↔ x = 0 :=
begin
  split ; intro h,
  { contrapose! h,
    exact group_with_zero.unit_ne_zero (units.map (v : K β†’* Ξ“β‚€) $ units.mk0 _ h) },
  { exact h.symm β–Έ v.map_zero },
end

lemma ne_zero_iff {K : Type uβ‚€} [division_ring K]
  (v : valuation K Ξ“β‚€) {x : K} : v x β‰  0 ↔ x β‰  0 :=
not_iff_not_of_iff v.zero_iff

@[simp] lemma map_inv' {K : Type uβ‚€} [division_ring K]
  (v : valuation K Ξ“β‚€) {x : K} (h : x β‰  0) : v x⁻¹ = (v x)⁻¹ :=
begin
  apply eq_inv_of_mul_right_eq_one',
  rw [← v.map_mul, mul_inv_cancel h, v.map_one]
end

@[simp] lemma map_inv {K : Type uβ‚€} [discrete_field K]
  (v : valuation K Ξ“β‚€) {x : K} : v x⁻¹ = (v x)⁻¹ :=
begin
  by_cases h : x = 0,
  { rw [h, inv_zero, map_zero, inv_zero'] },
  { exact v.map_inv' h }
end

lemma map_units_inv (x : units R) : v (x⁻¹ : units R) = (v x)⁻¹ :=
eq_inv_of_mul_right_eq_one' _ _ $ by rw [← v.map_mul, units.mul_inv, v.map_one]

@[simp] theorem unit_map_eq (u : units R) :
  (units.map (v : R β†’* Ξ“β‚€) u : Ξ“β‚€) = v u := rfl

@[simp] theorem map_neg_one : v (-1) = 1 :=
begin
  show (units.map (v : R β†’* Ξ“β‚€) (-1 : units R) : Ξ“β‚€) = (1 : units Ξ“β‚€),
  rw ← units.ext_iff,
  apply linear_ordered_structure.eq_one_of_pow_eq_one (nat.succ_ne_zero _) (_ : _ ^ 2 = _),
  rw [pow_two, ← monoid_hom.map_mul, units.ext_iff],
  show v ((-1) * (-1)) = 1,
  rw [neg_one_mul, neg_neg, v.map_one]
end

@[simp] lemma map_neg (x : R) : v (-x) = v x :=
calc v (-x) = v (-1 * x)   : by simp
        ... = v (-1) * v x : map_mul _ _ _
        ... = v x          : by simp

lemma map_sub_swap (x y : R) : v (x - y) = v (y - x) :=
calc v (x - y) = v (-(y - x)) : by rw show x - y = -(y-x), by abel
           ... = _ : map_neg _ _

lemma map_sub_le_max (x y : R) : v (x - y) ≀ max (v x) (v y) :=
calc v (x-y) = v (x + -y)   : by simp
        ... ≀ max (v x) (v $ -y) : v.map_add _ _
        ... = max (v x) (v y)    : by rw map_neg

lemma map_add_of_distinct_val (h : v x β‰  v y) : v (x + y) = max (v x) (v y) :=
begin
  suffices : Β¬v (x + y) < max (v x) (v y),
    from or_iff_not_imp_right.1 (le_iff_eq_or_lt.1 (v.map_add x y)) this,
  intro h',
  wlog vyx : v y < v x using x y,
  { apply lt_or_gt_of_ne h.symm },
  { rw max_eq_left_of_lt vyx at h',
    apply lt_irrefl (v x),
    calc v x = v ((x+y) - y)         : by simp
         ... ≀ max (v $ x + y) (v y) : map_sub_le_max _ _ _
         ... < v x                   : max_lt h' vyx },
  { apply this h.symm,
    rwa [add_comm, max_comm] at h' }
end

lemma map_eq_of_sub_lt (h : v (y - x) < v x) : v y = v x :=
begin
  have := valuation.map_add_of_distinct_val v (ne_of_gt h).symm,
  rw max_eq_right (le_of_lt h) at this,
  simpa using this
end

/-- A ring homomorphism S β†’ R induces a map valuation R Ξ“β‚€ β†’ valuation S Ξ“β‚€ -/
def comap {S : Type u₁} [ring S] (f : S β†’ R) [is_ring_hom f] (v : valuation R Ξ“β‚€) :
  valuation S Ξ“β‚€ :=
by refine_struct { to_fun := v ∘ f, .. }; intros;
  simp [is_ring_hom.map_zero f, is_ring_hom.map_one f, is_ring_hom.map_mul f, is_ring_hom.map_add f]

@[simp] lemma comap_id : v.comap (id : R β†’ R) = v := ext $ Ξ» r, rfl

lemma comap_comp {S₁ : Type u₁} [ring S₁] {Sβ‚‚ : Type uβ‚‚} [ring Sβ‚‚]
(f : S₁ β†’ Sβ‚‚) [is_ring_hom f] (g : Sβ‚‚ β†’ R) [is_ring_hom g] :
  v.comap (g ∘ f) = (v.comap g).comap f :=
ext $ Ξ» r, rfl

/-- A ≀-preserving group homomorphism Ξ“β‚€ β†’ Ξ“'β‚€ induces a map valuation R Ξ“β‚€ β†’ valuation R Ξ“'β‚€. -/
def map (f : Ξ“β‚€ β†’* Ξ“'β‚€) (hβ‚€ : f 0 = 0) (hf : monotone f) (v : valuation R Ξ“β‚€) : valuation R Ξ“'β‚€ :=
{ to_fun := f ∘ v,
  map_zero' := show f (v 0) = 0, by rw [v.map_zero, hβ‚€],
  map_add' := Ξ» r s,
    calc f (v (r + s)) ≀ f (max (v r) (v s))     : hf (v.map_add r s)
                   ... = max (f (v r)) (f (v s)) : hf.map_max,
  .. monoid_hom.comp f (v : R β†’* Ξ“β‚€) }

/-- Two valuations on R are defined to be equivalent if they induce the same preorder on R. -/
def is_equiv (v₁ : valuation R Ξ“β‚€) (vβ‚‚ : valuation R Ξ“'β‚€) : Prop :=
βˆ€ r s, v₁ r ≀ v₁ s ↔ vβ‚‚ r ≀ vβ‚‚ s

end basic -- end of section

namespace is_equiv
variables [ring R]
variables {v : valuation R Ξ“β‚€}
variables {v₁ : valuation R Ξ“β‚€} {vβ‚‚ : valuation R Ξ“'β‚€} {v₃ : valuation R Ξ“''β‚€}

@[refl] lemma refl : v.is_equiv v :=
Ξ» _ _, iff.refl _

@[symm] lemma symm (h : v₁.is_equiv vβ‚‚) : vβ‚‚.is_equiv v₁ :=
Ξ» _ _, iff.symm (h _ _)

@[trans] lemma trans (h₁₂ : v₁.is_equiv vβ‚‚) (h₂₃ : vβ‚‚.is_equiv v₃) : v₁.is_equiv v₃ :=
Ξ» _ _, iff.trans (h₁₂ _ _) (h₂₃ _ _)

lemma of_eq {v' : valuation R Ξ“β‚€} (h : v = v') : v.is_equiv v' :=
by subst h; refl

lemma map {v' : valuation R Ξ“β‚€} (f : Ξ“β‚€ β†’* Ξ“'β‚€) (hβ‚€ : f 0 = 0) (hf : monotone f) (inf : injective f)
  (h : v.is_equiv v') :
  (v.map f hβ‚€ hf).is_equiv (v'.map f hβ‚€ hf) :=
Ξ» r s,
calc f (v r) ≀ f (v s) ↔ v r ≀ v s : by rw linear_order_le_iff_of_monotone_injective inf hf
                   ... ↔ v' r ≀ v' s : h r s
                   ... ↔ f (v' r) ≀ f (v' s) : by rw linear_order_le_iff_of_monotone_injective inf hf

/-- `comap` preserves equivalence. -/
lemma comap {S : Type uβ‚‚} [ring S] (f : S β†’ R) [is_ring_hom f] (h : v₁.is_equiv vβ‚‚) :
  (v₁.comap f).is_equiv (vβ‚‚.comap f) :=
Ξ» r s, h (f r) (f s)

lemma val_eq (h : v₁.is_equiv vβ‚‚) {r s : R} :
  v₁ r = v₁ s ↔ vβ‚‚ r = vβ‚‚ s :=
⟨λ H, le_antisymm ((h _ _).1 (le_of_eq H)) ((h _ _).1 (le_of_eq H.symm)),
 λ H, le_antisymm ((h.symm _ _).1 (le_of_eq H)) ((h.symm _ _).1 (le_of_eq H.symm)) ⟩

lemma ne_zero (h : v₁.is_equiv vβ‚‚) {r : R} :
  v₁ r β‰  0 ↔ vβ‚‚ r β‰  0 :=
begin
  have : v₁ r β‰  v₁ 0 ↔ vβ‚‚ r β‰  vβ‚‚ 0 := not_iff_not_of_iff h.val_eq,
  rwa [v₁.map_zero, vβ‚‚.map_zero] at this,
end

end is_equiv -- end of namespace

lemma is_equiv_of_map_strict_mono [ring R] {v : valuation R Ξ“β‚€}
  (f : Ξ“β‚€ β†’* Ξ“'β‚€) (hβ‚€ : f 0 = 0) (H : strict_mono f) :
  is_equiv (v.map f hβ‚€ (H.monotone)) v :=
λ x y, ⟨H.le_iff_le.mp, λ h, H.monotone h⟩

lemma is_equiv_of_val_le_one {K : Type*} [division_ring K]
  (v : valuation K Ξ“β‚€) (v' : valuation K Ξ“'β‚€) (h : βˆ€ {x:K}, v x ≀ 1 ↔ v' x ≀ 1) :
  v.is_equiv v' :=
begin
  intros x y,
  by_cases hy : y = 0, { simp [hy, zero_iff], },
  rw show y = 1 * y, by rw one_mul,
  rw show x = (x * y⁻¹) * y, { rw [mul_assoc, inv_mul_cancel hy, mul_one], },
  iterate 2 {rw [v.map_mul _ y, v'.map_mul _ y]},
  rw [v.map_one, v'.map_one],
  split; intro H,
  { apply actual_ordered_comm_monoid.mul_le_mul_right',
    replace hy := v.ne_zero_iff.mpr hy,
    replace H := linear_ordered_structure.le_of_le_mul_right hy H,
    rwa h at H, },
  { apply actual_ordered_comm_monoid.mul_le_mul_right',
    replace hy := v'.ne_zero_iff.mpr hy,
    replace H := linear_ordered_structure.le_of_le_mul_right hy H,
    rwa h, },
end

/-- A valuation is trivial if it maps everything to 0 or 1.-/
def is_trivial [ring R] (v : valuation R Ξ“β‚€) : Prop :=
βˆ€ r:R, v r = 0 ∨ v r = 1

section trivial -- the trivial valuation
variable [comm_ring R]
variables (I : ideal R) [prime : I.is_prime]

/-- The trivial Ξ“β‚€-valued valuation associated to a prime ideal S of R. -/
def trivial : valuation R (with_zero punit) :=
{ to_fun := λ x, if x ∈ I then 0 else 1,
  map_zero' := if_pos I.zero_mem,
  map_one'  := if_neg (assume h, prime.1 (I.eq_top_iff_one.2 h)),
  map_mul'  := Ξ» x y,
    if hx : x ∈ I then by rw [if_pos hx, zero_mul, if_pos (I.mul_mem_right hx)]
    else if hy : y ∈ I then by rw [if_pos hy, mul_zero, if_pos (I.mul_mem_left hy)]
    else have hxy : x * y βˆ‰ I,
    by { assume hxy, replace hxy := prime.mem_or_mem hxy, tauto },
    by rw [if_neg hx, if_neg hy, if_neg hxy, mul_one],
  map_add'  := Ξ» x y, begin
      split_ifs with hxy hx hy _ hx hy;
      try {simp}; try {exact le_refl _},
      { exact hxy (I.add_mem hx hy) }
    end }

lemma trivial_is_trivial (I : ideal R) [hI : I.is_prime] :
  (trivial I).is_trivial :=
begin
  intro r, generalize : (trivial I) r = x,
  cases x; [left, {right, cases x}]; refl
end

lemma is_trivial_iff_val_le_one {K : Type*} [division_ring K] {v : valuation K Ξ“β‚€} :
  v.is_trivial ↔ βˆ€ x:K, v x ≀ 1 :=
begin
  split; intros h x,
  { cases h x; simp *, },
  { contrapose! h, cases h with h₁ hβ‚‚,
    by_cases hx : v x ≀ 1,
    { refine ⟨x⁻¹, _⟩,
      rw [v.map_inv', ← linear_ordered_structure.inv_lt_inv _ _,
        inv_inv'', inv_one'],
      { exact lt_of_le_of_ne hx hβ‚‚ },
      { exact inv_ne_zero' _ h₁ },
      { exact one_ne_zero },
      { rwa v.ne_zero_iff at h₁, } },
    { push_neg at hx, exact ⟨_, hx⟩ } }
end

end trivial -- end of section

section supp
variables  [comm_ring R]
variables (v : valuation R Ξ“β‚€)

/-- The support of a valuation v : R β†’ Ξ“β‚€ is the ideal of R where v vanishes. -/
def supp : ideal R :=
{ carrier := {x | v x = 0},
  zero := map_zero v,
  add  := Ξ» x y hx hy, le_zero_iff.mp $
    calc v (x + y) ≀ max (v x) (v y) : v.map_add x y
               ... ≀ 0               : max_le (le_zero_iff.mpr hx) (le_zero_iff.mpr hy),
  smul  := Ξ» c x hx, calc v (c * x)
                        = v c * v x : map_mul v c x
                    ... = v c * 0 : congr_arg _ hx
                    ... = 0 : mul_zero _ }

@[simp] lemma mem_supp_iff (x : R) : x ∈ supp v ↔ v x = 0 := iff.rfl
-- @[simp] lemma mem_supp_iff' (x : R) : x ∈ (supp v : set R) ↔ v x = 0 := iff.rfl

/-- The support of a valuation is a prime ideal. -/
instance : ideal.is_prime (supp v) :=
⟨λ (h : v.supp = ⊀), one_ne_zero $ show (1 : Ξ“β‚€) = 0,
from calc 1 = v 1 : v.map_one.symm
        ... = 0   : show (1:R) ∈ supp v, by rw h; trivial,
 Ξ» x y hxy, begin
    show v x = 0 ∨ v y = 0,
    change v (x * y) = 0 at hxy,
    rw [v.map_mul x y] at hxy,
    exact group_with_zero.mul_eq_zero _ _ hxy
  end⟩

/-- v(a)=v(a+s) if s ∈ supp(v). -/
lemma val_add_supp (a s : R) (h : s ∈ supp v) : v (a + s) = v a :=
begin
  have aux : βˆ€ a s, v s = 0 β†’ v (a + s) ≀ v a,
  { intros a' s' h', refine le_trans (v.map_add a' s') (max_le (le_refl _) _), simp [h'], },
  apply le_antisymm (aux a s h),
  calc v a = v (a + s + -s) : by simp
       ... ≀ v (a + s)      : aux (a + s) (-s) (by rwa ←ideal.neg_mem_iff at h)
end

/-- If `hJ : J βŠ† supp v` then `on_quot_val hJ` is the induced function on R/J as a function.
Note: it's just the function; the valuation is `on_quot hJ`. -/
definition on_quot_val {J : ideal R} (hJ : J ≀ supp v) :
  J.quotient β†’ Ξ“β‚€ :=
Ξ» q, quotient.lift_on' q v $ Ξ» a b h,
calc v a = v (b + (a - b)) : by simp
     ... = v b             : v.val_add_supp b (a - b) (hJ h)

/-- The extension of valuation v on R to valuation on R/J if J βŠ† supp v -/
definition on_quot {J : ideal R} (hJ : J ≀ supp v) :
  valuation J.quotient Ξ“β‚€ :=
{ to_fun := v.on_quot_val hJ,
  map_zero' := v.map_zero,
  map_one'  := v.map_one,
  map_mul'  := Ξ» xbar ybar, quotient.indβ‚‚' v.map_mul xbar ybar,
  map_add'  := Ξ» xbar ybar, quotient.indβ‚‚' v.map_add xbar ybar }

@[simp] lemma on_quot_comap_eq {J : ideal R} (hJ : J ≀ supp v) :
  (v.on_quot hJ).comap (ideal.quotient.mk J) = v :=
ext $ Ξ» r,
begin
  refine @quotient.lift_on_beta _ _ (J.quotient_rel) v (Ξ» a b h, _) _,
  calc v a = v (b + (a - b)) : by simp
       ... = v b             : v.val_add_supp b (a - b) (hJ h)
end

end supp -- end of section

section supp_comm
variable [comm_ring R]
variables (v : valuation R Ξ“β‚€)

lemma comap_supp {S : Type u₁} [comm_ring S] (f : S β†’ R) [is_ring_hom f] :
  supp (v.comap f) = ideal.comap f v.supp :=
ideal.ext $ Ξ» x,
begin
  rw [mem_supp_iff, ideal.mem_comap, mem_supp_iff],
  refl,
end

lemma self_le_supp_comap (J : ideal R) (v : valuation (quotient J) Ξ“β‚€) :
  J ≀ (v.comap (ideal.quotient.mk J)).supp :=
by rw [comap_supp, ← ideal.map_le_iff_le_comap]; simp

@[simp] lemma comap_on_quot_eq (J : ideal R) (v : valuation J.quotient Ξ“β‚€) :
  (v.comap (ideal.quotient.mk J)).on_quot (v.self_le_supp_comap J) = v :=
ext $ by { rintro ⟨x⟩, refl }

/-- The quotient valuation on R/J has support supp(v)/J if J βŠ† supp v. -/
lemma supp_quot {J : ideal R} (hJ : J ≀ supp v) :
supp (v.on_quot hJ) = (supp v).map (ideal.quotient.mk J) :=
begin
  apply le_antisymm,
  { rintro ⟨x⟩ hx,
    apply ideal.subset_span,
    exact ⟨x, hx, rfl⟩ },
  { rw ideal.map_le_iff_le_comap,
    intros x hx, exact hx }
end

lemma supp_quot_supp : supp (v.on_quot (le_refl _)) = 0 :=
by rw supp_quot; exact ideal.map_quotient_self _

lemma quot_preorder_comap {J : ideal R} (hJ : J ≀ supp v) :
preorder.lift (ideal.quotient.mk J) (v.on_quot hJ).to_preorder = v.to_preorder :=
preorder.ext $ Ξ» x y, iff.rfl

end supp_comm -- end of section

end valuation