Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Literal Endpoint Charge

Abstract

Accepted q paths have the literal arithmetic charge Q(j) - Q(n).

Definition 1.1 (The nonadjacent digit formula).

Formalization. D5/S1/Words/Palindromes/PeriodDoubling/BaseQArithmetic.tripleSignedDigits (✓ std3).

Source. Repository-derived.

Commentary.

Digits are in increasing order of position: digit i is bit i+1 of 3X minus bit i+1 of X. div and mod are natural integer quotient and remainder. The chosen length is a separate parameter.

Definition 1.2 (Q from positions, sign changes and endpoint parity).

Formalization. D5/S1/Words/Palindromes/PeriodDoubling/BaseQArithmetic.signedDigitCharge (✓ std3).

Source. Repository-derived.

Commentary.

Take X = div(n+1,2) and h = log(2,3X)+1. Enumerate its nonadjacent digits, discard zeros, and sum the weights 1+2(i mod 2), consecutive sign changes, and endpoint parity XOR the negativity of the first surviving sign. The last indicator is zero when no digit survives. Option.elim returns the displayed default for none and applies its function for some.

Definition 1.3 (Endpoint and first-sign memory checker).

Formalization. D5/S1/Words/Palindromes/PeriodDoubling/BaseQArithmetic.memoryRowCheck (✓ std3).

Source. Repository-derived.

Commentary.

Every outgoing edge must preserve the two endpoint parities and update both first-nonzero-sign memories only while their incoming memory is zero. This Boolean checker is reused by the charge identification and by the lowest-position arithmetic interpretation.

Theorem 1.4 (Exact charge of every accepting path).

Proof. Machine-checked in Lean as D5/S1/Words/Palindromes/PeriodDoubling/BaseQArithmetic.base_path_Q_semantics (✓ std3). ∎

Source. Repository-derived.

Commentary.

For an accepting charge-mode path whose source parities and binary folds encode n and j, the sum of q edge charges plus the terminal phase correction is Q(j)-Q(n). Component 2 or 3 of the source is the endpoint parity; the last two components of an edge label are bits of the integer quotients div(n,2) and div(j,2). The proof checks all sign-memory transitions and identifies the padded output streams with the unique nonadjacent expansions of the rounded halves. The dummy initial zero contributes no weight.

References