pith. machine review for the scientific record. sign in
theorem proved term proof high

pattern_to_nat_bound

show as:
view Lean formalization →

The theorem establishes that any d-bit pattern, when summed as powers of two for its set bits, yields an integer strictly less than 2^d. Discrete mathematicians and computer scientists formalizing Gray code conversions would cite this bound to guarantee pattern values remain in the representable range. The proof is a one-line wrapper that applies the GrayCodeFacts hypothesis envelope.

claimFor every natural number $d$ and every bit pattern $p$ of length $d$, the integer value obtained by summing $2^k$ over positions $k$ where the $k$-th bit of $p$ is set satisfies $p < 2^d$.

background

The module Patterns.GrayCodeAxioms declares classical Gray code properties as axioms pending full bitwise formalization. A Pattern d denotes a bit vector of length d, i.e., a function from Fin d to Bool whose support determines which powers of two are included in the sum. The local theoretical setting stresses that all such properties possess multiple published proofs in the discrete mathematics literature, with references to Savage (1997) and Knuth (2011).

proof idea

The proof is a one-line wrapper that applies GrayCodeFacts.pattern_to_nat_bound. This directly invokes the hypothesis envelope class declared earlier in the same module, which collects the classical Gray code axioms.

why it matters in Recognition Science

The result supplies the numerical bound required by the GrayCodeFacts class, which is the immediate downstream consumer. It completes the elementary combinatorics step inside the Patterns module and supports axiomatic treatment of bit patterns that appear in Recognition Science encodings. The declaration aligns with the framework's reliance on discrete combinatorial objects that interface with the phi-ladder and forcing chain without introducing new hypotheses.

scope and limits

Lean usage

example (d : ℕ) (p : Pattern d) : (∑ k : Fin d, if p k then 2^(k.val) else 0) < 2^d := pattern_to_nat_bound d p

formal statement (Lean)

 127theorem pattern_to_nat_bound :
 128  ∀ (d : ℕ) (p : Pattern d),
 129    (∑ k : Fin d, if p k then 2^(k.val) else 0) < 2^d :=

proof body

Term-mode proof.

 130  GrayCodeFacts.pattern_to_nat_bound
 131
 132/-- **Classical Result**: Consecutive Gray codes differ in one bit.
 133
 134For any n < 2^d - 1, gray(n) and gray(n+1) differ in exactly one bit position.
 135
 136**Proof**:
 137- gray(n) XOR gray(n+1) = [n XOR (n>>1)] XOR [(n+1) XOR ((n+1)>>1)]
 138- This simplifies to a single power of 2 (bit at position of least significant 0 in n)
 139
 140**References**:
 141- Savage (1997), Theorem 2.1
 142- Knuth (2011), Theorem 7.2.1.1.A
 143
 144**Status**: Defining property of Gray codes
 145-/

used by (1)

From the project-wide theorem graph. These declarations reference this one in their body.

depends on (20)

Lean names referenced from this declaration's body.