fact
stringlengths
0
6.66k
type
stringclasses
10 values
imports
stringclasses
399 values
filename
stringclasses
465 values
symbolic_name
stringlengths
1
75
index_level
int64
0
7.85k
Functor B A := Build_Functor B A (fun xym__Fx_to_Gy => fun x => xym__Fx_to_Gy x x 1) (fun x__s x__d x__m => fun x => x__m x x 1) (fun _ _ _ _ _ => idpath) (fun _ => idpath).
Definition
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
B_to_A
2,500
(a : a_part) (b : b_part a) := Eval simpl in forall x, (((left_identity_natural_transformation_1 _) o (p_identity_of G _ oR _) o (B_to_A _1 b x) o (_ oL (p_identity_of F _)^-1) o (left_identity_natural_transformation_2 _)) = 1)%natural_transformation.
Definition
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
b_id_part
2,501
Functor B C. Proof. refine (Build_Functor B C (fun xym__Fx_to_Gy => fun x y z m1 m2 => xym__Fx_to_Gy y z m1 o p_morphism_of F m2)%functor (fun xym__s xym__d xym__m => fun x y z m1 m2 => xym__m y z m1 oR p_morphism_of F m2) _ _); simpl; repeat (intro || apply path_forall); [ apply composition_of_whisker_r | apply whisker_r_left_identity ]. Defined.
Definition
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
B_to_C_1
2,502
Functor B C. Proof. refine (Build_Functor B C (fun xym__Fx_to_Gy => fun x y z m1 m2 => p_morphism_of G m1 o xym__Fx_to_Gy x y m2)%functor (fun xym__s xym__d xym__m => fun x y z m1 m2 => p_morphism_of G m1 oL xym__m x y m2) _ _); simpl; repeat (intro || apply path_forall); [ apply composition_of_whisker_l | apply whisker_l_right_identity ]. Defined.
Definition
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
B_to_C_2
2,503
Functor B C := Build_Functor B C (fun xym__Fx_to_Gy => fun x y z m1 m2 => xym__Fx_to_Gy x z (m1 o m2)) (fun xym__s xym__d xym__m => fun x y z m1 m2 => xym__m x z (m1 o m2)) (fun _ _ _ _ _ => idpath) (fun _ => idpath).
Definition
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
B_to_C_3
2,504
c_part' (a : a_part) (b : b_part a) : forall (x y z : X) (m1 : morphism X y z) (m2 : morphism X x y), Type. Proof. hnf in a, b. pose (fun x y m => (b x y m : morphism _ _ _)) as bB; simpl in *. intros x y z m1 m2. exact (((associator_2 _ _ _) o (B_to_C_2 _1 bB x y z m1 m2) o (associator_1 _ _ _) o (B_to_C_1 _1 bB x y z m1 m2) o (associator_2 _ _ _)) = ((p_composition_of G _ _ _ m1 m2 oR _) o (B_to_C_3 _1 bB x y z m1 m2) o (_ oL (p_composition_of F _ _ _ m1 m2)^-1)))%natural_transformation. Defined.
Definition
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
c_part'
2,505
(a : a_part) (b : b_part a) := Eval simpl in forall x y z m1 m2, @' a b x y z m1 m2.
Definition
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
c_part
2,506
`{Funext} (X : PreCategory)
Record
Require Import Category.Core Functor.Core NaturalTransformation.Core. Require Import Pseudofunctor.Core. Require Import Category.Morphisms FunctorCategory.Morphisms. Require Import Functor.Composition.Core. Require Import NaturalTransformation.Composition.Core NaturalTransformation.Composition.Laws. Require Import NaturalTransformation.Identity.
Categories\PseudonaturalTransformation\Core.v
PseudonaturalTransformation
2,507
`{Funext} : PreCategory := cat_of HProp.
Definition
Require Import Category.Strict. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Core.v
prop_cat
2,508
`{Funext} : PreCategory := cat_of HSet.
Definition
Require Import Category.Strict. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Core.v
set_cat
2,509
`{fs : Funext} (X : set_cat) C D F G (T1 T2 : morphism set_cat X (Build_HSet (@NaturalTransformation C D F G))) (H : forall x y, T1 x y = T2 x y) `{@IsIsomorphism set_cat _ _ T1} : @IsIsomorphism set_cat _ _ T2. Proof. exists (T1^-1)%morphism; abstract ( first [ apply @iso_moveR_Vp | apply @iso_moveR_pV ]; repeat first [ intro | solve [ auto | symmetry; auto ] | apply @path_forall | path_natural_transformation ] ). Defined.
Lemma
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
isisomorphism_set_cat_natural_transformation_paths
2,510
s d (m : morphism set_cat s d) `{IsEquiv _ _ m} : IsIsomorphism m := Build_IsIsomorphism set_cat s d m m^-1%function (path_forall _ _ (eissect m)) (path_forall _ _ (eisretr m)).
Definition
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
isiso_isequiv
2,511
s d (m : morphism set_cat s d) `{IsIsomorphism _ _ _ m} : IsEquiv m := Build_IsEquiv _ _ m m^-1%morphism (ap10 right_inverse) (ap10 left_inverse) (fun _ => path_ishprop _ _).
Definition
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
isequiv_isiso
2,512
(s d : set_cat) (m : s <~> d) : s <~=~> d := Build_Isomorphic (@isiso_isequiv s d m _). Global Instance isequiv_isiso_isequiv s d : IsEquiv (@ s d) | 0. Proof. refine (isequiv_adjointify (@ s d) (fun m => Build_Equiv _ _ _ (@isequiv_isiso s d m m)) _ _); simpl in *; clear; abstract ( intros [? ?]; simpl; unfold ; simpl; apply ap; apply path_ishprop ). Defined.
Definition
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
iso_equiv
2,513
(s d : set_cat) (p : s = d) : iso_equiv s d (equiv_path _ _ (ap trunctype_type p)) = idtoiso set_cat p. Proof. apply path_isomorphic. case p. reflexivity. Defined.
Lemma
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
path_idtoequiv_idtoiso
2,514
s d (m : morphism prop_cat s d) `{IsEquiv _ _ m} : IsIsomorphism m := Build_IsIsomorphism prop_cat s d m m^-1%function (path_forall _ _ (eissect m)) (path_forall _ _ (eisretr m)).
Definition
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
isiso_isequiv_prop
2,515
s d (m : morphism prop_cat s d) `{IsIsomorphism _ _ _ m} : IsEquiv m := Build_IsEquiv _ _ m m^-1%morphism (ap10 right_inverse) (ap10 left_inverse) (fun _ => path_ishprop _ _).
Definition
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
isequiv_isiso_prop
2,516
(s d : prop_cat) (m : s <~> d) : s <~=~> d := Build_Isomorphic (@isiso_isequiv_prop s d m _). Global Instance isequiv_isiso_isequiv_prop s d : IsEquiv (@ s d) | 0. Proof. refine (isequiv_adjointify (@ s d) (fun m => Build_Equiv _ _ _ (@isequiv_isiso_prop s d m _)) _ _); simpl in *; clear; abstract ( intros [? ?]; simpl; unfold ; simpl; apply ap; apply path_ishprop ). Defined.
Definition
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
iso_equiv_prop
2,517
(s d : prop_cat) (p : s = d) : iso_equiv_prop s d (equiv_path _ _ (ap trunctype_type p)) = idtoiso prop_cat p. Proof. apply path_isomorphic. case p. reflexivity. Defined.
Lemma
Require Import Category.Core NaturalTransformation.Core. Require Import Category.Morphisms NaturalTransformation.Paths. Require Import Category.Univalent. Require Import SetCategory.Core. Require Import HoTT.Basics HoTT.Types TruncType.
Categories\SetCategory\Morphisms.v
path_idtoequiv_idtoiso_prop
2,518
Functor C prop_cat.
Definition
Require Import Category.Core Functor.Core SetCategory.Core. Require Import Basics.Trunc.
Categories\SetCategory\Functors\SetProp.v
to_prop
2,519
Functor C set_cat.
Definition
Require Import Category.Core Functor.Core SetCategory.Core. Require Import Basics.Trunc.
Categories\SetCategory\Functors\SetProp.v
to_set
2,520
Functor prop_cat C.
Definition
Require Import Category.Core Functor.Core SetCategory.Core. Require Import Basics.Trunc.
Categories\SetCategory\Functors\SetProp.v
from_prop
2,521
Functor set_cat C.
Definition
Require Import Category.Core Functor.Core SetCategory.Core. Require Import Basics.Trunc.
Categories\SetCategory\Functors\SetProp.v
from_set
2,522
(F : to_prop C) : to_set C := Build_Functor C set_cat (fun x => Build_HSet (F x)) (fun s d m => (F _1 m)%morphism) (fun s d d' m m' => composition_of F s d d' m m') (fun x => identity_of F x).
Definition
Require Import Category.Core Functor.Core SetCategory.Core. Require Import Basics.Trunc.
Categories\SetCategory\Functors\SetProp.v
to_prop2set
2,523
(F : from_set C) : from_prop C := Build_Functor prop_cat C (fun x => F (Build_HSet x)) (fun s d m => (F _1 (m : morphism set_cat (Build_HSet s) (Build_HSet d)))%morphism) (fun s d d' m m' => composition_of F (Build_HSet s) (Build_HSet d) (Build_HSet d') m m') (fun x => identity_of F (Build_HSet x)).
Definition
Require Import Category.Core Functor.Core SetCategory.Core. Require Import Basics.Trunc.
Categories\SetCategory\Functors\SetProp.v
from_set2prop
2,524
(X : PreCategory) :=
Record
Require Import Category.Core. Require Import HoTT.Basics HoTT.Types HSet. Import PreCategoryOfStructures.
Categories\Structure\Core.v
NotionOfStructure
2,525
forall xa yb (H : x xa = x yb), transport P H (a xa) = a yb -> xa = yb. Proof. intros [? ?] [? ?] H H'; simpl in *; path_induction; reflexivity. Defined.
Lemma
Require Import Category.Core. Require Import HoTT.Basics HoTT.Types HSet. Import PreCategoryOfStructures.
Categories\Structure\Core.v
path_object
2,526
(xa yb : object) :=
Record
Require Import Category.Core. Require Import HoTT.Basics HoTT.Types HSet. Import PreCategoryOfStructures.
Categories\Structure\Core.v
morphism
2,527
(xa yb : object) : { f : Category.Core.morphism X xa.1 yb.1 | is_structure_homomorphism _ _ _ f xa.2 yb.2 } <~> morphism xa yb. Proof. issig. Defined.
Lemma
Require Import Category.Core. Require Import HoTT.Basics HoTT.Types HSet. Import PreCategoryOfStructures.
Categories\Structure\Core.v
issig_morphism
2,528
forall xa yb (fh gi : morphism xa yb), f fh = f gi -> fh = gi. Proof. intros ? ? [? ?] [? ?] H; simpl in *; path_induction; apply ap. apply path_ishprop. Defined.
Lemma
Require Import Category.Core. Require Import HoTT.Basics HoTT.Types HSet. Import PreCategoryOfStructures.
Categories\Structure\Core.v
path_morphism
2,529
X (P : NotionOfStructure X) : PreCategory. Proof. refine (@Build_PreCategory _ (@morphism _ P) (fun xa => {| f := identity xa.1; h := is_structure_homomorphism_identity _ _ xa.2 |}) (fun xa yb zc gi fh => {| f := (f gi) o (f fh); h := is_structure_homomorphism_composition _ _ _ _ _ _ _ _ _ (h fh) (h gi) |}) _ _ _ (fun s d => istrunc_equiv_istrunc _ (issig_morphism P s d))); simpl; abstract ( repeat match goal with | |- @morphism _ P _ _ -> _ => intros [? ?]; simpl in * | |- _ -> _ => intro end; first [ apply path_morphism; exact (associativity _ _ _ _ _ _ _ _) | apply path_morphism; exact (left_identity _ _ _ _) | apply path_morphism; exact (right_identity _ _ _ _) ] ). Defined.
Definition
Require Import Category.Core. Require Import HoTT.Basics HoTT.Types HSet. Import PreCategoryOfStructures.
Categories\Structure\Core.v
precategory_of_structures
2,530
(xa yb : StrX) (f : xa <~=~> yb) : xa.1 <~=~> yb.1. Proof. exists (PreCategoryOfStructures.f (f : morphism _ _ _)). exists (PreCategoryOfStructures.f f^-1). - exact (ap (@PreCategoryOfStructures.f _ _ _ _) (@left_inverse _ _ _ _ f)). - exact (ap (@PreCategoryOfStructures.f _ _ _ _) (@right_inverse _ _ _ _ f)). Defined.
Definition
Require Import Category.Core Category.Univalent Category.Morphisms. Require Import Structure.Core. Require Import Types.Sigma Trunc Equivalences. Require Import Basics.Iff Basics.Tactics.
Categories\Structure\IdentityPrinciple.v
sip_isotoid_helper
2,531
(xa : StrX) : @sip_isotoid_helper xa xa (reflexivity _) = reflexivity _. Proof. unfold sip_isotoid_helper, reflexivity, isomorphic_refl. apply ap. apply path_ishprop. Defined.
Lemma
Require Import Category.Core Category.Univalent Category.Morphisms. Require Import Structure.Core. Require Import Types.Sigma Trunc Equivalences. Require Import Basics.Iff Basics.Tactics.
Categories\Structure\IdentityPrinciple.v
sip_isotoid_helper_refl
2,532
x y (p : x = y) (a : P x) (b : P y) : transport P p a = b <-> is_structure_homomorphism P _ _ (idtoiso X p) a b * is_structure_homomorphism P _ _ (idtoiso X p)^-1 b a. Proof. split. - intros; path_induction; split; apply reflexivity. - intros [H0 H1]; path_induction; simpl in *. apply antisymmetry_structure; assumption. Defined.
Lemma
Require Import Category.Core Category.Univalent Category.Morphisms. Require Import Structure.Core. Require Import Types.Sigma Trunc Equivalences. Require Import Basics.Iff Basics.Tactics.
Categories\Structure\IdentityPrinciple.v
sip_helper
2,533
(xa yb : StrX) (f : xa <~=~> yb) : xa = yb. Proof. refine (path_sigma_uncurried _ _ _ (isotoid X xa.1 yb.1 (sip_isotoid_helper f); _)). apply sip_helper; simpl. split; lazymatch goal with | [ |- context[idtoiso ?X ((isotoid ?X ?x ?y) ?m)] ] => pose proof (eisretr (@idtoiso X x y) m) as H'; pattern (idtoiso X ((isotoid X x y) m)) end; refine (transport _ H'^ _); clear H'; simpl; apply PreCategoryOfStructures.h. Defined.
Definition
Require Import Category.Core Category.Univalent Category.Morphisms. Require Import Structure.Core. Require Import Types.Sigma Trunc Equivalences. Require Import Basics.Iff Basics.Tactics.
Categories\Structure\IdentityPrinciple.v
sip_isotoid
2,534
xa : @sip_isotoid xa xa (reflexivity _) = reflexivity _. Proof. refine (_ @ eta_path_sigma_uncurried _). refine (ap (path_sigma_uncurried _ _ _) _). apply equiv_path_sigma_hprop. simpl. refine (_ @ eisretr (isotoid X xa.1 xa.1) 1%path). apply ap. apply sip_isotoid_helper_refl. Defined.
Lemma
Require Import Category.Core Category.Univalent Category.Morphisms. Require Import Structure.Core. Require Import Types.Sigma Trunc Equivalences. Require Import Basics.Iff Basics.Tactics.
Categories\Structure\IdentityPrinciple.v
sip_isotoid_refl
2,535
xa yb (p : xa = yb) : PreCategoryOfStructures.f (idtoiso (precategory_of_structures P) p : morphism _ _ _) = idtoiso X p..1. Proof. induction p; reflexivity. Defined.
Lemma
Require Import Category.Core Category.Univalent Category.Morphisms. Require Import Structure.Core. Require Import Types.Sigma Trunc Equivalences. Require Import Basics.Iff Basics.Tactics.
Categories\Structure\IdentityPrinciple.v
path_f_idtoiso_precategory_of_structures
2,536
(xa yb : StrX) (x : xa <~=~> yb) : PreCategoryOfStructures.f (idtoiso (precategory_of_structures P) (sip_isotoid x) : morphism _ _ _) = PreCategoryOfStructures.f (x : morphism _ _ _). Proof. refine (path_f_idtoiso_precategory_of_structures _ @ _). refine ((ap _ (ap _ _)) @ (ap (@morphism_isomorphic _ _ _) (eisretr (@idtoiso X xa.1 yb.1) (sip_isotoid_helper _)))). exact (pr1_path_sigma_uncurried _). Defined.
Lemma
Require Import Category.Core Category.Univalent Category.Morphisms. Require Import Structure.Core. Require Import Types.Sigma Trunc Equivalences. Require Import Basics.Iff Basics.Tactics.
Categories\Structure\IdentityPrinciple.v
structure_identity_principle_helper
2,537
`{Funext} (Οƒ : Signature) : PreCategory. Proof. apply (@Build_PreCategory (SetAlgebra Οƒ) Homomorphism hom_id (@hom_compose Οƒ)); [intros; by apply path_hset_homomorphism .. | exact _]. Defined.
Lemma
Require Import Import Morphisms.CategoryMorphismsNotations isomorphic_notations.
Classes\categories\ua_category.v
precategory_algebra
2,538
`{Funext} {Οƒ} {A B : object (precategory_algebra Οƒ)} : A <~=~> B β†’ A β‰… B. Proof. intros [f [a b c]]. unshelve eapply (@BuildIsomorphic _ _ _ f). intros s. refine (isequiv_adjointify (f s) (a s) _ _). - exact (apD10_homomorphism c s). - exact (apD10_homomorphism b s). Defined.
Lemma
Require Import Import Morphisms.CategoryMorphismsNotations isomorphic_notations.
Classes\categories\ua_category.v
catiso_to_uaiso
2,539
`{Funext} {Οƒ} {A B : object (precategory_algebra Οƒ)} : A β‰… B β†’ A <~=~> B. Proof. intros [f F G]. set (h := BuildHomomorphism f). apply (@Morphisms.Build_Isomorphic _ A B h). apply (@Morphisms.Build_IsIsomorphism _ A B h (hom_inv h)). - apply path_hset_homomorphism. funext s x. apply eissect. - apply path_hset_homomorphism. funext s x. apply eisretr. Defined.
Lemma
Require Import Import Morphisms.CategoryMorphismsNotations isomorphic_notations.
Classes\categories\ua_category.v
uaiso_to_catiso
2,540
`{Funext} {Οƒ : Signature} (A B : object (precategory_algebra Οƒ)) : @Morphisms.idtoiso (precategory_algebra Οƒ) A B = catiso_to_uaiso^-1 o isomorphic_id o (path_setalgebra A B)^-1. Proof. funext p. destruct p. by apply Morphisms.path_isomorphic. Defined.
Lemma
Require Import Import Morphisms.CategoryMorphismsNotations isomorphic_notations.
Classes\categories\ua_category.v
path_idtoiso_isomorphic_id
2,541
`{Univalence} (Οƒ : Signature) : IsCategory (precategory_algebra Οƒ). Proof. intros A B. rewrite path_idtoiso_isomorphic_id. apply @isequiv_compose. - apply isequiv_compose. - apply isequiv_inverse. Qed.
Lemma
Require Import Import Morphisms.CategoryMorphismsNotations isomorphic_notations.
Classes\categories\ua_category.v
iscategory_algebra
2,542
`{Univalence} (Οƒ : Signature) : Category := Build_Category (iscategory_algebra Οƒ).
Definition
Require Import Import Morphisms.CategoryMorphismsNotations isomorphic_notations.
Classes\categories\ua_category.v
category_algebra
2,543
Type0 := | bzero : | double1 : -> | double2 : -> .
Inductive
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binnat
2,544
(n : binnat) : binnat := match n with | bzero => double1 bzero | double1 n' => double2 n' | double2 n' => double1 ( n') end.
Fixpoint
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
Succ
2,545
(n : binnat) : binnat := match n with | bzero => bzero | double1 n' => double2 ( n') | double2 n' => double2 (Succ ( n')) end.
Fixpoint
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
double
2,546
(n : nat) : nat := match n with | O => O | S n' => S (S ( n')) end.
Fixpoint
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
Double
2,547
(n : nat) : nat := S (Double n).
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
Double1
2,548
(n : nat) : nat := S (S (Double n)).
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
Double2
2,549
(n : nat) : binnat := match n with | O => bzero | S n' => Succ ( n') end. End basics. Section binary_equiv. Local unary' (n : binnat) : nat := match n with | bzero => O | double1 n' => Double1 (unary' n') | double2 n' => Double2 (unary' n') end. Local Definition succunary (n : binnat) : unary' (Succ n) = S (unary' n). Proof. induction n. - reflexivity. - reflexivity. - simpl. rewrite IHn. reflexivity. Qed.
Fixpoint
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binary
2,550
(n : nat) : binary (Double1 n) = double1 (binary n). Proof. induction n. - reflexivity. - change (binary (Double1 n.+1)) with (Succ (Succ (binary (Double n).+1))). rewrite IHn. reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
double1binary
2,551
(n : nat) : binary (Double2 n) = double2 (binary n). Proof. induction n. - reflexivity. - change (binary (Double2 n.+1)) with (Succ (Succ (binary (Double n).+2))). rewrite IHn. reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
double2binary
2,552
nat <~> binnat := Build_Equiv _ _ binary isequiv_binary.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
equiv_binary
2,553
(n : nat) : binary n.+1 = Succ (binary n). Proof. reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binarysucc
2,554
forall m, unary (Succ m) = S (unary m). Proof. equiv_intros binary n. rewrite <- binarysucc. rewrite eissect, eissect. reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
unarysucc
2,555
forall (m n : binnat), (Succ m) + n = Succ (m + n). Proof. induction m; induction n; try reflexivity; simpl; rewrite <- IHm; done. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binnatplussucc
2,556
(m n : nat) : binary m + binary n = binary (m + n). Proof. induction m; induction n; try reflexivity. - simpl. rewrite binnatplussucc. apply ap. done. - simpl. rewrite <- IHm. rewrite binnatplussucc. done. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binaryplus
2,557
(m n : binnat) : unary m + unary n = unary (m + n). Proof. etransitivity (unary (binary (_^-1 m + _^-1 n))). - apply ((eissect binary (unary m + unary n)) ^). - rewrite <- binaryplus. rewrite (eisretr binary m), (eisretr binary n). reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
unaryplus
2,558
forall (m n : binnat), (Succ m) * n = n + (m * n). Proof. induction m. - intros n. change (bzero + n = n + bzero). apply commutativity. - intros n. simpl. change (double2 m * n) with ((m * n) + (m * n) + n + n). apply commutativity. - intros n. simpl. change (double1 (Succ m) * n) with ((Succ m) * n + (Succ m) * n + n). rewrite IHm. rewrite (commutativity n (double2 m * n)). rewrite (commutativity n (m * n)). rewrite <- (associativity (m * n) n (m * n + n)). rewrite (commutativity n (m * n + n)). rewrite (associativity (m * n) _ _). rewrite (associativity (m * n) (m * n) n). done. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binnatmultsucc
2,559
(m n : nat) : binary m * binary n = binary (m * n). Proof. induction m; induction n; try reflexivity; rewrite binnatmultsucc, IHm, binaryplus; done. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binarymult
2,560
(m n : binnat) : unary m * unary n = unary (m * n). Proof. etransitivity (unary (binary (_^-1 m * _^-1 n))). - apply ((eissect binary (unary m * unary n)) ^). - rewrite <- binarymult. rewrite (eisretr binary m), (eisretr binary n). reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
unarymult
2,561
NaturalsToSemiRing nat := fun _ _ _ _ _ _ => fix f (n: nat) := match n with | 0%nat => 0 | S n' => 1 + f n' end.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
nat_to_semiring_helper
2,562
(m : binnat) : toR (Succ m) = (toR m)+1. Proof. induction m. - change (2 * 0 + 1 = 0 + 1). rewrite mult_comm. rewrite mult_0_l. done. - change (2 * (toR m) + 2 = 2 * (toR m) + 1 + 1). apply plus_assoc. - induction m as [|m _|m _]. + change (2 * (2 * 0 + 1) + 1 = 2 * 0 + 2 + 1). rewrite plus_mult_distr_l. rewrite (@mult_1_r _ Aplus Amult Azero Aone H _). rewrite mult_0_r, mult_0_r. reflexivity. + change (2 * (2 * (toR m) + 2) + 1 = 2 * (2 * (toR m) + 1 ) + 2 + 1). apply (ap (fun z => z + 1)). assert (L : 2 * toR m + 2 = 2 * toR m + 1 + 1) by by rewrite plus_assoc. rewrite L; clear L. rewrite plus_mult_distr_l. rewrite mult_1_r. reflexivity. + simpl in IHm. change ((2 * (toR (double1 (Succ m))) + 1 = 2 * (toR (double2 m)) + 2 + 1)). rewrite IHm; clear IHm. rewrite plus_mult_distr_l. rewrite mult_1_r. reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
f_suc
2,563
forall m : binnat, toR m = toR_vianat m. Proof. equiv_intro binary n. induction n as [|n IHn]. - reflexivity. - induction n as [|n _]. + change ((1 + 1) * 0 + 1 = 1). rewrite mult_0_r. apply plus_0_l. + rewrite f_suc. rewrite IHn. assert (L : (toR_fromnat ∘ binary^-1) (binary n.+1) + 1 = toR_fromnat ((binary^-1 (binary n.+1)).+1)%nat). { simpl rewrite (plus_comm _ 1). simpl rewrite unarysucc. reflexivity. } rewrite L; clear L. rewrite <- unarysucc. rewrite <- binarysucc. reflexivity. Qed.
Definition
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
f_nat
2,564
(h : binnat -> R) `{!IsSemiRingPreserving h} : forall x, toR x = h x. Proof. equiv_intro binary n. rewrite f_nat; unfold Compose. rewrite eissect. refine (toR_unique (h ∘ binary) n). Qed.
Lemma
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binnat_toR_unique
2,565
(z:binnat) : LeftCancellation plus z. Proof. intros x y p. apply (equiv_inj unary). apply (ap unary) in p. rewrite <- unaryplus, <- unaryplus in p. exact (left_cancellation _ _ _ _ p). Qed.
Instance
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binnat_plus_cancel_l
2,566
(z : binnat): PropHolds (z <> 0) -> LeftCancellation (.*.) z. Proof. intros E. hnf in E. assert (H : unary z <> unary 0). { intros q. apply (equiv_inj unary) in q. exact (E q). } intros x y p. apply (ap unary) in p. rewrite <- unarymult, <- unarymult in p. exact (equiv_inj unary (nat_mult_cancel_l (unary z) H _ _ p)). Qed.
Instance
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binnat_mult_cancel_l
2,567
Trichotomy (lt:Lt binnat). Proof. intros x y. pose (T := nat_trichotomy (unary x) (unary y)). destruct T as [l|[c|r]]. - left; assumption. - right; left. apply (equiv_inj unary); assumption. - right; right; assumption. Defined.
Instance
Require Import Require Import Require Import
Classes\implementations\binary_naturals.v
binnat_trichotomy
2,568
(F : I β†’ Type) : list I β†’ Type := fold_right (Ξ» (i:I) (A:Type), F i * A) Unit.
Definition
Require Import
Classes\implementations\family_prod.v
FamilyProd
2,569
{F G : I β†’ Type} {β„“ : list I} (f : βˆ€ i, F i β†’ G i) : FamilyProd F β„“ β†’ FamilyProd G β„“ := match β„“ with | nil => const_tt _ | i :: β„“' => Ξ» '(x,s), (f i x, f s) end.
Fixpoint
Require Import
Classes\implementations\family_prod.v
map_family_prod
2,570
(F : I β†’ Type) {β„“ : list I} (P : βˆ€ i, F i -> Type) : FamilyProd F β„“ β†’ Type := match β„“ with | nil => Ξ» _, Unit | i :: _ => Ξ» '(x,s), P i x ∧ F P s end.
Fixpoint
Require Import
Classes\implementations\family_prod.v
for_all_family_prod
2,571
(F G : I β†’ Type) {β„“ : list I} (R : βˆ€ i, F i -> G i -> Type) : FamilyProd F β„“ β†’ FamilyProd G β„“ β†’ Type := match β„“ with | nil => Ξ» _ _, Unit | i :: _ => Ξ» '(x,s) '(y,t), R i x y ∧ F G R s t end.
Fixpoint
Require Import
Classes\implementations\family_prod.v
for_all_2_family_prod
2,572
(F : I β†’ Type) (R : βˆ€ i, Relation (F i)) `{!βˆ€ i, Reflexive (R i)} {β„“ : list I} (s : FamilyProd F β„“) : for_all_2_family_prod F F R s s.
Lemma
Require Import
Classes\implementations\family_prod.v
reflexive_for_all_2_family_prod
2,573
Frac@{} : Type
Record
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
Frac@
2,574
Frac_ishset' : IsHSet Frac. Proof. assert (E : sig (fun n : R => sig (fun d : R => d <> 0 )) <~> Frac). - issig. - apply (istrunc_equiv_istrunc _ E). Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
Frac_ishset'
2,575
pl@{} : Plus Frac. Proof. intros q r; refine (frac (num q * den r + num r * den q) (den q * den r) _). Defined.
Instance
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
pl@
2,576
equiv@{} := fun x y => num x * den y = num y * den x. Global Instance equiv_equiv_rel@{} : EquivRel equiv. Proof. split. - intros x. hnf. reflexivity. - intros x y. unfold equiv. apply symmetry. - intros x y z. unfold equiv. intros E1 E2. apply (mult_left_cancel (den y)). + solve_propholds. + rewrite !mult_assoc, !(mult_comm (den y)). rewrite E1, <-E2. rewrite <-!mult_assoc. rewrite (mult_comm (den x)). reflexivity. Qed.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
equiv@
2,577
pl_respect@{} : forall q1 q2, equiv q1 q2 -> forall r1 r2, equiv r1 r2 -> equiv (q1 + r1) (q2 + r2). Proof. unfold equiv;intros q1 q2 Eq r1 r2 Er. simpl. rewrite plus_mult_distr_r. rewrite <-(associativity (num q1) (den r1)). rewrite (associativity (den r1)), (mult_comm (den r1)), <-(associativity (den q2)). rewrite (associativity (num q1)), Eq. rewrite (mult_comm (den q2)), <-(associativity (num r1)), (associativity (den q1)). rewrite (mult_comm (den q1)), <-(associativity (den r2)), (associativity (num r1)). rewrite Er. rewrite (mult_comm (den r1)), <-(associativity (num q2)), (associativity (den q1)). rewrite (mult_comm (den q1)), <-(associativity (den r2)), (associativity (num q2)). rewrite <-(associativity (num r2)), (associativity (den r1)), (mult_comm _ (den q2)). rewrite (mult_comm (den r1)), (associativity (num r2)). apply symmetry;apply plus_mult_distr_r. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
pl_respect@
2,578
pl_comm@{} : forall q r, equiv (pl q r) (pl r q). Proof. intros q r;unfold equiv;simpl. rewrite (mult_comm (den r)), plus_comm. reflexivity. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
pl_comm@
2,579
pl_assoc@{} : forall q r t, equiv (pl q (pl r t)) (pl (pl q r) t). Proof. intros;unfold equiv;simpl. apply ap011;[|apply symmetry,associativity]. rewrite plus_mult_distr_r. rewrite (plus_mult_distr_r _ _ (den t)). rewrite plus_assoc. apply ap011;[apply ap011|]. - apply associativity. - rewrite <-(associativity (num r)), <-(associativity (num r) (den q)). rewrite (mult_comm (den t)). reflexivity. - rewrite (mult_comm (den q));apply symmetry,associativity. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
pl_assoc@
2,580
ml@{} : Mult Frac. Proof. intros q r; refine (frac (num q * num r) (den q * den r) _). Defined.
Instance
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
ml@
2,581
ml_respect@{} : forall q1 q2, equiv q1 q2 -> forall r1 r2, equiv r1 r2 -> equiv (q1 * r1) (q2 * r2). Proof. unfold equiv;intros q1 q2 Eq r1 r2 Er. simpl. rewrite <-(associativity (num q1)), (associativity (num r1)). rewrite (mult_comm (num r1)), <-(associativity (den q2)), (associativity (num q1)). rewrite Eq, Er. rewrite <-(associativity (num q2)), (associativity (den q1)), (mult_comm (den q1)). rewrite <-(simple_associativity (num r2)), <-(simple_associativity (num q2)). reflexivity. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
ml_respect@
2,582
neg@{} : Negate Frac. Proof. intros q;refine (frac (- num q) (den q) _). Defined.
Instance
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
neg@
2,583
neg_respect@{} : forall q r, equiv q r -> equiv (- q) (- r). Proof. unfold equiv;simpl;intros q r E. rewrite <-2!negate_mult_distr_l. rewrite E;reflexivity. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
neg_respect@
2,584
nonzero_num@{} x : ~ (equiv x 0) <-> num x <> 0. Proof. split; intros E F; apply E. - red. rewrite F. simpl. rewrite 2!mult_0_l. reflexivity. - red in F;simpl in F. rewrite mult_1_r, mult_0_l in F. trivial. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
nonzero_num@
2,585
pl_0_l@{} x : equiv (0 + x) x. Proof. red;simpl. rewrite mult_1_r, mult_0_l, mult_1_l, plus_0_l. reflexivity. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
pl_0_l@
2,586
pl_0_r@{} x : equiv (x + 0) x. Proof. red;simpl. rewrite 2!mult_1_r, mult_0_l, plus_0_r. reflexivity. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
pl_0_r@
2,587
pl_neg_l@{} x : equiv (- x + x) 0. Proof. red;simpl. rewrite mult_1_r, mult_0_l. rewrite <-plus_mult_distr_r. rewrite plus_negate_l. apply mult_0_l. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
pl_neg_l@
2,588
ml_assoc@{} q r t : equiv (ml q (ml r t)) (ml (ml q r) t). Proof. red;simpl. rewrite (associativity (num q)), (associativity (den q)). reflexivity. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
ml_assoc@
2,589
dec_rec@{} : DecRecip Frac := fun x => match decide_rel (=) (num x) 0 with | inl _ => 0 | inr P => frac (den x) (num x) P end.
Instance
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
dec_rec@
2,590
dec_recip_respect@{} : forall q r, equiv q r -> equiv (/ q) (/ r). Proof. unfold equiv,dec_recip,dec_rec;intros q r E;simpl. destruct (decide_rel paths (num q) 0) as [E1|E1], (decide_rel paths (num r) 0) as [E2|E2];simpl. - trivial. - rewrite E1 in E;rewrite mult_0_l in E. destruct E2. apply (right_cancellation_ne_0 mult (den q));try solve_propholds. rewrite mult_0_l;apply symmetry,E. - rewrite E2 in E;rewrite mult_0_l in E. destruct E1. apply (right_cancellation_ne_0 mult (den r));try solve_propholds. rewrite mult_0_l;trivial. - rewrite (mult_comm (den q)), (mult_comm (den r)). apply symmetry, E. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
dec_recip_respect@
2,591
(x : Frac R1) : Frac R2. Proof. apply (frac (f (num x)) (f (den x))). apply isinjective_ne_0. apply (den_ne_0 x). Defined.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
lift
2,592
forall q r, equiv q r -> equiv (lift q) (lift r). Proof. unfold equiv;simpl;intros q r E. rewrite <-2!preserves_mult. apply ap,E. Qed.
Lemma
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
lift_respects
2,593
F@{} := quotient equiv.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
F@
2,594
path@{} {x y} : equiv x y -> ' x = ' y := related_classes_eq _.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
path@
2,595
F_rect@{i} (P : F -> Type@{i}) {sP : forall x, IsHSet (P x)} (dclass : forall x : Frac R, P (' x)) (dequiv : forall x y E, (path E) # (dclass x) = (dclass y)) : forall q, P q := quotient_ind equiv P dclass dequiv.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
F_rect@
2,596
P {sP} dclass dequiv x : @F_rect P sP dclass dequiv (' x) = dclass x := 1.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
F_compute
2,597
P {sP} dclass dequiv q r (E : equiv q r) : apD (@F_rect P sP dclass dequiv) (path E) = dequiv q r E := quotient_ind_compute_path _ _ _ _ _ _ _ _.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
F_compute_path
2,598
F_ind@{i} (P : F -> Type@{i}) {sP : forall x, IsHProp (P x)} (dclass : forall x : Frac R, P (' x)) : forall x, P x. Proof. apply (@F_rect P (fun _ => istrunc_hprop) dclass). intros;apply path_ishprop. Qed.
Definition
Require Import HoTT.HIT.quotient. Require Import Import Frac.
Classes\implementations\field_of_fractions.v
F_ind@
2,599