luyh-equations 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- luyh_equations-1.2.0/LICENSE +5 -0
- luyh_equations-1.2.0/MANIFEST.in +9 -0
- luyh_equations-1.2.0/PKG-INFO +599 -0
- luyh_equations-1.2.0/README.md +570 -0
- luyh_equations-1.2.0/SECURITY.md +40 -0
- luyh_equations-1.2.0/assets/luyh-logo.png +0 -0
- luyh_equations-1.2.0/benchmarks/benchmark_engine.py +50 -0
- luyh_equations-1.2.0/benchmarks/results.json +36 -0
- luyh_equations-1.2.0/docs/EMPIRICAL_RESULTS.json +57 -0
- luyh_equations-1.2.0/docs/LUYH_EQUATIONS_PROOF.md +1005 -0
- luyh_equations-1.2.0/docs/LUYH_EQUATIONS_PROOF.pdf +2971 -2
- luyh_equations-1.2.0/docs/REPRODUCIBILITY.md +30 -0
- luyh_equations-1.2.0/docs/SECURITY_ASSESSMENT.md +55 -0
- luyh_equations-1.2.0/examples/basic.py +16 -0
- luyh_equations-1.2.0/legacy/README.md +13 -0
- luyh_equations-1.2.0/legacy/luyh_original.py +111 -0
- luyh_equations-1.2.0/pyproject.toml +82 -0
- luyh_equations-1.2.0/setup.cfg +4 -0
- luyh_equations-1.2.0/setup.py +10 -0
- luyh_equations-1.2.0/src/luyh/__init__.py +81 -0
- luyh_equations-1.2.0/src/luyh/_native.c +558 -0
- luyh_equations-1.2.0/src/luyh/analysis.py +232 -0
- luyh_equations-1.2.0/src/luyh/cli.py +315 -0
- luyh_equations-1.2.0/src/luyh/docs/LUYH_EQUATIONS_PROOF.pdf +2971 -2
- luyh_equations-1.2.0/src/luyh/engine.py +219 -0
- luyh_equations-1.2.0/src/luyh/keys.py +83 -0
- luyh_equations-1.2.0/src/luyh/model.py +53 -0
- luyh_equations-1.2.0/src/luyh/operators.py +29 -0
- luyh_equations-1.2.0/src/luyh/pairs.py +49 -0
- luyh_equations-1.2.0/src/luyh/py.typed +1 -0
- luyh_equations-1.2.0/src/luyh/research.py +106 -0
- luyh_equations-1.2.0/src/luyh/structure.py +35 -0
- luyh_equations-1.2.0/src/luyh/traps.py +178 -0
- luyh_equations-1.2.0/src/luyh_equations.egg-info/PKG-INFO +599 -0
- luyh_equations-1.2.0/src/luyh_equations.egg-info/SOURCES.txt +44 -0
- luyh_equations-1.2.0/src/luyh_equations.egg-info/dependency_links.txt +1 -0
- luyh_equations-1.2.0/src/luyh_equations.egg-info/entry_points.txt +2 -0
- luyh_equations-1.2.0/src/luyh_equations.egg-info/requires.txt +7 -0
- luyh_equations-1.2.0/src/luyh_equations.egg-info/top_level.txt +1 -0
- luyh_equations-1.2.0/tests/test_analysis.py +51 -0
- luyh_equations-1.2.0/tests/test_engine.py +54 -0
- luyh_equations-1.2.0/tests/test_keys_and_operators.py +41 -0
- luyh_equations-1.2.0/tests/test_research.py +22 -0
- luyh_equations-1.2.0/tests/test_structure.py +20 -0
- luyh_equations-1.2.0/tests/test_traps.py +63 -0
- luyh_equations-1.2.0/tools/build_proof_pdf.py +662 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include SECURITY.md
|
|
4
|
+
recursive-include assets *.png
|
|
5
|
+
recursive-include docs *.md *.pdf *.json
|
|
6
|
+
recursive-include examples *.py
|
|
7
|
+
recursive-include benchmarks *.py *.json
|
|
8
|
+
recursive-include legacy *.py *.md
|
|
9
|
+
recursive-include tools *.py
|
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: luyh-equations
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: A native LUYH range-trap and exact-divisibility research engine
|
|
5
|
+
Author: CC
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Keywords: divisibility,range transform,cryptanalysis,experimental mathematics
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
17
|
+
Classifier: Topic :: Security :: Cryptography
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
26
|
+
Requires-Dist: ruff>=0.9; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=6.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src="https://res.cloudinary.com/vppzdwxg/image/upload/v1789855705/luyh-logo.png" alt="LUYH logo" width="260">
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<h1 align="center">LUYH Equations</h1>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
Complex palindrome rotation-variable equations<br>
|
|
38
|
+
Native range-transform and exact-divisibility research engine
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://pypi.org/project/luyh-equations/"><img alt="PyPI 1.2.0" src="https://img.shields.io/badge/PyPI-1.2.0-D4AF37?style=for-the-badge&labelColor=2B1B0E"></a>
|
|
43
|
+
<img alt="Python 3.10 through 3.13" src="https://img.shields.io/badge/Python-3.10%E2%80%933.13-F2C94C?style=for-the-badge&labelColor=3A2608">
|
|
44
|
+
<img alt="Mandatory native C engine" src="https://img.shields.io/badge/Engine-Native%20C-B8860B?style=for-the-badge&labelColor=2B1B0E">
|
|
45
|
+
<img alt="Production stable status" src="https://img.shields.io/badge/Status-Production%2FStable-E8B923?style=for-the-badge&labelColor=3A2608">
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
`luyh-equations` is a native-accelerated research implementation of CC / Cecil's
|
|
49
|
+
LUYH construction. It preserves the supplied equations and makes the original
|
|
50
|
+
`range_a` / `range_b` preprocessing explicit, testable, and reproducible.
|
|
51
|
+
|
|
52
|
+
> **Interpretation correction:** LUYH is *like* a prime-number expansion in the
|
|
53
|
+
> sense that a derived number is expanded into a larger exact multiplicative
|
|
54
|
+
> structure. LUYH is not based on prime numbers, does not require primality, and
|
|
55
|
+
> does not use a primality result to obtain `C % S == 0`.
|
|
56
|
+
|
|
57
|
+
The package is organized around two exact structures:
|
|
58
|
+
|
|
59
|
+
1. a **range trap** that maps an unconstrained four-symbol key into the
|
|
60
|
+
adjacent-distinct domain; and
|
|
61
|
+
2. a **divisibility construction** that embeds the LUYH summation `S` as an
|
|
62
|
+
explicit factor of the component `C`.
|
|
63
|
+
|
|
64
|
+
The native C extension is mandatory. Python calls use it automatically; there
|
|
65
|
+
is no silent pure-Python fallback.
|
|
66
|
+
|
|
67
|
+
## Central result
|
|
68
|
+
|
|
69
|
+
Let the LUYH window scores be `s_0, ..., s_(w-1)` and define
|
|
70
|
+
|
|
71
|
+
\[
|
|
72
|
+
S = \sum_t s_t, \qquad m = \min_t s_t, \qquad M = \max_t s_t.
|
|
73
|
+
\]
|
|
74
|
+
|
|
75
|
+
The supplied final expression is exactly
|
|
76
|
+
|
|
77
|
+
\[
|
|
78
|
+
C = S n^2 M^2 m(n+m).
|
|
79
|
+
\]
|
|
80
|
+
|
|
81
|
+
Therefore, whenever `S != 0`,
|
|
82
|
+
|
|
83
|
+
\[
|
|
84
|
+
C \bmod S = 0,
|
|
85
|
+
\qquad
|
|
86
|
+
\frac{C}{S}=n^2M^2m(n+m).
|
|
87
|
+
\]
|
|
88
|
+
|
|
89
|
+
The zero remainder is a constructed divisibility certificate. It is neither a
|
|
90
|
+
coincidence nor a test of whether any value is prime.
|
|
91
|
+
|
|
92
|
+
## The original range trap
|
|
93
|
+
|
|
94
|
+
The supplied driver defines:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
range_a = 2035
|
|
98
|
+
range_b = range_a - 1
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Their roles are different:
|
|
102
|
+
|
|
103
|
+
| Parameter | Exact role |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `range_a = A` | Number of raw symbols generated; the key length |
|
|
106
|
+
| `range_b = B` | Number of adjacent pairs inspected from left to right |
|
|
107
|
+
|
|
108
|
+
The significant object is the ordered pair `(range_a, range_b)`, especially
|
|
109
|
+
the complete setting `B = A - 1`. The arithmetic sum `range_a + range_b` is not
|
|
110
|
+
inserted into the LUYH equation.
|
|
111
|
+
|
|
112
|
+
For each inspected pair, an equal next symbol is replaced according to the
|
|
113
|
+
original code:
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
11 -> 12
|
|
117
|
+
22 -> 21
|
|
118
|
+
33 -> 32
|
|
119
|
+
44 -> 43
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The pass is sequential, so a replacement becomes the left symbol for the next
|
|
123
|
+
comparison.
|
|
124
|
+
|
|
125
|
+
### What is proved about the trap
|
|
126
|
+
|
|
127
|
+
For alphabet `{1,2,3,4}`, key length `A`, and `0 <= B < A`:
|
|
128
|
+
|
|
129
|
+
- the first `B` adjacent pairs are unequal after one pass;
|
|
130
|
+
- applying the same trap again makes no further change (idempotence);
|
|
131
|
+
- the exact image size is
|
|
132
|
+
|
|
133
|
+
\[
|
|
134
|
+
4\,3^B\,4^{A-B-1};
|
|
135
|
+
\]
|
|
136
|
+
|
|
137
|
+
- the raw domain size is `4^A`;
|
|
138
|
+
- the average raw preimage multiplicity is
|
|
139
|
+
|
|
140
|
+
\[
|
|
141
|
+
(4/3)^B;
|
|
142
|
+
\]
|
|
143
|
+
|
|
144
|
+
- the largest possible raw preimage bucket contains exactly
|
|
145
|
+
|
|
146
|
+
\[
|
|
147
|
+
2^B
|
|
148
|
+
\]
|
|
149
|
+
|
|
150
|
+
keys, and this maximum is attainable; and
|
|
151
|
+
|
|
152
|
+
- the image entropy ceiling is
|
|
153
|
+
|
|
154
|
+
\[
|
|
155
|
+
2A-B(2-\log_2 3)\text{ bits}.
|
|
156
|
+
\]
|
|
157
|
+
|
|
158
|
+
With the original complete trap, `B=A-1`, the image is precisely the set of
|
|
159
|
+
adjacent-distinct keys and contains
|
|
160
|
+
|
|
161
|
+
\[
|
|
162
|
+
4\,3^{A-1}
|
|
163
|
+
\]
|
|
164
|
+
|
|
165
|
+
members.
|
|
166
|
+
|
|
167
|
+
At `A=2035`, `B=2034`, the raw domain has 4,070 bits of index capacity while
|
|
168
|
+
the trapped image has an entropy ceiling of approximately 3,225.814 bits. The
|
|
169
|
+
finite-domain contraction is approximately 844.186 bits. This is a structural
|
|
170
|
+
property of the preprocessing, not a claim that the resulting bits are uniform
|
|
171
|
+
or cryptographically random.
|
|
172
|
+
|
|
173
|
+
## How the two structures compose
|
|
174
|
+
|
|
175
|
+
```mermaid
|
|
176
|
+
flowchart TD
|
|
177
|
+
R["Raw key: 4^A domain"] --> T["Range trap: B comparisons"]
|
|
178
|
+
T --> K["Adjacent-constrained key"]
|
|
179
|
+
K --> E["Unchanged LUYH equations"]
|
|
180
|
+
E --> S["Window scores and summation S"]
|
|
181
|
+
S --> C["C = S n^2 M^2 m(n+m)"]
|
|
182
|
+
C --> Z["Certificate: C % S = 0"]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The range trap determines which constrained key reaches the equations. The
|
|
186
|
+
equations determine `S`, `m`, and `M`. The final multiplication then guarantees
|
|
187
|
+
the zero remainder. `range_a` and `range_b` shape the input path, but the direct
|
|
188
|
+
algebraic reason for `% = 0` is the explicit factor `S` in `C`.
|
|
189
|
+
|
|
190
|
+
## Cryptographic research significance
|
|
191
|
+
|
|
192
|
+
The proved significance is structural:
|
|
193
|
+
|
|
194
|
+
- **Finite-domain projection:** `(A,B)` defines an exact constrained image and
|
|
195
|
+
a measurable many-to-one preimage structure.
|
|
196
|
+
- **Canonicalization:** a complete trapped key is a fixed point of the trap.
|
|
197
|
+
- **Deterministic certificate:** `C % S == 0` verifies the exact multiplicative
|
|
198
|
+
relationship whenever `S != 0`.
|
|
199
|
+
- **Parameter sensitivity:** changing `A`, `B`, or `n` changes the constrained
|
|
200
|
+
domain, window schedule, and resulting certificate transcript.
|
|
201
|
+
- **Reproducibility:** key hashes, trap statistics, native build metadata, and
|
|
202
|
+
full scores can be recorded for independent experiments.
|
|
203
|
+
|
|
204
|
+
Those properties make LUYH relevant to cryptographic analysis of constrained
|
|
205
|
+
domains and verifiable arithmetic relations. They do **not**, by themselves,
|
|
206
|
+
prove that LUYH is a trapdoor function, hash, key-derivation function,
|
|
207
|
+
encryption system, or one-way function. Any security use requires a separately
|
|
208
|
+
defined protocol and evidence for its security objective.
|
|
209
|
+
|
|
210
|
+
## Installation
|
|
211
|
+
|
|
212
|
+
### From a wheel
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
python -m pip install luyh_equations-1.2.0-<python>-<platform>.whl
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Wheels contain the compiled native extension. A wheel is specific to a Python
|
|
219
|
+
version and platform.
|
|
220
|
+
|
|
221
|
+
### From source
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
python -m pip install build
|
|
225
|
+
python -m build
|
|
226
|
+
python -m pip install dist/luyh_equations-1.2.0-*.whl
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
A C compiler and Python development headers are required when building from
|
|
230
|
+
source. The included CI workflow builds CPython 3.10-3.13 wheels for Linux,
|
|
231
|
+
macOS, and Windows.
|
|
232
|
+
|
|
233
|
+
## Python callable guide
|
|
234
|
+
|
|
235
|
+
Import from `luyh`; the Python frontend routes equation evaluation through the
|
|
236
|
+
mandatory compiled C extension. Choose a call according to the experiment you
|
|
237
|
+
intend to run:
|
|
238
|
+
|
|
239
|
+
| Callable | Use |
|
|
240
|
+
| --- | --- |
|
|
241
|
+
| `evaluate(key, n=5, *, audit_reference=False, verify_invariants=True)` | Evaluate the supplied LUYH equations directly, without the range trap. |
|
|
242
|
+
| `evaluate_trapped(key, n=5, *, range_b=None, audit_reference=False, verify_invariants=True)` | Apply the original range stage and then evaluate; this is the primary two-stage call. |
|
|
243
|
+
| `LuyhEngine(n=5, *, audit_reference=False, verify_invariants=True)` | Reuse one configured native engine for repeated or batch evaluation. |
|
|
244
|
+
| `evaluate_reference(key, n=5)` | Run the transparent Python audit oracle; use for verification, not performance. |
|
|
245
|
+
| `apply_range_trap(key, range_b=None)` | Return the trapped key only. |
|
|
246
|
+
| `range_trap_report(key, range_b=None)` | Measure changes, violations, image size, entropy ceiling, and hashes. |
|
|
247
|
+
| `generate_trapped_key(range_a, *, range_b=None, seed=20260919)` | Reproduce deterministic original-style key generation and trapping. |
|
|
248
|
+
| `divisibility_report(result)` | Verify and expose the constructed factors behind `C % S`. |
|
|
249
|
+
| `evaluate_research(key, options=None)` | Produce a complete JSON-serializable research record. |
|
|
250
|
+
| `range_domain_report(range_a, n=5, *, range_b=None, max_inputs=100_000)` | Exhaustively test a tractable trapped domain. |
|
|
251
|
+
| `influence_report(key, n=5, *, max_positions=128, positions=None)` | Measure selected one-symbol mutations. |
|
|
252
|
+
| `collision_report(key_length, n=5, *, max_inputs=100_000, projection="component")` | Exhaustively count outputs and collision buckets for a small domain. |
|
|
253
|
+
| `native_info()` | Return native ABI and build metadata for experiment logs. |
|
|
254
|
+
| `proof_resource()` | Yield a filesystem path to the proof PDF bundled in the installed wheel. |
|
|
255
|
+
| `validate_key()`, `translate_key_to_operators()` | Validate the four-symbol alphabet or inspect the original operator translation. |
|
|
256
|
+
| `effective_prefix_length()`, `ignored_suffix_length()` | Inspect the proved key-dependence bound for a chosen length and `n`. |
|
|
257
|
+
|
|
258
|
+
### Common arguments
|
|
259
|
+
|
|
260
|
+
| Argument | Meaning |
|
|
261
|
+
| --- | --- |
|
|
262
|
+
| `key` | A nonempty `str` or `int` containing only `1`, `2`, `3`, and `4`; strings preserve leading symbols and are preferred. |
|
|
263
|
+
| `n` | Positive pair-grid depth. Larger values increase work and memory rapidly. |
|
|
264
|
+
| `range_b` | Number of adjacent pairs processed. `None` selects the original complete setting `len(key) - 1`; valid explicit values satisfy `0 <= range_b < len(key)`. |
|
|
265
|
+
| `audit_reference` | Also run the Python oracle and require exact score-vector equality with the native result. This is intentionally slower. |
|
|
266
|
+
| `verify_invariants` | Check window count, the supplied component expression, and the divisibility invariant after native evaluation. Keep enabled for normal research. |
|
|
267
|
+
|
|
268
|
+
### Reading evaluation results
|
|
269
|
+
|
|
270
|
+
`evaluate()` returns an immutable `LuyhResult`. `evaluate_trapped()` returns a
|
|
271
|
+
`TrappedEvaluation` containing the trapped key, a `RangeTrapReport`, and the
|
|
272
|
+
same `LuyhResult` under `.evaluation`.
|
|
273
|
+
|
|
274
|
+
| `LuyhResult` field | Meaning |
|
|
275
|
+
| --- | --- |
|
|
276
|
+
| `window_scores` | Ordered integer score for every nonempty symmetric window. |
|
|
277
|
+
| `summation` | `S`, the sum of all window scores. |
|
|
278
|
+
| `minimum`, `maximum` | `m` and `M` from the score vector. |
|
|
279
|
+
| `component` | `C`, calculated by the supplied final expression. |
|
|
280
|
+
| `modulus` | `C % S`, or `None` when `S == 0`. |
|
|
281
|
+
| `cofactor` | `C // S`, or `None` when `S == 0`. |
|
|
282
|
+
| `root_condition` | True exactly when the defined modulus is zero. |
|
|
283
|
+
| `backend` | Native backend identifier recorded with the result. |
|
|
284
|
+
|
|
285
|
+
Every report object implements `.as_dict()`. `LuyhResult.as_dict()` accepts
|
|
286
|
+
`include_scores=False` when a compact record is preferred.
|
|
287
|
+
|
|
288
|
+
### Reusing the native engine
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
from luyh import LuyhEngine
|
|
292
|
+
|
|
293
|
+
engine = LuyhEngine(n=3, audit_reference=False, verify_invariants=True)
|
|
294
|
+
results = engine.evaluate_many([
|
|
295
|
+
"123412341",
|
|
296
|
+
"214321432",
|
|
297
|
+
"341234123",
|
|
298
|
+
])
|
|
299
|
+
|
|
300
|
+
print(engine.cache_info)
|
|
301
|
+
print(engine.native_info)
|
|
302
|
+
print([result.component for result in results])
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Per-call overrides are also available:
|
|
306
|
+
|
|
307
|
+
```python
|
|
308
|
+
result = engine.evaluate(
|
|
309
|
+
"123412341",
|
|
310
|
+
audit_reference=True,
|
|
311
|
+
verify_invariants=True,
|
|
312
|
+
)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### JSON research output
|
|
316
|
+
|
|
317
|
+
```python
|
|
318
|
+
import json
|
|
319
|
+
|
|
320
|
+
from luyh import ResearchOptions, evaluate_research
|
|
321
|
+
|
|
322
|
+
record = evaluate_research(
|
|
323
|
+
"1111222333444",
|
|
324
|
+
ResearchOptions(
|
|
325
|
+
n=3,
|
|
326
|
+
apply_range_trap=True,
|
|
327
|
+
range_b=None,
|
|
328
|
+
audit_reference=True,
|
|
329
|
+
verify_invariants=True,
|
|
330
|
+
include_influence=True,
|
|
331
|
+
max_influence_positions=128,
|
|
332
|
+
seed=20260919,
|
|
333
|
+
),
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
print(json.dumps(record, indent=2, sort_keys=True))
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
`ResearchOptions.apply_range_trap=False` intentionally bypasses preprocessing.
|
|
340
|
+
`seed` is provenance metadata for a research record; it does not randomize
|
|
341
|
+
`evaluate_research()` itself.
|
|
342
|
+
|
|
343
|
+
## Quick start: original two-stage path
|
|
344
|
+
|
|
345
|
+
```python
|
|
346
|
+
from luyh import divisibility_report, evaluate_trapped
|
|
347
|
+
|
|
348
|
+
run = evaluate_trapped(
|
|
349
|
+
"1111222333444",
|
|
350
|
+
n=3,
|
|
351
|
+
audit_reference=True,
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
print(run.trapped_key)
|
|
355
|
+
print(run.trap.range_a)
|
|
356
|
+
print(run.trap.range_b)
|
|
357
|
+
print(run.trap.changed_symbols)
|
|
358
|
+
|
|
359
|
+
result = run.evaluation
|
|
360
|
+
structure = divisibility_report(result)
|
|
361
|
+
|
|
362
|
+
print(result.summation) # S
|
|
363
|
+
print(result.component) # C
|
|
364
|
+
print(result.modulus) # C % S
|
|
365
|
+
print(result.cofactor) # C // S
|
|
366
|
+
print(structure.identity_holds)
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
`evaluate_trapped()` applies `range_b = range_a - 1` by default, matching the
|
|
370
|
+
original driver. Supply a smaller `range_b` for a partial trap.
|
|
371
|
+
|
|
372
|
+
## Direct equation evaluation
|
|
373
|
+
|
|
374
|
+
The equations can also be evaluated without preprocessing:
|
|
375
|
+
|
|
376
|
+
```python
|
|
377
|
+
from luyh import evaluate
|
|
378
|
+
|
|
379
|
+
result = evaluate("123412341", n=3, audit_reference=True)
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
This distinction is explicit: `evaluate()` evaluates the equations, while
|
|
383
|
+
`evaluate_trapped()` reproduces the range stage and then evaluates them.
|
|
384
|
+
|
|
385
|
+
## Range APIs
|
|
386
|
+
|
|
387
|
+
### Apply and inspect a trap
|
|
388
|
+
|
|
389
|
+
```python
|
|
390
|
+
from luyh import apply_range_trap, range_trap_report
|
|
391
|
+
|
|
392
|
+
raw = "1111222333444"
|
|
393
|
+
trapped = apply_range_trap(raw)
|
|
394
|
+
report = range_trap_report(raw)
|
|
395
|
+
|
|
396
|
+
assert report.range_b == report.range_a - 1
|
|
397
|
+
assert report.trapped_prefix_violations_after == 0
|
|
398
|
+
assert report.idempotent
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Deterministic original-style generation
|
|
402
|
+
|
|
403
|
+
```python
|
|
404
|
+
from luyh import generate_trapped_key
|
|
405
|
+
|
|
406
|
+
key = generate_trapped_key(
|
|
407
|
+
range_a=2035,
|
|
408
|
+
range_b=2034,
|
|
409
|
+
seed=20260919,
|
|
410
|
+
)
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Exhaustive small-domain verification
|
|
414
|
+
|
|
415
|
+
```python
|
|
416
|
+
from luyh import range_domain_report
|
|
417
|
+
|
|
418
|
+
report = range_domain_report(
|
|
419
|
+
range_a=7,
|
|
420
|
+
range_b=6,
|
|
421
|
+
n=2,
|
|
422
|
+
max_inputs=20_000,
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
assert report.raw_inputs == 4**7
|
|
426
|
+
assert report.distinct_trapped_keys == 4 * 3**6
|
|
427
|
+
assert report.distinct_trapped_keys == report.theoretical_trapped_keys
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
## Research records
|
|
431
|
+
|
|
432
|
+
```python
|
|
433
|
+
from luyh import ResearchOptions, evaluate_research
|
|
434
|
+
|
|
435
|
+
record = evaluate_research(
|
|
436
|
+
"1111222333444",
|
|
437
|
+
ResearchOptions(
|
|
438
|
+
n=3,
|
|
439
|
+
apply_range_trap=True,
|
|
440
|
+
range_b=None,
|
|
441
|
+
audit_reference=True,
|
|
442
|
+
verify_invariants=True,
|
|
443
|
+
include_influence=True,
|
|
444
|
+
max_influence_positions=128,
|
|
445
|
+
seed=20260919,
|
|
446
|
+
),
|
|
447
|
+
)
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
The version-2 research record contains:
|
|
451
|
+
|
|
452
|
+
- raw-key SHA-256 fingerprint;
|
|
453
|
+
- `range_a`, `range_b`, changed-symbol count, image formula, and compression;
|
|
454
|
+
- full LUYH score vector and summary values;
|
|
455
|
+
- exact divisibility structure and cofactor;
|
|
456
|
+
- native backend and environment provenance;
|
|
457
|
+
- optional one-symbol influence measurements.
|
|
458
|
+
|
|
459
|
+
No primality assumption is present in the record schema.
|
|
460
|
+
|
|
461
|
+
## Command-line interface
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
# Original two-stage path: complete range trap, then LUYH
|
|
465
|
+
luyh evaluate 1111222333444 -n 3 --scores
|
|
466
|
+
|
|
467
|
+
# Machine-readable record
|
|
468
|
+
luyh evaluate 1111222333444 -n 3 --json
|
|
469
|
+
|
|
470
|
+
# Partial range trap
|
|
471
|
+
luyh evaluate 1111222333444 -n 3 --range-b 5 --json
|
|
472
|
+
|
|
473
|
+
# Bypass preprocessing and evaluate only the equations
|
|
474
|
+
luyh evaluate 1111222333444 -n 3 --raw-key --json
|
|
475
|
+
|
|
476
|
+
# Exhaustive range trap study
|
|
477
|
+
luyh range-study 7 -n 2 --range-b 6 --max-inputs 20000 --json
|
|
478
|
+
|
|
479
|
+
# Influence and collision diagnostics
|
|
480
|
+
luyh influence 12341234123412341 -n 3 --json
|
|
481
|
+
luyh collisions 7 -n 2 --projection component --json
|
|
482
|
+
|
|
483
|
+
# Native/reference benchmark
|
|
484
|
+
luyh benchmark --length 2035 -n 5 --repeats 5 --seed 20260919 --json
|
|
485
|
+
|
|
486
|
+
# Compiled backend metadata and bundled proof
|
|
487
|
+
luyh native-info
|
|
488
|
+
luyh proof
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
The CLI applies the complete range trap by default for `evaluate`, `influence`,
|
|
492
|
+
and `batch`. Use `--raw-key` only when intentionally studying the equation core
|
|
493
|
+
without the original preprocessing.
|
|
494
|
+
|
|
495
|
+
## Empirical results
|
|
496
|
+
|
|
497
|
+
All recorded experiments are deterministic and stored in
|
|
498
|
+
`docs/EMPIRICAL_RESULTS.json`.
|
|
499
|
+
|
|
500
|
+
| Experiment | Verified result |
|
|
501
|
+
| --- | ---: |
|
|
502
|
+
| Complete trap, `A=7`, `B=6` | 16,384 raw keys -> 2,916 trapped keys |
|
|
503
|
+
| Theoretical image at `A=7`, `B=6` | `4 * 3^6 = 2,916` |
|
|
504
|
+
| Largest observed trap bucket | 64 raw keys |
|
|
505
|
+
| Same exhaustive domain, `n=2` | 53 distinct components |
|
|
506
|
+
| Defined modulus cases | every result had `C % S = 0` |
|
|
507
|
+
| Seeded original scale, `A=2035` | 479 adjacent repeats detected; 472 symbols changed |
|
|
508
|
+
| Original-scale trap result | zero adjacent violations; idempotent |
|
|
509
|
+
| Original-scale LUYH result, `n=5` | 1,018 scores, `S=570,294`, `C % S=0` |
|
|
510
|
+
|
|
511
|
+
For the complete `A=7` trap, increasing `B` from 0 through 6 produced exactly
|
|
512
|
+
the predicted image sizes:
|
|
513
|
+
|
|
514
|
+
```text
|
|
515
|
+
B: 0 1 2 3 4 5 6
|
|
516
|
+
distinct outputs: 16384 12288 9216 6912 5184 3888 2916
|
|
517
|
+
largest bucket: 1 2 4 8 16 32 64
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
This confirms that `range_b` is an active domain-contraction parameter rather
|
|
521
|
+
than an unused loop constant.
|
|
522
|
+
|
|
523
|
+
## Native performance
|
|
524
|
+
|
|
525
|
+
The mandatory C extension owns window traversal, ordered de-duplication,
|
|
526
|
+
caching, and set orchestration while preserving CPython numerical semantics.
|
|
527
|
+
The recorded `A=2035`, `n=5` benchmark measured:
|
|
528
|
+
|
|
529
|
+
| Engine | Median time |
|
|
530
|
+
| --- | ---: |
|
|
531
|
+
| Transparent Python reference | 1.899302 s |
|
|
532
|
+
| Mandatory native core | 0.126996 s |
|
|
533
|
+
| Median speedup | **14.96x** |
|
|
534
|
+
|
|
535
|
+
The range trap itself is linear in `range_b`; its recorded original-scale pass
|
|
536
|
+
took approximately 0.00022 seconds on the benchmark system.
|
|
537
|
+
|
|
538
|
+
Performance figures describe that environment and are not universal.
|
|
539
|
+
|
|
540
|
+
## Limits
|
|
541
|
+
|
|
542
|
+
- Keys use only `1`, `2`, `3`, and `4`.
|
|
543
|
+
- `MAX_KEY_LENGTH = 1_048_576` symbols in both Python and C.
|
|
544
|
+
- Inputs above the limit are rejected; they are never truncated.
|
|
545
|
+
- `range_b` must satisfy `0 <= range_b < range_a`.
|
|
546
|
+
- `n` must be positive. Large `n` increases pair grids and memory use rapidly.
|
|
547
|
+
- If `S == 0`, `C % S` is undefined and reported as `None`.
|
|
548
|
+
|
|
549
|
+
## Source fidelity
|
|
550
|
+
|
|
551
|
+
The range layer reproduces the original driver separately from the equation
|
|
552
|
+
engine. Version 1.2.0 does **not** change:
|
|
553
|
+
|
|
554
|
+
- the `1 -> L`, `2 -> U`, `3 -> Y`, `4 -> H` mapping;
|
|
555
|
+
- pair construction or rotation;
|
|
556
|
+
- recursive level ordering;
|
|
557
|
+
- reassembly or finishing functions;
|
|
558
|
+
- symmetric window scores;
|
|
559
|
+
- `S`, `m`, `M`, or the final `C` expression;
|
|
560
|
+
- the mandatory C evaluator's numerical behavior.
|
|
561
|
+
|
|
562
|
+
`legacy/luyh_original.py` remains the normalized copy of the supplied source.
|
|
563
|
+
The reference evaluator and native evaluator can still be required to match
|
|
564
|
+
score for score with `audit_reference=True`.
|
|
565
|
+
|
|
566
|
+
## Project layout
|
|
567
|
+
|
|
568
|
+
```text
|
|
569
|
+
src/luyh/_native.c mandatory CPython extension
|
|
570
|
+
src/luyh/engine.py unchanged LUYH equation evaluation
|
|
571
|
+
src/luyh/traps.py range_a / range_b trap model
|
|
572
|
+
src/luyh/structure.py exact divisibility report
|
|
573
|
+
src/luyh/analysis.py range, collision, and influence studies
|
|
574
|
+
src/luyh/research.py versioned reproducible records
|
|
575
|
+
src/luyh/cli.py command-line frontend
|
|
576
|
+
assets/luyh-logo.png transparent README logo master
|
|
577
|
+
docs/ proof, assessment, and experiment records
|
|
578
|
+
tests/ native, trap, identity, and API tests
|
|
579
|
+
legacy/ supplied source preserved for audit
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
## Proof document
|
|
583
|
+
|
|
584
|
+
The wheel contains `docs/LUYH_EQUATIONS_PROOF.pdf`. The paper formally proves:
|
|
585
|
+
|
|
586
|
+
- the partial and complete range-trap theorems;
|
|
587
|
+
- idempotence and exact image cardinality;
|
|
588
|
+
- average and maximum preimage behavior;
|
|
589
|
+
- the exact LUYH divisibility identity;
|
|
590
|
+
- the correct interpretation of `C % S == 0`;
|
|
591
|
+
- the boundary between structural cryptographic importance and an unproved
|
|
592
|
+
security property.
|
|
593
|
+
|
|
594
|
+
## Status and license
|
|
595
|
+
|
|
596
|
+
This is a stable research release for reproducible mathematical and
|
|
597
|
+
cryptanalytic investigation. It is not a production security primitive.
|
|
598
|
+
|
|
599
|
+
Copyright (c) 2026 CC / Cecil. All rights reserved. See `LICENSE`.
|