[Imprint][Data Privacy Statement][E-Mail]

Back to main index. View the specification. View theorem base summary, View theorem base listing, the used properties by spec, the dependency list, the symbol table,

Specification encoding
generic specification
   

   
parameter
   elem

   using buffer, error-class
target
   
   
   functions  encoding-size : elem → nat;
   predicates  is-encoded : elem × buffer;
               is-garbage : buffer;
   procedures encode# elem × nat : buffer × nat : error  nondeterministic;
              decode# nat × buffer : elem × nat : error  nondeterministic;
   
   
   

   

   axioms is-encoded-size :  ⊦ is-encoded(a, buf) → # buf = encoding-size(a);
          is-encoded-unique-size :  ⊦ is-encoded(a, buf) ∧ n ≤ # buf → (is-encoded(b, subarray(buf, 0, n)) ↔ b = a ∧ n = # buf);
          used for: s, ls;
          is-garbage :  ⊦ is-garbage(buf) ↔ (∀ a. ¬ is-encoded(a, buf));
          encode-contract
          : n + encoding-size(a) ≤ # buf, buf0 = buf
            ⊦ ⟪encode#(a, n; buf, n0; err)⟫ 
                 (  (err = ESUCCESS ∨ ⌊err⌋ ) ∧ # buf = # buf0 ∧ subarray(buf, 0, n) = subarray(buf0, 0, n)
                  ∧   subarray(buf, n + encoding-size(a), # buf - n + encoding-size(a))
                    = subarray(buf0, n + encoding-size(a), # buf - n + encoding-size(a))
                  ∧ (err = ESUCCESS → is-encoded(a, subarray(buf, n, encoding-size(a))) ∧ n0 = encoding-size(a)));
          decode-contract
          : ⊦ ⟪decode#(n, buf; a, n0; err)⟫ 
                 ((err = ESUCCESS ∨ ⌊err⌋ ) ∧ (err = ESUCCESS → is-encoded(a, subarray(buf, n, n0)) ∧ n + n0 ≤ # buf ∧ n0 = encoding-size(a)));

   

   
end generic specification