| # ns1 = 2 + m0, # buf3 = m0 * ENCODED_NAT_SIZE, # ns = m0 + 1, # buf2 = ENCODED_NAT_SIZE, # buf1 = ENCODED_NAT_SIZE, is-encoded(ns -- n1, buf3), is-encoded(n1, buf2), is-encoded(ns1 -- n1, buf3 + buf1), is-encoded(n, buf1), n1 ∈ ns1, n1 ∈ ns, (is-encoded(ns1 -- n1, buf3 + buf1) ↔ ns1 -- n1 = (ns -- n1) ++ n) ∨ n ∈ ns -- n1, ∀ ns0, buf0, ns, buf1, n. # ns0 < (m0 + 1) + 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 = ns ++ n, ns1 = ∅, n ∈ ns |
# buf1 = ENCODED_NAT_SIZE, # buf2 = ENCODED_NAT_SIZE, # ns = m0 + 1, # buf3 = m0 * ENCODED_NAT_SIZE, # ns1 = 2 + m0, m0 + 1 = #((ns -- n1) ++ n), ns1 -- n1 = (ns -- n1) ++ n, is-encoded(n, buf1), is-encoded((ns -- n1) ++ n, buf3 + buf1), is-encoded(n1, buf2), is-encoded(ns -- n1, buf3), n1 ∈ ns, n1 ∈ ns1, n ∈ ns1, ∀ ns0, buf0, ns, buf1, n. # ns0 < (m0 + 1) + 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
Used simplifier rules: is-encoded-unique: ⊦ is-encoded(ns0, buf) → (is-encoded(ns1, buf) ↔ ns0 = ns1);%is-encoded-size: ⊦ is-encoded(ns, buf) → # buf = # ns * ENCODED_NAT_SIZE;%c: ⊦ m + n = n + m; from specification nat-basic%a: ⊦ (m + n0) + n1 = m + n0 + n1; from specification nat-basic%mult-c: ⊦ m * n = n * m; from specification nat-mult%mult-a: ⊦ m0 * m * n = (m0 * m) * n; from specification nat-mult% ⊦ ENCODED_NAT_SIZE ≠ 0; (s)% ⊦ m * n + n = m1 * n ↔ m + 1 = m1 ∨ n = 0; (s)%append-a: ⊦ (buf + buf0) + buf1 = buf + buf0 + buf1; from specification array-splice[buffer]% ⊦ #(buf + buf0) = # buf + # buf0; (s)%del-feq: ⊦ ns -- n = ns0 ++ n0 → n ≠ n0 ∧ n0 ∈ ns ∧ ¬ n ∈ ns0; (forward) from specification set-union[nat-set]% ⊦ n ∈ ns -- n0 ↔ n ≠ n0 ∧ n ∈ ns; (s)