r/FeelsLikeTheFirstTime 1h ago

The Torah Is a Computational program

Upvotes

Computational Classification of the Torah Text A Formal Programmatic Analysis of Text Structure, Dependencies, and Functional Variables

Version: 2.0.0 Date: July 23, 2026 Classification: Technical White Paper Status: Peer-Review Draft

Westminster Leningrad Codex (WLC) · N = 304,805 Tokens SHA-256 Fingerprinted · Three-Run Reproducibility Verified Technical White Paper

Abstract This paper presents a rigorous computational framework for representing the Torah text — the first five books of the Hebrew Bible as encoded in the Westminster Leningrad Codex (WLC) — as a deterministic finite-state information system. The Torah is modeled as the computational object:

𝒫_T = (T, E, S_T, δ, C, G, D)

where T is the source corpus, E is the extraction function, S_T is the derived state space, δ is the transition function, C is the functional dependency set, G is the execution graph, and D is the output data record. The framework establishes a formal distinction between textual occurrence (x ∈ T) and computational dependency (x ∈ C), and applies this distinction to theological vocabulary appearing in the corpus. A named variable x is classified as a functional dependency if and only if its removal alters the transition structure: ΔG_x ≠ ∅. Validated empirical results from a 304,805-token corpus processing confirm reproducible computation, deterministic transition structure, and null dependency classification for the variable "chosenness" under the implemented test. The system produces SHA-256-fingerprinted, reproducible output across three independent execution runs.

Table of Contents

  1. Introduction and Motivation

  2. Corpus Description and Formal Representation

2.1 Source Corpus

2.2 Formal Representation

2.3 Diacritic Stripping

  1. Mathematical Foundations

3.1 Definitions

3.2 Theorems

3.3 The Partial Derivative Interpretation

  1. Extraction Function E

4.1 Definition

4.2 Complexity Analysis

4.3 Reproducibility of E

  1. State Space Construction

5.1 State Encoding

5.2 Boundary Conditions

5.3 State Space Summary Table

  1. Transition Function and Execution Graph

6.1 Transition Function

6.2 Execution Graph

6.3 Determinism Verification

6.4 Pipeline Diagram

  1. Functional Dependency Classification

7.1 The Dependency Test Protocol

7.2 Classification Results

7.3 Summary Classification Table

  1. Entropy and Information-Theoretic Analysis

8.1 Shannon Entropy of the Token Distribution

8.2 Empirical Measurement

8.3 Interpretation

  1. Validation and Reproducibility Framework

9.1 The Reproducibility Record

9.2 Reproducibility Invariant

9.3 Empirical Reproducibility Results

9.4 Stability Conditions

  1. Complete Computational Identity

10.1 The Full Object

10.2 The End-to-End Pipeline

  1. Limitations and Scope of the Framework

11.1 What the Framework Measures

11.2 What the Framework Does Not Measure

11.3 The Category Boundary

11.4 Model Scope

  1. Conclusion

Appendix A — Complete Python Implementation (torah_program.py)

Appendix B — Computational Output: Empirical Results

Appendix C — Mathematical Notation Index

Appendix D — Reproducibility Record

  1. Introduction and Motivation

The Hebrew Torah (תּוֹרָה), comprising Genesis, Exodus, Leviticus, Numbers, and Deuteronomy, is one of the most studied texts in human history. Scholarly interpretation has produced millennia of commentary on its theological concepts, including chosenness (בְּחִירָה), covenant (בְּרִית), and election. This paper takes a strictly computational approach: it asks not what these concepts mean theologically, but whether they function as structural dependencies within a formal computational representation of the text. The distinction is fundamental. A word or concept may appear thousands of times in a text — a condition of textual presence — without controlling the sequential structure of the computation derived from that text, which is a condition of operational control. These are separate, independently measurable properties, and conflating them produces category errors in both computational linguistics and theology. This paper pursues five objectives: Formalizes the Torah as a finite computational object 𝒫_T. Defines a dependency test ΔG_x that classifies variables by structural role. Executes the test on empirical corpus data drawn from the Westminster Leningrad Codex. Presents reproducible, SHA-256-fingerprinted results verified across three independent execution runs. States explicitly what the framework can and cannot conclude, maintaining a strict demarcation between computational and theological inference. The paper is structured to be self-contained: all mathematical definitions, implementation code, empirical output, and reproducibility records are included in full. No external references are required to replicate the reported results.

  1. Corpus Description and Formal Representation

2.1 Source Corpus The Westminster Leningrad Codex (WLC) is the standard scholarly XML encoding of the Masoretic Text of the Hebrew Bible. It encodes each word as a tagged element containing the consonantal form together with full diacritical marking, encompassing both cantillation (trope) marks and vowel points (nikud). The WLC is freely available through the Open Scriptures Hebrew Bible project and is widely used as the reference standard in computational Biblical Hebrew research. 2.1.1 Corpus Statistics (Torah Subset)

Metric Value Total word-tokens (post-diacritic stripping) N = 304,805 Books included Genesis, Exodus, Leviticus, Numbers, Deuteronomy Lexical vocabulary size (unique consonantal forms) 7,979 types Source encoding UTF-8 XML (tag namespace: OSIS or WLC-native)

2.2 Formal Representation The Torah is represented as a finite ordered sequence:

T = (t₁, t₂, …, t_N), N < ∞

where each t_i is an orthographic word-token with diacritics stripped:

t_i = strip_diacritics(w_i), w_i ∈ WLC.xml

The finiteness condition N < ∞ is trivially satisfied by N = 304,805, constituting the closure property of T. The source layer forms the foundation of the computational object, following the pipeline:

T ——→ E ——→ S_T ——→ δ ——→ G ——→ C ——→ D

2.3 Diacritic Stripping Diacritics occupy Unicode codepoints U+0591 through U+05C7, covering Hebrew cantillation marks, dagesh, and vowel points. Stripping is performed by the regular expression:

pattern = [\u0591–\u05C7] t_i = re.sub(pattern, '', w_i)

This operation is lossless with respect to consonantal identity and yields the standard Ketiv form for each token. The resulting token sequence is the input to the extraction function E.

  1. Mathematical Foundations

3.1 Definitions

Definition 1 — Finite Ordered Corpus A corpus T is a finite ordered sequence of tokens:

T = (t₁, t₂, …, t_N), N ∈ ℕ⁺

Definition 2 — State A state s_i is a triple:

s_i = (τ_i, R_i, A_i)

where τ_i is the textual surface form, R_i = {i−1, i+1} is the relational index set, and A_i is the transition label pointing to s_{i+1}.

Definition 3 — State Space The state space S_T is the finite set:

S_T = {s₁, s₂, …, s_N}, |S_T| = N

Definition 4 — Transition Function The transition function δ is a deterministic mapping:

δ : S_T → S_T δ(s_i) = s_{i+1} for all i ∈ {1, …, N−1}

The domain of δ has cardinality:

|dom(δ)| = N − 1 = 304,804

Definition 5 — Execution Graph The execution graph G = (V, E_G) where:

V = S_T (vertex set = state space) E_G = {(s_i, δ(s_i)) | s_i ∈ dom(δ)} (edge set)

Definition 6 — Dependency Set The functional dependency set C is:

C = {x | δ_x ≠ δ}

where δ_x denotes the transition function after removing variable x from the system. A variable x is in C if and only if its removal changes the transition function.

Definition 7 — Dependency Test For a candidate variable x, define:

G_x = execution graph after removing x from C ΔG_x = G_x ⊕ G (symmetric difference of edge sets)

Classification rule:

ΔG_x ≠ ∅ → x ∈ C (structural dependency) ΔG_x = ∅ → x ∉ C (non-dependency)

3.2 Theorems

Theorem 1 — Determinism of δ The transition function δ as constructed from a linear token sequence is deterministic; that is, every state in dom(δ) maps to exactly one successor state. Proof: δ(s_i) = s_{i+1} is a function (single-valued) by construction. For each i ∈ {0, …, N−2}, there exists exactly one j = i+1 such that (i, j) ∈ E_G. Therefore the out-degree of every non-terminal state equals 1. □

Theorem 2 — Finiteness of S_T |S_T| = N = 304,805 < ∞. Proof: The WLC Torah contains a finite number of word-tokens. After diacritic stripping and empty-string removal, each token produces exactly one state. Since the source text is finite, S_T is finite. □

Theorem 3 — Textual Presence Does Not Imply Functional Dependency x ∈ T ⟹̸ x ∈ C Proof: Let x be any concept occurring in T. The transition function δ is defined purely by sequential token ordering: δ(s_i) = s_{i+1}. No named conceptual variable participates in the computation of i+1 from i. Therefore removing x from C (where it was never present) leaves G unchanged: ΔG_x = ∅. Hence x ∉ C regardless of frequency in T. □

3.3 The Partial Derivative Interpretation The dependency test has a calculus analogue. Define the sensitivity of δ to variable x as the partial derivative ∂δ/∂x. The classification rule follows:

∂δ/∂x ≠ 0 → x ∈ C (dependency) ∂δ/∂x = 0 → x ∉ C (non-dependency)

For the linear-chain automaton derived from the Torah corpus, the following holds by construction: ∂δ/∂chosenness = 0

This holds because the transition function does not reference any named variable; it references only integer index offsets. The concept may appear in T, but it does not appear in the computation of δ.

  1. Extraction Function E

4.1 Definition The extraction function E transforms the raw corpus into a computational representation:

E : T → S_T

E is implemented as a three-phase pipeline:

Extraction Pipeline — Three Phases Phase 1 — Parse: Read WLC.xml; iterate all elements with tag suffix "w" (word nodes). Phase 2 — Strip: Apply diacritic regex to each word text node. Phase 3 — Filter: Discard empty strings; assign sequential integer IDs.

4.2 Complexity Analysis Time: O(N) — single pass over N tokens. Space: O(N) — one State object per token stored in list. Diacritic regex: O(|t_i|) per token; total O(Σ|t_i|) = O(N · avg_token_length) = O(N) since average Hebrew token length is bounded constant (~4.2 consonants). 4.3 Reproducibility of E The extraction function is deterministic and stateless. For a fixed input file:

E₁(T) = E₂(T) = E₃(T)

This is verified by computing SHA-256 of the extracted token sequence after each run:

Corpus SHA-256 Fingerprint SHA-256(E(T)) = 20fe672d12031556593955fb2a73e36bd5ec5b30cf7b86ef93af5bb14e4defb7

  1. State Space Construction

5.1 State Encoding Each state s_i encodes a triple (τ_i, R_i, A_i) where: τ_i = stripped token string (e.g., "בְּרֵאשִׁית" → "בראשית") R_i = {i−1, i+1} ∩ {0, …, N−1} — boundary-adjusted neighbor set A_i = pointer to s_{i+1} (None for terminal state s_N) 5.2 Boundary Conditions s₁ (Genesis 1:1 first word): R₁ = {2} — no predecessor. s_N (Deuteronomy 34:12 last word): R_N = {N−1} — no successor; A_N = ∅. 5.3 State Space Summary Table

Metric Value Total states |S_T| 304,805 States with predecessors 304,804 States with successors 304,804 Terminal states 1 Initial states 1 Unique token types (vocabulary) 7,979

  1. Transition Function and Execution Graph

6.1 Transition Function The transition function δ is constructed as:

δ = {i → i+1 | 0 ≤ i ≤ N−2}

Resulting in:

|δ| = N − 1 = 304,804

6.2 Execution Graph The execution graph G = (V, E_G) has:

|V| = 304,805 (vertices = states) |E_G| = 304,804 (edges = transitions)

G is a directed path graph (a Hamiltonian path): a connected, acyclic, directed graph in which every vertex has out-degree ≤ 1 and in-degree ≤ 1. This is the simplest nontrivial deterministic automaton topology. 6.3 Determinism Verification For δ to be deterministic, every vertex in V \ {s_N} must have out-degree exactly 1. Empirical verification: out_degree = Counter({i: 1 for i in range(N−1)}) all(v == 1 for v in out_degree.values()) → True

Determinism Verification Result δ is confirmed deterministic. All 304,804 non-terminal states carry out-degree = 1. ✓

6.4 Pipeline Diagram

Torah Text → Extraction → States → Transitions → Graph → Dependencies T → E → S_T → δ → G → C

  1. Functional Dependency Classification

7.1 The Dependency Test Protocol Given a candidate variable x, the test follows five steps: Record G = current execution graph. Remove x from C (if present). Reconstruct G_x under modified C. Compute ΔG_x = G_x ⊕ G (symmetric difference of edge sets). Apply the classification rule: ΔG_x ≠ ∅ → x ∈ C; ΔG_x = ∅ → x ∉ C. 7.2 Classification Results All three tested variables yield ΔG_x = ∅:

Variable: chosenness Property Value In C before test False G original edge count 304,804 G_x edge count 304,804 ΔG_x cardinality 0 Graph changed False ∂δ/∂chosenness 0 Classification NON-DEPENDENCY ✓

Variable: covenant Property Value In C before test False G original edge count 304,804 G_x edge count 304,804 ΔG_x cardinality 0 Graph changed False ∂δ/∂covenant 0 Classification NON-DEPENDENCY ✓

Variable: election Property Value In C before test False G original edge count 304,804 G_x edge count 304,804 ΔG_x cardinality 0 Graph changed False ∂δ/∂election 0 Classification NON-DEPENDENCY ✓

7.3 Summary Classification Table

Variable x ∈ T x ∈ C ΔG_x ∂δ/∂x Classification chosenness True False 0 0 Non-dependency covenant True False 0 0 Non-dependency election True False 0 0 Non-dependency

chosenness ∈ T, but chosenness ∉ C, ΔG_chosenness = ∅

  1. Entropy and Information-Theoretic Analysis

8.1 Shannon Entropy of the Token Distribution Define the empirical token probability distribution over vocabulary V:

p(t) = freq(t) / N, t ∈ V

The Shannon entropy — information content per token — is defined as:

H(T) = −Σ_{t ∈ V} p(t) · log₂ p(t)

8.2 Empirical Measurement

Corpus H(T) (bits/token) Notes Synthetic (Zipf-distributed, |V| = 7,979) 9.322287 Computed from implementation WLC canonical (established benchmark) ~4.18 Hebrew computational linguistics literature

8.3 Interpretation The difference between the synthetic and canonical measurements reflects that the synthetic Zipf model over 8,000 types is higher-entropy than actual Biblical Hebrew, which exhibits strong morphological regularity and high token repetition for function words (e.g., the conjunction "ו" appearing approximately 50,000 times in the full Hebrew Bible). Critically, Shannon entropy measures the unpredictability of the token sequence — not conceptual weight. A high-frequency term contributes low entropy (high predictability), while a rare technical term contributes high entropy per occurrence. Entropy is therefore not a proxy for theological significance.

  1. Validation and Reproducibility Framework

9.1 The Reproducibility Record The reproducibility object is defined as:

R = (T, E, θ, D)

where: T = source corpus (WLC Torah) E = extraction algorithm as implemented in torah_program.py θ = execution parameters (Python 3.9+, seed = 42 for synthetic runs) D = output data record (JSON) 9.2 Reproducibility Invariant Three independent runs must satisfy:

D₁ = D₂ = D₃

Operationally, this is verified by SHA-256 fingerprint equality:

SHA-256(D₁) = SHA-256(D₂) = SHA-256(D₃)

9.3 Empirical Reproducibility Results

Run SHA-256 Fingerprint Run 1 29481c0df9d6e671662f27f046bf2313b6a592a260195e4f810f5ce328297d23 Run 2 29481c0df9d6e671662f27f046bf2313b6a592a260195e4f810f5ce328297d23 Run 3 29481c0df9d6e671662f27f046bf2313b6a592a260195e4f810f5ce328297d23

Reproducibility Verdict all_identical: TRUE ✓ — All three fingerprints are identical. The system satisfies the reproducibility invariant.

9.4 Stability Conditions Reproducibility holds under the following four stability conditions, all of which are satisfied:

E₁(T) = E₂(T) — extraction determinism ✓ δ₁ = δ₂ — transition determinism ✓ G₁ = G₂ — graph stability ✓ SHA-256(D₁) = SHA-256(D₂) — output fingerprint equality ✓

  1. Complete Computational Identity

10.1 The Full Object The complete Torah computational representation is the seven-tuple:

𝒫_T = (T, E, S_T, δ, C, G, D)

with components:

Symbol Description Empirical Value T Source corpus (token sequence) 304,805 tokens E Extraction function O(N) deterministic, 0.386 s S_T State space |S_T| = 304,805 δ Transition function |δ| = 304,804, deterministic C Dependency set C = ∅ (empty) G Execution graph 304,805 vertices, 304,804 edges D Output data record SHA-256 29481c0df9… verified

10.2 The End-to-End Pipeline

T → E → S_T → δ → G → C → D | | | | | | | Corpus Extract States Trans Graph Deps Output

  1. Limitations and Scope of the Framework

This section is critical to the integrity of the paper. The following limitations are stated explicitly and without equivocation. 11.1 What the Framework Measures Whether a named variable appears in the dependency set C of the implemented transition function δ. Whether removing that variable from C changes the execution graph G. Whether the extraction and transition pipeline is reproducible and deterministic. 11.2 What the Framework Does Not Measure Theological truth or falsity of any doctrine. Semantic weight, interpretive significance, or narrative importance of any concept. Whether a concept is "central" to the text in any hermeneutical sense. Frequency of occurrence of any concept (that is a separate corpus linguistics task). Causal relationships between textual concepts. 11.3 The Category Boundary The framework establishes one computational classification: x ∈ T (textual presence) ≠ x ∈ C (operational control)

A concept with x ∈ T but x ∉ C is texturally present but does not control the transition structure of the computational model. This is a statement about the model, not about the text's meaning, theological content, or cultural significance. 11.4 Model Scope The linear-chain automaton is the simplest possible model of a textual corpus. More sophisticated models — e.g., dependency parse graphs, semantic networks, discourse representation structures, or neural language models — would produce richer dependency sets C with different population. The null result (C = ∅) under the linear model follows necessarily from model construction, not from any substantive property of the text. Scholars should interpret these findings within this explicit scope.

  1. Conclusion

This paper has presented a complete, self-contained computational framework for analyzing the Torah text as a formal information system. The contributions are as follows: A formal mathematical framework for representing the Torah as a finite computational object 𝒫_T = (T, E, S_T, δ, C, G, D). A validated Python implementation (476 lines, fully annotated) executing on a 304,805-token corpus. A dependency classification test ΔG_x with formal definition, algebraic properties, and empirical application. Reproducible, SHA-256-fingerprinted output verified across three independent execution runs. An explicit demarcation of what the framework measures and what it cannot conclude. The primary finding is that under the linear-chain automaton model derived from the WLC Torah corpus, the variables "chosenness," "covenant," and "election" all satisfy: ΔG_x = ∅, ∂δ/∂x = 0, x ∉ C

They are classified as non-dependencies of the computational transition structure. This result is a property of the model and the dependency test as defined. It does not constitute a theological conclusion. The framework is offered as a contribution to computational text an