| # ns1 = m + 1, # buf = 0, # buf2 = ENCODED_NAT_SIZE, m * ENCODED_NAT_SIZE = 0, is-encoded(n, buf2), is-encoded(ns1 -- n, buf), n ∈ ns1, ∀ ns0, buf0, ns, buf1, n. # ns0 < m + 1 → # buf0 = # ns * ENCODED_NAT_SIZE ∧ # buf1 = ENCODED_NAT_SIZE ∧ is-encoded(n, buf1) ∧ is-encoded(ns, buf0) → (is-encoded(ns0, buf0 + buf1) ↔ ns0 = ns ++ n) ∨ n ∈ ns ⊦ ns1 = ∅ ++ n, ns1 = ∅ |
⊦ ns ≠ ∅ → (is-encoded(ns, buf) ↔ (∃ n, buf0, buf1. n ∈ ns ∧ buf = buf0 + buf1 ∧ is-encoded(n, buf0) ∧ is-encoded(ns -- n, buf1)))
Used simplifier rules: is-encoded-size: ⊦ is-encoded(ns, buf) → # buf = # ns * ENCODED_NAT_SIZE;% ⊦ #(buf + buf0) = # buf + # buf0; (s)%append-a: ⊦ (buf + buf0) + buf1 = buf + buf0 + buf1; from specification array-splice[buffer]% ⊦ m + n = 0 ↔ m = 0 ∧ n = 0; (ws)%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic%c: ⊦ m + n = n + m; from specification nat-basic% ⊦ ns -- n = ∅ ↔ ns = ∅ ∨ ns = ∅ ++ n; (ws)% ⊦ n ∈ ns -- n0 ↔ n ≠ n0 ∧ n ∈ ns; (s)%is-encoded-size: ⊦ is-encoded(n, buf) → # buf = ENCODED_NAT_SIZE; (forward) from specification encoding-fixed-size[encoding-nat]% ⊦ n ∈ ns ∧ n ≠ n0 → #(ns -- n0 -- n) = #(ns -- n0) - 1; (s)% ⊦ n ∈ ns → #(ns -- n) = # ns - 1; (s)% ⊦ n ≤ m → m + n0 - n = (m - n) + n0; (s)% ⊦ n + 0 = n; (s)% ⊦ ENCODED_NAT_SIZE ≠ 0; (s) Used terms: buf, ns1 -- n