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.
(******************************************************************************)
(*                                                                            *)
(*                                  PHI                                       *)
(*                                                                            *)
(*   phi n = \sum_(i < n) 2 ^ troot 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]
From hanoi Require Import triangular. Set Implicit Arguments. Unset Strict Implicit. Unset Printing Implicit Defensive. Definition phi n := foldr (addn \o (fun i => 2 ^ troot i)) 0 (iota 0 n). Notation "'ϕ' n" := (phi n) (format "'ϕ' n", at level 0).
= [:: (0, 0); (1, 1); (2, 3); (3, 5); (4, 9); (5, 13); (6, 17); (7, 25); (8, 33); (9, 41); (10, 49)] : seq (nat * nat)
n:nat

ϕ(n) = \sum_(i < n) 2 ^ ∇i
3
5
ϕ(n) = \sum_(0 <= i < n | predT i) 2 ^ ∇i
5
foldr (addn \o (fun i : nat => 2 ^ ∇i)) 0 (iota 0 n) = foldr (applybig \o (fun i : nat => BigBody i addn (predT i) (2 ^ ∇i))) 0 (index_iota 0 n)
by rewrite /index_iota subn0. Qed.
5
ϕ(n.+1) = ϕ(n) + 2 ^ ∇n
12
by rewrite !phiE big_ord_recr. Qed.
m, n:nat

m <= n -> ϕ(m) <= ϕ(n)
17
6
IH:forall m : nat, m <= n -> ϕ(m) <= ϕ(n)
m:nat

m <= n.+1 -> ϕ(m) <= ϕ(n.+1)
20
ϕ(n) <= ϕ(n.+1)
by rewrite phiS leq_addr. Qed.
5
(0 < ϕ(n)) = (0 < n)
29
by case: n. Qed.
n, p:nat

p <= n.+1 -> ϕ(Δn + p) = 1 + (n + p) * 2 ^ n - 2 ^ n
2e
6
IHn:forall p : nat, p <= n.+1 -> ϕ(Δn + p) = 1 + (n + p) * 2 ^ n - 2 ^ n

forall p : nat, p <= n.+2 -> ϕ(Δn.+1 + p) = 1 + (n.+1 + p) * 2 ^ n.+1 - 2 ^ n.+1
37
ϕ(Δn.+1 + 0) = 1 + (n.+1 + 0) * 2 ^ n.+1 - 2 ^ n.+1
638
p:nat
IHp:p <= n.+2 -> ϕ(Δn.+1 + p) = 1 + (n.+1 + p) * 2 ^ n.+1 - 2 ^ n.+1
pLn:p < n.+2
ϕ(Δn.+1 + p.+1) = 1 + (n.+1 + p.+1) * 2 ^ n.+1 - 2 ^ n.+1
37
2 ^ n <= (n + n.+1) * 2 ^ n
37
1 + ((n + n.+1) * 2 ^ n - 2 ^ n) = 1 + n.+1 * 2 ^ n.+1 - 2 ^ n.+1
3f
37
4b
3e
37
1 + (n + n) * 2 ^ n = 1 + n.+1 * 2 ^ n.+1 - 2 ^ n.+1
3e
37
1 + n * 2 ^ n.+1 = 1 + n.+1 * 2 ^ n.+1 - 2 ^ n.+1
3e
37
2 ^ n.+1 <= n.+1 * 2 ^ n.+1
3e
40
44
40
1 + (n.+1 + p) * 2 ^ n.+1 - 2 ^ n.+1 + 2 ^ ∇(Δn.+1 + p) = 1 + (n.+1 + p.+1) * 2 ^ n.+1 - 2 ^ n.+1
40
1 + (n.+1 + p) * 2 ^ n.+1 - 2 ^ n.+1 + 2 ^ n.+1 = 1 + (n.+1 + p.+1) * 2 ^ n.+1 - 2 ^ n.+1
40
∇(Δn.+1 + p) = n.+1
40
1 + (n.+1 + p) * 2 ^ n.+1 = 1 + (n.+1 + p.+1) * 2 ^ n.+1 - 2 ^ n.+1
40
2 ^ n.+1 <= 1 + (n.+1 + p) * 2 ^ n.+1
67
40
6f
66
40
68
by apply/eqP; rewrite trootE leq_addr [delta _.+2]deltaS ltn_add2l. Qed.
a, n, p, q:nat

0 < n -> a + (n + p) * 2 ^ q - 2 ^ q = a + (n.-1 + p) * 2 ^ q
77
a, p, q, n:nat

a + (n.+1 + p) * 2 ^ q - 2 ^ q = a + (n.+1.-1 + p) * 2 ^ q
80
a + ((n.+1 + p) * 2 ^ q - 2 ^ q) = a + (n.+1.-1 + p) * 2 ^ q
by rewrite [_ + p]addSn mulSn [2 ^ _ + _]addnC addnK. Qed.
79
0 < p -> a + (n + p) * 2 ^ q - 2 ^ q = a + (n + p.-1) * 2 ^ q
88
by move=> H; rewrite ![n + _]addnC phi_simpl. Qed.
5
ϕ(n) = 1 + (∇n + tmod n) * 2 ^ ∇n - 2 ^ ∇n
8d
by rewrite {1}[n]tmodE phi_deltaD // ltnW // ltnS tmod_le. Qed.
5
ϕ(Δn) = 1 + n * 2 ^ n - 2 ^ n
92
by rewrite phi_modE troot_delta tmod_delta addn0. Qed.
5
ϕ(n.+1) = 1 + (∇n + tmod n) * 2 ^ ∇n
97
5
1 + (∇n.+1 + tmod n.+1) * 2 ^ ∇n.+1 - 2 ^ ∇n.+1 = 1 + (∇n + tmod n) * 2 ^ ∇n
5
1 + (∇n + (tmod n).+1) * 2 ^ ∇n - 2 ^ ∇n = 1 + (∇n + tmod n) * 2 ^ ∇n
5
1 + ((∇n).+1 + 0) * 2 ^ (∇n).+1 - 2 ^ (∇n).+1 = 1 + (∇n + ∇n) * 2 ^ ∇n
5
a5
5
1 + ∇n * 2 ^ (∇n).+1 = 1 + (∇n + ∇n) * 2 ^ ∇n
by rewrite expnS addnn -mul2n mulnCA mulnA. Qed.
5
odd ϕ(n) = (0 < n)
ae
5
odd ϕ(n.+2) = (0 < n.+2)
5
odd 1 (+) odd (∇n.+1 + tmod n.+1) && (∇n.+1 == 0) = (0 < n.+2)
n, k:nat

0 < k.+1 -> odd 1 (+) odd (k.+1 + tmod n.+1) && (k.+1 == 0) = (0 < n.+2)
by rewrite andbF. Qed. Definition g n m := (phi m).*2 + (2 ^ (n - m)).-1. Definition gmin n := delta (troot n).-1 + tmod n.
5
1 < n -> 0 < gmin n
c1
5
0 < gmin n.+3
5
0 < Δ(∇n.+3).-1
5
3 <= ∇n.+3 -> 0 < Δ(∇n.+3).-1
5
1 < ∇n.+3 -> 0 < Δ(∇n.+3).-1
n, m:nat

1 < m.+1 -> 0 < Δm
by rewrite ltnS => /delta_le. Qed.
5
n = gmin n + ∇n
dc
5
n.+1 = gmin n.+1 + ∇n.+1
5
Δ(∇n.+1) + tmod n.+1 = Δ(∇n.+1).-1 + tmod n.+1 + ∇n.+1
n, t:nat

Δt.+1 + tmod n.+1 = Δt + tmod n.+1 + t.+1
by rewrite deltaS addnAC. Qed.
5
gmin n <= n
ef
by rewrite {2}[n]gminE leq_addr. Qed.
5
0 < n -> gmin n < n
f4
5
gmin n.+1 < n.+1
5
0 < ∇n.+1
by apply: troot_gt0. Qed.
5
∇(gmin n) = ∇n - (tmod n != ∇n)
101
6
mEt:tmod n = ∇n

∇(gmin n) = ∇n - ~~ true
6
mDt:tmod n != ∇n
∇(gmin n) = ∇n - ~~ false
108
∇(Δ(tmod n).-1 + tmod n) = tmod n
10b
10d
10f
610e
mLt:tmod n < ∇n

10f
11a
∇(gmin n) = (∇n).-1
11a
Δ(∇n).-1 <= Δ(∇n).-1 + tmod n < Δ(∇n).-1.+1
6
mLt:tmod n.+2 < ∇n.+2

Δ(∇n.+2).-1 <= Δ(∇n.+2).-1 + tmod n.+2 < Δ(∇n.+2).-1.+1
ec
mLt:tmod n.+2 < t.+1

Δt <= Δt + tmod n.+2 < Δt.+1
by rewrite leq_addr deltaS ltn_add2l. Qed.
5
tmod (gmin n) = (tmod n != ∇n) * tmod n
131
108
tmod (gmin n) = ~~ true * tmod n
10d
tmod (gmin n) = ~~ false * tmod n
108
tmod (Δ(tmod n).-1 + tmod n) = 0
139
6109
t:nat

tmod (Δt.+1.-1 + t.+1) = 0
139
10d
13b
11a
13b
by rewrite mul1n /tmod {1}/gmin gmin_root mDt subn1 addnC addnK. Qed.
19
m < gmin n -> ∇m < ∇n
14d
1a
mLg:m < gmin n

∇m < ∇n
1a155
nP:0 < n

156
15a
n < m -> false
1a15515b
tnEtm:∇n = ∇m
false
162
164
162
∇n == ∇(gmin n)
1a15515b163
tnEtg:∇n = ∇(gmin n)
164
16e
164
16e
tmod m < tmod (gmin n) -> false
16e
tmod (gmin n) = 0
16e
(tmod n != ∇n) * tmod n = 0
16e
tmod n <> ∇n -> ∇(gmin n) = ∇n - ~~ false -> ~~ false * tmod n = 0
1a15515b16316f
F:∇n = (∇n).-1

~~ false * tmod n = 0
186
(∇n < ∇n) = false -> ~~ false * tmod n = 0
by rewrite -{2}(prednK (troot_gt0 nP)) -F leqnn. Qed.
5
ϕ(n) = g n (gmin n)
18e
5
ϕ(n.+1) = g n.+1 (gmin n.+1)
5
1 + (∇n.+1 + tmod n.+1) * 2 ^ ∇n.+1 - 2 ^ ∇n.+1 = ϕ(Δ(∇n.+1).-1 + tmod n.+1).*2 + (2 ^ (n.+1 - (Δ(∇n.+1).-1 + tmod n.+1))).-1
5
1 + (∇n.+1 + tmod n.+1) * 2 ^ ∇n.+1 - 2 ^ ∇n.+1 = (1 + ((∇n.+1).-1 + tmod n.+1) * 2 ^ (∇n.+1).-1 - 2 ^ (∇n.+1).-1).*2 + (2 ^ (n.+1 - (Δ(∇n.+1).-1 + tmod n.+1))).-1
6
x:=∇n.+1:nat
y:=tmod n.+1:nat

1 + (x + y) * 2 ^ x - 2 ^ x = (1 + (x.-1 + y) * 2 ^ x.-1 - 2 ^ x.-1).*2 + (2 ^ (n.+1 - (Δx.-1 + y))).-1
1a1
1 + (x.-1 + y) * 2 ^ x = (1 + (x.-1 + y) * 2 ^ x.-1 - 2 ^ x.-1).*2 + (2 ^ (n.+1 - (Δx.-1 + y))).-1
1a1
1 + (x.-1 + y) * 2 ^ x = 1 * 2 + (x.-1 + y) * 2 ^ x - 2 ^ x + (2 ^ (n.+1 - (Δx.-1 + y))).-1
1a1
n.+1 = Δx.-1 + x + y
1a1
1 + (x.-1 + y) * 2 ^ x = 1 * 2 + (x.-1 + y) * 2 ^ x - 2 ^ x + (2 ^ (Δx.-1 + x + y - (Δx.-1 + y))).-1
1a1
1b3
1a1
1 + (x.-1 + y) * 2 ^ x = 1 * 2 + (x.-1 + y) * 2 ^ x - 2 ^ x + (2 ^ x).-1
5
1 + ((∇n.+1).-1 + tmod n.+1) * 2 ^ ∇n.+1 = 1 * 2 + ((∇n.+1).-1 + tmod n.+1) * 2 ^ ∇n.+1 - 2 ^ ∇n.+1 + (2 ^ ∇n.+1).-1
5
1 + ((∇n.+3).-1 + tmod n.+3) * 2 ^ ∇n.+3 = 1 * 2 + ((∇n.+3).-1 + tmod n.+3) * 2 ^ ∇n.+3 - 2 ^ ∇n.+3 + (2 ^ ∇n.+3).-1
5
1 + ((∇n.+3).-1 + tmod n.+3) * 2 ^ ∇n.+3 = 1 * 2 + ((∇n.+3).-2 + tmod n.+3) * 2 ^ ∇n.+3 + (2 ^ ∇n.+3).-1
5
(0 + ((∇n.+3).-2.+1 + tmod n.+3) * 2 ^ ∇n.+3).+1 = 1 * 2 + ((∇n.+3).-2.+1.-1 + tmod n.+3) * 2 ^ ∇n.+3 + (2 ^ ∇n.+3).-1
n, u:nat
__:(0 < u.+1) = (0 < 2) || (∇n.+3 == 0)

(0 + ((∇n.+3).-2.+1 + tmod n.+3) * u.+1).+1 = 1 * 2 + ((∇n.+3).-2.+1.-1 + tmod n.+3) * u.+1 + u.+1.-1
by rewrite addSn mulSn add0n -addSn addnAC. Qed.
d8
m.+1 < n -> g n m.+1 + 2 ^ (n - m.+1) = g n m + 2 ^ (∇m).+1
1d3
d9
H:m.+1 < n

(1 + (∇m.+1 + tmod m.+1) * 2 ^ ∇m.+1 - 2 ^ ∇m.+1).*2 + (2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (1 + (∇m + tmod m) * 2 ^ ∇m - 2 ^ ∇m).*2 + (2 ^ (n - m)).-1 + 2 ^ (∇m).+1
1da
(1 + ((∇m.+1).-1 + tmod m.+1) * 2 ^ ∇m.+1).*2 + (2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (1 + (∇m + tmod m) * 2 ^ ∇m - 2 ^ ∇m).*2 + (2 ^ (n - m)).-1 + 2 ^ (∇m).+1
1da
0 < n - m
1da
(1 + ((∇m.+1).-1 + tmod m.+1) * 2 ^ ∇m.+1).*2 + (2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (1 + (∇m + tmod m) * 2 ^ ∇m - 2 ^ ∇m).*2 + (2 ^ (n - m).-1.+1).-1 + 2 ^ (∇m).+1
1da
1e7
1da
(1 + ((∇m.+1).-1 + tmod m.+1) * 2 ^ ∇m.+1).*2 + (2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (1 + (∇m + tmod m) * 2 ^ ∇m - 2 ^ ∇m).*2 + (2 ^ (n - m.+1) + 2 ^ (n - m.+1)).-1 + 2 ^ (∇m).+1
1da
(∇m.+1 == ∇m) && (tmod m.+1 == (tmod m).+1) || [&& ∇m.+1 == (∇m).+1, tmod m.+1 == 0 & tmod m == ∇m] -> (1 + ((∇m.+1).-1 + tmod m.+1) * 2 ^ ∇m.+1).*2 + (2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (1 + (∇m + tmod m) * 2 ^ ∇m - 2 ^ ∇m).*2 + (2 ^ (n - m.+1) + 2 ^ (n - m.+1)).-1 + 2 ^ (∇m).+1
d91db
H1:∇m.+1 = ∇m
H2:tmod m.+1 = (tmod m).+1

1ee
d91db
H1:∇m.+1 = (∇m).+1
H2:tmod m.+1 = 0
H3:tmod m = ∇m
1ee
1f6
(1 + ((∇m).-1 + (tmod m).+1) * 2 ^ ∇m).*2 + (2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (1 + ((∇m).-1 + tmod m) * 2 ^ ∇m).*2 + (2 ^ (n - m.+1) + 2 ^ (n - m.+1)).-1 + 2 ^ (∇m).+1
1f9
1f6
(2 ^ ∇m).*2 + ((2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1)) = (2 ^ (n - m.+1) + 2 ^ (n - m.+1)).-1 + 2 ^ (∇m).+1
1f9
1f6
(2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (2 ^ (n - m.+1) + 2 ^ (n - m.+1)).-1
1f9
1fb
1ee
1fb
(1 + ∇m * 2 ^ (∇m).+1).*2 + (2 ^ (n - m.+1)).-1 + 2 ^ (n - m.+1) = (1 + (∇m).*2 * 2 ^ ∇m - 2 ^ ∇m).*2 + (2 ^ (n - m.+1) + 2 ^ (n - m.+1)).-1 + 2 ^ (∇m).+1
d91db1fc1fd1fe
x:=∇m:nat
y:=n - m.+1:nat

(1 + x * 2 ^ x.+1).*2 + (2 ^ y).-1 + 2 ^ y = (1 + x.*2 * 2 ^ x - 2 ^ x).*2 + (2 ^ y + 2 ^ y).-1 + 2 ^ x.+1
215
2 ^ x.+1 <= (1 + x.*2 * 2 ^ x).*2
215
(1 + x * 2 ^ x.+1).*2 + (2 ^ y).-1 + 2 ^ y = (1 + x.*2 * 2 ^ x).*2 + (2 ^ y + 2 ^ y).-1
215
2 ^ x <= 1 + x.*2 * 2 ^ x
21d
215
21f
215
(2 ^ y).-1 + 2 ^ y = (2 ^ y + 2 ^ y).-1
by case: expn (expn_gt0 2 y). Qed.
d8
m < gmin n -> g n m.+1 <= g n m
22c
1a
mLg:m < gmin n.+1

g n.+1 m.+1 <= g n.+1 m
233
m < n
1a234
mLn:m < n
235
23c
235
1a23423d
mtLm:m.+1 + ∇m <= n

235
23c
m.+1 + ∇m <= n
244
g n.+1 m + 2 ^ (∇m).+1 <= g n.+1 m + 2 ^ (n.+1 - m.+1)
246
23c
248
23c
m.+1 + ∇m <= gmin n.+1 + ∇m
23c
gmin n.+1 + ∇m <= n
23c
256
23c
gmin n.+1 + (∇m).+1 <= n.+1
23c
Δ(∇n.+1).-1 + (∇m).+1 <= Δ(∇n.+1)
23c
0 < ∇n.+1 -> Δ(∇n.+1).-1 + (∇m).+1 <= Δ(∇n.+1)
1a23423d144
E:∇n.+1 = t.+1

Δt + (∇m).+1 <= Δt.+1
269
∇m < ∇n.+1
by apply: gmin_root_lt. Qed.
d8
gmin n <= m -> m.+1 < n -> g n m <= g n m.+1
271
d9
gLm:gmin n <= m
mLn:m.+1 < n

g n m <= g n m.+1
d927927a
mtLm:n <= m.+1 + (∇m).+1

27b
278
n <= m.+1 + (∇m).+1
27f
g n m + 2 ^ (n - m.+1) <= g n m + 2 ^ (∇m).+1
281
278
283
278
∇n <= (∇m).+2
278
∇n <= (∇(gmin n)).+2
278
(∇(gmin n)).+1 < (∇m).+2
278
tmod n <> ∇n -> ∇n <= (∇n - ~~ false).+2
293
278
295
by rewrite !ltnS troot_le. Qed.
d8
m < n -> g n (gmin n) <= g n m
29e
d923d

g n (gmin n) <= g n m
d923d279

2a6
d923d155
2a6
d9279

m - gmin n + gmin n < n -> g n (gmin n) <= g n (m - gmin n + gmin n)
2ab
d9279
k:nat
IH:k + gmin n < n -> g n (gmin n) <= g n (k + gmin n)
H1:k.+1 + gmin n < n

g n (gmin n) <= g n (k.+1 + gmin n)
2ab
2b6
k + gmin n < n
2ab
2ad
2a6
2ad
g n (gmin n) <= g n (gmin n - (gmin n - m))
2ad
0 <= gmin n -> g n (gmin n) <= g n (gmin n - 0)
d923d1552b7
IH:k <= gmin n -> g n (gmin n) <= g n (gmin n - k)
kLm:k < gmin n
g n (gmin n) <= g n (gmin n - k.+1)
2cc
2cf
2cc
g n (gmin n - k) <= g n (gmin n - k.+1)
2cc
g n (gmin n - k.+1).+1 <= g n (gmin n - k.+1)
by rewrite gS_minl // -subSn // subSS leq_subr. Qed. (* This is (2.1) *)
a, b:nat

ϕ(a + b) <= ϕ(a).*2 + (2 ^ b).-1
2dc
2de
ϕ(a + b.+1) <= ϕ(a).*2 + (2 ^ b.+1).-1
2de
g (a + b.+1) (gmin (a + b.+1)) <= ϕ(a).*2 + (2 ^ (a + b.+1 - a)).-1
2de
a < a + b.+1
by rewrite -addSnnS leq_addr. Qed.