Built with Alectryon, running Coq+SerAPI v8.13.0+0.13.0. 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. Style: centered; floating; windowed.
(******************************************************************************)
(*                                                                            *)
(*                              Triangular number                             *)
(*                                                                            *)
(******************************************************************************)
(*                                                                            *)
(*     delta n = the n^th triangular number                                   *)
(*     troot n = the triangular root of n                                     *)
(*      tmod n = the triangular modulo of n                                   *)
(*                                                                            *)
(*                                                                            *)
(******************************************************************************)

Notation "[ rel _ _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ : _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ & _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ & _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ | _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "[ rel _ _ in _ ]" was already used in scope fun_scope. [notation-overridden,parsing]
Notation "_ + _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ - _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ <= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ < _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ >= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ > _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ <= _ <= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ < _ <= _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ <= _ < _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ < _ < _" was already used in scope nat_scope. [notation-overridden,parsing]
Notation "_ * _" was already used in scope nat_scope. [notation-overridden,parsing]
Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive.
m, n:nat

0 < m -> (m + n).-1 = m.-1 + n
m, n:nat

0 < m -> (m + n).-1 = m.-1 + n
by case: m. Qed.
m, n:nat

0 < n -> (m + n).-1 = m + n.-1
m, n:nat

0 < n -> (m + n).-1 = m + n.-1
by case: n => // n; rewrite addnS. Qed.
a, b, c:nat

a - b - (c - b) <= a - c
a, b, c:nat

a - b - (c - b) <= a - c
a, b, c:nat
bLa:a < b

a - b - (c - b) <= a - c
a, b, c:nat
aLb:b <= a
a - b - (c - b) <= a - c
a, b, c:nat
bLa:a < b

a - b = 0
a, b, c:nat
aLb:b <= a
a - b - (c - b) <= a - c
a, b, c:nat
aLb:b <= a

a - b - (c - b) <= a - c
a, b, c:nat
aLb:b <= a
bLc:b < c

a - b - (c - b) <= a - c
a, b, c:nat
aLb:b <= a
cLb:c <= b
a - b - (c - b) <= a - c
a, b, c:nat
aLb:b <= a
cLb:c <= b

a - b - (c - b) <= a - c
a, b, c:nat
aLb:b <= a
cLb:c <= b

a - b - 0 <= a - c
by rewrite subn0 leq_sub2l. Qed.
b, a, c:nat

a - c <= a - b + (b - c)
b, a, c:nat

a - c <= a - b + (b - c)
b, a, c:nat

a <= a - b + (b - c + c)
b, a, c:nat

a <= a - b + b
b, a, c:nat
H:b < c
a <= a - b + (b - c + c)
b, a, c:nat
H:a < b

a <= a - b + b
b, a, c:nat
H:b < c
a <= a - b + (b - c + c)
b, a, c:nat
H:a < b

b <= a - b + b
b, a, c:nat
H:b < c
a <= a - b + (b - c + c)
b, a, c:nat
H:b < c

a <= a - b + (b - c + c)
b, a, c:nat
H:b < c

b <= c -> a <= a - b + (b - c + c)
b, a, c:nat
H:b < c

a <= a - b + (0 + c)
b, a, c:nat
H:b < c

a - (0 + c) <= a - b
by apply: leq_sub2l; apply: ltnW. Qed. (******************************************************************************) (* *) (* Triangular number *) (* *) (******************************************************************************) Definition delta n := (n.+1 * n)./2. Notation "'Δ' n " := (delta n) (format "'Δ' n", at level 10).
= [:: (1, 1); (2, 3); (3, 6); (4, 10); (5, 15); (6, 21); (7, 28); (8, 36); (9, 45); (10, 55); (11, 66); (12, 78); (13, 91); (14, 105); (15, 120); (16, 136); (17, 153); (18, 171); (19, 190); (20, 210)] : seq (nat * nat)
n:nat

Δn.+1 = Δn + n.+1
n:nat

Δn.+1 = Δn + n.+1
n:nat

odd (n.+1 * n) && odd (2 * n.+1) + ((n.+1 * n)./2 + (2 * n.+1)./2) = (n.+1 * n)./2 + n.+1
n:nat

(n.+1 * n)./2 + ((n.+1).*2)./2 = (n.+1 * n)./2 + n.+1
by rewrite -{4}(half_bit_double n.+1 false). Qed.
n:nat

0 < n -> 0 < Δn
n:nat

0 < n -> 0 < Δn
by case: n => // n _; rewrite deltaS addnS ltnS leq_addr. Qed.
n:nat

Δn = \sum_(i < n.+1) i
n:nat

Δn = \sum_(i < n.+1) i
n:nat
IH:Δn = \sum_(i < n.+1) i

Δn.+1 = \sum_(i < n.+2) i
by rewrite big_ord_recr /= -IH deltaS. Qed.
= [:: (0, 0); (1, 1); (2, 3); (3, 6); (4, 10); (5, 15); (6, 21); (7, 28); (8, 36); (9, 45); (10, 55)] : seq (nat * nat)
m, n:nat

m <= n -> Δm <= Δn
m, n:nat

m <= n -> Δm <= Δn
by move=> H; apply/half_leq/leq_mul. Qed.
n:nat

(8 * Δn).+1 = n.*2.+1 ^ 2
n:nat

(8 * Δn).+1 = n.*2.+1 ^ 2
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

(8 * Δn.+1).+1 = (n.+1).*2.+1 ^ 2
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

n.*2.+1 ^ 2 + 8 * n.+1 = (n.+1).*2.+1 ^ 2
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

n.*2.+1 ^ 2 + 8 * n.+1 = (n.*2.+1 + 2) ^ 2
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

n.*2.+1 ^ 2 + 8 * n.+1 = n.*2.+1 ^ 2 + (2 ^ 2 + 2 * (n.*2.+1 * 2))
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

8 * n.+1 = 2 ^ 2 + 2 * (n.*2.+1 * 2)
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

8 + 8 * n = 2 ^ 2 + 2 * (n.*2.+1 * 2)
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

8 + 8 * n = 2 ^ 2 + 2 * 2 + 2 * (n.*2 * 2)
n:nat
IH:(8 * Δn).+1 = n.*2.+1 ^ 2

8 * n = 2 * (n.*2 * 2)
by rewrite mulnCA -muln2 -!mulnA mulnC. Qed.
n:nat

n <= Δn
n:nat

n <= Δn
by case: n => // n; rewrite deltaS addnS ltnS leq_addl. Qed. (******************************************************************************) (* *) (* Triangular root *) (* *) (******************************************************************************) Definition troot n := let l := iota 0 n.+2 in (find (fun x => n < delta x) l).-1. Notation "∇ n" := (troot n) (format "∇ n", at level 10).
= [:: (0, 0); (1, 1); (2, 1); (3, 2); (4, 2); (5, 2); (6, 3); (7, 3); (8, 3); (9, 3); (10, 4)] : seq (nat * nat)
n:nat

0 < n -> 0 < ∇n
n:nat

0 < n -> 0 < ∇n
by case: n. Qed.
m:nat

Δ(∇m) <= m
m:nat

Δ(∇m) <= m
m:nat

~~ (m < Δ(find (fun x : nat => m < Δx) (iota 0 m.+2)).-1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool

~~ (m < Δ(find f l).-1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
n:nat
E:(find f l).-1 = n.+1

~~ (m < Δn.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
n:nat
E:(find f l).-1 = n.+1

f (nth 0 l (find f l).-1) = false -> ~~ (m < Δn.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
n:nat
E:(find f l).-1 = n.+1

n.+1 < m.+2
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
n:nat
E:(find f l).-1 = n.+1

0 < find f l
by case: find E. Qed.
m:nat

m < Δ(∇m).+1
m:nat

m < Δ(∇m).+1
m:nat

~~ (Δ(find (fun x : nat => m < Δx) (iota 0 m.+2)).-1.+1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool

~~ (Δ(find f l).-1.+1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool

has f l
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
~~ (Δ(find f l).-1.+1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool

f m.+1
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
~~ (Δ(find f l).-1.+1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool

(false + (m.+1).*2)./2 <= (m.+2 * m.+1)./2
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
~~ (Δ(find f l).-1.+1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l

~~ (Δ(find f l).-1.+1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l

m < Δ(nth 0 l (find f l)) -> ~~ (Δ(find f l).-1.+1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
E:(find f l).-1 = 0

m < Δ(nth 0 l (find f l)) -> ~~ (Δ1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
n:nat
E:(find f l).-1 = n.+1
m < Δ(nth 0 l (find f l)) -> ~~ (Δn.+2 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l

1.-1 = 0 -> m < Δ(nth 0 l 1) -> ~~ (Δ1 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
n:nat
E:(find f l).-1 = n.+1
m < Δ(nth 0 l (find f l)) -> ~~ (Δn.+2 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
n:nat
E:(find f l).-1 = n.+1

m < Δ(nth 0 l (find f l)) -> ~~ (Δn.+2 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
n:nat
E:(find f l).-1 = n.+1

m < Δ(0 + find f l) -> ~~ (Δn.+2 < m.+1)
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
n:nat
E:(find f l).-1 = n.+1
find f l < m.+2
m:nat
l:=iota 0 m.+2:seq nat
f:=fun H : nat => m < ΔH:nat -> bool
Hfl:has f l
n:nat
E:(find f l).-1 = n.+1

find f l < m.+2
by rewrite -(size_iota 0 m.+2) -has_find. Qed. (* Galois connection *)
m, n:nat

(n <= ∇m) = (Δn <= m)
m, n:nat

(n <= ∇m) = (Δn <= m)
m, n:nat

Δ(∇m) <= m
m, n:nat
dmLn:∇m < n
false = (Δn <= m)
m, n:nat
dmLn:∇m < n

false = (Δn <= m)
m, n:nat
dmLn:∇m < n

~~ (Δn <= m)
m, n:nat
dmLn:∇m < n

m < Δn
by apply: leq_trans (delta_root_gt _) (delta_le dmLn). Qed.
m, n:nat

(∇m < n) = (m < Δn)
m, n:nat

(∇m < n) = (m < Δn)
by rewrite ltnNge root_delta_le -ltnNge. Qed.
m, n:nat

m <= n -> ∇m <= ∇n
m, n:nat

m <= n -> ∇m <= ∇n
by move=> mLn; rewrite root_delta_le (leq_trans (delta_root_le _)). Qed.
m:nat
n:nat_eqType

(∇m == n) = (Δn <= m < Δn.+1)
m:nat
n:nat_eqType

(∇m == n) = (Δn <= m < Δn.+1)
m:nat
n:nat_eqType

(∇m == n) = (n <= ∇m < n.+1)
by rewrite ltnS -eqn_leq. Qed.
n:nat

∇(Δn) = n
n:nat

∇(Δn) = n
by apply/eqP; rewrite trootE leqnn deltaS -addn1 leq_add2l. Qed.
n:nat

∇n <= n
n:nat

∇n <= n
by rewrite -{2}[n]troot_delta troot_le // geq_deltann. Qed. (******************************************************************************) (* *) (* Triangular modulo *) (* *) (******************************************************************************) Definition tmod n := n - delta (troot n).
n:nat

tmod (Δn) = 0
n:nat

tmod (Δn) = 0
by rewrite /tmod troot_delta subnn. Qed.
n:nat

n = Δ(∇n) + tmod n
n:nat

n = Δ(∇n) + tmod n
by rewrite addnC (subnK (delta_root_le _)). Qed.
n:nat

tmod n <= ∇n
n:nat

tmod n <= ∇n
by rewrite leq_subLR -ltnS -addnS -deltaS delta_root_gt. Qed.
m, n:nat

∇m < ∇n -> m < n
m, n:nat

∇m < ∇n -> m < n
m, n:nat

m < Δ(∇m) + (∇m).+1
by rewrite {1}[m]tmodE ltn_add2l ltnS tmod_le. Qed.
m, n:nat

∇m = ∇n -> (tmod m <= tmod n) = (m <= n)
m, n:nat

∇m = ∇n -> (tmod m <= tmod n) = (m <= n)
by move=> tmEtn; rewrite {2}[m]tmodE {2}[n]tmodE tmEtn leq_add2l. Qed.
m, n:nat

∇m = ∇n -> (tmod m < tmod n) = (m < n)
m, n:nat

∇m = ∇n -> (tmod m < tmod n) = (m < n)
by move=> tmEtn; rewrite {2}[m]tmodE {2}[n]tmodE tmEtn ltn_add2l. Qed.
m:nat

(∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1) || [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m]
m:nat

(∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1) || [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m]
m:nat

∇m <= ∇m.+1 -> (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1) || [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m]
m:nat
He:∇m = ∇m.+1

(∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1) || [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m]
m:nat
He:∇m < ∇m.+1
(∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1) || [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m]
m:nat
He:∇m < ∇m.+1

(∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1) || [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m]
m:nat
He:∇m < ∇m.+1

[&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] || (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1

∇m.+1 == (∇m).+1
m:nat
He:∇m < ∇m.+1
∇m.+1 == (∇m).+1 -> [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] || (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1

Δ(∇m.+1) <= m.+1
m:nat
He:∇m < ∇m.+1
true && (m.+1 < Δ(∇m).+2)
m:nat
He:∇m < ∇m.+1
∇m.+1 == (∇m).+1 -> [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] || (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1

true && (m.+1 < Δ(∇m).+2)
m:nat
He:∇m < ∇m.+1
∇m.+1 == (∇m).+1 -> [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] || (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1

true && (Δ(∇m) + (tmod m).+2 <= Δ(∇m) + ((∇m).+1 + (∇m).+2))
m:nat
He:∇m < ∇m.+1
∇m.+1 == (∇m).+1 -> [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] || (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1

∇m.+1 == (∇m).+1 -> [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] || (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1

[&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] || (∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1

[&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1

m.+1 == m.+1 -> [&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1

Δ(∇m) + (tmod m).+1 == Δ(∇m) + (∇m).+1 + tmod m.+1 -> [&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1
He2:tmod m = ∇m + tmod m.+1

[&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1
He2:tmod m = ∇m + tmod m.+1

tmod m <= ∇m -> [&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1
He2:tmod m = ∇m + tmod m.+1

tmod m < ∇m -> [&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1
He2:tmod m = ∇m + tmod m.+1
He3:tmod m = ∇m
[&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1
He2:tmod m = ∇m + tmod m.+1
He3:tmod m = ∇m

[&& true, tmod m.+1 == 0 & tmod m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (tmod m).+1)
m:nat
He:∇m < ∇m.+1
He1:∇m.+1 = (∇m).+1
He2:tmod m = ∇m + tmod m.+1
He3:tmod m = ∇m

[&& true, tmod m == tmod m & ∇m == ∇m] || ((∇m).+1 == ∇m) && (tmod m.+1 == (∇m).+1)
by rewrite !eqxx. Qed.
m, n:nat

(m <= n) = (∇m < ∇n) || (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat

(m <= n) = (∇m < ∇n) || (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmGdn:∇m < ∇n

(m <= n) = true
m, n:nat
∇n <= ∇m -> (m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmGdn:∇m < ∇n

m <= n
m, n:nat
∇n <= ∇m -> (m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmGdn:∇m < ∇n

m <= Δ(∇m).+1
m, n:nat
dmGdn:∇m < ∇n
Δ(∇m).+1 <= n
m, n:nat
∇n <= ∇m -> (m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmGdn:∇m < ∇n

Δ(∇m).+1 <= n
m, n:nat
∇n <= ∇m -> (m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmGdn:∇m < ∇n

Δ(∇m).+1 <= Δ(∇n)
m, n:nat
dmGdn:∇m < ∇n
Δ(∇n) <= n
m, n:nat
∇n <= ∇m -> (m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmGdn:∇m < ∇n

Δ(∇n) <= n
m, n:nat
∇n <= ∇m -> (m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat

∇n <= ∇m -> (m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dnEdm:∇n = ∇m

(m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmLdn:∇n < ∇m
(m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dnEdm:∇n = ∇m

(m <= n) = (tmod m <= tmod n)
m, n:nat
dmLdn:∇n < ∇m
(m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmLdn:∇n < ∇m

(m <= n) = (∇m == ∇n) && (tmod m <= tmod n)
m, n:nat
dmLdn:∇n < ∇m

(m <= n) = false
m, n:nat
dmLdn:∇n < ∇m

~~ (m <= n)
m, n:nat
dmLdn:∇n < ∇m

n < m
m, n:nat
dmLdn:∇n < ∇m

Δ(∇n).+1 <= m
m, n:nat
dmLdn:∇n < ∇m

Δ(∇n).+1 <= Δ(∇m)
by apply: delta_le. Qed.
m, n:nat

(m < n) = (∇m < ∇n) || (∇m == ∇n) && (tmod m < tmod n)
m, n:nat

(m < n) = (∇m < ∇n) || (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dmGdn:∇m < ∇n

(m < n) = true
m, n:nat
∇n <= ∇m -> (m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dmGdn:∇m < ∇n

m < n
m, n:nat
∇n <= ∇m -> (m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dmGdn:∇m < ∇n

Δ(∇m).+1 <= n
m, n:nat
∇n <= ∇m -> (m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dmGdn:∇m < ∇n

Δ(∇n) <= n
m, n:nat
∇n <= ∇m -> (m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat

∇n <= ∇m -> (m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dnEdm:∇n = ∇m

(m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dmLdn:∇n < ∇m
(m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dnEdm:∇n = ∇m

(m < n) = (tmod m < tmod n)
m, n:nat
dmLdn:∇n < ∇m
(m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dmLdn:∇n < ∇m

(m < n) = (∇m == ∇n) && (tmod m < tmod n)
m, n:nat
dmLdn:∇n < ∇m

(m < n) = false
m, n:nat
dmLdn:∇n < ∇m

~~ (m < n)
m, n:nat
dmLdn:∇n < ∇m

n < m
m, n:nat
dmLdn:∇n < ∇m

Δ(∇n).+1 <= m
m, n:nat
dmLdn:∇n < ∇m

Δ(∇n).+1 <= Δ(∇m)
by apply: delta_le. Qed. (******************************************************************************) (* *) (* Correspondence between N and N x N *) (* *) (******************************************************************************) (* An explicit definition of N <-> N * N *) Definition tpair n := (troot n - tmod n, tmod n).
= [:: (0, (0, 0)); (1, (1, 0)); (2, (0, 1)); (3, (2, 0)); (4, (1, 1)); (5, (0, 2)); (6, (3, 0)); (7, (2, 1)); (8, (1, 2)); (9, (0, 3)); (10, (4, 0)); (11, (3, 1)); (12, (2, 2)); (13, (1, 3)); (14, (0, 4)); (15, (5, 0)); (16, (4, 1)); (17, (3, 2)); (18, (2, 3)); (19, (1, 4))] : seq (nat * (nat * nat))
Definition pairt p := delta (p.1 + p.2) + p.2.
n:nat

pairt (tpair n) = n
n:nat

pairt (tpair n) = n
n:nat

Δ(∇n) + tmod n = n
by rewrite /tmod addnC subnK // delta_root_le. Qed.
p:(nat * nat)%type

tpair (pairt p) = p
p:(nat * nat)%type

tpair (pairt p) = p
a, b:nat

tpair (pairt (a, b)) = (a, b)
a, b:nat

(∇(Δ(a + b) + b) - (Δ(a + b) + b - Δ(∇(Δ(a + b) + b))), Δ(a + b) + b - Δ(∇(Δ(a + b) + b))) = (a, b)
a, b:nat

∇(Δ(a + b) + b) = a + b
a, b:nat
(a + b - (Δ(a + b) + b - Δ(a + b)), Δ(a + b) + b - Δ(a + b)) = (a, b)
a, b:nat

∇(Δ(a + b) + b) == a + b
a, b:nat
(a + b - (Δ(a + b) + b - Δ(a + b)), Δ(a + b) + b - Δ(a + b)) = (a, b)
a, b:nat

Δ(a + b) + b < Δ(a + b) + (a + b).+1
a, b:nat
(a + b - (Δ(a + b) + b - Δ(a + b)), Δ(a + b) + b - Δ(a + b)) = (a, b)
a, b:nat

(a + b - (Δ(a + b) + b - Δ(a + b)), Δ(a + b) + b - Δ(a + b)) = (a, b)
by rewrite [delta _ + _]addnC !addnK. Qed.