Exact re-encoding of arbitrary valid Pauli payloads #
The parser's width and count checks make every retained row canonical. For the implemented Shoup field, decoding and re-encoding therefore recovers every accepted raw payload, not only payloads constructed from a semantic answer.
theorem
MIPRE.QLD.PauliAnswerProgram.fieldRows_roundtrip
{k n : ℕ}
(E : SAT.BinField k)
(hE : ∀ (bs : Cost.BitStr), List.length bs = k → E.toBits (E.ofBits bs) = bs)
(rows : List Cost.BitStr)
(hn : rows.length = n)
(hw : ∀ row ∈ rows, List.length row = k)
:
theorem
MIPRE.QLD.PauliAnswerProgram.answerRows_decodeRows
{k m d : ℕ}
(E : SAT.BinField k)
(hE : ∀ (bs : Cost.BitStr), List.length bs = k → E.toBits (E.ofBits bs) = bs)
(T : Ty)
(rows : List Cost.BitStr)
(hn : rows.length = count T m d)
(hw : ∀ row ∈ rows, List.length row = width T k)
:
Exact-width rows are recovered after semantic answer decoding.
theorem
MIPRE.QLD.PauliAnswerProgram.parser_rows_spec
(T : Ty)
(m k d : ℕ)
(bs : Cost.BitStr)
(h : (parser.toFun (T, Cost.unary m, Cost.unary k, Cost.unary d, bs)).1 = true)
:
A successful parser returns the exact count, exact row widths and the original bits.
theorem
MIPRE.QLD.PauliAnswerProgram.decodeBits_format
{k m d : ℕ}
(E : SAT.BinField k)
(q : Question E.carrier m)
(bs : Cost.BitStr)
:
Decoding an answer always has the constructor prescribed by its actual question.
theorem
MIPRE.QLD.PauliAnswerProgram.answerBits_decodeBits
(k : ℕ)
(hk : 1 ≤ k)
(m d : ℕ)
(T : Ty)
(bs : Cost.BitStr)
(h : (parser.toFun (T, Cost.unary m, Cost.unary k, Cost.unary d, bs)).1 = true)
:
Every accepted raw payload for the implemented field re-encodes exactly.