A successful parse is canonical
ProvedPvsNP.parseCNF_soundIf a word parses as a formula, encoding that formula returns the original word.
Status: Known mathematics / implementation obligation awaiting formal proof.
import Definitions.Def_PvsNPFrontier
namespace PvsNP
theorem parseCNF_sound (w : Str) (F : CNF) (h : parseCNF w = some F) :
encodeCNF F = w := by sorry
end PvsNPRead-back
What the Lean code literally says, in plain math · gpt-6-astra
For every Boolean word and every finite formula , if the parser described here succeeds on with result , then . The hypothesis is an exact successful parse result, and the conclusion is equality of the entire word, not merely a prefix or a logically equivalent formula. Here , is the set of all finite Boolean lists, including the empty list, and is list length. A formula is a finite list of clauses, each clause a finite list of literals . Under an assignment , the literal is true exactly when , a clause is true exactly when some literal in it is true, and a formula is true exactly when every clause is true. Thus an empty clause is false and an empty formula is true. Write for this Boolean-list encoding of a formula : for each literal , take followed by the little-endian canonical binary digits of (the digits of form the empty list), replace each bit by , and append ; concatenate these literal encodings within each clause and append ; then concatenate the clause encodings in formula order. In particular . The parser works as follows. Its outer recursion starts with fuel , returns the empty formula on an empty remainder even at fuel zero, and otherwise fails at fuel zero; with positive fuel it parses one clause from the current nonempty remainder using clause fuel equal to that remainder’s length plus one, then recurses on the returned suffix with outer fuel reduced by one. Clause parsing fails at fuel zero; with positive fuel it consumes as the end of an empty remaining clause, or parses one literal and recurses on its suffix with clause fuel reduced by one. Literal parsing requires an initial pair for the sign. On the remainder it starts data fuel : zero data fuel fails; with positive data fuel ends the digit sequence, while contributes digit and decreases fuel by one; all other cases fail. The collected digits are interpreted little-endian and accepted only if they equal the canonical binary digits of the resulting natural number. A parsed literal is that sign/index pair together with the suffix after its delimiter; any failed subparse makes the containing parse fail. Success of the outer parse requires consuming the complete input. The supplied body is admitted with sorry; no proof of this assertion is supplied there.