Built with Alectryon, running Coq+SerAPI v8.18.0+0.18.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]
LocalOpen Scope nat_scope.LocalOpen Scope mc_scope.Local Set Universe Minimization ToSet.(* This should go away one Coq has universe cumulativity through inductives. *)Sectionnat_lift.UniverseN.(* It's important that the universe [N] be free. Occasionally, Coq will choose universe variables in proofs that force [N] to be [Set]. To pinpoint where this happens, you can add the line [Constraint Set < N.] here, and see what fails below. *)Letnatpaths := @paths@{N} nat.Infix"=N=" := natpaths.
natpaths:= paths: nat -> nat -> Type
Symmetric natpaths
natpaths:= paths: nat -> nat -> Type
Symmetric natpaths
unfold natpaths; apply _.Defined.Global Instancenat_0: Zero@{N} nat := 0%nat.Global Instancenat_1: One@{N} nat := 1%nat.Global Instancenat_plus: Plus@{N} nat := Nat.Core.add.Notationmul := Nat.Core.mul.Global Instancenat_mult: Mult@{N} nat := Nat.Core.mul.Ltacsimpl_nat :=
change (@plus nat _) with Nat.Core.add;
change (@mult nat _) with Nat.Core.mul;
simpl;
change Nat.Core.add with (@plus nat Nat.Core.add);
change Nat.Core.mul with (@mult nat Nat.Core.mul).(** [0 + a =N= a] *)Local Instanceadd_0_l : LeftIdentity@{N N} (plus : Plus nat) 0 := fun_ => idpath.Definitionadd_S_lab : S a + b =N= S (a + b) := idpath.(** [a + 0 =N= a] *)
natpaths:= paths: nat -> nat -> Type
RightIdentity (plus : Plus nat) (0 : Zero nat)
natpaths:= paths: nat -> nat -> Type
RightIdentity (plus : Plus nat) (0 : Zero nat)
natpaths:= paths: nat -> nat -> Type
0 + 0 = 0
natpaths:= paths: nat -> nat -> Type a: nat IHa: a + 0 = a
a.+1 + 0 = a.+1
natpaths:= paths: nat -> nat -> Type
0 + 0 = 0
reflexivity.
natpaths:= paths: nat -> nat -> Type a: nat IHa: a + 0 = a
a.+1 + 0 = a.+1
apply (ap S), IHa.Qed.
natpaths:= paths: nat -> nat -> Type
forallab : nat, a + b.+1 =N= (a + b).+1
natpaths:= paths: nat -> nat -> Type
forallab : nat, a + b.+1 =N= (a + b).+1
natpaths:= paths: nat -> nat -> Type b: nat
0 + b.+1 =N= (0 + b).+1
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a + b.+1 =N= (a + b).+1
a.+1 + b.+1 =N= (a.+1 + b).+1
natpaths:= paths: nat -> nat -> Type b: nat
0 + b.+1 =N= (0 + b).+1
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a + b.+1 =N= (a + b).+1
a.+1 + b.+1 =N= (a.+1 + b).+1
apply (ap S), IHa.Qed.(** [forall a b c : nat, a + (b + c) = (a + b) + c]. The RHS is written [a + b + c]. *)
natpaths:= paths: nat -> nat -> Type
Associative (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type
Associative (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type b, c: nat
0 + (b + c) = 0 + b + c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a + (b + c) = a + b + c
a.+1 + (b + c) = a.+1 + b + c
natpaths:= paths: nat -> nat -> Type b, c: nat
0 + (b + c) = 0 + b + c
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a + (b + c) = a + b + c
a.+1 + (b + c) = a.+1 + b + c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a + (b + c) = a + b + c
(a + (b + c)).+1 = (a + b + c).+1
apply (ap S), IHa.Qed.
natpaths:= paths: nat -> nat -> Type
Commutative (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type
Commutative (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type b: nat
0 + b = b + 0
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a + b = b + a
a.+1 + b = b + a.+1
natpaths:= paths: nat -> nat -> Type b: nat
0 + b = b + 0
natpaths:= paths: nat -> nat -> Type b: nat
0 + b = b
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a + b = b + a
a.+1 + b = b + a.+1
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a + b = b + a
a.+1 + b = (b + a).+1
apply (ap S), IHa.Qed.Local Instancemul_0_l : LeftAbsorb@{N N} (mult : Mult nat) (zero : Zero nat)
:= fun_ => idpath.Definitionmul_S_lab : (S a) * b =N= b + a * b := idpath.(** [1 * a =N= a]. *)Local Instancemul_1_l : LeftIdentity@{N N} (mult : Mult nat) (one : One nat)
:= add_0_r.
natpaths:= paths: nat -> nat -> Type
RightAbsorb (mult : Mult nat) (0 : Zero nat)
natpaths:= paths: nat -> nat -> Type
RightAbsorb (mult : Mult nat) (0 : Zero nat)
natpaths:= paths: nat -> nat -> Type
0 * 0 = 0
natpaths:= paths: nat -> nat -> Type a: nat IHa: a * 0 = 0
a.+1 * 0 = 0
natpaths:= paths: nat -> nat -> Type
0 * 0 = 0
reflexivity.
natpaths:= paths: nat -> nat -> Type a: nat IHa: a * 0 = 0
a.+1 * 0 = 0
natpaths:= paths: nat -> nat -> Type a: nat IHa: a * 0 = 0
a * 0 = 0
exact IHa.Qed.
natpaths:= paths: nat -> nat -> Type a, b: nat
a * b.+1 =N= a + a * b
natpaths:= paths: nat -> nat -> Type a, b: nat
a * b.+1 =N= a + a * b
natpaths:= paths: nat -> nat -> Type b: nat
0 * b.+1 =N= 0 + 0 * b
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b.+1 =N= a + a * b
a.+1 * b.+1 =N= a.+1 + a.+1 * b
natpaths:= paths: nat -> nat -> Type b: nat
0 * b.+1 =N= 0 + 0 * b
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b.+1 =N= a + a * b
a.+1 * b.+1 =N= a.+1 + a.+1 * b
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b.+1 =N= a + a * b
(b + a * b.+1).+1 = (a + (b + a * b)).+1
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b.+1 =N= a + a * b
b + a * b.+1 = a + (b + a * b)
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b.+1 =N= a + a * b
b + a * b.+1 = a + b + a * b
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b.+1 =N= a + a * b
b + a * b.+1 = b + a + a * b
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b.+1 =N= a + a * b
b + a * b.+1 = b + (a + a * b)
exact (ap (plus b) IHa).Qed.(** [a * 1 =N= a]. *)
natpaths:= paths: nat -> nat -> Type
RightIdentity (mult : Mult nat) (1 : One nat)
natpaths:= paths: nat -> nat -> Type
RightIdentity (mult : Mult nat) (1 : One nat)
natpaths:= paths: nat -> nat -> Type a: nat
a * 1 = a
natpaths:= paths: nat -> nat -> Type a: nat
a + a * 0 = a
natpaths:= paths: nat -> nat -> Type a: nat
a + 0 = a
apply add_0_r.Qed.
natpaths:= paths: nat -> nat -> Type
Commutative (mult : Mult nat)
natpaths:= paths: nat -> nat -> Type
Commutative (mult : Mult nat)
natpaths:= paths: nat -> nat -> Type b: nat
0 * b = b * 0
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b = b * a
a.+1 * b = b * a.+1
natpaths:= paths: nat -> nat -> Type b: nat
0 * b = b * 0
natpaths:= paths: nat -> nat -> Type b: nat
0 * b = 0
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b = b * a
a.+1 * b = b * a.+1
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b = b * a
a.+1 * b = b + b * a
natpaths:= paths: nat -> nat -> Type a, b: nat IHa: a * b = b * a
b + a * b = b + b * a
apply (ap (funx => b + x)), IHa.Qed.(** [a * (b + c) =N= a * b + a * c]. *)
natpaths:= paths: nat -> nat -> Type
LeftDistribute (mult : Mult nat) (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type
LeftDistribute (mult : Mult nat) (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type b, c: nat
0 * (b + c) = 0 * b + 0 * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
a.+1 * (b + c) = a.+1 * b + a.+1 * c
natpaths:= paths: nat -> nat -> Type b, c: nat
0 * (b + c) = 0 * b + 0 * c
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
a.+1 * (b + c) = a.+1 * b + a.+1 * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
b + c + a * (b + c) = b + a * b + (c + a * c)
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
b + (c + a * (b + c)) = b + a * b + (c + a * c)
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
b + (c + a * (b + c)) = b + (a * b + (c + a * c))
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
c + a * (b + c) = a * b + (c + a * c)
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
c + a * (b + c) = a * b + c + a * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
c + a * (b + c) = c + a * b + a * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b + c) = a * b + a * c
c + a * (b + c) = c + (a * b + a * c)
apply (ap (plus c)), IHa.Qed.(** [(a + b) * c =N= a * c + b * c]. This also follows from [plus_mult_distr_r], which currently requires that we already have a semiring. It should be adjusted to not require associativity. *)
natpaths:= paths: nat -> nat -> Type
RightDistribute (mult : Mult nat) (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type
RightDistribute (mult : Mult nat) (plus : Plus nat)
natpaths:= paths: nat -> nat -> Type a, b, c: nat
(a + b) * c = a * c + b * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat
c * (a + b) = a * c + b * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat
c * a + c * b = a * c + b * c
apply ap011; apply mul_comm.Defined.
natpaths:= paths: nat -> nat -> Type
Associative (mult : Mult nat)
natpaths:= paths: nat -> nat -> Type
Associative (mult : Mult nat)
natpaths:= paths: nat -> nat -> Type b, c: nat
0 * (b * c) = 0 * b * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b * c) = a * b * c
a.+1 * (b * c) = a.+1 * b * c
natpaths:= paths: nat -> nat -> Type b, c: nat
0 * (b * c) = 0 * b * c
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b * c) = a * b * c
a.+1 * (b * c) = a.+1 * b * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b * c) = a * b * c
b * c + a * (b * c) = (b + a * b) * c
natpaths:= paths: nat -> nat -> Type a, b, c: nat IHa: a * (b * c) = a * b * c
split.Qed.Definitionpredx := match x with | 0%nat => 0 | S k => k end.Global InstanceS_inj : IsInjective@{N N} S
:= { injective := funabE => ap pred E }.(** This is also in Spaces.Nat.Core. *)
natpaths:= paths: nat -> nat -> Type a, b: nat E: (b + a * b.+1).+1 =N= 0
((a.+1 =N= 0) + (b.+1 =N= 0))%type
destruct (S_neq_0 _ E).Defined.
natpaths:= paths: nat -> nat -> Type
NoZeroDivisors nat
natpaths:= paths: nat -> nat -> Type
NoZeroDivisors nat
natpaths:= paths: nat -> nat -> Type x: nat Ex: x <> 0 y: nat Ey1: y <> 0 Ey2: x * y = 0
Empty
natpaths:= paths: nat -> nat -> Type x: nat Ex: x <> 0 y: nat Ey1: y <> 0 Ey2: ((x =N= 0) + (y =N= 0))%type
Empty
destruct Ey2;auto.Qed.
natpaths:= paths: nat -> nat -> Type
forallz : nat, LeftCancellation plus z
natpaths:= paths: nat -> nat -> Type
forallz : nat, LeftCancellation plus z
natpaths:= paths: nat -> nat -> Type
forallzxy : nat, z + x = z + y -> x = y
natpaths:= paths: nat -> nat -> Type b, c: nat E: b = c
b = c
natpaths:= paths: nat -> nat -> Type a: nat IHa: forallxy : nat, a + x = a + y -> x = y b, c: nat E: (a + b).+1 = (a + c).+1
b = c
natpaths:= paths: nat -> nat -> Type b, c: nat E: b = c
b = c
trivial.
natpaths:= paths: nat -> nat -> Type a: nat IHa: forallxy : nat, a + x = a + y -> x = y b, c: nat E: (a + b).+1 = (a + c).+1
b = c
natpaths:= paths: nat -> nat -> Type a: nat IHa: forallxy : nat, a + x = a + y -> x = y b, c: nat E: (a + b).+1 = (a + c).+1
a + b = a + c
natpaths:= paths: nat -> nat -> Type a: nat IHa: forallxy : nat, a + x = a + y -> x = y b, c: nat E: (a + b).+1 = (a + c).+1
(a + b).+1 = (a + c).+1
assumption.Qed.
natpaths:= paths: nat -> nat -> Type
forallz : nat,
PropHolds (~ (z =N= 0)) -> LeftCancellation mult z
natpaths:= paths: nat -> nat -> Type
forallz : nat,
PropHolds (~ (z =N= 0)) -> LeftCancellation mult z
natpaths:= paths: nat -> nat -> Type
forallz : nat, ~ (z =N= 0) -> LeftCancellation mult z
natpaths:= paths: nat -> nat -> Type
forallz : nat,
~ (z =N= 0) ->
forallxy : nat, z * x = z * y -> x = y
natpaths:= paths: nat -> nat -> Type
forallbca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c
natpaths:= paths: nat -> nat -> Type a: nat Ea: ~ (a =N= 0) E: a * 0 = a * 0
0 = 0
natpaths:= paths: nat -> nat -> Type c, a: nat Ea: ~ (a =N= 0) E: a * 0 = a * c.+1
0 = c.+1
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c a: nat Ea: ~ (a =N= 0) E: a * b.+1 = a * 0
b.+1 = 0
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c c, a: nat Ea: ~ (a =N= 0) E: a * b.+1 = a * c.+1
b.+1 = c.+1
natpaths:= paths: nat -> nat -> Type a: nat Ea: ~ (a =N= 0) E: a * 0 = a * 0
0 = 0
reflexivity.
natpaths:= paths: nat -> nat -> Type c, a: nat Ea: ~ (a =N= 0) E: a * 0 = a * c.+1
0 = c.+1
natpaths:= paths: nat -> nat -> Type c, a: nat Ea: ~ (a =N= 0) E: 0 = a * c.+1
0 = c.+1
natpaths:= paths: nat -> nat -> Type c, a: nat Ea: ~ (a =N= 0) E: a + a * c = 0
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c a: nat Ea: ~ (a =N= 0) E: a * b.+1 = a * 0
b.+1 = 0
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c a: nat Ea: ~ (a =N= 0) E: a + a * b = 0
b.+1 = 0
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c a: nat Ea: ~ (a =N= 0) E: ((a =N= 0) * ((a * b)%mc =N= 0))%type
b.+1 = 0
destruct (Ea (fst E)).
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c c, a: nat Ea: ~ (a =N= 0) E: a * b.+1 = a * c.+1
b.+1 = c.+1
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c c, a: nat Ea: ~ (a =N= 0) E: a + a * b = a + a * c
b.+1 = c.+1
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c c, a: nat Ea: ~ (a =N= 0) E: a * b = a * c
b.+1 = c.+1
natpaths:= paths: nat -> nat -> Type b: nat IHb: forallca : nat,
~ (a =N= 0) -> a * b = a * c -> b = c c, a: nat Ea: ~ (a =N= 0) E: a * b = a * c
b = c
apply IHb with a;trivial.Qed.(* Order *)Global Instancenat_le: Le@{N N} nat := Nat.Core.leq.Global Instancenat_lt: Lt@{N N} nat := Nat.Core.lt.
natpaths:= paths: nat -> nat -> Type
forallnk : nat, n ≤ k + n
natpaths:= paths: nat -> nat -> Type
forallnk : nat, n ≤ k + n
natpaths:= paths: nat -> nat -> Type n: nat
n ≤ 0 + n
natpaths:= paths: nat -> nat -> Type n, k: nat IHk: n ≤ k + n
n ≤ k.+1 + n
natpaths:= paths: nat -> nat -> Type n: nat
n ≤ 0 + n
apply Nat.Core.leq_n.
natpaths:= paths: nat -> nat -> Type n, k: nat IHk: n ≤ k + n
n ≤ k.+1 + n
natpaths:= paths: nat -> nat -> Type n, k: nat IHk: n ≤ k + n
n ≤ (k + n).+1
natpaths:= paths: nat -> nat -> Type n, k: nat IHk: n ≤ k + n
Core.leq n (k + n)
assumption.Qed.
natpaths:= paths: nat -> nat -> Type
forallnm : nat, n ≤ m <-> {k : nat & m =N= k + n}
natpaths:= paths: nat -> nat -> Type
forallnm : nat, n ≤ m <-> {k : nat & m =N= k + n}
natpaths:= paths: nat -> nat -> Type n, m: nat
n ≤ m -> {k : nat & m =N= k + n}
natpaths:= paths: nat -> nat -> Type n, m: nat
{k : nat & m =N= k + n} -> n ≤ m
natpaths:= paths: nat -> nat -> Type n, m: nat
n ≤ m -> {k : nat & m =N= k + n}
natpaths:= paths: nat -> nat -> Type n: nat
{k : nat & n =N= k + n}
natpaths:= paths: nat -> nat -> Type n, m: nat E: Core.leq n m IH: {k : nat & m =N= k + n}
{k : nat & m.+1 =N= k + n}
natpaths:= paths: nat -> nat -> Type n: nat
{k : nat & n =N= k + n}
exists0;split.
natpaths:= paths: nat -> nat -> Type n, m: nat E: Core.leq n m IH: {k : nat & m =N= k + n}
{k : nat & m.+1 =N= k + n}
natpaths:= paths: nat -> nat -> Type n, m: nat E: Core.leq n m k: nat IH: m =N= k + n
{k : nat & m.+1 =N= k + n}
natpaths:= paths: nat -> nat -> Type n, m: nat E: Core.leq n m k: nat IH: m =N= k + n
m.+1 =N= k.+1 + n
rewrite IH;reflexivity.
natpaths:= paths: nat -> nat -> Type n, m: nat
{k : nat & m =N= k + n} -> n ≤ m
natpaths:= paths: nat -> nat -> Type n, m, k: nat Hk: m =N= k + n
n ≤ m
natpaths:= paths: nat -> nat -> Type n, m, k: nat Hk: m =N= k + n
n ≤ k + n
apply le_plus.Qed.
natpaths:= paths: nat -> nat -> Type
foralla : nat, 0 ≤ a
natpaths:= paths: nat -> nat -> Type
foralla : nat, 0 ≤ a
induction a;constructor;auto.Qed.
natpaths:= paths: nat -> nat -> Type
forallab : nat, a ≤ b <-> a.+1 ≤ b.+1
natpaths:= paths: nat -> nat -> Type
forallab : nat, a ≤ b <-> a.+1 ≤ b.+1
natpaths:= paths: nat -> nat -> Type a, b: nat
a ≤ b <-> a.+1 ≤ b.+1
natpaths:= paths: nat -> nat -> Type a, b: nat
{k : nat & b =N= k + a} <-> a.+1 ≤ b.+1
natpaths:= paths: nat -> nat -> Type a, b: nat
{k : nat & b =N= k + a} <->
{k : nat & b.+1 =N= k + a.+1}
natpaths:= paths: nat -> nat -> Type a, b, k: nat E: b =N= k + a
b.+1 =N= k + a.+1
natpaths:= paths: nat -> nat -> Type a, b, k: nat E: b.+1 =N= k + a.+1
b =N= k + a
natpaths:= paths: nat -> nat -> Type a, b, k: nat E: b =N= k + a
b.+1 =N= k + a.+1
natpaths:= paths: nat -> nat -> Type a, b, k: nat E: b =N= k + a
(k + a).+1 =N= (k + a).+1
reflexivity.
natpaths:= paths: nat -> nat -> Type a, b, k: nat E: b.+1 =N= k + a.+1
b =N= k + a
natpaths:= paths: nat -> nat -> Type a, b, k: nat E: b = k + a
b =N= k + a
trivial.Qed.
natpaths:= paths: nat -> nat -> Type
foralla : nat, 0 < a.+1
natpaths:= paths: nat -> nat -> Type
foralla : nat, 0 < a.+1
natpaths:= paths: nat -> nat -> Type a: nat
0 < a.+1
natpaths:= paths: nat -> nat -> Type a: nat
0 ≤ a
apply zero_least.Qed.
natpaths:= paths: nat -> nat -> Type
forallab : nat,
a ≤ b.+1 -> ((a ≤ b) + (a = b.+1))%type
natpaths:= paths: nat -> nat -> Type
forallab : nat,
a ≤ b.+1 -> ((a ≤ b) + (a = b.+1))%type
natpaths:= paths: nat -> nat -> Type b: nat
0 ≤ b.+1 -> ((0 ≤ b) + (0 = b.+1))%type
natpaths:= paths: nat -> nat -> Type a, b: nat
a.+1 ≤ b.+1 -> ((a.+1 ≤ b) + (a.+1 = b.+1))%type
natpaths:= paths: nat -> nat -> Type b: nat
0 ≤ b.+1 -> ((0 ≤ b) + (0 = b.+1))%type
intros;left;apply zero_least.
natpaths:= paths: nat -> nat -> Type a, b: nat
a.+1 ≤ b.+1 -> ((a.+1 ≤ b) + (a.+1 = b.+1))%type
natpaths:= paths: nat -> nat -> Type a, b: nat E: a.+1 ≤ b.+1
((a.+1 ≤ b) + (a.+1 = b.+1))%type
natpaths:= paths: nat -> nat -> Type a, b: nat E: a ≤ b
((a.+1 ≤ b) + (a.+1 = b.+1))%type
natpaths:= paths: nat -> nat -> Type a, b: nat E: Core.leq a b
((a.+1 ≤ b.+1) + (a.+1 = b.+2))%type
natpaths:= paths: nat -> nat -> Type a, b: nat E: Core.leq a b
a.+1 ≤ b.+1
natpaths:= paths: nat -> nat -> Type a, b: nat E: Core.leq a b
a ≤ b
trivial.Defined.
natpaths:= paths: nat -> nat -> Type
forallab : nat, ((a ≤ b) + (b < a))%type
natpaths:= paths: nat -> nat -> Type
forallab : nat, ((a ≤ b) + (b < a))%type
natpaths:= paths: nat -> nat -> Type
forallb : nat, ((0 ≤ b) + (b < 0))%type
natpaths:= paths: nat -> nat -> Type a: nat IHa: forallb : nat, ((a ≤ b) + (b < a))%type
forallb : nat, ((a.+1 ≤ b) + (b < a.+1))%type
natpaths:= paths: nat -> nat -> Type
forallb : nat, ((0 ≤ b) + (b < 0))%type
intros;left;apply zero_least.
natpaths:= paths: nat -> nat -> Type a: nat IHa: forallb : nat, ((a ≤ b) + (b < a))%type
forallb : nat, ((a.+1 ≤ b) + (b < a.+1))%type
natpaths:= paths: nat -> nat -> Type a: nat IHa: forallb : nat, ((a ≤ b) + (b < a))%type
natpaths:= paths: nat -> nat -> Type m: nat IHn0: foralln0 : nat,
m =N= n0.+1 ->
forallle_mn1le_mn2 : m ≤ n0, le_mn1 = le_mn2 def_n2:= 1%path: m = m
foralldef_n2 : m = m,
Core.leq_n m =
paths_ind m (fun (n : nat) (_ : m = n) => m ≤ n)
(Core.leq_n m) m def_n2
natpaths:= paths: nat -> nat -> Type m: nat IHn0: foralln0 : nat,
m =N= n0.+1 ->
forallle_mn1le_mn2 : m ≤ n0, le_mn1 = le_mn2 def_n2:= 1%path: m = m def_n0: m = m
Core.leq_n m =
paths_ind m (fun (n : nat) (_ : m = n) => m ≤ n)
(Core.leq_n m) m def_n0
natpaths:= paths: nat -> nat -> Type m: nat IHn0: foralln0 : nat,
m =N= n0.+1 ->
forallle_mn1le_mn2 : m ≤ n0, le_mn1 = le_mn2 def_n2:= 1%path: m = m def_n0: m = m
Core.leq_n m =
paths_ind m (fun (n : nat) (_ : m = n) => m ≤ n)
(Core.leq_n m) m 1
natpaths:= paths: nat -> nat -> Type m: nat IHn0: foralln0 : nat,
m =N= n0.+1 ->
forallle_mn1le_mn2 : m ≤ n0, le_mn1 = le_mn2 def_n2:= 1%path: m = m def_n0: m = m
Core.leq_n m = Core.leq_n m
reflexivity.
natpaths:= paths: nat -> nat -> Type m, m0: nat IHn0: foralln0 : nat,
m0.+1 =N= n0.+1 ->
forallle_mn1le_mn2 : m ≤ n0, le_mn1 = le_mn2 def_n2:= 1%path: m0.+1 = m0.+1 le_mn2: Core.leq m m0
foralldef_n2 : m0.+1 = m,
Core.leq_n m =
paths_ind m0.+1
(fun (n : nat) (_ : m0.+1 = n) => m ≤ n)
(Core.leq_S m m0 le_mn2) m def_n2
natpaths:= paths: nat -> nat -> Type m, m0: nat IHn0: foralln0 : nat,
m0.+1 =N= n0.+1 ->
forallle_mn1le_mn2 : m ≤ n0, le_mn1 = le_mn2 def_n2:= 1%path: m0.+1 = m0.+1 le_mn2: Core.leq m m0 def_n0: m0.+1 = m le_mn0: Core.leq m0.+1 m0
natpaths:= paths: nat -> nat -> Type n': nat IHn: forallm : nat, n' ≤ Core.max n' m m': nat IHm: n'.+1 ≤ Core.max n'.+1 m'
n'.+1 ≤ (Core.max n' m').+1
natpaths:= paths: nat -> nat -> Type n': nat IHn: forallm : nat, n' ≤ Core.max n' m m': nat IHm: n'.+1 ≤ Core.max n'.+1 m'
n' ≤ Core.max n' m'
exact (IHn m').Qed.
natpaths:= paths: nat -> nat -> Type n, m: nat
m ≤ Core.max n m
natpaths:= paths: nat -> nat -> Type n, m: nat
m ≤ Core.max n m
natpaths:= paths: nat -> nat -> Type n: nat
forallm : nat, m ≤ Core.max n m
natpaths:= paths: nat -> nat -> Type n': nat IHn: forallm : nat, m ≤ Core.max n' m
0 ≤ n'.+1
natpaths:= paths: nat -> nat -> Type n': nat IHn: forallm : nat, m ≤ Core.max n' m m': nat IHm: m' ≤ Core.max n'.+1 m'
m'.+1 ≤ (Core.max n' m').+1
natpaths:= paths: nat -> nat -> Type n': nat IHn: forallm : nat, m ≤ Core.max n' m
0 ≤ n'.+1
apply zero_least.
natpaths:= paths: nat -> nat -> Type n': nat IHn: forallm : nat, m ≤ Core.max n' m m': nat IHm: m' ≤ Core.max n'.+1 m'
m'.+1 ≤ (Core.max n' m').+1
natpaths:= paths: nat -> nat -> Type n': nat IHn: forallm : nat, m ≤ Core.max n' m m': nat IHm: m' ≤ Core.max n'.+1 m'
m' ≤ Core.max n' m'
exact (IHn m').Qed.
natpaths:= paths: nat -> nat -> Type
OrderEmbedding S
natpaths:= paths: nat -> nat -> Type
OrderEmbedding S
natpaths:= paths: nat -> nat -> Type
OrderPreserving S
natpaths:= paths: nat -> nat -> Type
OrderReflecting S
natpaths:= paths: nat -> nat -> Type
OrderPreserving S
intros ??;apply le_S_S.
natpaths:= paths: nat -> nat -> Type
OrderReflecting S
intros ??;apply le_S_S.Qed.
natpaths:= paths: nat -> nat -> Type
StrictOrderEmbedding S
natpaths:= paths: nat -> nat -> Type
StrictOrderEmbedding S
split;apply _.Qed.Global Instancenat_naturals_to_semiring : NaturalsToSemiRing@{N i} nat :=
fun______ => fix f (n: nat) := match n with0%nat => 0 | 1%nat => 1 |
S n' => 1 + f n' end.Sectionfor_another_semiring.UniverseU.Context {R:Type@{U} } `{IsSemiCRing@{U} R}.NotationtoR := (naturals_to_semiring nat R).(* Add Ring R: (rings.stdlib_semiring_theory R). *)
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
forallx : nat, toR x.+1 = 1 + toR x
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
forallx : nat, toR x.+1 = 1 + toR x
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
toR 1 = 1 + toR 0
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R x: nat
toR x.+2 = 1 + toR x.+1
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
toR 1 = 1 + toR 0
symmetry;apply plus_0_r.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R x: nat
toR x.+2 = 1 + toR x.+1
reflexivity.Defined.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat
toR (a + a') = toR a + toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat
toR (a + a') = toR a + toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a': nat
toR (0 + a') = toR 0 + toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a + a') = toR a + toR a'
toR (a.+1 + a') = toR a.+1 + toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a': nat
toR (0 + a') = toR 0 + toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a': nat
toR a' = 0 + toR a'
applysymmetry,plus_0_l.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a + a') = toR a + toR a'
toR (a.+1 + a') = toR a.+1 + toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a + a') = toR a + toR a'
toR (a + a').+1 = toR a.+1 + toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a + a') = toR a + toR a'
1 + (toR a + toR a') = 1 + toR a + toR a'
apply associativity.Qed.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat
toR (a * a') = toR a * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat
toR (a * a') = toR a * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a': nat
toR (0 * a') = toR 0 * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a * a') = toR a * toR a'
toR (a.+1 * a') = toR a.+1 * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a': nat
toR (0 * a') = toR 0 * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a': nat
0 = 0 * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a': nat
0 = 0
reflexivity.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a * a') = toR a * toR a'
toR (a.+1 * a') = toR a.+1 * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a * a') = toR a * toR a'
toR (a.+1 * a') = (1 + toR a) * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a * a') = toR a * toR a'
toR (a' + a * a') = (1 + toR a) * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a * a') = toR a * toR a'
toR a' + toR a * toR a' = (1 + toR a) * toR a'
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R a, a': nat IHa: toR (a * a') = toR a * toR a'
toR a' + toR a * toR a' = toR a' + toR a * toR a'
reflexivity.Qed.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsSemiRingPreserving toR
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsSemiRingPreserving toR
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsSemiGroupPreserving toR
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsUnitPreserving toR
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsSemiGroupPreserving toR
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsUnitPreserving toR
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsSemiGroupPreserving toR
rapply f_preserves_plus.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsUnitPreserving toR
reflexivity.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsSemiGroupPreserving toR
rapply f_preserves_mult.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R
IsUnitPreserving toR
reflexivity.Defined.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h x: nat
toR x = h x
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h x: nat
toR x = h x
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h
toR 0 = h 0
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h n: nat E: toR n = h n
toR n.+1 = h n.+1
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h
toR 0 = h 0
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h
0 = h 0
applysymmetry,preserves_0.
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h n: nat E: toR n = h n
toR n.+1 = h n.+1
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h n: nat E: toR n = h n
1 + toR n = h n.+1
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h n: nat E: toR n = h n
1 + toR n = h (1 + n)
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h n: nat E: toR n = h n
1 + toR n = h 1 + h n
natpaths:= paths: nat -> nat -> Type R: Type Aplus: Plus R Amult: Mult R Azero: Zero R Aone: One R H: IsSemiCRing R h: nat -> R IsSemiRingPreserving0: IsSemiRingPreserving h n: nat E: toR n = h n
forall (B : Type) (Aplus0 : Plus B) (Amult0 : Mult B)
(Azero0 : Zero B) (Aone0 : One B) (H : IsSemiCRing B)
(h : nat -> B),
IsSemiRingPreserving h ->
forallx : nat, naturals_to_semiring nat B x = h x