| # ns1 = m + 1, # buf1 = ENCODED_NAT_SIZE, # buf0 = # ns * ENCODED_NAT_SIZE, # buf2 = ENCODED_NAT_SIZE, # buf = m * ENCODED_NAT_SIZE, buf0 + buf1 = buf2 + buf, is-encoded(n, buf1), is-encoded(ns1 -- n0, buf), is-encoded(n0, buf2), n0 ∈ ns1, ∃ n, buf2, buf1. n ∈ ns ∧ buf0 = buf2 + buf1 ∧ is-encoded(n, buf2) ∧ is-encoded(ns -- n, buf1), ∀ 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 ⊦ ns = ∅, ns1 = ∅, ns1 = ns ++ n, n ∈ ns |
# buf3 = (# ns - 1) * ENCODED_NAT_SIZE, # ns1 = m + 1, # buf1 = ENCODED_NAT_SIZE, # buf2 = ENCODED_NAT_SIZE, # ns * ENCODED_NAT_SIZE = m * ENCODED_NAT_SIZE, ENCODED_NAT_SIZE + # buf3 = m * ENCODED_NAT_SIZE, is-encoded(n, buf1), is-encoded(ns1 -- n1, buf3 + buf1), is-encoded(n1, buf2), is-encoded(ns -- n1, buf3), n1 ∈ ns, n1 ∈ 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 ⊦ # ns = 0, ns = ∅, ns1 = ∅, ns1 = ns ++ n, n ∈ ns
Used simplifier rules: is-encoded-size: ⊦ is-encoded(ns, buf) → # buf = # ns * ENCODED_NAT_SIZE;%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic% ⊦ n + 0 = n; (s)% ⊦ n ≤ m → m + n0 - n = (m - n) + n0; (s)%c: ⊦ m + n = n + m; from specification nat-basic% ⊦ n ∈ ns → #(ns -- n) = # ns - 1; (s)%size-zero-01: ⊦ ns ≠ ∅ → # ns ≠ 0; (forward) from specification set-basic[nat-set]%ne-01: ⊦ n ∈ ns → ns ≠ ∅; (forward) from specification set-basic[nat-set]%⊦ # buf = # buf0 → (buf + buf1 = buf0 + buf2 ↔ buf = buf0 ∧ buf1 = buf2); (ws)%⊦ buf0 + buf1 = buf2 + buf3 ∧ is-encoded(n, buf0) → (is-encoded(n0, buf2) ↔ # buf0 = # buf2 ∧ n = n0); (ws)%append-a: ⊦ (buf + buf0) + buf1 = buf + buf0 + buf1; from specification array-splice[buffer]% ⊦ #(buf + buf0) = # buf + # buf0; (s)