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]
Declare Scope mc_scope.Open Scope mc_scope.Generalizable VariablesA B f g x y.MonomorphicUniverseUlarge Uhuge.MonomorphicConstraintUlarge < Uhuge.
A, P: Type sP: IsHProp P x: merely A
(A -> P) -> P
A, P: Type sP: IsHProp P x: merely A
(A -> P) -> P
A, P: Type sP: IsHProp P E: A -> P
merely A -> P
A, P: Type sP: IsHProp P E: A -> P
Trunc (-1) A -> IsHProp P
A, P: Type sP: IsHProp P E: A -> P
A -> P
A, P: Type sP: IsHProp P E: A -> P
Trunc (-1) A -> IsHProp P
exact _.
A, P: Type sP: IsHProp P E: A -> P
A -> P
exact E.Qed.Notation" g ∘ f " := (Compose g f).Notation"(∘)" := Compose (only parsing) : mc_scope.Definitionid {A : Type} (a : A) := a.Notation"(=)" := paths (only parsing) : mc_scope.Notation"( x =)" := (paths x) (only parsing) : mc_scope.Notation"(= x )" := (funy => paths y x) (only parsing) : mc_scope.Notation"(<>)" := (funxy => ~x = y) (only parsing) : mc_scope.Notation"( x <>)" := (funy => x <> y) (only parsing) : mc_scope.Notation"(<> x )" := (funy => y <> x) (only parsing) : mc_scope.ClassApartA := apart : Relation A.Infix"≶" := apart : mc_scope.Notation"(≶)" := apart (only parsing) : mc_scope.Notation"( x ≶)" := (apart x) (only parsing) : mc_scope.Notation"(≶ x )" := (funy => apart y x) (only parsing) : mc_scope.(* Even for setoids with decidable equality x <> y does not imply x ≶ y.Therefore we introduce the following class. *)ClassTrivialApartA {Aap : Apart A} :=
{ trivial_apart_prop :: is_mere_relation A apart
; trivial_apart : forallxy, x ≶ y <-> x <> y }.Definitionsig_apart `{Apart A} (P: A -> Type) : Apart (sig P) := funxy => x.1 ≶ y.1.#[export]
Hint Extern10 (Apart (sig _)) => apply @sig_apart : typeclass_instances.ClassCastAB := cast: A -> B.Arguments cast _ _ {Cast} _.Notation"' x" := (cast _ _ x) : mc_scope.#[global] Typeclasses Transparent Cast.(* Other canonically named relations/operations/constants: *)ClassSgOpA := sg_op: A -> A -> A.ClassMonUnitA := mon_unit: A.ClassPlusA := plus: A -> A -> A.ClassMultA := mult: A -> A -> A.ClassOneA := one: A.ClassZeroA := zero: A.ClassNegateA := negate: A -> A.ClassInverseA := inv: A -> A.ClassDecRecipA := dec_recip: A -> A.DefinitionApartZeroR `{Zero R} `{Apart R} := sig (≶ zero).ClassRecipA `{Apart A} `{Zero A} := recip: ApartZero A -> A.#[global] Typeclasses Transparent SgOp MonUnit Plus Mult Zero One Negate.ClassMeetA := meet: A -> A -> A.ClassJoinA := join: A -> A -> A.ClassTopA := top: A.ClassBottomA := bottom: A.#[global] Typeclasses Transparent Meet Join Top Bottom.ClassLeA := le: Relation A.ClassLtA := lt: Relation A.#[global] Typeclasses Transparent Le Lt.DefinitionNonNegR `{Zero R} `{Le R} := sig (le zero).DefinitionPosR `{Zero R} `{Lt R} := sig (lt zero).DefinitionNonPosR `{Zero R} `{Le R} := sig (funy => le y zero).(** *** Hints for converting between types of operations *)Instanceplus_is_sg_op `{f : Plus A} : SgOp A := f.Definitionsg_op_is_plus `{f : SgOp A} : Plus A := f.Instancemult_is_sg_op `{f : Mult A} : SgOp A := f.Definitionsg_op_is_mult `{f : SgOp A} : Mult A := f.Instancezero_is_mon_unit `{c : Zero A} : MonUnit A := c.Definitionmon_unit_is_zero `{c : MonUnit A} : Zero A := c.Instanceone_is_mon_unit `{c : One A} : MonUnit A := c.Definitionmon_unit_is_one `{c : MonUnit A} : One A := c.Instancemeet_is_sg_op `{f : Meet A} : SgOp A := f.Instancejoin_is_sg_op `{f : Join A} : SgOp A := f.Definitiontop_is_mon_unit `{s : Top A} : MonUnit A := s.Definitionbottom_is_mon_unit `{s : Bottom A} : MonUnit A := s.Instancenegate_is_inverse `{i : Negate A} : Inverse A := i.Definitioninverse_is_negate `{i : Inverse A} : Negate A := i.#[export]
Hint Extern4 (Apart (ApartZero _)) => apply @sig_apart : typeclass_instances.#[export]
Hint Extern4 (Apart (NonNeg _)) => apply @sig_apart : typeclass_instances.#[export]
Hint Extern4 (Apart (Pos _)) => apply @sig_apart : typeclass_instances.(** For more information on using [mc_add_scope] and [mc_mult_scope], see the files test/Algebra/Groups/Expressions.v and test/Algebra/Rings/Expressions.v. *)ModuleAdditiveNotations.(** [mc_add_scope] is generally used when working with abelian groups. *)Declare Scope mc_add_scope.Infix"+" := sg_op : mc_add_scope.Notation"(+)" := sg_op (only parsing) : mc_add_scope.Notation"( x +)" := (sg_op x) (only parsing) : mc_add_scope.Notation"(+ x )" := (funy => sg_op y x) (only parsing) : mc_add_scope.Notation"0" := mon_unit : mc_add_scope.Notation"- x" := (inv x) : mc_add_scope.Notation"(-)" := inv (only parsing) : mc_add_scope.Notation"x - y" := (sg_op x (inv y)) : mc_add_scope.EndAdditiveNotations.ModuleMultiplicativeNotations.(** [mc_mult_scope] is generally used when working with general groups. *)Declare Scope mc_mult_scope.Infix"*" := sg_op : mc_mult_scope.Notation"( x *.)" := (sg_op x) (only parsing) : mc_mult_scope.Notation"(.*.)" := sg_op (only parsing) : mc_mult_scope.Notation"(.* x )" := (funy => sg_op y x) (only parsing) : mc_mult_scope.Notation"1" := mon_unit : mc_mult_scope.Notation"x ^" := (inv x) : mc_mult_scope.Notation"(^)" := inv (only parsing) : mc_mult_scope.EndMultiplicativeNotations.(** We group these notations into a module, so that just this subset can be exported in some cases. *)ModuleExport BinOpNotations.Export AdditiveNotations MultiplicativeNotations.Infix"+" := plus : mc_scope.Notation"(+)" := plus (only parsing) : mc_scope.Notation"( x +)" := (plus x) (only parsing) : mc_scope.Notation"(+ x )" := (funy => y + x) (only parsing) : mc_scope.Infix"*" := mult : mc_scope.(* We don't add "( * )", "( * x )" and "( x * )" notations because they conflict with comments. *)Notation"( x *.)" := (mult x) (only parsing) : mc_scope.Notation"(.*.)" := mult (only parsing) : mc_scope.Notation"(.* x )" := (funy => y * x) (only parsing) : mc_scope.Notation"- x" := (negate x) : mc_scope.Notation"(-)" := negate (only parsing) : mc_scope.Notation"x - y" := (x + negate y) : mc_scope.Notation"0" := zero : mc_scope.Notation"1" := one : mc_scope.Notation"2" := (1 + 1) : mc_scope.Notation"3" := (1 + (1 + 1)) : mc_scope.Notation"4" := (1 + (1 + (1 + 1))) : mc_scope.Notation"5" := (1 + (1 + (1 + (1 + 1)))) : mc_scope.Notation"6" := (1 + (1 + (1 + (1 + (1 + 1))))) : mc_scope.Notation"- 1" := (-(1)) : mc_scope.Notation"- 2" := (-(2)) : mc_scope.Notation"- 3" := (-(3)) : mc_scope.Notation"- 4" := (-(4)) : mc_scope.EndBinOpNotations.Notation"/ x" := (dec_recip x) : mc_scope.Notation"(/)" := dec_recip (only parsing) : mc_scope.Notation"x / y" := (x * /y) : mc_scope.Notation"// x" := (recip x) : mc_scope.Notation"(//)" := recip (only parsing) : mc_scope.Notation"x // y" := (x * //y) : mc_scope.Notation"⊤" := top : mc_scope.Notation"⊥" := bottom : mc_scope.Infix"⊓" := meet : mc_scope.Notation"(⊓)" := meet (only parsing) : mc_scope.Notation"( X ⊓)" := (meet X) (only parsing) : mc_scope.Notation"(⊓ X )" := (funY => Y ⊓ X) (only parsing) : mc_scope.Infix"⊔" := join : mc_scope.Notation"(⊔)" := join (only parsing) : mc_scope.Notation"( X ⊔)" := (join X) (only parsing) : mc_scope.Notation"(⊔ X )" := (funY => Y ⊔ X) (only parsing) : mc_scope.Infix"≤" := le : mc_scope.Notation"(≤)" := le (only parsing) : mc_scope.Notation"( x ≤)" := (le x) (only parsing) : mc_scope.Notation"(≤ x )" := (funy => y ≤ x) (only parsing) : mc_scope.Infix"<=" := le (only parsing) : mc_scope.Notation"(<=)" := le (only parsing) : mc_scope.Notation"( x <=)" := (le x) (only parsing) : mc_scope.Notation"(<= x )" := (funy => y ≤ x) (only parsing) : mc_scope.Infix"<" := lt : mc_scope.Notation"(<)" := lt (only parsing) : mc_scope.Notation"( x <)" := (lt x) (only parsing) : mc_scope.Notation"(< x )" := (funy => y < x) (only parsing) : mc_scope.Notation"x ≤ y ≤ z" := (x ≤ y /\ y ≤ z) : mc_scope.Notation"x ≤ y < z" := (x ≤ y /\ y < z) : mc_scope.Notation"x < y < z" := (x < y /\ y < z) : mc_scope.Notation"x < y ≤ z" := (x < y /\ y ≤ z) : mc_scope.(** It is likely that ≤ and < are transitive (and ≤ reflexive) so inform [auto] of this. *)Ltacauto_trans := match goal with
[ H: ?R?x?y, I: ?R?y?z |- ?R?x?z] => apply (transitivity H I)
end.#[export]
Hint Extern2 (?x ≤ ?y) => reflexivity : core.#[export]
Hint Extern4 (?x ≤ ?z) => auto_trans : core.#[export]
Hint Extern4 (?x < ?z) => auto_trans : core.ClassAbsA `{Le A} `{Zero A} `{Negate A}
:= abs_sig: forall (x : A), { y : A | (0 ≤ x -> y = x) /\ (x ≤ 0 -> y = -x)}.Definitionabs `{Abs A} := funx : A => (abs_sig x).1.(* Common properties: *)(* Class Inverse `(A -> B) : Type := inverse: B -> A.Arguments inverse {A B} _ {Inverse} _.Typeclasses Transparent Inverse.Notation "f ⁻¹" := (inverse f) : mc_scope. *)ClassIdempotent `(f: A -> A -> A) (x : A) : Type := idempotency: f x x = x.Arguments idempotency {A} _ _ {Idempotent}.ClassUnaryIdempotent {A} (f: A -> A) : Type :=
unary_idempotent :: Idempotent Compose f.
A: Type f: A -> A H: UnaryIdempotent f x: A
f (f x) = f x
A: Type f: A -> A H: UnaryIdempotent f x: A
f (f x) = f x
A: Type f: A -> A H: UnaryIdempotent f x: A
(f ∘ f) x = f x
A: Type f: A -> A H: UnaryIdempotent f x: A
f ∘ f = f
A: Type f: A -> A H: UnaryIdempotent f x: A
f ∘ f = f
A: Type f: A -> A H: UnaryIdempotent f x: A
Idempotent Compose f
exact _.Qed.ClassBinaryIdempotent `(op: A -> A -> A) : Type
:= binary_idempotent :: forallx, Idempotent op x.ClassLeftIdentity {AB} (op : A -> B -> B) (x : A): Type
:= left_identity: forally, op x y = y.
H: Funext n: trunc_index A, B: Type op: A -> B -> B x: A
IsTrunc n.+1 B -> IsTrunc n (LeftIdentity op x)
H: Funext n: trunc_index A, B: Type op: A -> B -> B x: A
IsTrunc n.+1 B -> IsTrunc n (LeftIdentity op x)
unfold LeftIdentity; exact _.Defined.ClassRightIdentity {AB} (op : A -> B -> A) (y : B): Type
:= right_identity: forallx, op x y = x.
H: Funext n: trunc_index A, B: Type op: A -> B -> A y: B
IsTrunc n.+1 A -> IsTrunc n (RightIdentity op y)
H: Funext n: trunc_index A, B: Type op: A -> B -> A y: B
IsTrunc n.+1 A -> IsTrunc n (RightIdentity op y)
unfold RightIdentity; exact _.Defined.ClassAbsorption {ABC} (op1: A -> C -> A) (op2: A -> B -> C) : Type
:= absorption: forallxy, op1 x (op2 x y) = x.ClassLeftAbsorb {AB} (op : A -> B -> A) (x : A): Type
:= left_absorb: forally, op x y = x.ClassRightAbsorb {AB} (op : A -> B -> B) (y : B): Type
:= right_absorb: forallx, op x y = y.ClassLeftInverse {A} {B} {C} (op : A -> B -> C) (inv : B -> A) (unit : C)
:= left_inverse: forallx, op (inv x) x = unit.
H: Funext n: trunc_index A, B, C: Type op: A -> B -> C inv: B -> A unit: C
IsTrunc n.+1 C -> IsTrunc n (LeftInverse op inv unit)
H: Funext n: trunc_index A, B, C: Type op: A -> B -> C inv: B -> A unit: C
IsTrunc n.+1 C -> IsTrunc n (LeftInverse op inv unit)
unfold LeftInverse; exact _.Defined.ClassRightInverse {A} {B} {C} (op : A -> B -> C) (inv : A -> B) (unit : C)
:= right_inverse: forallx, op x (inv x) = unit.
H: Funext n: trunc_index A, B, C: Type op: A -> B -> C inv: A -> B unit: C
IsTrunc n.+1 C -> IsTrunc n (RightInverse op inv unit)
H: Funext n: trunc_index A, B, C: Type op: A -> B -> C inv: A -> B unit: C
IsTrunc n.+1 C -> IsTrunc n (RightInverse op inv unit)
unfold RightInverse; exact _.Defined.ClassCommutative {BA} (f : A -> A -> B) : Type
:= commutativity: forallxy, f x y = f y x.#[global] Typeclasses Transparent Commutative.ClassHeteroAssociative {ABCABBCABC}
(fA_BC: A -> BC -> ABC) (fBC: B -> C -> BC)
(fAB_C: AB -> C -> ABC) (fAB : A -> B -> AB): Type
:= associativity : forallxyz, fA_BC x (fBC y z) = fAB_C (fAB x y) z.ClassAssociative {A} (f : A -> A -> A)
:= simple_associativity :: HeteroAssociative f f f f.
H: Funext A: Type n: trunc_index f: A -> A -> A IsTrunc0: IsTrunc n.+1 A
IsTrunc n (Associative f)
H: Funext A: Type n: trunc_index f: A -> A -> A IsTrunc0: IsTrunc n.+1 A
A: Type f: A -> A -> A assoc: Associative f z, y, x: A
f (f x y) z = f x (f y z)
exact (assoc x y z)^.Defined.Hint Immediate associative_flip : typeclass_instances.ClassInvolutive {A} (f : A -> A) := involutive: forallx, f (f x) = x.ClassTotalRelation `(R : Relation A) : Type := total : forallxy : A, R x y |_| R y x.Arguments total {A} _ {TotalRelation} _ _.ClassTrichotomy `(R : Relation A)
:= trichotomy : forallxy : A, R x y |_| x = y |_| R y x.Arguments trichotomy {A} R {Trichotomy} _ _.Arguments irreflexivity {A} _ {Irreflexive} _ _.ClassCoTransitive `(R : Relation A) : Type := cotransitive
: forallxy, R x y -> forallz, hor (R x z) (R z y).Arguments cotransitive {A R CoTransitive x y} _ _.ClassEquivRel `(R : Relation A) : Type := Build_EquivRel
{ EquivRel_Reflexive :: Reflexive R ;
EquivRel_Symmetric :: Symmetric R ;
EquivRel_Transitive :: Transitive R }.DefinitionSigEquivRel {A:Type} (R : Relation A) : Type :=
{_ : Reflexive R | { _ : Symmetric R | Transitive R}}.
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
IsTrunc n (SigEquivRel R)
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
IsTrunc n (SigEquivRel R)
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
IsTrunc n (Reflexive R)
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
Reflexive R ->
IsTrunc n {_ : Symmetric R & Transitive R}
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
IsTrunc n (Reflexive R)
exact istrunc_forall.
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
Reflexive R ->
IsTrunc n {_ : Symmetric R & Transitive R}
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y) a: Reflexive R
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
IsTrunc n (EquivRel R)
H: Funext A: Type R: Relation A n: trunc_index H0: forallxy : A, IsTrunc n (R x y)
IsTrunc n (EquivRel R)
exact (istrunc_equiv_istrunc (SigEquivRel R) (issig_equiv_rel R)).Qed.ClassConjugateA := conj : A -> A.ClassDistrOpp {A} `(SgOp A) `(Conjugate A)
:= distropp : forallxy : A, conj (sg_op x y) = sg_op (conj y) (conj x).ClassSwapOp {A} `(Negate A) `(Conjugate A)
:= swapop : forallx, conj (-x) = - (conj x).ClassFactorNegLeft {A} `(Negate A) `(SgOp A)
:= factorneg_l : forallxy, sg_op (-x) y = - (sg_op x y).ClassFactorNegRight {A} `(Negate A) `(SgOp A)
:= factorneg_r : forallxy, sg_op x (-y) = - (sg_op x y).ClassLeftHeteroDistribute {ABC}
(f : A -> B -> C) (g_r : B -> B -> B) (g : C -> C -> C) : Type
:= distribute_l : forallabc, f a (g_r b c) = g (f a b) (f a c).ClassRightHeteroDistribute {ABC}
(f : A -> B -> C) (g_l : A -> A -> A) (g : C -> C -> C) : Type
:= distribute_r: forallabc, f (g_l a b) c = g (f a c) (f b c).ClassLeftDistribute {A} (fg: A -> A -> A)
:= simple_distribute_l :: LeftHeteroDistribute f g g.ClassRightDistribute {A} (fg: A -> A -> A)
:= simple_distribute_r :: RightHeteroDistribute f g g.ClassHeteroSymmetric {A} {T : A -> A -> Type}
(R : forall {xy}, T x y -> T y x -> Type) : Type
:= hetero_symmetric `(a : T x y) (b : T y x) : R a b -> R b a.(* Although cancellation is the same as being injective, we want a proper name to refer to this commonly used property. *)Sectioncancellation.Context `(op : A -> A -> A) (z : A).ClassLeftCancellation := left_cancellation : forallxy, op z x = op z y -> x = y.ClassRightCancellation := right_cancellation : forallxy, op x z = op y z -> x = y.Context {Aap : Apart A}.ClassStrongLeftCancellation := strong_left_cancellation
: forallxy, x ≶ y -> op z x ≶ op z y.ClassStrongRightCancellation := strong_right_cancellation
: forallxy, x ≶ y -> op x z ≶ op y z.Endcancellation.(* Common names for properties that hold in N, Z, Q, ... *)ClassZeroProductA `{!Mult A} `{!Zero A} : Type
:= zero_product : forallxy, x * y = 0 -> x = 0 |_| y = 0.ClassZeroDivisor {R} `{Zero R} `{Mult R} (x : R) : Type
:= zero_divisor : x <> 0 /\ existsy, y <> 0 /\ x * y = 0.ClassNoZeroDivisorsR `{Zero R} `{Mult R} : Type
:= no_zero_divisors x : ~ZeroDivisor x.
A: Type Mult0: Mult A Zero0: Zero A H: ZeroProduct A
NoZeroDivisors A
A: Type Mult0: Mult A Zero0: Zero A H: ZeroProduct A
NoZeroDivisors A
A: Type Mult0: Mult A Zero0: Zero A H: ZeroProduct A x: A fst: x <> 0 proj1: A fst0: proj1 <> 0 E: x * proj1 = 0
Empty
destruct (zero_product _ _ E); auto.Qed.(* A common induction principle for both the naturals and integers *)ClassBiinductionR `{Zero R} `{One R} `{Plus R} : Type
:= biinduction (P : R -> Type)
: P 0 -> (foralln, P n <-> P (1 + n)) -> foralln, P n.(** Additional operations **)ClassCutMinusA := cut_minus : A -> A -> A.Infix"∸" := cut_minus : mc_scope.Notation"(∸)" := cut_minus (only parsing) : mc_scope.Notation"( x ∸)" := (cut_minus x) (only parsing) : mc_scope.Notation"(∸ y )" := (funx => x ∸ y) (only parsing) : mc_scope.Inductivecomparison : Set := LT | EQ | GT.ClassCompareA := compare : A -> A -> comparison.Infix"?=" := compare : mc_scope.Notation"(?=)" := compare (only parsing) : mc_scope.Notation"( x ?=)" := (compare x) (only parsing) : mc_scope.Notation"(?= y )" := (funx => x ?= y) (only parsing) : mc_scope.ClassEqbA := eqb : A -> A -> Bool.Infix"=?" := eqb : mc_scope.Notation"(=?)" := eqb (only parsing) : mc_scope.Notation"( x =?)" := (eqb x) (only parsing) : mc_scope.Notation"(=? y )" := (funx => x =? y) (only parsing) : mc_scope.ClassLtbA := ltb : A -> A -> Bool.Infix"<?" := ltb : mc_scope.Notation"(<?)" := ltb (only parsing) : mc_scope.Notation"( x <?)" := (ltb x) (only parsing) : mc_scope.Notation"(<? y )" := (funx => x <? y) (only parsing) : mc_scope.ClassLebA := leb : A -> A -> Bool.Infix"<=?" := leb : mc_scope.Notation"(<=?)" := leb (only parsing) : mc_scope.Notation"( x <=?)" := (leb x) (only parsing) : mc_scope.Notation"(<=? y )" := (funx => x <=? y) (only parsing) : mc_scope.ClassReturn (M : Type -> Type) := ret : forall {A}, A -> M A.ClassBind (M : Type -> Type) := bind : forall {AB}, M A -> (A -> M B) -> M B.ClassEnumerable@{i} (A : Type@{i}) :=
{ enumerator : nat -> A
; enumerator_issurj :: IsSurjection enumerator }.Arguments enumerator A {_} _.Arguments enumerator_issurj A {_} _.(* The following class is nice to parametrize instances by additional properties, for example: [forall z, PropHolds (z <> 0) -> LeftCancellation op z] This tool is very powerful as we can combine it with instances as: [forall x y, PropHolds (x <> 0) -> PropHolds (y <> 0) -> PropHolds (x * y <> 0)] Of course, one should be very careful not to make too many instances as that could easily lead to a blow-up of the search space (or worse, cycles).*)ClassPropHolds (P : Type) := prop_holds: P.#[export]
Hint Extern0 (PropHolds _) => assumption : typeclass_instances.Ltacsolve_propholds :=
match goal with
| [ |- PropHolds (?P) ] => apply _
| [ |- ?P ] => change (PropHolds P); apply _
end.