| # buf1 = ENCODED_NAT_SIZE, # buf0 = # ns * ENCODED_NAT_SIZE, is-encoded(n, buf1), ∃ n, buf2, buf1. n ∈ ns ∧ buf0 = buf2 + buf1 ∧ is-encoded(n, buf2) ∧ is-encoded(ns -- n, buf1), ∀ ns0, buf0, ns2, buf1, n0. # ns0 < #(ns ++ n) → # buf0 = # ns2 * ENCODED_NAT_SIZE ∧ # buf1 = ENCODED_NAT_SIZE ∧ is-encoded(n0, buf1) ∧ is-encoded(ns2, buf0) → (is-encoded(ns0, buf0 + buf1) ↔ ns0 = ns2 ++ n0) ∨ n0 ∈ ns2 ⊦ ns = ∅, n ∈ ns, ∃ n0, buf, buf2. (n0 = n ∨ n0 ∈ ns) ∧ buf0 + buf1 = buf + buf2 ∧ is-encoded(n0, buf) ∧ is-encoded((ns ++ n) -- n0, buf2) |
# buf1 = ENCODED_NAT_SIZE, # buf2 = ENCODED_NAT_SIZE, # buf = (# ns - 1) * ENCODED_NAT_SIZE, ENCODED_NAT_SIZE + # buf = # ns * ENCODED_NAT_SIZE, is-encoded(n, buf1), is-encoded(ns -- n0, buf), is-encoded(n0, buf2), n0 ∈ ns, ∀ ns0, buf0, ns2, buf1, n0. # ns0 < #(ns ++ n) → # buf0 = # ns2 * ENCODED_NAT_SIZE ∧ # buf1 = ENCODED_NAT_SIZE ∧ is-encoded(n0, buf1) ∧ is-encoded(ns2, buf0) → (is-encoded(ns0, buf0 + buf1) ↔ ns0 = ns2 ++ n0) ∨ n0 ∈ ns2 ⊦ # ns = 0, ns = ∅, n ∈ ns, ∃ n0, buf4, buf3. (n0 = n ∨ n0 ∈ ns) ∧ (buf2 + buf) + buf1 = buf4 + buf3 ∧ is-encoded(n0, buf4) ∧ is-encoded((ns ++ n) -- n0, buf3)
Used simplifier rules: is-encoded-size: ⊦ is-encoded(ns, buf) → # buf = # ns * ENCODED_NAT_SIZE;% ⊦ 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]%is-encoded-size: ⊦ is-encoded(n, buf) → # buf = ENCODED_NAT_SIZE; (forward) from specification encoding-fixed-size[encoding-nat]%append-a: ⊦ (buf + buf0) + buf1 = buf + buf0 + buf1; from specification array-splice[buffer]% ⊦ #(buf + buf0) = # buf + # buf0; (s)