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.
(** Representation of cardinals, see Chapter 10 of the HoTT book. *)
[Loading ML file number_string_notation_plugin.cmxs (using legacy method) ... done]
Require Import HoTT.Classes.interfaces.abstract_algebra.(** This speeds things up considerably *)LocalOpaque equiv_isequiv istrunc_isequiv_istrunc.(** ** Definitions and operations *)DefinitionCard := Trunc 0 HSet.DefinitioncardA `{IsHSet A} : Card
:= tr (Build_HSet A).
a, b: Card
Card
a, b: Card
Card
b, a: HSet
Card
exact (tr (Build_HSet (a + b))).Defined.
a, b: Card
Card
a, b: Card
Card
b, a: HSet
Card
exact (tr (Build_HSet (a * b))).Defined.
H: Funext b, a: Card
Card
H: Funext b, a: Card
Card
H: Funext a, b: HSet
Card
exact (tr (Build_HSet (b -> a))).Defined.
H: Univalence
Card -> Card -> HProp
H: Univalence
Card -> Card -> HProp
H: Univalence a: HSet
Card -> HProp
H: Univalence a, b: HSet
HProp
exact (hexists (fun (i : a -> b) => IsInjective i)).Defined.(** ** Properties *)Sectioncontents.Context `{Univalence}.#[export] Instanceplus_card : Plus Card := sum_card.#[export] Instancemult_card : Mult Card := prod_card.#[export] Instancezero_card : Zero Card := tr (Build_HSet Empty).#[export] Instanceone_card : One Card := tr (Build_HSet Unit).#[export] Instancele_card : Le Card := leq_card.(* Reduce an algebraic equation to an equivalence *)Local Ltacreduce :=
repeat (intros ?); strip_truncations; cbn; f_ap; apply path_hset.(* Simplify an equation by unfolding all the definitions apart from the actual operations. *)(* Note that this is an expensive thing to do, and will be very slow unless we tell it not to unfold the following. *)Local Ltacsimpl_ops :=
cbv-[plus_card mult_card zero_card one_card exp_card].(** We only make the instances of upper classes global, since the other instances will be project anyway. *)(** *** [Card] is a semi-ring *)
Build_HSet (a * (b + c)) <~>
Build_HSet (a * b + a * c)
apply sum_distrib_l.Defined.
H: Univalence
LeftAbsorb mult_card zero_card
H: Univalence
LeftAbsorb mult_card zero_card
H: Univalence y: HSet
Build_HSet (Empty * y) <~> Build_HSet Empty
apply prod_empty_l.Defined.
H: Univalence
IsSemiCRing Card
H: Univalence
IsSemiCRing Card
H: Univalence
LeftIdentity sg_op mon_unit
H: Univalence
LeftIdentity sg_op mon_unit
H: Univalence
LeftIdentity sg_op mon_unit
H: Univalence y: Card
sg_op mon_unit y = y
H: Univalence y: Card
plus_card zero_card y = y
H: Univalence y: Card
plus_card y zero_card = y
apply rightid_sum.
H: Univalence
LeftIdentity sg_op mon_unit
H: Univalence y: Card
sg_op mon_unit y = y
H: Univalence y: Card
mult_card one_card y = y
H: Univalence y: Card
mult_card y one_card = y
apply rightid_prod.Defined.(** *** Properties of exponentiation *)
H: Univalence a: Card
exp_card 0 a = 1
H: Univalence a: Card
exp_card 0 a = 1
H: Univalence a: Card
exp_card zero_card a = one_card
H: Univalence a: HSet
Build_HSet (Empty -> a) <~> Build_HSet Unit
H: Univalence a: HSet
Build_HSet Unit <~> Build_HSet (Empty -> a)
apply equiv_empty_rec.Defined.
H: Univalence a: Card
exp_card a 1 = 1
H: Univalence a: Card
exp_card a 1 = 1
H: Univalence a: Card
exp_card a one_card = one_card
H: Univalence a: HSet
Build_HSet (a -> Unit) <~> Build_HSet Unit
H: Univalence a: HSet
Build_HSet Unit <~> Build_HSet (a -> Unit)
apply equiv_unit_coind.Defined.
H: Univalence a: Card
exp_card 1 a = a
H: Univalence a: Card
exp_card 1 a = a
H: Univalence a: HSet
Build_HSet (Unit -> a) <~> a
H: Univalence a: HSet
a <~> Build_HSet (Unit -> a)
apply equiv_unit_rec.Defined.
H: Univalence a, b, c: Card
exp_card (b + c) a = exp_card b a * exp_card c a
H: Univalence a, b, c: Card
exp_card (b + c) a = exp_card b a * exp_card c a
H: Univalence c, b, a: HSet
Build_HSet (b + c -> a) <~>
Build_HSet ((b -> a) * (c -> a))
H: Univalence c, b, a: HSet
Build_HSet ((b -> a) * (c -> a)) <~>
Build_HSet (b + c -> a)
apply equiv_sum_distributive.Defined.
H: Univalence a, b, c: Card
exp_card (b * c) a = exp_card c (exp_card b a)
H: Univalence a, b, c: Card
exp_card (b * c) a = exp_card c (exp_card b a)
H: Univalence a, b, c: Card
exp_card (c * b) a = exp_card c (exp_card b a)
H: Univalence c, b, a: HSet
Build_HSet (c * b -> a) <~> Build_HSet (c -> b -> a)
H: Univalence c, b, a: HSet
Build_HSet (c -> b -> a) <~> Build_HSet (c * b -> a)
apply equiv_uncurry.Defined.
H: Univalence a, b, c: Card
exp_card c (a * b) = exp_card c a * exp_card c b
H: Univalence a, b, c: Card
exp_card c (a * b) = exp_card c a * exp_card c b
H: Univalence c, b, a: HSet
Build_HSet (c -> a * b) <~>
Build_HSet ((c -> a) * (c -> b))
H: Univalence c, b, a: HSet
Build_HSet ((c -> a) * (c -> b)) <~>
Build_HSet (c -> a * b)
apply equiv_prod_coind.Defined.(** *** Properties of ≤ *)
H: Univalence
Reflexive (funxx0 : Card => leq_card x x0)
H: Univalence
Reflexive (funxx0 : Card => leq_card x x0)
H: Univalence x: Card
leq_card x x
H: Univalence x: HSet
leq_card (tr x) (tr x)
H: Univalence x: HSet
{i : x -> x & IsInjective i}
H: Univalence x: HSet
IsInjective idmap
exact (fun__ => idmap).Defined.
H: Univalence
Transitive (funxx0 : Card => leq_card x x0)
H: Univalence
Transitive (funxx0 : Card => leq_card x x0)
H: Univalence a, b, c: Card
leq_card a b -> leq_card b c -> leq_card a c
H: Univalence c, b, a: HSet
leq_card (tr a) (tr b) ->
leq_card (tr b) (tr c) -> leq_card (tr a) (tr c)
H: Univalence c, b, a: HSet Hab: leq_card (tr a) (tr b) Hbc: leq_card (tr b) (tr c)
leq_card (tr a) (tr c)
H: Univalence c, b, a: HSet Hbc: {i : b -> c & IsInjective i} Hab: {i : a -> b & IsInjective i}
leq_card (tr a) (tr c)
H: Univalence c, b, a: HSet Hbc: {i : b -> c & IsInjective i} iab: a -> b Hab: IsInjective iab
leq_card (tr a) (tr c)
H: Univalence c, b, a: HSet ibc: b -> c Hbc: IsInjective ibc iab: a -> b Hab: IsInjective iab
leq_card (tr a) (tr c)
H: Univalence c, b, a: HSet ibc: b -> c Hbc: IsInjective ibc iab: a -> b Hab: IsInjective iab
{i : a -> c & IsInjective i}
H: Univalence c, b, a: HSet ibc: b -> c Hbc: IsInjective ibc iab: a -> b Hab: IsInjective iab
IsInjective (ibc ∘ iab)
H: Univalence c, b, a: HSet ibc: b -> c Hbc: IsInjective ibc iab: a -> b Hab: IsInjective iab x, y: a Hxy: (ibc ∘ iab) x = (ibc ∘ iab) y
x = y
H: Univalence c, b, a: HSet ibc: b -> c Hbc: IsInjective ibc iab: a -> b Hab: IsInjective iab x, y: a Hxy: (ibc ∘ iab) x = (ibc ∘ iab) y
iab x = iab y
H: Univalence c, b, a: HSet ibc: b -> c Hbc: IsInjective ibc iab: a -> b Hab: IsInjective iab x, y: a Hxy: (ibc ∘ iab) x = (ibc ∘ iab) y
ibc (iab x) = ibc (iab y)
exact Hxy.Defined.
H: Univalence
PreOrder le_card
H: Univalence
PreOrder le_card
split; exact _.Defined.Endcontents.(** * Cardinality comparisons *)(* We also work with cardinality comparisons directly to avoid unnecessary type truncations via cardinals. *)DefinitionInjectionXY :=
{ f : X -> Y | IsInjective f }.
Reflexive Injection
Reflexive Injection
X: Type
Injection X X
X: Type
IsInjective idmap
X: Type x, x': X
x = x' -> x = x'
done.Qed.
X, Y, Z: Type
Injection X Y -> Injection Y Z -> Injection X Z
X, Y, Z: Type
Injection X Y -> Injection Y Z -> Injection X Z
X, Y, Z: Type f: X -> Y Hf: IsInjective f g: Y -> Z Hg: IsInjective g
Injection X Z
X, Y, Z: Type f: X -> Y Hf: IsInjective f g: Y -> Z Hg: IsInjective g
IsInjective (funx : X => g (f x))
X, Y, Z: Type f: X -> Y Hf: IsInjective f g: Y -> Z Hg: IsInjective g x, x': X H: g (f x) = g (f x')
x = x'
byapply Hf, Hg.Qed.DefinitionInjectsIntoXY :=
merely (Injection X Y).
Reflexive (funXY : Type => InjectsInto X Y)
Reflexive (funXY : Type => InjectsInto X Y)
X: Type
InjectsInto X X
X: Type
Injection X X
reflexivity.Qed.
X, Y, Z: Type
InjectsInto X Y -> InjectsInto Y Z -> InjectsInto X Z
X, Y, Z: Type
InjectsInto X Y -> InjectsInto Y Z -> InjectsInto X Z
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z
InjectsInto X Z
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z
Injection X Y -> InjectsInto X Z
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z f: X -> Y Hf: IsInjective f
InjectsInto X Z
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z f: X -> Y Hf: IsInjective f
Injection Y Z -> InjectsInto X Z
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z f: X -> Y Hf: IsInjective f g: Y -> Z Hg: IsInjective g
InjectsInto X Z
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z f: X -> Y Hf: IsInjective f g: Y -> Z Hg: IsInjective g
Injection X Z
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z f: X -> Y Hf: IsInjective f g: Y -> Z Hg: IsInjective g
IsInjective (funx : X => g (f x))
X, Y, Z: Type H1: InjectsInto X Y H2: InjectsInto Y Z f: X -> Y Hf: IsInjective f g: Y -> Z Hg: IsInjective g x, x': X H: g (f x) = g (f x')
x = x'
byapply Hf, Hg.Qed.(** * Infinity *)(* We call a set infinite if nat embeds into it. *)DefinitioninfiniteX :=
Injection nat X.