def
definition
Pattern
show as:
view math explainer →
open explainer
Generate a durable explainer page for this declaration.
open lean source
IndisputableMonolith.Streams on GitHub at line 14.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
-
lambda_PBM_approx -
ionization_monotone_within_period -
entries_distinct -
anomaly_dissolved -
is_recognition_loop -
recognition_loop_has_surjection -
impulse_after_octaves_mono_decay -
octavePeriod_eq_eight -
octavePeriod_is_minimal_cover -
VolcanicForcingAsJCostImpulseCert -
utm_exists -
ledgerVecParity -
parityPattern -
parity -
attempt5 -
blockSumAligned8_periodic -
Cylinder -
firstBlockSum_eq_Z_on_cylinder -
observeAvg8_periodic_eq_Z -
Pattern -
subBlockSum8_periodic_eq_Z -
Z_of_window -
eight_tick_neutral_implies_exact -
isNeutralWindow -
eight_tick_minimal -
C2_scope -
C3_scope -
card_pattern -
CompleteCover -
cover_exact_pow -
eight_tick_min -
instFintypePattern -
min_ticks_cover -
no_surj_small -
Pattern -
T7_nyquist_obstruction -
T7_threshold_bijection -
binaryReflectedGray -
natToGray -
GrayCodeFacts
formal source
11def Stream := Nat → Bool
12
13/-- A finite window/pattern of length `n`. -/
14def Pattern (n : Nat) := Fin n → Bool
15
16/-- Integer functional `Z` counting ones in a finite window. -/
17def Z_of_window {n : Nat} (w : Pattern n) : Nat :=
18 ∑ i : Fin n, (if w i then 1 else 0)
19
20lemma Z_of_window_nonneg {n : Nat} (w : Pattern n) : 0 ≤ Z_of_window w := by
21 unfold Z_of_window
22 apply Finset.sum_nonneg
23 intro i _
24 split <;> decide
25
26@[simp] lemma Z_of_window_zero (w : Pattern 0) : Z_of_window w = 0 := by
27 simp [Z_of_window]
28
29/-- The cylinder set of streams whose first `n` bits coincide with the window `w`. -/
30def Cylinder {n : Nat} (w : Pattern n) : Set Stream :=
31 { s | ∀ i : Fin n, s i.val = w i }
32
33@[simp] lemma mem_Cylinder_zero (w : Pattern 0) (s : Stream) : s ∈ Cylinder w := by
34 intro i; exact (Fin.elim0 i)
35
36@[simp] lemma Cylinder_zero (w : Pattern 0) : Cylinder w = Set.univ := by
37 ext s; constructor
38 · intro _; exact Set.mem_univ _
39 · intro _; exact (mem_Cylinder_zero w s)
40
41/-- Periodic extension of an 8‑bit window. -/
42def extendPeriodic8 (w : Pattern 8) : Stream := fun t =>
43 let h8 : 0 < 8 := by decide
44 let i : Fin 8 := ⟨t % 8, Nat.mod_lt _ h8⟩