Library UniMath.CategoryTheory.categories.flds
Require Import UniMath.Foundations.PartD.
Require Import UniMath.Foundations.Propositions.
Require Import UniMath.Foundations.Sets.
Require Import UniMath.Foundations.UnivalenceAxiom.
Require Import UniMath.Algebra.BinaryOperations.
Require Import UniMath.Algebra.Monoids.
Require Import UniMath.Algebra.RigsAndRings.
Require Import UniMath.Algebra.Domains_and_Fields.
Require Import UniMath.CategoryTheory.Core.Categories.
Require Import UniMath.CategoryTheory.Core.Isos.
Require Import UniMath.CategoryTheory.Core.Univalence.
Local Open Scope cat.
Section def_fld_precategory.
Definition fld_fun_space (A B : fld) : hSet := make_hSet (ringfun A B) (isasetrigfun A B).
Definition fld_precategory_ob_mor : precategory_ob_mor :=
tpair (λ ob : UU, ob -> ob -> UU) fld (λ A B : fld, fld_fun_space A B).
Definition fld_precategory_data : precategory_data :=
make_precategory_data
fld_precategory_ob_mor (λ (X : fld), (rigisotorigfun (idrigiso X)))
(fun (X Y Z : fld) (f : ringfun X Y) (g : ringfun Y Z) => rigfuncomp f g).
Local Lemma fld_id_left (X Y : fld) (f : ringfun X Y) :
rigfuncomp (rigisotorigfun (idrigiso X)) f = f.
Show proof.
Opaque fld_id_left.
Local Lemma fld_id_right (X Y : fld) (f : ringfun X Y) :
rigfuncomp f (rigisotorigfun (idrigiso Y)) = f.
Show proof.
Opaque fld_id_right.
Local Lemma fld_assoc (X Y Z W : fld) (f : ringfun X Y) (g : ringfun Y Z) (h : ringfun Z W) :
rigfuncomp f (rigfuncomp g h) = rigfuncomp (rigfuncomp f g) h.
Show proof.
Opaque fld_assoc.
Lemma is_precategory_fld_precategory_data : is_precategory fld_precategory_data.
Show proof.
Definition fld_precategory : precategory :=
make_precategory fld_precategory_data is_precategory_fld_precategory_data.
Lemma has_homsets_fld_precategory : has_homsets fld_precategory.
Show proof.
End def_fld_precategory.
Definition fld_fun_space (A B : fld) : hSet := make_hSet (ringfun A B) (isasetrigfun A B).
Definition fld_precategory_ob_mor : precategory_ob_mor :=
tpair (λ ob : UU, ob -> ob -> UU) fld (λ A B : fld, fld_fun_space A B).
Definition fld_precategory_data : precategory_data :=
make_precategory_data
fld_precategory_ob_mor (λ (X : fld), (rigisotorigfun (idrigiso X)))
(fun (X Y Z : fld) (f : ringfun X Y) (g : ringfun Y Z) => rigfuncomp f g).
Local Lemma fld_id_left (X Y : fld) (f : ringfun X Y) :
rigfuncomp (rigisotorigfun (idrigiso X)) f = f.
Show proof.
Opaque fld_id_left.
Local Lemma fld_id_right (X Y : fld) (f : ringfun X Y) :
rigfuncomp f (rigisotorigfun (idrigiso Y)) = f.
Show proof.
Opaque fld_id_right.
Local Lemma fld_assoc (X Y Z W : fld) (f : ringfun X Y) (g : ringfun Y Z) (h : ringfun Z W) :
rigfuncomp f (rigfuncomp g h) = rigfuncomp (rigfuncomp f g) h.
Show proof.
Opaque fld_assoc.
Lemma is_precategory_fld_precategory_data : is_precategory fld_precategory_data.
Show proof.
use make_is_precategory_one_assoc.
- intros a b f. use fld_id_left.
- intros a b f. use fld_id_right.
- intros a b c d f g h. use fld_assoc.
- intros a b f. use fld_id_left.
- intros a b f. use fld_id_right.
- intros a b c d f g h. use fld_assoc.
Definition fld_precategory : precategory :=
make_precategory fld_precategory_data is_precategory_fld_precategory_data.
Lemma has_homsets_fld_precategory : has_homsets fld_precategory.
Show proof.
End def_fld_precategory.
Section def_fld_category.
Definition fld_category : category := make_category _ has_homsets_fld_precategory.
Definition fld_category : category := make_category _ has_homsets_fld_precategory.
Lemma fld_iso_is_equiv (A B : ob fld_category) (f : z_iso A B) : isweq (pr1 (pr1 f)).
Show proof.
use isweq_iso.
- exact (pr1rigfun _ _ (inv_from_z_iso f)).
- intros x.
use (toforallpaths _ _ _ (subtypeInjectivity _ _ _ _ (z_iso_inv_after_z_iso f)) x).
intros x0. use isapropisrigfun.
- intros x.
use (toforallpaths _ _ _ (subtypeInjectivity _ _ _ _ (z_iso_after_z_iso_inv f)) x).
intros x0. use isapropisrigfun.
Opaque fld_iso_is_equiv.- exact (pr1rigfun _ _ (inv_from_z_iso f)).
- intros x.
use (toforallpaths _ _ _ (subtypeInjectivity _ _ _ _ (z_iso_inv_after_z_iso f)) x).
intros x0. use isapropisrigfun.
- intros x.
use (toforallpaths _ _ _ (subtypeInjectivity _ _ _ _ (z_iso_after_z_iso_inv f)) x).
intros x0. use isapropisrigfun.
Lemma fld_iso_equiv (X Y : ob fld_category) : z_iso X Y -> ringiso (X : fld) (Y : fld).
Show proof.
intro f.
use make_ringiso.
- exact (make_weq (pr1 (pr1 f)) (fld_iso_is_equiv X Y f)).
- exact (pr2 (pr1 f)).
use make_ringiso.
- exact (make_weq (pr1 (pr1 f)) (fld_iso_is_equiv X Y f)).
- exact (pr2 (pr1 f)).
Lemma fld_equiv_is_z_iso (X Y : ob fld_category) (f : ringiso (X : fld) (Y : fld)) :
@is_z_isomorphism fld_category X Y (ringfunconstr (pr2 f)).
Show proof.
exists (ringfunconstr (pr2 (invrigiso f))).
use make_is_inverse_in_precat.
- use rigfun_paths. use funextfun. intros x. use homotinvweqweq.
- use rigfun_paths. use funextfun. intros y. use homotweqinvweq.
Opaque fld_equiv_is_z_iso.use make_is_inverse_in_precat.
- use rigfun_paths. use funextfun. intros x. use homotinvweqweq.
- use rigfun_paths. use funextfun. intros y. use homotweqinvweq.
Lemma fld_equiv_iso (X Y : ob fld_category) : ringiso (X : fld) (Y : fld) -> z_iso X Y.
Show proof.
Lemma fld_iso_equiv_is_equiv (X Y : fld_category) : isweq (fld_iso_equiv X Y).
Show proof.
use isweq_iso.
- exact (fld_equiv_iso X Y).
- intros x. use z_iso_eq. use rigfun_paths. apply idpath.
- intros y. use rigiso_paths. use subtypePath.
+ intros x0. use isapropisweq.
+ apply idpath.
Opaque fld_iso_equiv_is_equiv.- exact (fld_equiv_iso X Y).
- intros x. use z_iso_eq. use rigfun_paths. apply idpath.
- intros y. use rigiso_paths. use subtypePath.
+ intros x0. use isapropisweq.
+ apply idpath.
Definition fld_iso_equiv_weq (X Y : ob fld_category) :
weq (z_iso X Y) (ringiso (X : fld) (Y : fld)).
Show proof.
Lemma fld_equiv_iso_is_equiv (X Y : ob fld_category) : isweq (fld_equiv_iso X Y).
Show proof.
use isweq_iso.
- exact (fld_iso_equiv X Y).
- intros y. use rigiso_paths. use subtypePath.
+ intros x0. use isapropisweq.
+ apply idpath.
- intros x. use z_iso_eq. use rigfun_paths. apply idpath.
Opaque fld_equiv_iso_is_equiv.- exact (fld_iso_equiv X Y).
- intros y. use rigiso_paths. use subtypePath.
+ intros x0. use isapropisweq.
+ apply idpath.
- intros x. use z_iso_eq. use rigfun_paths. apply idpath.
Definition fld_equiv_weq_iso (X Y : ob fld_category) :
(ringiso (X : fld) (Y : fld)) ≃ (z_iso X Y).
Show proof.
Definition fld_category_isweq (X Y : ob fld_category) : isweq (λ p : X = Y, idtoiso p).
Show proof.
use (@isweqhomot
(X = Y) (z_iso X Y)
(pr1weq (weqcomp (fld_univalence X Y) (fld_equiv_weq_iso X Y)))
_ _ (weqproperty (weqcomp (fld_univalence X Y) (fld_equiv_weq_iso X Y)))).
intros e. induction e.
use (pathscomp0 weqcomp_to_funcomp_app).
use total2_paths_f.
- apply idpath.
- use proofirrelevance. use isaprop_is_z_isomorphism.
Opaque fld_category_isweq.(X = Y) (z_iso X Y)
(pr1weq (weqcomp (fld_univalence X Y) (fld_equiv_weq_iso X Y)))
_ _ (weqproperty (weqcomp (fld_univalence X Y) (fld_equiv_weq_iso X Y)))).
intros e. induction e.
use (pathscomp0 weqcomp_to_funcomp_app).
use total2_paths_f.
- apply idpath.
- use proofirrelevance. use isaprop_is_z_isomorphism.
Definition fld_category_is_univalent : is_univalent fld_category.
Show proof.
Definition fld_univalent_category : univalent_category
:= make_univalent_category fld_category fld_category_is_univalent.
End def_fld_category.