Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reorganising category_theory/instances/rings.lean
- Loading branch information
1 parent
29507a4
commit 7056d5b
Showing
3 changed files
with
71 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/- Copyright (c) 2019 Scott Morrison. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Scott Morrison, Johannes Hölzl | ||
Multivariable polynomials on a type is the left adjoint of the | ||
forgetful functor from commutative rings to types. | ||
-/ | ||
|
||
import category_theory.instances.CommRing.basic | ||
import category_theory.adjunction | ||
import data.mv_polynomial | ||
|
||
universe u | ||
|
||
open mv_polynomial | ||
open category_theory | ||
open category_theory.instances | ||
|
||
namespace category_theory.instances.CommRing | ||
|
||
local attribute [instance, priority 0] subtype.fintype set_fintype classical.prop_decidable | ||
|
||
noncomputable def polynomial_ring : Type u ⥤ CommRing.{u} := | ||
{ obj := λ α, ⟨mv_polynomial α ℤ, by apply_instance⟩, | ||
map := λ α β f, ⟨eval₂ C (X ∘ f), by apply_instance⟩, | ||
map_id' := λ α, subtype.ext.mpr $ funext $ eval₂_eta, | ||
map_comp' := λ α β γ f g, subtype.ext.mpr $ funext $ λ p, | ||
by apply mv_polynomial.induction_on p; intros; | ||
simp only [*, eval₂_add, eval₂_mul, eval₂_C, eval₂_X, comp_val, | ||
eq_self_iff_true, function.comp_app, types_comp] at * } | ||
|
||
@[simp] lemma polynomial_ring_obj_α {α : Type u} : | ||
(polynomial_ring.obj α).α = mv_polynomial α ℤ := rfl | ||
|
||
@[simp] lemma polynomial_ring_map_val {α β : Type u} {f : α → β} : | ||
(polynomial_ring.map f).val = eval₂ C (X ∘ f) := rfl | ||
|
||
noncomputable def adj : adjunction polynomial_ring (forget : CommRing ⥤ Type u) := | ||
adjunction.mk_of_hom_equiv _ _ | ||
{ hom_equiv := λ α R, | ||
{ to_fun := λ f, f ∘ X, | ||
inv_fun := λ f, ⟨eval₂ int.cast f, by apply_instance⟩, | ||
left_inv := λ f, subtype.ext.mpr $ funext $ λ p, | ||
begin | ||
have H0 := λ n, (congr (int.eq_cast' (f.val ∘ C)) (rfl : n = n)).symm, | ||
have H1 := λ p₁ p₂, (@is_ring_hom.map_add _ _ _ _ f.val f.2 p₁ p₂).symm, | ||
have H2 := λ p₁ p₂, (@is_ring_hom.map_mul _ _ _ _ f.val f.2 p₁ p₂).symm, | ||
apply mv_polynomial.induction_on p; intros; | ||
simp only [*, eval₂_add, eval₂_mul, eval₂_C, eval₂_X, | ||
eq_self_iff_true, function.comp_app, hom_coe_app] at * | ||
end, | ||
right_inv := by tidy }, | ||
hom_equiv_naturality_left_symm' := λ X' X Y f g, subtype.ext.mpr $ funext $ λ p, | ||
begin | ||
apply mv_polynomial.induction_on p; intros; | ||
simp only [*, eval₂_mul, eval₂_add, eval₂_C, eval₂_X, | ||
comp_val, equiv.coe_fn_symm_mk, hom_coe_app, polynomial_ring_map_val, | ||
eq_self_iff_true, function.comp_app, add_right_inj, types_comp] at * | ||
end } | ||
|
||
end category_theory.instances.CommRing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/- | ||
Copyright (c) 2019 Scott Morrison. All rights reserved. | ||
Released under Apache 2.0 license as described in the file LICENSE. | ||
Authors: Scott Morrison | ||
-/ | ||
|
||
import category_theory.instances.CommRing.basic | ||
import category_theory.instances.CommRing.adjunctions |