Built with Alectryon, running Coq+SerAPI v8.19.0+0.19.3. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Require Import Spaces.Nat.Core.Require Export HoTT.Classes.interfaces.canonical_names.Require Import Modalities.ReflectiveSubuniverse.Local Set Polymorphic Inductive Cumulativity.Generalizable VariablesA B C f g x y.(*For various structures we omit declaration of substructures. For example, if wesay:Class Setoid_Morphism := { setoidmor_a : Setoid A ; setoidmor_b : Setoid B ; sm_proper : Proper ((=) ==> (=)) f }.#[export] Existing Instances setoidmor_a setoidmor_b sm_proper.then each time a Setoid instance is required, Coq will try to prove that aSetoid_Morphism exists. This obviously results in an enormous blow-up of thesearch space. Moreover, one should be careful to declare a Setoid_Morphismsas a substructure. Consider [f t1 t2], now if we want to perform setoid rewritingin [t2] Coq will first attempt to prove that [f t1] is Proper, for which it willattempt to prove [Setoid_Morphism (f t1)]. If many structures declareSetoid_Morphism as a substructure, setoid rewriting will become horribly slow.*)(* An unbundled variant of the former CoRN CSetoid. We do not include a proof that A is a Setoid because it can be derived. *)ClassIsApartA {Aap : Apart A} : Type :=
{ apart_set :: IsHSet A
; apart_mere :: is_mere_relation _ apart
; apart_symmetric :: Symmetric (≶)
; apart_cotrans :: CoTransitive (≶)
; tight_apart : forallxy, ~(x ≶ y) <-> x = y }.
A: Type Aplus: Plus A Amult: Mult A Azero: Zero A Aone: One A Anegate: Negate A
IsCRing -> IsRing
A: Type Aplus: Plus A Amult: Mult A Azero: Zero A Aone: One A Anegate: Negate A
IsCRing -> IsRing
A: Type Aplus: Plus A Amult: Mult A Azero: Zero A Aone: One A Anegate: Negate A H: IsCRing
IsRing
A: Type Aplus: Plus A Amult: Mult A Azero: Zero A Aone: One A Anegate: Negate A H: IsCRing
RightDistribute mult plus
A: Type Aplus: Plus A Amult: Mult A Azero: Zero A Aone: One A Anegate: Negate A H: IsCRing a, b, c: A
(a + b) * c = a * c + b * c
A: Type Aplus: Plus A Amult: Mult A Azero: Zero A Aone: One A Anegate: Negate A H: IsCRing a, b, c: A
sg_op c (a + b) = a * c + b * c
A: Type Aplus: Plus A Amult: Mult A Azero: Zero A Aone: One A Anegate: Negate A H: IsCRing a, b, c: A
c * a + c * b = a * c + b * c
f_ap; apply commutativity.Defined.ClassIsIntegralDomain :=
{ intdom_ring : IsCRing
; intdom_nontrivial : PropHolds (not (1 = 0))
; intdom_nozeroes :: NoZeroDivisors A }.(* We do not include strong extensionality for (-) and (/) because it can be derived *)ClassIsField {Aap: Apart A} {Arecip: Recip A} :=
{ field_ring :: IsCRing
; field_apart :: IsApart A
; field_plus_ext :: StrongBinaryExtensionality (+)
; field_mult_ext :: StrongBinaryExtensionality (.*.)
; field_nontrivial : PropHolds (1 ≶ 0)
; recip_inverse : forallx, x.1 // x = 1 }.(* We let /0 = 0 so properties as Injective (/), f (/x) = / (f x), / /x = x, /x * /y = /(x * y) hold without any additional assumptions *)ClassIsDecField {Adec_recip : DecRecip A} :=
{ decfield_ring :: IsCRing
; decfield_nontrivial : PropHolds (1 <> 0)
; dec_recip_0 : /0 = 0
; dec_recip_inverse : forallx, x <> 0 -> x / x = 1 }.ClassFieldCharacteristic@{j} {Aap : Apart@{i j} A} (k : nat) : Type@{j}
:= field_characteristic : foralln : nat,
Nat.Core.lt 0 n ->
iff@{j j j} (forallm : nat, not@{j} (paths@{Set} n
(nat_mul k m)))
(@apart A Aap (nat_iter n (1 +) 0) 0).Endupper_classes.(* Due to bug #2528 *)#[export]
Hint Extern4 (PropHolds (1 <> 0)) =>
eapply @intdom_nontrivial : typeclass_instances.#[export]
Hint Extern5 (PropHolds (1 ≶ 0)) =>
eapply @field_nontrivial : typeclass_instances.#[export]
Hint Extern5 (PropHolds (1 <> 0)) =>
eapply @decfield_nontrivial : typeclass_instances.(*For a strange reason IsCRing instances of Integers are sometimes obtained byIntegers -> IntegralDomain -> Ring and sometimes directly. Making this aninstance with a low priority instead of using intdom_ring:> IsCRing forces Coq totake the right way*)#[export]
Hint Extern10 (IsCRing _) => apply @intdom_ring : typeclass_instances.Arguments recip_inverse {A Aplus Amult Azero Aone Anegate Aap Arecip IsField} _.Arguments dec_recip_inverse
{A Aplus Amult Azero Aone Anegate Adec_recip IsDecField} _ _.Arguments dec_recip_0 {A Aplus Amult Azero Aone Anegate Adec_recip IsDecField}.Sectionlattice.ContextA {Ajoin: Join A} {Ameet: Meet A} {Abottom : Bottom A} {Atop : Top A}.ClassIsJoinSemiLattice :=
join_semilattice :: @IsSemiLattice A join_is_sg_op.ClassIsBoundedJoinSemiLattice :=
bounded_join_semilattice :: @IsBoundedSemiLattice A
join_is_sg_op bottom_is_mon_unit.ClassIsMeetSemiLattice :=
meet_semilattice :: @IsSemiLattice A meet_is_sg_op.ClassIsBoundedMeetSemiLattice :=
bounded_meet_semilattice :: @IsBoundedSemiLattice A
meet_is_sg_op top_is_mon_unit.ClassIsLattice :=
{ lattice_join :: IsJoinSemiLattice
; lattice_meet :: IsMeetSemiLattice
; join_meet_absorption :: Absorption (⊔) (⊓)
; meet_join_absorption :: Absorption (⊓) (⊔) }.ClassIsBoundedLattice :=
{ boundedlattice_join :: IsBoundedJoinSemiLattice
; boundedlattice_meet :: IsBoundedMeetSemiLattice
; boundedjoin_meet_absorption :: Absorption (⊔) (⊓)
; boundedmeet_join_absorption :: Absorption (⊓) (⊔)}.ClassIsDistributiveLattice :=
{ distr_lattice_lattice :: IsLattice
; join_meet_distr_l :: LeftDistribute (⊔) (⊓) }.Endlattice.Sectionmorphism_classes.Sectionsgmorphism_classes.Context {AB : Type} {Aop : SgOp A} {Bop : SgOp B}
{Aunit : MonUnit A} {Bunit : MonUnit B}.LocalOpen Scope mc_mult_scope.ClassIsSemiGroupPreserving (f : A -> B) :=
preserves_sg_op : forallxy, f (x * y) = f x * f y.ClassIsUnitPreserving (f : A -> B) :=
preserves_mon_unit : f mon_unit = mon_unit.ClassIsMonoidPreserving (f : A -> B) :=
{ monmor_sgmor :: IsSemiGroupPreserving f
; monmor_unitmor :: IsUnitPreserving f }.Endsgmorphism_classes.Sectionringmorphism_classes.Context {AB : Type} {Aplus : Plus A} {Bplus : Plus B}
{Amult : Mult A} {Bmult : Mult B} {Azero : Zero A} {Bzero : Zero B}
{Aone : One A} {Bone : One B}.ClassIsSemiRingPreserving (f : A -> B) :=
{ semiringmor_plus_mor :: @IsMonoidPreserving A B
(+) (+) 00 f
; semiringmor_mult_mor :: @IsMonoidPreserving A B
(.*.) (.*.) 11 f }.Context {Aap : Apart A} {Bap : Apart B}.ClassIsSemiRingStrongPreserving (f : A -> B) :=
{ strong_semiringmor_sr_mor :: IsSemiRingPreserving f
; strong_semiringmor_strong_mor :: StrongExtensionality f }.Endringmorphism_classes.Sectionlatticemorphism_classes.Context {AB : Type} {Ajoin : Join A} {Bjoin : Join B}
{Ameet : Meet A} {Bmeet : Meet B}.ClassIsJoinPreserving (f : A -> B) :=
join_slmor_sgmor :: @IsSemiGroupPreserving A B join_is_sg_op join_is_sg_op f.ClassIsMeetPreserving (f : A -> B) :=
meet_slmor_sgmor :: @IsSemiGroupPreserving A B meet_is_sg_op meet_is_sg_op f.Context {Abottom : Bottom A} {Bbottom : Bottom B}.ClassIsBoundedJoinPreserving (f : A -> B) := bounded_join_slmor_monmor
:: @IsMonoidPreserving A B join_is_sg_op join_is_sg_op
bottom_is_mon_unit bottom_is_mon_unit f.ClassIsLatticePreserving (f : A -> B) :=
{ latticemor_join_mor :: IsJoinPreserving f
; latticemor_meet_mor :: IsMeetPreserving f }.Endlatticemorphism_classes.Endmorphism_classes.Sectionid_mor.Context `{SgOp A} `{MonUnit A}.
A: Type H: SgOp A H0: MonUnit A
IsSemiGroupPreserving id
A: Type H: SgOp A H0: MonUnit A
IsSemiGroupPreserving id
split.Defined.
A: Type H: SgOp A H0: MonUnit A
IsMonoidPreserving id
A: Type H: SgOp A H0: MonUnit A
IsMonoidPreserving id
split; split.Defined.Endid_mor.Sectioncompose_mor.Context
`{SgOp A} `{MonUnit A}
`{SgOp B} `{MonUnit B}
`{SgOp C} `{MonUnit C}
(f : A -> B) (g : B -> C).(** Making these global instances causes typeclass loops. Instead they are declared below as [Hint Extern]s that apply only when the goal has the specified form. *)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C
IsSemiGroupPreserving f ->
IsSemiGroupPreserving g ->
IsSemiGroupPreserving (g ∘ f)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C
IsSemiGroupPreserving f ->
IsSemiGroupPreserving g ->
IsSemiGroupPreserving (g ∘ f)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C fp: IsSemiGroupPreserving f gp: IsSemiGroupPreserving g x, y: A
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C fp: IsSemiGroupPreserving f gp: IsSemiGroupPreserving g x, y: A
g (f (sg_op x y)) = sg_op (g (f x)) (g (f y))
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C fp: IsSemiGroupPreserving f gp: IsSemiGroupPreserving g x, y: A
f (sg_op x y) = ?Goal
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C fp: IsSemiGroupPreserving f gp: IsSemiGroupPreserving g x, y: A
g ?Goal = sg_op (g (f x)) (g (f y))
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C fp: IsSemiGroupPreserving f gp: IsSemiGroupPreserving g x, y: A
f (sg_op x y) = ?Goal
apply fp.
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C fp: IsSemiGroupPreserving f gp: IsSemiGroupPreserving g x, y: A
g (sg_op (f x) (f y)) = sg_op (g (f x)) (g (f y))
apply gp.Defined.
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C
IsMonoidPreserving f ->
IsMonoidPreserving g -> IsMonoidPreserving (g ∘ f)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C
IsMonoidPreserving f ->
IsMonoidPreserving g -> IsMonoidPreserving (g ∘ f)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C X: IsMonoidPreserving f X0: IsMonoidPreserving g
IsSemiGroupPreserving (g ∘ f)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C X: IsMonoidPreserving f X0: IsMonoidPreserving g
IsUnitPreserving (g ∘ f)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C X: IsMonoidPreserving f X0: IsMonoidPreserving g
IsSemiGroupPreserving (g ∘ f)
exact _.
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C X: IsMonoidPreserving f X0: IsMonoidPreserving g
IsUnitPreserving (g ∘ f)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C X: IsMonoidPreserving f X0: IsMonoidPreserving g
g (f mon_unit) = mon_unit
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B C: Type H3: SgOp C H4: MonUnit C f: A -> B g: B -> C X: IsMonoidPreserving f X0: IsMonoidPreserving g
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B
forallIsEquiv0 : IsEquiv f,
IsSemiGroupPreserving f -> IsSemiGroupPreserving f^-1
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B
forallIsEquiv0 : IsEquiv f,
IsSemiGroupPreserving f -> IsSemiGroupPreserving f^-1
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B E: IsEquiv f fp: IsSemiGroupPreserving f x, y: B
f^-1 (sg_op x y) = sg_op (f^-1 x) (f^-1 y)
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B E: IsEquiv f fp: IsSemiGroupPreserving f x, y: B
f (f^-1 (sg_op x y)) = f (sg_op (f^-1 x) (f^-1 y))
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B E: IsEquiv f fp: IsSemiGroupPreserving f x, y: B
sg_op x y = f (sg_op (f^-1 x) (f^-1 y))
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B E: IsEquiv f fp: IsSemiGroupPreserving f x, y: B
f (sg_op (f^-1 x) (f^-1 y)) = sg_op x y
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B E: IsEquiv f fp: IsSemiGroupPreserving f x, y: B
sg_op (f (f^-1 x)) (f (f^-1 y)) = sg_op x y
f_ap; apply eisretr.Defined.
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B
forallIsEquiv0 : IsEquiv f,
IsMonoidPreserving f -> IsMonoidPreserving f^-1
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B
forallIsEquiv0 : IsEquiv f,
IsMonoidPreserving f -> IsMonoidPreserving f^-1
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
IsSemiGroupPreserving f^-1
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
IsUnitPreserving f^-1
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
IsSemiGroupPreserving f^-1
exact _.
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
IsUnitPreserving f^-1
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
f (f^-1 mon_unit) = f mon_unit
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
f (f^-1 mon_unit) = ?Goal
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
?Goal = f mon_unit
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
f (f^-1 mon_unit) = ?Goal
apply eisretr.
A: Type H: SgOp A H0: MonUnit A B: Type H1: SgOp B H2: MonUnit B f: A -> B IsEquiv0: IsEquiv f X: IsMonoidPreserving f
mon_unit = f mon_unit
symmetry; exact preserves_mon_unit.Defined.Endinvert_mor.#[export]
Hint Extern4 (IsSemiGroupPreserving (_ ∘ _)) =>
class_apply @compose_sg_morphism : typeclass_instances.#[export]
Hint Extern4 (IsMonoidPreserving (_ ∘ _)) =>
class_apply @compose_monoid_morphism : typeclass_instances.#[export]
Hint Extern4 (IsSemiGroupPreserving (_ o _)) =>
class_apply @compose_sg_morphism : typeclass_instances.#[export]
Hint Extern4 (IsMonoidPreserving (_ o _)) =>
class_apply @compose_monoid_morphism : typeclass_instances.#[export]
Hint Extern4 (IsSemiGroupPreserving (_^-1)) =>
class_apply @invert_sg_morphism : typeclass_instances.#[export]
Hint Extern4 (IsMonoidPreserving (_^-1)) =>
class_apply @invert_monoid_morphism : typeclass_instances.#[export]
Instanceisinjective_mapinO_tr {AB : Type} (f : A -> B)
{p : MapIn (Tr (-1)) f} : IsInjective f
:= funxypfeq => ap pr1 (@center _ (p (f y) (x; pfeq) (y; idpath))).Sectionstrong_injective.Context {AB} {Aap : Apart A} {Bap : Apart B} (f : A -> B) .ClassIsStrongInjective :=
{ strong_injective : forallxy, x ≶ y -> f x ≶ f y
; strong_injective_mor : StrongExtensionality f }.Endstrong_injective.Sectionextras.ClassCutMinusSpecA (cm : CutMinus A) `{Zero A} `{Plus A} `{Le A} := {
cut_minus_le : forallxy, y ≤ x -> x ∸ y + y = x ;
cut_minus_0 : forallxy, x ≤ y -> x ∸ y = 0
}.
H: Funext n: trunc_index A, B: Type unitA: MonUnit A unitB: MonUnit B f: A -> B
IsTrunc n.+1 B -> IsTrunc n (IsUnitPreserving f)
H: Funext n: trunc_index A, B: Type unitA: MonUnit A unitB: MonUnit B f: A -> B
IsTrunc n.+1 B -> IsTrunc n (IsUnitPreserving f)
unfold IsUnitPreserving; exact _.Defined.
H: Funext n: trunc_index A, B: Type opA: SgOp A opB: SgOp B f: A -> B
IsTrunc n.+1 B -> IsTrunc n (IsSemiGroupPreserving f)
H: Funext n: trunc_index A, B: Type opA: SgOp A opB: SgOp B f: A -> B
IsTrunc n.+1 B -> IsTrunc n (IsSemiGroupPreserving f)
unfold IsSemiGroupPreserving; exact _.Defined.Definitionissig_IsSemiRingPreserving {AB : Type}
`{Plus A, Plus B, Mult A, Mult B, Zero A, Zero B, One A, One B} {f : A -> B}
: _ <~> IsSemiRingPreserving f := ltac:(issig).Definitionissig_IsMonoidPreserving {AB : Type} `{SgOp A} `{SgOp B}
`{MonUnit A} `{MonUnit B} {f : A -> B} : _ <~> IsMonoidPreserving f
:= ltac:(issig).#[export] Instanceishprop_ismonoidpreserving `{Funext} {A B : Type} `{SgOp A}
`{SgOp B} `{IsHSet B} `{MonUnit A} `{MonUnit B} (f : A -> B)
: IsHProp (IsMonoidPreserving f)
:= istrunc_equiv_istrunc _ issig_IsMonoidPreserving.#[export] Instanceishprop_issemiringpreserving `{Funext} {A B : Type} `{IsHSet B}
`{Plus A, Plus B, Mult A, Mult B, Zero A, Zero B, One A, One B}
(f : A -> B)
: IsHProp (IsSemiRingPreserving f)
:= istrunc_equiv_istrunc _ issig_IsSemiRingPreserving.Definitionissig_issemigroupxy : _ <~> @IsSemiGroup x y := ltac:(issig).#[export] Instanceishprop_issemigroup `{Funext} x y
: IsHProp (@IsSemiGroup x y)
:= istrunc_equiv_istrunc _ (issig_issemigroup _ _).Definitionissig_ismonoidxyz : _ <~> @IsMonoid x y z := ltac:(issig).#[export] Instanceishprop_ismonoid `{Funext} x y z : IsHProp (@IsMonoid x y z)
:= istrunc_equiv_istrunc _ (issig_ismonoid _ _ _).Definitionissig_isgroupwxyz : _ <~> @IsGroup w x y z := ltac:(issig).#[export] Instanceishprop_isgroup `{Funext} w x y z : IsHProp (@IsGroup w x y z)
:= istrunc_equiv_istrunc _ (issig_isgroup _ _ _ _).Endextras.