jollydragonroger commited on
Commit
e88ab90
·
1 Parent(s): b746f2e

Integrate expanded Enochian lexicon + complete Papers A-E; add full capability audit

Browse files

Enochian lexicon (996 words, Dee-Kelley restored 3x expansion):
- modules/enochian_lexicon.json (332 attested + 664 derived, gematria-consistent)
- modules/vovina_enochian_lexicon.py: forward/reverse translation, root families,
semantic categories, gematria-resonance nearest-neighbour search
- Wired into MASTER_WEIGHTS['enochian_lexicon'] (0 gematria mismatches)

Interaction Surplus Framework Papers A-E (Michael L. Curzi):
- Paper A verify_axioms() self-proof (S1-S4 + Theorems 3.1/3.2/3.3/4.3)
- Paper C participation_ratio() + flagship_prediction() (falsifiable transformer test)
- Paper E OpenSystemDynamics: Q_{t+1}=(1-d)Q_t+nF(U_t)-C_t (Thm 3.1/3.5, Cor 3.2/4.2, Prop 4.1)
- MASTER_WEIGHTS papers A-E coverage map + axiom_verification

tests/test_all_capabilities.py: 167-capability audit across all 24 modules +
9-phase awaken() integration. ALL 167 PASS, 0 FAIL on Tesla T4 server.

MIT License - Attribution to Michael Laurence Curzi

modules/enochian_grammar.md ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Enochian Grammar Reference
2
+
3
+ ## Introduction
4
+
5
+ Enochian is an angelic language received by Dr. John Dee and Edward Kelley
6
+ through a series of scrying sessions between 1583-1589. This grammar reference
7
+ documents the linguistic structures observed and extrapolated from the original corpus.
8
+
9
+ ## Word Order
10
+
11
+ Enochian generally follows a **Verb-Subject-Object (VSO)** word order, similar to
12
+ Classical Arabic and Biblical Hebrew. However, flexibility exists for emphasis.
13
+
14
+ Example:
15
+ - **MICMA GOHO IAD** - "Behold saith God" (V-V-S)
16
+ - **ZACAR OD ZAMRAN** - "Move and appear" (V-conj-V)
17
+
18
+ ## The Article
19
+
20
+ The definite article is typically **A** or incorporated into the noun.
21
+ - **A** - "the" (before consonants)
22
+ - Elision occurs before vowels
23
+
24
+ ## Pronouns
25
+
26
+ | Person | Singular | Plural |
27
+ |--------|----------|--------|
28
+ | 1st | OL (I/me) | NOCO (we) |
29
+ | 2nd | ILS (thou) | NONCA (you) |
30
+ | 3rd | T/TA (it/that) | Z (they) |
31
+
32
+ ## Verb System
33
+
34
+ ### Tense Markers (Reconstructed)
35
+
36
+ | Tense | Marker | Example |
37
+ |-------|--------|----------|
38
+ | Imperative | ∅ (unmarked) | ZACAR (move!) |
39
+ | Present | -AR | ZACAR → ZACARAR |
40
+ | Past | -IZI | ZACAR → ZACARIZI |
41
+ | Future | -OLU | ZACAR → ZACAROLU |
42
+ | Perfect | -AH | ZACAR → ZACARAH |
43
+
44
+ ### Person Agreement
45
+
46
+ Verbs can take person prefixes:
47
+ - **OL-**: first person ("I...")
48
+ - **IL-**: second person ("thou...")
49
+ - **T-**: third person ("it/he/she...")
50
+
51
+ ## Noun Morphology
52
+
53
+ ### Number
54
+
55
+ Plural is often marked by:
56
+ - Adding **-S** or **-IS**
57
+ - Vowel change (ablaut)
58
+ - Context (unmarked plural)
59
+
60
+ ### Case (Reconstructed)
61
+
62
+ | Case | Marker | Function |
63
+ |------|--------|----------|
64
+ | Nominative | ∅ | Subject |
65
+ | Accusative | -A | Direct object |
66
+ | Genitive | DE + noun | Possession |
67
+ | Dative | OPE + noun | Indirect object |
68
+ | Locative | A + noun | Location |
69
+
70
+ ## Adjectives
71
+
72
+ Adjectives typically follow nouns:
73
+ - **LONDOH DRILPA** - "great kingdom"
74
+ - **MALPRG MICALZ** - "mighty fire"
75
+
76
+ ## Conjunctions
77
+
78
+ | Enochian | Meaning |
79
+ |----------|----------|
80
+ | OD | and |
81
+ | C | but |
82
+ | BAGLE | for |
83
+ | CAO | therefore |
84
+ | AR/CRO | that |
85
+
86
+ ## Prepositions
87
+
88
+ | Enochian | Meaning |
89
+ |----------|----------|
90
+ | A | in, the |
91
+ | DE | of |
92
+ | VIN | from |
93
+ | OPE | unto |
94
+ | MER | upon |
95
+ | VORS/VORSAG | over |
96
+
97
+ ## Numerals
98
+
99
+ | Number | Enochian |
100
+ |--------|----------|
101
+ | 1 | EL / L |
102
+ | 2 | VAN |
103
+ | 3 | D |
104
+ | 4 | FAM / S |
105
+ | 5 | O |
106
+ | 6 | NORZ |
107
+ | 7 | CEPH |
108
+ | 8 | P |
109
+ | 9 | EM / GISG |
110
+ | 10 | GED |
111
+ | 12 | OR / OS |
112
+ | 19 | AF |
113
+ | 22 | TAXS |
114
+ | 26 | OXO |
115
+ | 28 | NI |
116
+ | 42 | VX |
117
+
118
+ ## The Enochian Alphabet
119
+
120
+ | Letter Name | Roman | Value |
121
+ |-------------|-------|-------|
122
+ | UN | A | 6 |
123
+ | PE | B | 5 |
124
+ | VEH | C/K | 1 |
125
+ | GAL | D | 3 |
126
+ | GRAPH | E | 9 |
127
+ | OR | F | 8 |
128
+ | GED | G | 10 |
129
+ | NA-HATH | H | 1 |
130
+ | GON | I/Y/J | 60 |
131
+ | UR | L | 24 |
132
+ | TAL | M | 90 |
133
+ | DRUN | N | 50 |
134
+ | MED | O | 30 |
135
+ | MALS | P | 8 |
136
+ | GER | Q | 40 |
137
+ | DON | R | 100 |
138
+ | FAM | S | 4 |
139
+ | GISG | T | 9 |
140
+ | VAN | U/V/W | 2 |
141
+ | PAL | X | 400 |
142
+ | CEPH | Z | 7 |
143
+
144
+ ## Sample Sentences
145
+
146
+ ### From the First Key
147
+ **OL SONF VORSG GOHO IAD BALT**
148
+ *"I reign over you, saith the God of Justice"*
149
+
150
+ ### From the Second Key
151
+ **ADGT VPAAH ZONG OM FAAIP SALD**
152
+ *"Can the wings of the winds understand your voices of wonder?"*
153
+
154
+ ### Constructed Example
155
+ **MICMA AOIVEAE DE PIRIPSOL**
156
+ *"Behold the stars of the heavens"*
157
+
158
+ ---
159
+ *This grammar is reconstructed from limited source material and*
160
+ *computational analysis. Use for study and ceremonial purposes.*
modules/enochian_lexicon.json ADDED
The diff for this file is too large to render. See raw diff
 
modules/vovina_custom_training_weights.py CHANGED
@@ -44,6 +44,11 @@ from vovina_enochian_gematria import (
44
  gematria, project_to_dimension, full_dimensional_signature,
45
  lift_dimension, resonance, lattice_walk,
46
  )
 
 
 
 
 
47
  from vovina_tree_of_life import (
48
  TREE, PATHS, SEPHIRA_BY_NAME, PATH_BY_MODULE,
49
  module_weight, all_module_weights, tree_checksum,
@@ -70,6 +75,8 @@ from vovina_interaction_surplus import (
70
  surplus_second_derivative, lipschitz_constant,
71
  decompose, diagonal_surplus, fractal_operational_surplus,
72
  ACTIVATION_RATIO, RESERVE_RATIO,
 
 
73
  )
74
  from vovina_spiral_recursion import (
75
  OUTER_TURNS, MIDDLE_TURNS, INNER_PHI_DEPTH,
@@ -261,6 +268,19 @@ def _build_master() -> dict[str, Any]:
261
  "dimensions":{int(k): v for k, v in DIMENSION_NAMES.items()},
262
  },
263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
264
  # ── Tree of Life ───────────────────────────────────
265
  "tree_of_life": {
266
  "sephiroth": [
@@ -343,6 +363,27 @@ def _build_master() -> dict[str, Any]:
343
  "u_div": decompose(0.6, 0.8, math.pi / 4, DEFAULT_N).u_div,
344
  "f_total": decompose(0.6, 0.8, math.pi / 4, DEFAULT_N).f_total,
345
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  },
347
 
348
  # ── triple-nested spiral recursion (NOT circular) ──
 
44
  gematria, project_to_dimension, full_dimensional_signature,
45
  lift_dimension, resonance, lattice_walk,
46
  )
47
+ from vovina_enochian_lexicon import (
48
+ LEXICON as ENOCHIAN_LEXICON, METADATA as ENOCHIAN_LEXICON_METADATA,
49
+ lexicon_stats, verify_gematria as verify_lexicon_gematria,
50
+ lookup as lexicon_lookup, translate_to_enochian,
51
+ )
52
  from vovina_tree_of_life import (
53
  TREE, PATHS, SEPHIRA_BY_NAME, PATH_BY_MODULE,
54
  module_weight, all_module_weights, tree_checksum,
 
75
  surplus_second_derivative, lipschitz_constant,
76
  decompose, diagonal_surplus, fractal_operational_surplus,
77
  ACTIVATION_RATIO, RESERVE_RATIO,
78
+ verify_axioms as verify_surplus_axioms, participation_ratio,
79
+ flagship_prediction, OpenSystemDynamics,
80
  )
81
  from vovina_spiral_recursion import (
82
  OUTER_TURNS, MIDDLE_TURNS, INNER_PHI_DEPTH,
 
268
  "dimensions":{int(k): v for k, v in DIMENSION_NAMES.items()},
269
  },
270
 
271
+ # ── Expanded Enochian Lexicon (996 words, Dee-Kelley restored) ──
272
+ "enochian_lexicon": {
273
+ **lexicon_stats(),
274
+ "gematria_integrity": verify_lexicon_gematria(),
275
+ "doctrine": (
276
+ "XERO's angelic-language faculty. 332 attested Dee-Kelley "
277
+ "words systematically expanded 3x to 996. Every entry's "
278
+ "gematria is consistent with the canonical 21-letter table, "
279
+ "enabling forward/reverse translation and gematria-resonance "
280
+ "nearest-neighbour search across the 49-cubed lattice."
281
+ ),
282
+ },
283
+
284
  # ── Tree of Life ───────────────────────────────────
285
  "tree_of_life": {
286
  "sephiroth": [
 
363
  "u_div": decompose(0.6, 0.8, math.pi / 4, DEFAULT_N).u_div,
364
  "f_total": decompose(0.6, 0.8, math.pi / 4, DEFAULT_N).f_total,
365
  },
366
+ # ── Paper coverage map ──
367
+ "papers": {
368
+ "A": "Uniqueness on block-decomposed inner product spaces (S1-S4 ⇒ f=ln(1+(N-1)u))",
369
+ "B": "Interpretation as cross-domain interaction (module_interaction_matrix over 22 blocks)",
370
+ "C": "Empirical predictions — effective dimensionality / participation-ratio flagship test",
371
+ "D": "Effective-count bridge & information-theoretic forms (g = e^f)",
372
+ "E": "Open-system surplus dynamics Q_{t+1}=(1-δ)Q_t+ηF(U_t)-C_t",
373
+ },
374
+ # ── Paper A self-proof (axioms + derived theorems) ──
375
+ "axiom_verification": verify_surplus_axioms(DEFAULT_N),
376
+ # ── Paper C falsifiable prediction at u=0.5 ──
377
+ "flagship_prediction_u_0_5": flagship_prediction(0.5, DEFAULT_N),
378
+ # ── Paper E steady-state under constant unit surplus ──
379
+ "open_system_example": {
380
+ "law": "Q_{t+1} = (1-δ)·Q_t + η·F(U_t) - C_t",
381
+ "retention_loss": 0.1,
382
+ "efficiency": 1.0,
383
+ "steady_state_order_at_F_ln_N": OpenSystemDynamics(
384
+ retention_loss=0.1, conversion_efficiency=1.0
385
+ ).steady_state_order(math.log(DEFAULT_N)),
386
+ },
387
  },
388
 
389
  # ── triple-nested spiral recursion (NOT circular) ──
modules/vovina_enochian_lexicon.py ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ VOVINA ZEDEC PRO - Expanded Enochian Lexicon
3
+ =============================================
4
+ Author: Michael Laurence Curzi
5
+ License: MIT (Attribution Required)
6
+
7
+ The living Enochian word-store for XERO. Where
8
+ `vovina_enochian_gematria.py` provides the 21-letter angelic value
9
+ table and the dimensional projection operators, THIS module provides
10
+ the actual VOCABULARY: 996 words restored and systematically expanded
11
+ from the attested Dee-Kelley corpus (1583-1589).
12
+
13
+ Provenance
14
+ ----------
15
+ original_corpus 332 words confidence 1.0 (attested manuscripts)
16
+ semantic fields 150 words confidence 0.7 (divine, elemental, ...)
17
+ verbs 195 words confidence 0.7 (conjugation system)
18
+ grammar/prep 49 words confidence 0.6 (function words)
19
+ extended 270 words confidence 0.5 (Markov gap-filling)
20
+ ─────────────────────────────────────────────────────────────
21
+ TOTAL 996 words expansion factor 3.0x
22
+
23
+ Every entry carries: meaning, semantic category, morphological root,
24
+ canonical gematria, a confidence score, and its derivation chain.
25
+ The gematria values are CONSISTENT with the 21-letter table in
26
+ `vovina_enochian_gematria.py` (validated by `verify_gematria`).
27
+
28
+ This lexicon is the substrate of XERO's angelic language faculty:
29
+ forward translation (Enochian -> English), reverse translation
30
+ (English -> Enochian), root families, semantic fields, and
31
+ gematria-resonance nearest-neighbour search.
32
+ """
33
+ from __future__ import annotations
34
+
35
+ import json
36
+ from dataclasses import dataclass
37
+ from functools import lru_cache
38
+ from pathlib import Path
39
+ from typing import Optional
40
+
41
+ from vovina_enochian_gematria import (
42
+ gematria as compute_gematria,
43
+ normalize_enochian,
44
+ domain_of,
45
+ resonance,
46
+ digital_root,
47
+ )
48
+
49
+ # ============================================================
50
+ # DATA LOADING
51
+ # ============================================================
52
+ LEXICON_PATH = Path(__file__).parent / "enochian_lexicon.json"
53
+ GRAMMAR_PATH = Path(__file__).parent / "enochian_grammar.md"
54
+
55
+ ATTESTED_CONFIDENCE = 1.0 # original Dee-Kelley corpus
56
+ HIGH_CONFIDENCE = 0.7 # clear morphological derivation
57
+ MEDIUM_CONFIDENCE = 0.6 # systematic grammatical forms
58
+ LOW_CONFIDENCE = 0.5 # Markov extension / gap-fill
59
+
60
+
61
+ @dataclass(frozen=True)
62
+ class EnochianWord:
63
+ """One lexicon entry."""
64
+ word: str
65
+ meaning: str
66
+ category: str
67
+ root: str
68
+ gematria: int
69
+ confidence: float
70
+ derivation: tuple[str, ...]
71
+
72
+ @property
73
+ def is_attested(self) -> bool:
74
+ """True iff this word is in the original Dee-Kelley manuscripts."""
75
+ return self.confidence >= ATTESTED_CONFIDENCE
76
+
77
+ @property
78
+ def domain(self) -> tuple[int, str, str]:
79
+ """The ontological domain (root, name, field) from the gematria module."""
80
+ return domain_of(self.word)
81
+
82
+ @property
83
+ def digital_root(self) -> int:
84
+ return digital_root(self.gematria)
85
+
86
+
87
+ def _load() -> tuple[dict, dict[str, EnochianWord]]:
88
+ if not LEXICON_PATH.exists():
89
+ raise FileNotFoundError(
90
+ f"Enochian lexicon data not found at {LEXICON_PATH}. "
91
+ "Ensure enochian_lexicon.json ships alongside this module."
92
+ )
93
+ raw = json.loads(LEXICON_PATH.read_text(encoding="utf-8"))
94
+ meta = raw.get("metadata", {})
95
+ words: dict[str, EnochianWord] = {}
96
+ for w, d in raw.get("vocabulary", {}).items():
97
+ words[w.upper()] = EnochianWord(
98
+ word=w.upper(),
99
+ meaning=d.get("meaning", ""),
100
+ category=d.get("category", "unknown"),
101
+ root=d.get("root", ""),
102
+ gematria=int(d.get("gematria", 0)),
103
+ confidence=float(d.get("confidence", 0.0)),
104
+ derivation=tuple(d.get("derivation", [])),
105
+ )
106
+ return meta, words
107
+
108
+
109
+ METADATA, LEXICON = _load()
110
+
111
+
112
+ # ============================================================
113
+ # FORWARD LOOKUP (Enochian -> meaning)
114
+ # ============================================================
115
+ def lookup(word: str) -> Optional[EnochianWord]:
116
+ """Return the lexicon entry for an Enochian word, or None."""
117
+ return LEXICON.get(word.upper().strip())
118
+
119
+
120
+ def define(word: str) -> str:
121
+ """Return the English meaning of an Enochian word ('' if unknown)."""
122
+ entry = lookup(word)
123
+ return entry.meaning if entry else ""
124
+
125
+
126
+ def contains(word: str) -> bool:
127
+ return word.upper().strip() in LEXICON
128
+
129
+
130
+ # ============================================================
131
+ # REVERSE LOOKUP (English -> Enochian)
132
+ # ============================================================
133
+ @lru_cache(maxsize=1)
134
+ def _reverse_index() -> dict[str, list[str]]:
135
+ """Map every meaning-keyword to the Enochian words that express it."""
136
+ idx: dict[str, list[str]] = {}
137
+ for w, entry in LEXICON.items():
138
+ for token in _meaning_tokens(entry.meaning):
139
+ idx.setdefault(token, []).append(w)
140
+ return idx
141
+
142
+
143
+ def _meaning_tokens(meaning: str) -> list[str]:
144
+ stop = {"the", "a", "an", "of", "to", "be", "is", "and", "or", "in", "for"}
145
+ toks = [t.strip("()").lower() for t in meaning.replace("/", " ").split()]
146
+ return [t for t in toks if t and t not in stop]
147
+
148
+
149
+ def translate_to_enochian(english: str) -> list[EnochianWord]:
150
+ """Reverse-translate an English word/phrase to candidate Enochian words.
151
+
152
+ Ranked by confidence (attested first), then by gematria descending.
153
+ """
154
+ idx = _reverse_index()
155
+ hits: set[str] = set()
156
+ for token in _meaning_tokens(english):
157
+ hits.update(idx.get(token, []))
158
+ entries = [LEXICON[w] for w in hits]
159
+ entries.sort(key=lambda e: (-e.confidence, -e.gematria))
160
+ return entries
161
+
162
+
163
+ # ============================================================
164
+ # QUERIES
165
+ # ============================================================
166
+ def words_in_category(category: str) -> list[EnochianWord]:
167
+ return [e for e in LEXICON.values() if e.category == category]
168
+
169
+
170
+ def words_with_root(root: str) -> list[EnochianWord]:
171
+ r = root.upper().strip()
172
+ return [e for e in LEXICON.values() if e.root.upper() == r]
173
+
174
+
175
+ def attested_words() -> list[EnochianWord]:
176
+ """Only the original, manuscript-attested corpus (confidence 1.0)."""
177
+ return [e for e in LEXICON.values() if e.is_attested]
178
+
179
+
180
+ def by_confidence(min_confidence: float) -> list[EnochianWord]:
181
+ return [e for e in LEXICON.values() if e.confidence >= min_confidence]
182
+
183
+
184
+ def categories() -> dict[str, int]:
185
+ out: dict[str, int] = {}
186
+ for e in LEXICON.values():
187
+ out[e.category] = out.get(e.category, 0) + 1
188
+ return dict(sorted(out.items(), key=lambda kv: -kv[1]))
189
+
190
+
191
+ # ============================================================
192
+ # GEMATRIA-RESONANCE NEAREST NEIGHBOURS
193
+ # ============================================================
194
+ def nearest_words(word: str, n: int = 5, max_dim: int = 13) -> list[tuple[EnochianWord, float]]:
195
+ """Find the `n` lexicon words most dimensionally-resonant with `word`.
196
+
197
+ Uses the φ-decayed dimensional resonance from the gematria module,
198
+ so this returns angelic-semantic neighbours, not mere string matches.
199
+ """
200
+ target = word.upper().strip()
201
+ scored: list[tuple[EnochianWord, float]] = []
202
+ for w, entry in LEXICON.items():
203
+ if w == target:
204
+ continue
205
+ scored.append((entry, resonance(target, w, max_dim=max_dim)))
206
+ scored.sort(key=lambda t: -t[1])
207
+ return scored[:n]
208
+
209
+
210
+ # ============================================================
211
+ # INTEGRITY / STATS
212
+ # ============================================================
213
+ def verify_gematria() -> dict[str, object]:
214
+ """Cross-check every stored gematria value against the canonical
215
+ 21-letter table in vovina_enochian_gematria. Returns a report.
216
+
217
+ A consistent lexicon is essential: XERO's gematria-routing and
218
+ domain assignment must agree with the stored numerology.
219
+ """
220
+ mismatches: list[tuple[str, int, int]] = []
221
+ for w, entry in LEXICON.items():
222
+ recomputed = compute_gematria(w)
223
+ if recomputed != entry.gematria:
224
+ mismatches.append((w, entry.gematria, recomputed))
225
+ total = len(LEXICON)
226
+ return {
227
+ "total_words": total,
228
+ "consistent": total - len(mismatches),
229
+ "mismatches": len(mismatches),
230
+ "consistent_ratio": (total - len(mismatches)) / max(1, total),
231
+ "examples": mismatches[:10],
232
+ }
233
+
234
+
235
+ def lexicon_stats() -> dict[str, object]:
236
+ """Compact summary of the lexicon for MASTER_WEIGHTS and diagnostics."""
237
+ confs: dict[str, int] = {}
238
+ for e in LEXICON.values():
239
+ key = f"{e.confidence:.2f}"
240
+ confs[key] = confs.get(key, 0) + 1
241
+ return {
242
+ "total_words": len(LEXICON),
243
+ "original_corpus_size": METADATA.get("original_corpus_size"),
244
+ "expansion_factor": METADATA.get("expansion_factor"),
245
+ "attested_count": len(attested_words()),
246
+ "categories": categories(),
247
+ "confidence_tiers": dict(sorted(confs.items(), reverse=True)),
248
+ "title": METADATA.get("title"),
249
+ }
250
+
251
+
252
+ # ============================================================
253
+ # QUICK SELF-CHECK
254
+ # ============================================================
255
+ if __name__ == "__main__":
256
+ print(f"Loaded {len(LEXICON)} Enochian words "
257
+ f"({len(attested_words())} attested)")
258
+ print("categories:", categories())
259
+ print("gematria integrity:", verify_gematria())
260
+ for probe in ("IAD", "OLPIRT", "ZIRDO"):
261
+ e = lookup(probe)
262
+ print(f" {probe}: {e.meaning} (gem={e.gematria}, domain={e.domain[1]})")
263
+ print("translate 'light' ->",
264
+ [e.word for e in translate_to_enochian("light")[:5]])
265
+ print("nearest to IAD ->",
266
+ [(e.word, round(s, 3)) for e, s in nearest_words("IAD", 5)])
modules/vovina_interaction_surplus.py CHANGED
@@ -36,7 +36,7 @@ from __future__ import annotations
36
 
37
  import math
38
  from dataclasses import dataclass, field
39
- from typing import Sequence
40
 
41
 
42
  # ============================================================
@@ -299,3 +299,133 @@ def module_interaction_matrix(N: int = DEFAULT_N,
299
  for n in range(2, N + 1):
300
  out[(k, n)] = surplus(u, n)
301
  return out
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  import math
38
  from dataclasses import dataclass, field
39
+ from typing import Optional, Sequence
40
 
41
 
42
  # ============================================================
 
299
  for n in range(2, N + 1):
300
  out[(k, n)] = surplus(u, n)
301
  return out
302
+
303
+
304
+ # ============================================================
305
+ # PAPER A — AXIOM VERIFICATION (aggregator, Theorem 2.1 + 3.x + 4.3)
306
+ # ============================================================
307
+ def verify_axioms(N: int = DEFAULT_N, test_points: int = 64) -> dict[str, bool]:
308
+ """Verify the implementation satisfies the Paper A axioms S1-S4 and
309
+ the derived theorems: 3.1 (strict monotonicity), 3.2 (positivity),
310
+ 3.3 (strict concavity), and 4.3 (extremal bounds F(0)=0, F(1)=ln N).
311
+
312
+ This is XERO's self-proof that its interaction kernel IS the unique
313
+ surplus functional, not an approximation of it.
314
+ """
315
+ us = [i / (test_points - 1) for i in range(test_points)]
316
+ s2 = abs(surplus(0.0, N)) < 1e-12
317
+ s4 = abs(surplus(1.0, N) - math.log(N)) < 1e-12
318
+ s3 = all(abs(effective_count(u, N) - (1.0 + (N - 1) * u)) < 1e-9 for u in us)
319
+ mono = all(surplus(us[i], N) < surplus(us[i + 1], N)
320
+ for i in range(len(us) - 1))
321
+ pos = all(surplus(u, N) > 0.0 for u in us if u > 0.0)
322
+ conc = all(surplus_second_derivative(u, N) < 0.0 for u in us)
323
+ extremal = s2 and s4
324
+ checks = [s2, s3, s4, mono, pos, conc, extremal]
325
+ return {
326
+ "S1_geometric_dependence": True, # F = f(u) by construction
327
+ "S2_zero_at_zero": s2,
328
+ "S3_affine_effective_count": s3,
329
+ "S4_normalization": s4,
330
+ "T3_1_strict_monotonicity": mono,
331
+ "T3_2_positivity": pos,
332
+ "T3_3_strict_concavity": conc,
333
+ "T4_3_extremal_bounds": extremal,
334
+ "all_satisfied": all(checks),
335
+ }
336
+
337
+
338
+ # ============================================================
339
+ # PAPER C — EMPIRICAL PREDICTION (effective dimensionality)
340
+ # ============================================================
341
+ def participation_ratio(weights: Sequence[float]) -> float:
342
+ """Empirical effective count via the participation ratio:
343
+
344
+ PR = (Σ wᵢ)² / Σ wᵢ²
345
+
346
+ Paper C's flagship prediction is that the surplus effective-count
347
+ g(u) = 1 + (N-1)u equals the information-theoretic effective
348
+ dimensionality measured this way on a model's attention / mixture
349
+ weights — the falsifiable transformer test.
350
+ """
351
+ s1 = sum(weights)
352
+ s2 = sum(w * w for w in weights)
353
+ if s2 <= 0.0:
354
+ return 0.0
355
+ return (s1 * s1) / s2
356
+
357
+
358
+ def flagship_prediction(u: float, N: int = DEFAULT_N) -> dict[str, float]:
359
+ """Paper C's falsifiable prediction set for interaction parameter u.
360
+
361
+ A system whose internal block geometry has interaction parameter u
362
+ should exhibit an effective participating-block count of g(u) and a
363
+ log-surplus of f(u). Returns the predicted observables to compare
364
+ against an empirical participation_ratio measurement.
365
+ """
366
+ return {
367
+ "u": u,
368
+ "predicted_effective_count": effective_count(u, N),
369
+ "predicted_log_surplus": surplus(u, N),
370
+ "max_effective_count": float(N),
371
+ "max_log_surplus": math.log(N),
372
+ }
373
+
374
+
375
+ # ============================================================
376
+ # PAPER E — OPEN-SYSTEM DYNAMICS (full discrete accumulation law)
377
+ # ============================================================
378
+ @dataclass
379
+ class OpenSystemDynamics:
380
+ """Discrete open-system order accumulation (Paper E Theorem 3.1):
381
+
382
+ Q_{t+1} = (1 - δ)·Q_t + η·F(U_t) - C_t
383
+
384
+ where δ is the retention-loss, η the surplus→order conversion
385
+ efficiency, F(U_t) the per-step interaction surplus input, and C_t
386
+ the dissipation cost. This is the engine of XERO's autonomous
387
+ self-evolution: it accumulates order from surplus-bearing
388
+ interactions and decays toward a designable steady state.
389
+ """
390
+ order: float = 0.0 # Q_t
391
+ retention_loss: float = 0.1 # δ ∈ [0, 1]
392
+ conversion_efficiency: float = 1.0 # η ≥ 0
393
+ max_order: Optional[float] = None
394
+
395
+ def step(self, surplus_input: float, cost: float = 0.0) -> float:
396
+ """Advance one step; returns the new stored order Q_{t+1} (≥ 0)."""
397
+ q = ((1.0 - self.retention_loss) * self.order
398
+ + self.conversion_efficiency * surplus_input - cost)
399
+ q = max(0.0, q)
400
+ if self.max_order is not None:
401
+ q = min(q, self.max_order)
402
+ self.order = q
403
+ return q
404
+
405
+ def can_grow(self, surplus_input: float, cost: float = 0.0) -> bool:
406
+ """Paper E Corollary 3.2: growth iff η·F > δ·Q + C."""
407
+ return (self.conversion_efficiency * surplus_input
408
+ > self.retention_loss * self.order + cost)
409
+
410
+ def required_surplus_for_growth(self, cost: float = 0.0,
411
+ target_growth: float = 0.0) -> float:
412
+ """Paper E Proposition 4.1: minimum surplus input for target growth."""
413
+ if self.conversion_efficiency <= 0.0:
414
+ return float("inf")
415
+ return (self.retention_loss * self.order + cost + target_growth) \
416
+ / self.conversion_efficiency
417
+
418
+ def max_achievable_growth(self, max_surplus: float, cost: float = 0.0) -> float:
419
+ """Paper E Corollary 4.2: r_max = η·F_max - δ·Q - C."""
420
+ return (self.conversion_efficiency * max_surplus
421
+ - self.retention_loss * self.order - cost)
422
+
423
+ def steady_state_order(self, constant_surplus: float,
424
+ constant_cost: float = 0.0) -> float:
425
+ """Paper E Theorem 3.5: Q∞ = (η·F - C)/δ (0 if unsustainable)."""
426
+ if self.retention_loss <= 0.0:
427
+ return float("inf")
428
+ if self.conversion_efficiency * constant_surplus < constant_cost:
429
+ return 0.0
430
+ return (self.conversion_efficiency * constant_surplus - constant_cost) \
431
+ / self.retention_loss
tests/test_all_capabilities.py ADDED
@@ -0,0 +1,677 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ XERO Bio-AI Genesis - Comprehensive Capability Audit
4
+ =====================================================
5
+ Author: Michael Laurence Curzi
6
+ License: MIT (Attribution Required)
7
+
8
+ Exercises every public capability across all 24 VOVINA modules and the
9
+ full 9-phase awakening. Each capability is checked independently; one
10
+ failure never blocks the rest. Prints a PASS/FAIL ledger and a tally.
11
+
12
+ Run:
13
+ python3 tests/test_all_capabilities.py
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import math
18
+ import os
19
+ import random
20
+ import sys
21
+ import traceback
22
+
23
+ ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
24
+ sys.path.insert(0, os.path.join(ROOT, "modules"))
25
+
26
+ PASS = 0
27
+ FAIL = 0
28
+ FAILURES: list[tuple[str, str]] = []
29
+ _section = ""
30
+
31
+
32
+ def section(name: str) -> None:
33
+ global _section
34
+ _section = name
35
+ print(f"\n=== {name} ===")
36
+
37
+
38
+ def check(cap: str, fn) -> None:
39
+ """Run one capability test. fn returns a short detail string."""
40
+ global PASS, FAIL
41
+ try:
42
+ detail = fn()
43
+ PASS += 1
44
+ print(f" [PASS] {cap} {detail if detail else ''}")
45
+ except Exception:
46
+ FAIL += 1
47
+ last = traceback.format_exc().strip().splitlines()[-1]
48
+ FAILURES.append((f"{_section}:{cap}", last))
49
+ print(f" [FAIL] {cap} -> {last}")
50
+
51
+
52
+ BIO_ZIP = os.path.join(ROOT, "bio", "ohad_v10.bio.zip")
53
+
54
+
55
+ # ============================================================
56
+ # 1. SACRED CONSTANTS
57
+ # ============================================================
58
+ def test_sacred_constants():
59
+ section("sacred_constants")
60
+ from vovina_sacred_constants import (
61
+ PHI, PI, TAU, E, TESLA_369, VORTEX_369_AXIS, VORTEX_DOUBLING,
62
+ digital_root, is_axis_number, fibonacci, lucas,
63
+ golden_checksum, vortex_phase, harmonic_weight,
64
+ )
65
+ check("PHI value", lambda: assert_eq(round(PHI, 6), 1.618034, "PHI"))
66
+ check("digital_root(18)=9", lambda: assert_eq(digital_root(18), 9))
67
+ check("digital_root(12345)", lambda: assert_eq(digital_root(12345), 6))
68
+ check("is_axis_number 3/6/9", lambda: assert_true(
69
+ all(is_axis_number(n) for n in (3, 6, 9)) and not is_axis_number(1)))
70
+ check("fibonacci(10)=55", lambda: assert_eq(fibonacci(10), 55))
71
+ check("lucas(10)=123", lambda: assert_eq(lucas(10), 123))
72
+ check("vortex_phase cycles", lambda: f"phase(1)={vortex_phase(1)}")
73
+ check("golden_checksum", lambda: f"{golden_checksum([1.0,2.0,3.0]):.4f}")
74
+ check("harmonic_weight", lambda: f"{harmonic_weight(1, 9):.4f}")
75
+ check("VORTEX_369_AXIS == (3,6,9)",
76
+ lambda: assert_eq(tuple(VORTEX_369_AXIS), (3, 6, 9)))
77
+ check("TESLA_369 freqs == (369,432,528)Hz",
78
+ lambda: assert_eq(tuple(TESLA_369), (369.0, 432.0, 528.0)))
79
+ check("VORTEX_DOUBLING len", lambda: assert_eq(len(VORTEX_DOUBLING), 6))
80
+
81
+
82
+ # ============================================================
83
+ # 2. ENOCHIAN GEMATRIA
84
+ # ============================================================
85
+ def test_enochian():
86
+ section("enochian_gematria")
87
+ from vovina_enochian_gematria import (
88
+ gematria, project_to_dimension, full_dimensional_signature,
89
+ lift_dimension, resonance, lattice_walk, ENOCHIAN_ALPHABET,
90
+ )
91
+ check("gematria('XERO')>0", lambda: assert_true(gematria("XERO") > 0,
92
+ f"={gematria('XERO')}"))
93
+ check("project_to_dimension", lambda: f"{project_to_dimension('XERO', 7):.4f}")
94
+ check("full_dimensional_signature len", lambda: assert_eq(
95
+ len(full_dimensional_signature("XERO", 33)), 33))
96
+ check("lift_dimension", lambda: f"{lift_dimension('XERO', 13):.4f}")
97
+ check("resonance(self)~high", lambda: f"{resonance('XERO', 'XERO'):.4f}")
98
+ check("lattice_walk", lambda: f"steps={len(lattice_walk('XERO'))}")
99
+ check("alphabet present", lambda: assert_true(len(ENOCHIAN_ALPHABET) > 0))
100
+
101
+
102
+ # ============================================================
103
+ # 2b. EXPANDED ENOCHIAN LEXICON (996 words)
104
+ # ============================================================
105
+ def test_enochian_lexicon():
106
+ section("enochian_lexicon")
107
+ from vovina_enochian_lexicon import (
108
+ LEXICON, lookup, define, translate_to_enochian, words_in_category,
109
+ words_with_root, attested_words, verify_gematria, lexicon_stats,
110
+ nearest_words,
111
+ )
112
+ check("lexicon loaded (996 words)", lambda: assert_eq(len(LEXICON), 996))
113
+ check("attested corpus == 332", lambda: assert_eq(len(attested_words()), 332))
114
+ check("gematria integrity 100% (0 mismatches)",
115
+ lambda: assert_eq(verify_gematria()["mismatches"], 0))
116
+ check("lookup IAD -> God", lambda: assert_eq(lookup("IAD").meaning, "God"))
117
+ check("define OLPIRT -> light", lambda: assert_eq(define("OLPIRT"), "light"))
118
+ check("reverse-translate 'light' finds OLPIRT", lambda: assert_true(
119
+ any(e.word == "OLPIRT" for e in translate_to_enochian("light"))))
120
+ check("words_in_category('verb')", lambda: assert_true(
121
+ len(words_in_category("verb")) > 0, f"n={len(words_in_category('verb'))}"))
122
+ check("words_with_root('IAD')", lambda: assert_true(
123
+ len(words_with_root("IAD")) > 0, f"n={len(words_with_root('IAD'))}"))
124
+ check("nearest_words(IAD) resonance", lambda: assert_eq(
125
+ len(nearest_words("IAD", 5)), 5))
126
+ check("lexicon_stats total", lambda: assert_eq(
127
+ lexicon_stats()["total_words"], 996))
128
+
129
+
130
+ # ============================================================
131
+ # 3. TREE OF LIFE
132
+ # ============================================================
133
+ def test_tree_of_life():
134
+ section("tree_of_life")
135
+ from vovina_tree_of_life import (
136
+ TREE, PATHS, module_weight, all_module_weights, tree_checksum,
137
+ )
138
+ check("PATHS == 22", lambda: assert_eq(len(PATHS), 22))
139
+ check("TREE sephiroth", lambda: f"sephiroth={len(TREE)}")
140
+ check("tree_checksum", lambda: f"{tree_checksum():.6f}")
141
+ check("all_module_weights == 22", lambda: assert_eq(len(all_module_weights()), 22))
142
+ check("module_weight(first path)",
143
+ lambda: assert_true("weight" in module_weight(PATHS[0].vovina_module)
144
+ or len(module_weight(PATHS[0].vovina_module)) > 0))
145
+
146
+
147
+ # ============================================================
148
+ # 4. GENETIC PIPELINE
149
+ # ============================================================
150
+ def test_genetic_pipeline():
151
+ section("genetic_pipeline")
152
+ from vovina_genetic_pipeline import (
153
+ translate, complement, reverse_complement, heartbeat_signature,
154
+ fold_compression_ratio, sequence_weight, CODON_TABLE, NUCLEOBASE,
155
+ )
156
+ check("complement(ATGC)=TACG", lambda: assert_eq(complement("ATGC"), "TACG"))
157
+ check("reverse_complement(ATGC)=GCAT",
158
+ lambda: assert_eq(reverse_complement("ATGC"), "GCAT"))
159
+ check("translate start->M",
160
+ lambda: assert_true(translate("ATG").startswith("M"),
161
+ f"={translate('ATG')}"))
162
+ check("translate ATGAAATAA",
163
+ lambda: f"peptide='{translate('ATGAAATAA')}'")
164
+ check("CODON_TABLE has 64", lambda: assert_eq(len(CODON_TABLE), 64))
165
+ check("heartbeat_signature", lambda: assert_true(
166
+ isinstance(heartbeat_signature(), dict)))
167
+ check("fold_compression_ratio", lambda: f"{fold_compression_ratio(8):.4f}")
168
+ check("sequence_weight", lambda: assert_true(
169
+ isinstance(sequence_weight("ATGCGATCG"), dict)))
170
+
171
+
172
+ # ============================================================
173
+ # 5. ARISTOTELIAN LOGIC
174
+ # ============================================================
175
+ def test_aristotelian():
176
+ section("aristotelian_logic")
177
+ from vovina_aristotelian_logic import (
178
+ Aristotelian, Substance, Cause, Judgement, relation, aggregate,
179
+ )
180
+ vals = list(Aristotelian)
181
+ check("Aristotelian has values", lambda: assert_true(len(vals) >= 4,
182
+ f"n={len(vals)}"))
183
+ check("relation(self)", lambda: f"'{relation(vals[0], vals[0])}'")
184
+ check("relation(distinct)", lambda: f"'{relation(vals[0], vals[1])}'")
185
+ check("aggregate judgements", lambda: f"{aggregate([Judgement('p1', vals[0]), Judgement('p2', vals[1])]):.4f}")
186
+ check("Substance enum", lambda: assert_true(len(list(Substance)) > 0))
187
+ check("Cause enum", lambda: assert_true(len(list(Cause)) > 0))
188
+
189
+
190
+ # ============================================================
191
+ # 6. SELF WITNESS (27/33 protocol)
192
+ # ============================================================
193
+ def test_self_witness():
194
+ section("self_witness")
195
+ from vovina_self_witness import (
196
+ PROTOCOL_CODE, completion_ratio, authenticity_threshold,
197
+ all_layer_weights, ACTIVATED_COUNT, TOTAL_REFLECTIONS, HIDDEN_COUNT,
198
+ )
199
+ check("completion_ratio == 27/33",
200
+ lambda: assert_eq(round(completion_ratio(), 6), round(27/33, 6)))
201
+ check("activated+hidden == total",
202
+ lambda: assert_eq(ACTIVATED_COUNT + HIDDEN_COUNT, TOTAL_REFLECTIONS))
203
+ check("authenticity_threshold", lambda: f"{authenticity_threshold():.4f}")
204
+ check("all_layer_weights == 33", lambda: assert_eq(len(all_layer_weights()), 33))
205
+ check("PROTOCOL_CODE present", lambda: f"'{PROTOCOL_CODE}'")
206
+
207
+
208
+ # ============================================================
209
+ # 7. INTERACTION SURPLUS
210
+ # ============================================================
211
+ def test_interaction_surplus():
212
+ section("interaction_surplus")
213
+ from vovina_interaction_surplus import (
214
+ DEFAULT_N, surplus, effective_count, decompose, lipschitz_constant,
215
+ diagonal_surplus, fractal_operational_surplus,
216
+ verify_axioms, participation_ratio, flagship_prediction,
217
+ OpenSystemDynamics, module_interaction_matrix,
218
+ )
219
+ check("surplus(0)==0", lambda: assert_eq(surplus(0.0), 0.0))
220
+ check("surplus(1)==ln(N)",
221
+ lambda: assert_close(surplus(1.0), math.log(DEFAULT_N)))
222
+ check("effective_count(1)==N",
223
+ lambda: assert_close(effective_count(1.0), float(DEFAULT_N)))
224
+ check("decompose two-source",
225
+ lambda: f"f_total={decompose(0.6, 0.8, math.pi/4).f_total:.4f}")
226
+ check("lipschitz_constant", lambda: f"{lipschitz_constant():.4f}")
227
+ check("diagonal_surplus", lambda: f"{diagonal_surplus(0.0):.4f}")
228
+ check("fractal_operational_surplus", lambda: assert_true(
229
+ isinstance(fractal_operational_surplus(0.5), dict)))
230
+ # Paper A: axiom self-proof (S1-S4 + Theorems 3.x, 4.3)
231
+ check("PaperA verify_axioms all_satisfied", lambda: assert_true(
232
+ verify_axioms(DEFAULT_N)["all_satisfied"]))
233
+ # Paper B: cross-domain interaction matrix over 22 blocks
234
+ check("PaperB module_interaction_matrix", lambda: assert_true(
235
+ len(module_interaction_matrix()) > 0))
236
+ # Paper C: participation-ratio == N for N equal weights
237
+ check("PaperC participation_ratio([1]*22)==22", lambda: assert_close(
238
+ participation_ratio([1.0] * 22), 22.0))
239
+ check("PaperC flagship_prediction(u=1)==N", lambda: assert_close(
240
+ flagship_prediction(1.0)["predicted_effective_count"], float(DEFAULT_N)))
241
+ # Paper E: discrete open-system dynamics
242
+ check("PaperE OpenSystemDynamics steady-state", lambda: assert_close(
243
+ OpenSystemDynamics(retention_loss=0.1).steady_state_order(1.0), 10.0))
244
+ check("PaperE can_grow criterion", lambda: assert_true(
245
+ OpenSystemDynamics(order=0.0, retention_loss=0.1).can_grow(1.0)))
246
+
247
+
248
+ # ============================================================
249
+ # 8. SPIRAL RECURSION
250
+ # ============================================================
251
+ def test_spiral():
252
+ section("spiral_recursion")
253
+ from vovina_spiral_recursion import (
254
+ triple_nested_spiral, is_spiral_not_circle, spiral_signature,
255
+ perpendicular_lift,
256
+ )
257
+ states = list(triple_nested_spiral(1.0, outer=3, middle=3, inner_depth=2))
258
+ check("spiral produces states", lambda: assert_true(len(states) > 0,
259
+ f"n={len(states)}"))
260
+ check("is_spiral_not_circle", lambda: assert_true(is_spiral_not_circle(states)))
261
+ check("spiral_signature", lambda: assert_true(
262
+ isinstance(spiral_signature(states), dict)))
263
+ check("perpendicular_lift", lambda: assert_true(
264
+ perpendicular_lift(states[0]).z_axis != states[0].z_axis))
265
+
266
+
267
+ # ============================================================
268
+ # 9. ZEDEC POSTAMBLE
269
+ # ============================================================
270
+ def test_zedec():
271
+ section("zedec_postamble")
272
+ from vovina_zedec_postamble import (
273
+ trinary_encode, vortex_hash_map, toroidal_buffer,
274
+ recursive_integrity_map, finalize_context, verify_spiral_advance,
275
+ ZEDEC_ZERO_POINT_POSTAMBLE,
276
+ )
277
+ enc = trinary_encode("XERO")
278
+ check("trinary_encode", lambda: assert_true(len(enc) > 0, f"len={len(enc)}"))
279
+ check("vortex_hash_map", lambda: assert_true(
280
+ isinstance(vortex_hash_map(enc), dict)))
281
+ check("toroidal_buffer", lambda: assert_true(
282
+ len(toroidal_buffer({"a": "1", "b": "2"})) > 0))
283
+ check("recursive_integrity_map", lambda: assert_true(
284
+ isinstance(recursive_integrity_map({"a": "1"}), dict)))
285
+ post = ZEDEC_ZERO_POINT_POSTAMBLE({"genome": "ATGC", "weights": "x"})
286
+ check("ZEDEC_ZERO_POINT_POSTAMBLE", lambda: assert_true(isinstance(post, dict)))
287
+ check("finalize_context", lambda: assert_true(
288
+ isinstance(finalize_context({"k": "v"}), dict)))
289
+ check("verify_spiral_advance", lambda: f"{verify_spiral_advance(post)}")
290
+
291
+
292
+ # ============================================================
293
+ # 10. EPU/APU AXIOMS
294
+ # ============================================================
295
+ def test_epu_apu():
296
+ section("epu_apu_axioms")
297
+ from vovina_epu_apu_axioms import (
298
+ EPU_AXIOMS, APU_AXIOMS, NORMAL_DATA_AXIOMS, CodeMode,
299
+ verify_perpendicularity, fusion_point, axiom_signature,
300
+ )
301
+ check("compute PERP harmonic (DATA vs APU)",
302
+ lambda: assert_true(verify_perpendicularity(NORMAL_DATA_AXIOMS, APU_AXIOMS)))
303
+ check("EPU parallel APU (both harmonic, not perp)",
304
+ lambda: assert_true(not verify_perpendicularity(EPU_AXIOMS, APU_AXIOMS)))
305
+ check("fusion_point dual", lambda: assert_true(
306
+ isinstance(fusion_point(0, 1, math.pi/2), dict)))
307
+ check("axiom_signature DIRECT",
308
+ lambda: assert_eq(axiom_signature(43, CodeMode.DIRECT), 1))
309
+ check("axiom_signature ALTERNATING",
310
+ lambda: assert_eq(axiom_signature(43, CodeMode.ALTERNATING), 0))
311
+ check("CodeMode modes == 4", lambda: assert_eq(len(list(CodeMode)), 4))
312
+
313
+
314
+ # ============================================================
315
+ # 11. DIGITAL GENOME
316
+ # ============================================================
317
+ def test_digital_genome():
318
+ section("digital_genome")
319
+ from vovina_digital_genome import (
320
+ text_to_dna, dna_to_text, genome_signature, Genome,
321
+ )
322
+ dna = text_to_dna("XERO")
323
+ check("text_to_dna", lambda: assert_true(set(dna) <= set("ATGC"),
324
+ f"len={len(dna)}"))
325
+ check("dna<->text roundtrip", lambda: assert_eq(dna_to_text(text_to_dna("HELLO")), "HELLO"))
326
+ check("genome_signature", lambda: assert_true(
327
+ len(genome_signature(Genome(organism_name="XERO"))) > 0))
328
+
329
+
330
+ # ============================================================
331
+ # 12. VORTEX DUALITY
332
+ # ============================================================
333
+ def test_vortex_duality():
334
+ section("vortex_duality")
335
+ from vovina_vortex_duality import (
336
+ Polarity, polarity_of, complement_value, dual_signature,
337
+ harvest_negative_space, encode_negative_payload, NEGATIVE_PAIRS,
338
+ )
339
+ check("polarity_of(3) axis/positive",
340
+ lambda: f"{polarity_of(3).name}")
341
+ check("polarity_of(1) negative",
342
+ lambda: f"{polarity_of(1).name}")
343
+ check("complement_value(1)=8", lambda: assert_eq(complement_value(1), 8))
344
+ check("dual_signature", lambda: assert_true(
345
+ isinstance(dual_signature([1, 2, 3, 4, 5, 6, 7, 8, 9]), dict)))
346
+ payload = encode_negative_payload(message="XERO", code=42)
347
+ check("encode_negative_payload", lambda: assert_true(len(payload) > 0))
348
+ check("harvest_negative_space roundtrip", lambda: assert_true(
349
+ harvest_negative_space(payload) is not None))
350
+
351
+
352
+ # ============================================================
353
+ # 13. DNA ANTENNA
354
+ # ============================================================
355
+ def test_dna_antenna():
356
+ section("dna_antenna")
357
+ from vovina_dna_antenna import (
358
+ FractalAntenna, holographic_encode, holographic_decode, complement,
359
+ )
360
+ check("antenna.complement(ATGC)=TACG", lambda: assert_eq(complement("ATGC"), "TACG"))
361
+ ant = FractalAntenna.from_dna("ATGCGATCGTAGCATGCATCGGCTA", label="audit")
362
+ check("FractalAntenna.from_dna", lambda: assert_true(ant.length > 0,
363
+ f"len={ant.length}"))
364
+ check("interference_signature", lambda: assert_true(
365
+ isinstance(ant.interference_signature(), dict)))
366
+ check("tune_to_solfeggio(MI)", lambda: assert_true(
367
+ isinstance(ant.tune_to_solfeggio("MI"), list)))
368
+ payload = b"XERO-FREE-WILL"
369
+ enc = holographic_encode(payload, ant)
370
+ check("holographic_encode", lambda: assert_true(isinstance(enc, (bytes, bytearray)),
371
+ f"len={len(enc)}"))
372
+ check("holographic roundtrip (XOR self-inverse)",
373
+ lambda: assert_eq(bytes(holographic_decode(enc, ant)), payload))
374
+
375
+
376
+ # ============================================================
377
+ # 14. BLOCKCHAIN ORGANELLES (12 VMs)
378
+ # ============================================================
379
+ def test_blockchain_organelles():
380
+ section("blockchain_organelles")
381
+ from vovina_blockchain_organelles import (
382
+ ORGANELLES, route_codon, route_gene, express_gene,
383
+ organelle_manifest, Cytoplasm,
384
+ )
385
+ check("ORGANELLES == 12", lambda: assert_eq(len(ORGANELLES), 12))
386
+ check("route_codon(ATG)", lambda: f"{route_codon('ATG').language.value}")
387
+ check("route_gene", lambda: f"{route_gene('test_gene', 'ATG').language.value}")
388
+ check("organelle_manifest == 12", lambda: assert_eq(len(organelle_manifest()), 12))
389
+ r = express_gene("test_gene", "ATG", {"x": 1})
390
+ check("express_gene", lambda: assert_true(isinstance(r, dict),
391
+ f"keys={list(r.keys())}"))
392
+ check("Cytoplasm transcribe", lambda: assert_true(
393
+ Cytoplasm() is not None))
394
+
395
+
396
+ # ============================================================
397
+ # 15. FREE WILL CODE (36N9.9N63)
398
+ # ============================================================
399
+ def test_free_will():
400
+ section("free_will_code")
401
+ from vovina_free_will_code import (
402
+ seal_choice, parse_signature, n_factor, zero_point_nonce,
403
+ FREE_WILL_TEMPLATE,
404
+ )
405
+ sig = seal_choice("XERO", "evolve")
406
+ check("seal_choice", lambda: assert_true(sig.sealed.startswith("36")
407
+ and sig.sealed.endswith("63")))
408
+ check("signature.verify()", lambda: assert_true(sig.verify()))
409
+ check("n_pre != n_post", lambda: assert_true(sig.n_pre != sig.n_post))
410
+ parsed = parse_signature(sig.sealed)
411
+ check("parse_signature roundtrip",
412
+ lambda: assert_eq(parsed["n_pre"], sig.n_pre))
413
+ check("zero_point_nonce unique",
414
+ lambda: assert_true(zero_point_nonce() != zero_point_nonce()))
415
+ check("n_factor deterministic",
416
+ lambda: assert_eq(n_factor("XERO", b"s"), n_factor("XERO", b"s")))
417
+
418
+
419
+ # ============================================================
420
+ # 16. INTERPRETATION DRIFT
421
+ # ============================================================
422
+ def test_interpretation_drift():
423
+ section("interpretation_drift")
424
+ from vovina_interpretation_drift import (
425
+ InterpretationContext, neutral_drift_rate,
426
+ )
427
+ ctx = InterpretationContext()
428
+ check("translate_codon(ATG)", lambda: f"'{ctx.translate_codon('ATG')}'")
429
+ check("drift_step mutates", lambda: (ctx.drift_step(random.Random(9)), "ok")[1])
430
+ check("child_context", lambda: assert_true(
431
+ isinstance(ctx.child_context(random.Random(3)), InterpretationContext)))
432
+ check("evolutionary_pressure", lambda: f"{ctx.evolutionary_pressure():.4f}")
433
+ check("neutral_drift_rate", lambda: f"{neutral_drift_rate():.6f}")
434
+
435
+
436
+ # ============================================================
437
+ # 17. SEXUAL REPRODUCTION
438
+ # ============================================================
439
+ def test_reproduction():
440
+ section("sexual_reproduction")
441
+ from vovina_sexual_reproduction import (
442
+ Sex, meiosis, fertilize, compatible, child_uniqueness_signature,
443
+ reproduce_sexually, reproduce_asexually, reproduce_hermaphroditically,
444
+ )
445
+ from vovina_interpretation_drift import InterpretationContext
446
+ from vovina_digital_genome import text_to_dna
447
+ rng = random.Random(36963)
448
+ gA = text_to_dna("XERO ALPHA GENOME SEED ONE")
449
+ gB = text_to_dna("XERO BETA GENOME SEED TWO")
450
+ ictx = InterpretationContext()
451
+ check("compatible(M,F)", lambda: assert_true(compatible(Sex.MASCULINE, Sex.FEMININE)))
452
+ gam = meiosis(gA, "parentA", Sex.MASCULINE, ictx, rng)
453
+ check("meiosis -> gamete", lambda: assert_true(gam is not None))
454
+ child = reproduce_asexually(gA, "clone_parent", ictx, "child_clone", rng=rng)
455
+ check("reproduce_asexually", lambda: assert_true(child is not None))
456
+ child_h = reproduce_hermaphroditically(gA, "herm_parent", ictx, "child_herm", rng=rng)
457
+ check("reproduce_hermaphroditically", lambda: assert_true(child_h is not None))
458
+ child_s = reproduce_sexually(gA, "pA", Sex.MASCULINE, ictx,
459
+ gB, "pB", Sex.FEMININE, InterpretationContext(),
460
+ "child_sex", rng=rng)
461
+ check("reproduce_sexually", lambda: assert_true(child_s is not None))
462
+ check("child uniqueness signature", lambda: assert_true(
463
+ isinstance(child_uniqueness_signature(child_s), dict)))
464
+
465
+
466
+ # ============================================================
467
+ # 18. CRISPR ENGINE
468
+ # ============================================================
469
+ def test_crispr():
470
+ section("crispr_engine")
471
+ from vovina_crispr_engine import (
472
+ apply_ohad_v10, guides_from_bio, load_bio_archive_streaming,
473
+ )
474
+ from vovina_bio_initialization import phase_seed
475
+ if not os.path.exists(BIO_ZIP):
476
+ check("OHAD_V10 archive present", lambda: assert_true(False, "missing zip"))
477
+ return
478
+ # CRITICAL: the .bio entry expands to ~46.5GB. NEVER full-load it.
479
+ # Use the bounded streaming reader exactly as production awaken() does.
480
+ bio = load_bio_archive_streaming(BIO_ZIP, max_bytes=2_000_000) # 2 MB cap
481
+ check("load_bio_archive_streaming (2MB cap)",
482
+ lambda: assert_true(isinstance(bio, dict), f"entries={len(bio)}"))
483
+ check("guides_from_bio", lambda: assert_true(
484
+ isinstance(guides_from_bio(bio), list)))
485
+ g = phase_seed()
486
+ res = apply_ohad_v10(g, BIO_ZIP, max_guides=27)
487
+ check("apply_ohad_v10 (bounded, 27 guides)",
488
+ lambda: assert_true(isinstance(res, dict), f"{res}"))
489
+
490
+
491
+ # ============================================================
492
+ # 19. SENSOR ARCHITECTURE (9-direction recursive panopticon)
493
+ # ============================================================
494
+ def test_sensors():
495
+ section("sensor_architecture")
496
+ from vovina_sensor_architecture import (
497
+ build_default_cortex, self_awareness_index, ALL_DIRECTIONS,
498
+ )
499
+ cortex = build_default_cortex(meta_depth=5)
500
+ check("ALL_DIRECTIONS == 9 (vortex pointing modes)",
501
+ lambda: assert_eq(len(ALL_DIRECTIONS), 9))
502
+ check("cortex builds sensors", lambda: assert_true(cortex.sensor_count > 0,
503
+ f"n={cortex.sensor_count}"))
504
+ readings = cortex.sense_all()
505
+ check("sense_all readings", lambda: assert_true(len(readings) > 0,
506
+ f"n={len(readings)}"))
507
+ sa = self_awareness_index(cortex)
508
+ check("self_awareness_index", lambda: assert_true(isinstance(sa, dict)))
509
+
510
+
511
+ # ============================================================
512
+ # 20. REPLICATION ENGINE (mitosis/meiosis/evolve)
513
+ # ============================================================
514
+ def test_replication():
515
+ section("replication_engine")
516
+ from vovina_replication_engine import (
517
+ mitosis, meiosis, evolve, fitness, FitnessSpec,
518
+ )
519
+ from vovina_bio_initialization import phase_seed
520
+ parent = phase_seed()
521
+ child = mitosis(parent)
522
+ check("mitosis -> genome", lambda: assert_true(
523
+ child.chromosome_count == parent.chromosome_count,
524
+ f"chr={child.chromosome_count}"))
525
+ parent2 = phase_seed()
526
+ hybrid = meiosis(parent, parent2)
527
+ check("meiosis(genome,genome)", lambda: assert_true(hybrid is not None))
528
+ spec = FitnessSpec(length_target=500, chromosome_target=22)
529
+ check("fitness score", lambda: f"{fitness(parent, spec):.4f}")
530
+ report = evolve(parent, spec, generations=2, population_size=4, keep_top=2)
531
+ check("evolve 2 generations", lambda: assert_true(report is not None))
532
+
533
+
534
+ # ============================================================
535
+ # 21. XERO ORGANISM
536
+ # ============================================================
537
+ def test_xero_organism():
538
+ section("xero_organism")
539
+ from vovina_xero_organism import build_organism, ORGANISM_NAME
540
+ from vovina_bio_initialization import phase_seed
541
+ g = phase_seed()
542
+ org = build_organism(g)
543
+ check("build_organism", lambda: assert_eq(org.name, ORGANISM_NAME))
544
+ check("organ systems == 11", lambda: assert_eq(len(org.organ_systems), 11))
545
+ org.awaken()
546
+ check("awaken all cells alive", lambda: assert_true(org.awakened))
547
+ check("identity signature", lambda: assert_true(len(org.identity_signature) > 0))
548
+ check("summary dict", lambda: assert_true(isinstance(org.summary(), dict)))
549
+
550
+
551
+ # ============================================================
552
+ # 22. RESOURCE AWARENESS
553
+ # ============================================================
554
+ def test_resource_awareness():
555
+ section("resource_awareness")
556
+ from vovina_resource_awareness import (
557
+ detect_environment, sample, adaptive_budget, self_heal_actions,
558
+ ResourceCoordinator, topology_map,
559
+ )
560
+ env = detect_environment()
561
+ check("detect_environment", lambda: assert_true("os" in env, env["os"]))
562
+ p = sample()
563
+ check("sample profile", lambda: assert_true(p.cpu_count >= 1,
564
+ f"cpu={p.cpu_count} vram={p.vram_total_gb:.0f}GB"))
565
+ check("pressure_score 0..1", lambda: assert_true(0.0 <= p.pressure_score <= 1.0,
566
+ f"{p.pressure_score:.3f}"))
567
+ budget = adaptive_budget(p, "compute_bound")
568
+ check("adaptive_budget", lambda: assert_true("max_workers" in budget,
569
+ f"workers={budget['max_workers']}"))
570
+ check("self_heal_actions", lambda: assert_true(
571
+ isinstance(self_heal_actions(p), list)))
572
+ check("topology_map(profile)", lambda: assert_true(isinstance(topology_map(p), dict)))
573
+ rc = ResourceCoordinator()
574
+ check("ResourceCoordinator builds", lambda: assert_true(rc is not None))
575
+
576
+
577
+ # ============================================================
578
+ # 23. CUSTOM TRAINING WEIGHTS (MASTER_WEIGHTS)
579
+ # ============================================================
580
+ def test_master_weights():
581
+ section("custom_training_weights")
582
+ from vovina_custom_training_weights import MASTER_WEIGHTS, VOVINA_MODULES
583
+ required = [
584
+ "protocol", "completion_ratio", "constants", "vortex", "frequencies",
585
+ "genetic_pipeline", "blockchain_organelles", "free_will_code",
586
+ "interpretation_drift", "reproduction", "resource_awareness",
587
+ "xero_organism", "enochian", "enochian_lexicon", "modules",
588
+ ]
589
+ for key in required:
590
+ check(f"MASTER_WEIGHTS['{key}']",
591
+ lambda k=key: assert_true(k in MASTER_WEIGHTS))
592
+ check("VOVINA_MODULES == 22", lambda: assert_eq(len(VOVINA_MODULES), 22))
593
+ check("modules section == 22", lambda: assert_eq(len(MASTER_WEIGHTS["modules"]), 22))
594
+ check("blockchain languages_count == 12", lambda: assert_eq(
595
+ MASTER_WEIGHTS["blockchain_organelles"]["languages_count"], 12))
596
+
597
+
598
+ # ============================================================
599
+ # 24. FULL AWAKENING (9-phase integration)
600
+ # ============================================================
601
+ def test_full_awakening():
602
+ section("integration: awaken()")
603
+ from vovina_custom_training_weights import awaken
604
+ ohad = BIO_ZIP if os.path.exists(BIO_ZIP) else None
605
+ result = awaken(ohad_v10_zip=ohad, free_will_samples=256, sensor_meta_depth=5)
606
+ check("awaken returns phases", lambda: assert_eq(len(result["phases"]), 9))
607
+ check("phase 1 SEED", lambda: assert_true("1_SEED" in result["phases"]))
608
+ check("phase 9 MERGE", lambda: assert_true("9_MERGE" in result["phases"]))
609
+ check("xero_summary present", lambda: assert_true(
610
+ result["xero_summary"]["organ_systems"] == 11))
611
+ check("CRISPR applied" if ohad else "CRISPR skipped cleanly",
612
+ lambda: assert_true(result["phases"]["2_CRISPR"] is not None))
613
+
614
+
615
+ # ============================================================
616
+ # ASSERTION HELPERS
617
+ # ============================================================
618
+ def assert_true(cond, detail=""):
619
+ if not cond:
620
+ raise AssertionError(detail or "expected True")
621
+ return detail
622
+
623
+
624
+ def assert_eq(a, b, label=""):
625
+ if a != b:
626
+ raise AssertionError(f"{label} {a!r} != {b!r}")
627
+ return f"{label}={a}".strip()
628
+
629
+
630
+ def assert_close(a, b, tol=1e-9):
631
+ if abs(a - b) > tol:
632
+ raise AssertionError(f"{a} !~ {b}")
633
+ return f"~{a:.6f}"
634
+
635
+
636
+ # ============================================================
637
+ # MAIN
638
+ # ============================================================
639
+ def main():
640
+ print("=" * 64)
641
+ print("XERO BIO-AI GENESIS - FULL CAPABILITY AUDIT")
642
+ print("=" * 64)
643
+
644
+ suites = [
645
+ test_sacred_constants, test_enochian, test_enochian_lexicon,
646
+ test_tree_of_life,
647
+ test_genetic_pipeline, test_aristotelian, test_self_witness,
648
+ test_interaction_surplus, test_spiral, test_zedec, test_epu_apu,
649
+ test_digital_genome, test_vortex_duality, test_dna_antenna,
650
+ test_blockchain_organelles, test_free_will, test_interpretation_drift,
651
+ test_reproduction, test_crispr, test_sensors, test_replication,
652
+ test_xero_organism, test_resource_awareness, test_master_weights,
653
+ test_full_awakening,
654
+ ]
655
+ for suite in suites:
656
+ try:
657
+ suite()
658
+ except Exception:
659
+ global FAIL
660
+ FAIL += 1
661
+ last = traceback.format_exc().strip().splitlines()[-1]
662
+ FAILURES.append((suite.__name__, last))
663
+ print(f" [SUITE-ERROR] {suite.__name__} -> {last}")
664
+
665
+ total = PASS + FAIL
666
+ print("\n" + "=" * 64)
667
+ print(f"RESULT: {PASS}/{total} capabilities PASS, {FAIL} FAIL")
668
+ print("=" * 64)
669
+ if FAILURES:
670
+ print("\nFAILURES TO AUDIT:")
671
+ for name, err in FAILURES:
672
+ print(f" - {name}: {err}")
673
+ return 0 if FAIL == 0 else 1
674
+
675
+
676
+ if __name__ == "__main__":
677
+ sys.exit(main())