Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Arithmetic Meaning of the Signed-Digit Charge

Abstract

The q weights count position charges and successive nonzero-sign changes exactly.

Definition 1.1 (Signed-stream charge with incoming memory).

Formalization. D5/S1/Words/Palindromes/PeriodDoubling/BaseChargeArithmetic.digitStreamCharge (✓ std3).

Source. Repository-derived.

Commentary.

A zero digit contributes nothing and preserves the previous nonzero sign. A nonzero digit contributes 1 + 2 par and an extra unit when its sign differs from a nonzero incoming sign. The parity switches after every digit. This is the position-weight and sign-change part of Q, without its terminal endpoint-parity correction. The Boolean indicators are converted to natural numbers and then embedded in the integers.

Definition 1.2 (Literal last-sign and charge updates).

Formalization. D5/S1/Words/Palindromes/PeriodDoubling/BaseChargeArithmetic.chargeRowCheck (✓ std3).

Source. Repository-derived.

Commentary.

Each base edge flips the position parity, updates each most recent nonzero sign exactly when a nonzero digit is emitted, and gives q the difference of the two literal position-and-sign-change contributions.

Theorem 1.3 (The literal position and sign-change sum).

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

Source. Repository-derived.

Commentary.

Enumerate the digits from natural position p and discard the zeros. The charge is the sum of 1 + 2(i mod 2) over the surviving positions, plus the number of changes between successive surviving signs, plus the change from a nonzero incoming sign to the first surviving sign. An empty nonzero list has zero incoming correction. mod is natural remainder; Option.elim is zero for none and applies the displayed function for some.

Theorem 1.4 (q is the difference of the two stream charges).

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

Source. Repository-derived.

Commentary.

This equality holds for every finite path and either acceptance mode, without requiring its endpoints to be sources or goals. State component 1 is the current position parity; components 16 and 17 are the latest nonzero signs of the two streams. Every table edge updates these memories and carries the difference of the contributions. Path induction then reconstructs the entire charge. Components 10 and 12 of the successor state are the emitted input and output signed digits.

References

  • Truth anchor: D5/S1/Words/Palindromes/PeriodDoubling/BaseChargeArithmetic.base_path_charge_reconstruction
  • Truth anchor: D5/S1/Words/Palindromes/PeriodDoubling/BaseChargeArithmetic.chargeRowCheck
  • Truth anchor: D5/S1/Words/Palindromes/PeriodDoubling/BaseChargeArithmetic.digitStreamCharge
  • Truth anchor: D5/S1/Words/Palindromes/PeriodDoubling/BaseChargeArithmetic.digit_stream_charge_formula
  • Dependency: D5/S1/Words/Palindromes/PeriodDoubling/BaseSignedStreams