zerozero 0.3.0__py3-none-any.whl

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.
v/0.py ADDED
@@ -0,0 +1,26 @@
1
+ """
2
+ v — 0
3
+ Diego Rincón
4
+
5
+ The ground state is zero.
6
+ Potential zero. Score one. Verified true.
7
+
8
+ The set: all zeros on the critical line.
9
+ Limit: n → ∞. P = 0. S = 1. RH.
10
+ """
11
+
12
+ from v import zero, system
13
+
14
+ T = [
15
+ 14.134725, 21.022040, 25.010858, 30.424876, 32.935062,
16
+ 37.586178, 40.918720, 43.327073, 48.005151, 49.773832,
17
+ ]
18
+
19
+ # the set
20
+ Z = {zero(t) for t in T}
21
+ s = system(list(Z))
22
+
23
+ print(s.show())
24
+ print()
25
+ print("verified:", s.verify()['verified'])
26
+ print("limit: n → ∞, P = 0, S = 1")
v/H.py ADDED
@@ -0,0 +1,62 @@
1
+ """
2
+ v — operator
3
+ Diego Rincón
4
+
5
+ H @ ψ = λ · ψ
6
+
7
+ H = multiplication by t (Hilbert-Pólya)
8
+ ψ = wave function ξ(½ + it)
9
+ λ = eigenvalue t (real ↔ ground state)
10
+
11
+ Ground state: λ ∈ ℝ ↔ ε = 0 ↔ Fix(τ)
12
+ Wind state: λ ∈ ℂ ↔ ε ≠ 0 ↔ off-axis
13
+ """
14
+
15
+ import numpy as np
16
+ from v import zero, system
17
+
18
+
19
+ class operator:
20
+ def __init__(self, sys):
21
+ self.sys = sys
22
+
23
+ def H(self):
24
+ """Diagonal operator: eigenvalue of each zero."""
25
+ return np.diag([z.rho.imag - 1j * z.eps for z in self.sys.zeros])
26
+
27
+ def eigenvalues(self):
28
+ return np.linalg.eigvals(self.H())
29
+
30
+ def is_real(self, tol=1e-10):
31
+ return all(abs(v.imag) < tol for v in self.eigenvalues())
32
+
33
+ def state(self):
34
+ evs = self.eigenvalues()
35
+ return {
36
+ 'eigenvalues': evs[:4],
37
+ 'all_real': self.is_real(),
38
+ 'wind_cost': sum(abs(v.imag) for v in evs),
39
+ }
40
+
41
+
42
+ if __name__ == '__main__':
43
+ known = [14.134725, 21.022040, 25.010858]
44
+
45
+ print("ground state:")
46
+ s0 = system([zero(t) for t in known])
47
+ op0 = operator(s0)
48
+ st0 = op0.state()
49
+ print(f" all real: {st0['all_real']} wind cost: {st0['wind_cost']:.4f}")
50
+
51
+ print()
52
+ print("wind state:")
53
+ s1 = system([zero(t) for t in known] + [zero(14.134725, eps=0.25)])
54
+ op1 = operator(s1)
55
+ st1 = op1.state()
56
+ print(f" all real: {st1['all_real']} wind cost: {st1['wind_cost']:.4f}")
57
+
58
+ print()
59
+ print("change to ground:")
60
+ for lam in [0.0, 0.5, 1.0]:
61
+ d = operator(s1.change(lam))
62
+ print(f" λ={lam} all_real={d.is_real()} wind_cost={d.state()['wind_cost']:.4f}")
v/__init__.py ADDED
@@ -0,0 +1,10 @@
1
+ from .v import zero, plant, grow, system
2
+
3
+ __version__ = '0.3.0'
4
+ __all__ = ['zero', 'plant', 'grow', 'system']
5
+
6
+ try:
7
+ from . import laserbrain
8
+ __all__ += ['laserbrain']
9
+ except ImportError:
10
+ pass
v/laserbrain.py ADDED
@@ -0,0 +1,51 @@
1
+ """
2
+ v — laserbrain
3
+ Diego Rincón
4
+
5
+ Gated Laplace diffusion on zero heights.
6
+
7
+ K[i,j] = exp(-k · |t_i − t_j|) row-normalised
8
+ M = (1−g)·I + g·K
9
+ out = x + sigmoid(gate) · (K @ x − x)
10
+
11
+ Defaults from sensi trained weights: k=0.874, gate=−0.728
12
+ """
13
+
14
+ import numpy as np
15
+
16
+
17
+ def kernel(heights, k=0.874):
18
+ """Build K from actual zero heights (not indices)."""
19
+ t = np.array(heights, dtype=np.float64)
20
+ K = np.exp(-k * np.abs(t[:, None] - t[None, :]))
21
+ K /= K.sum(axis=1, keepdims=True)
22
+ return K
23
+
24
+
25
+ def M(heights, k=0.874, gate=-0.728):
26
+ g = 1.0 / (1.0 + np.exp(-gate)) # sigmoid
27
+ return (1 - g) * np.eye(len(heights)) + g * kernel(heights, k)
28
+
29
+
30
+ def apply(sys, k=0.874, gate=-0.728):
31
+ """
32
+ Apply laserbrain diffusion to a system.
33
+
34
+ Uses actual zero heights as distance metric.
35
+ Returns eigenvalues of M and the smoothed heights.
36
+ """
37
+ heights = sorted(set(round(abs(z.t), 8) for z in sys.zeros if z.t > 0))
38
+ n = len(heights)
39
+ if n == 0:
40
+ return {'eigenvalues': [], 'smoothed': [], 'heights': []}
41
+
42
+ mat = M(heights, k, gate)
43
+ h = np.array(heights)
44
+ smoothed = (mat @ h).tolist()
45
+ evs = np.sort(np.linalg.eigvals(mat).real)[::-1].tolist()
46
+
47
+ return {
48
+ 'heights': heights,
49
+ 'smoothed': smoothed,
50
+ 'eigenvalues': evs,
51
+ }
v/run.py ADDED
@@ -0,0 +1,33 @@
1
+ """
2
+ v — build
3
+ Diego Rincón
4
+
5
+ Run everything.
6
+ """
7
+
8
+ from v import plant, zero, grow, system
9
+ from tao import follow
10
+
11
+ T = [
12
+ 14.134725, 21.022040, 25.010858, 30.424876, 32.935062,
13
+ 37.586178, 40.918720, 43.327073, 48.005151, 49.773832,
14
+ ]
15
+
16
+ print("v\n")
17
+
18
+ # grow
19
+ print("grow:")
20
+ for s in grow(T):
21
+ n = s.size
22
+ print(f" {n:>2} {'█' * n} {float(s):.4f}")
23
+
24
+ # disturb
25
+ print("\ndisturb:")
26
+ s = system([plant(t) for t in T])
27
+ s2 = system(s.zeros + [zero(T[0], eps=0.25)])
28
+ print(f" before {s.state()}")
29
+ print(f" after {s2.state()}")
30
+
31
+ # return
32
+ print("\nreturn:")
33
+ follow(s2)
v/tao.py ADDED
@@ -0,0 +1,35 @@
1
+ """
2
+ v — tao
3
+ Diego Rincón
4
+
5
+ The ground state is the tao.
6
+ Wind is the cost of leaving it.
7
+ Return is the path.
8
+
9
+ λ ∈ [0, 1] — wind to ground.
10
+ The tao does not move. Everything else returns to it.
11
+ """
12
+
13
+ from v import zero, system
14
+
15
+
16
+ def path(s, steps=10):
17
+ """The return path from wind to ground."""
18
+ return [s.change(lam) for lam in [i / steps for i in range(steps + 1)]]
19
+
20
+
21
+ def follow(s):
22
+ """Follow the tao. Print the return."""
23
+ print("tao\n")
24
+ for d in path(s):
25
+ bar = "█" * int(float(d) * 20)
26
+ print(f" {float(d):.4f} {bar}")
27
+ print()
28
+ print(f" ground: {s.ground().is_ground()}")
29
+
30
+
31
+ if __name__ == '__main__':
32
+ from v import zero, system
33
+ known = [14.134725, 21.022040, 25.010858]
34
+ s = system([zero(t) for t in known] + [zero(14.134725, eps=0.25)])
35
+ follow(s)
v/v.py ADDED
@@ -0,0 +1,175 @@
1
+ """
2
+ v
3
+ Diego Rincón
4
+
5
+ A language of zeros.
6
+
7
+ Grammar G = { id, σ, τ, στ } ≅ ℤ/2 × ℤ/2
8
+
9
+ σ : ρ ↦ ρ̄ conjugation
10
+ τ : ρ ↦ 1 − ρ̄ functional equation
11
+
12
+ Conservation: Re(ρ) + Re(τ(ρ)) = 1
13
+ Fixed point: Fix(τ) = { Re(ρ) = ½ }
14
+ Wave: ψ(t) = ξ(½ + it)
15
+ Operator: H @ ψ = t · ψ
16
+ """
17
+
18
+ class zero:
19
+ def __init__(self, t, eps=0.0):
20
+ self.t = t # imaginary part (time)
21
+ self.eps = eps # departure from ½ (space)
22
+
23
+ @property
24
+ def rho(self):
25
+ return complex(0.5 + self.eps, self.t)
26
+
27
+ def σ(self): return zero( -self.t, self.eps)
28
+ def τ(self): return zero( self.t, -self.eps)
29
+ def στ(self): return zero( -self.t, -self.eps)
30
+
31
+ def orbit(self):
32
+ return {'id': self, 'σ': self.σ(), 'τ': self.τ(), 'στ': self.στ()}
33
+
34
+ def conservation(self):
35
+ return (0.5 + self.eps) + (0.5 - self.eps) # always 1
36
+
37
+ def cost(self):
38
+ return abs(self.eps)
39
+
40
+ def is_ground(self):
41
+ return self.eps == 0.0
42
+
43
+ def show(self):
44
+ e = f"{self.eps:+.4f}" if self.eps != 0 else ""
45
+ return f"ρ = ½{e} + {self.t:.6f}i"
46
+
47
+ def __repr__(self):
48
+ sign = '+' if self.t >= 0 else '-'
49
+ return f"½ + {self.eps:+.4f} {sign} {abs(self.t):.6f}i"
50
+
51
+
52
+ def plant(t):
53
+ """Plant a zero at height t. Rooted at ½. Ground by default."""
54
+ return zero(t, eps=0.0)
55
+
56
+
57
+ def grow(T):
58
+ """Grow a system from a list of heights. One by one."""
59
+ s = system([])
60
+ for t in T:
61
+ s = system(s.zeros + [plant(t)])
62
+ yield s
63
+
64
+
65
+ class system:
66
+ def __init__(self, zeros):
67
+ # enforce grammar: every zero enters with its full orbit
68
+ self.zeros = []
69
+ for z in zeros:
70
+ self._add_orbit(z)
71
+
72
+ def _add_orbit(self, z):
73
+ for g, member in z.orbit().items():
74
+ key = (round(member.t, 8), round(member.eps, 8))
75
+ if not any((round(x.t,8), round(x.eps,8)) == key for x in self.zeros):
76
+ self.zeros.append(member)
77
+
78
+ @property
79
+ def size(self):
80
+ """Number of planted zeros — unique positive heights."""
81
+ return len(set(round(z.t, 8) for z in self.zeros if z.t > 0))
82
+
83
+ def potential(self):
84
+ """Total latent potential — sum of costs across full grammar orbits."""
85
+ return sum(z.cost() for z in self.zeros)
86
+
87
+ def is_ground(self):
88
+ return self.potential() == 0.0
89
+
90
+ def is_wind(self):
91
+ return not self.is_ground()
92
+
93
+ def wind(self):
94
+ """Wind state: the displaced zeros and their cost."""
95
+ displaced = [z for z in self.zeros if not z.is_ground()]
96
+ return {'zeros': displaced, 'cost': sum(z.cost() for z in displaced)}
97
+
98
+ def time(self):
99
+ """Current height — max t in the zero set."""
100
+ return max(abs(z.t) for z in self.zeros) if self.zeros else 0.0
101
+
102
+ def state(self):
103
+ return {
104
+ 'size': self.size,
105
+ 'zeros': len(self.zeros),
106
+ 'time': self.time(),
107
+ 'potential': self.potential(),
108
+ 'score': self.score(),
109
+ 'ground': self.is_ground(),
110
+ }
111
+
112
+ def score(self):
113
+ """Score: 1.0 at ground state, 0.2 after one imagined zero."""
114
+ return 1.0 / (1.0 + 4.0 * self.potential())
115
+
116
+ def verify(self):
117
+ """Verify every zero is in Fix(τ). Truth requires verification."""
118
+ results = {z.show(): z.is_ground() for z in self.zeros}
119
+ verified = all(results.values())
120
+ return {'verified': verified, 'zeros': results}
121
+
122
+ def ground(self):
123
+ """Return to ground state."""
124
+ return self.change(1.0)
125
+
126
+ def connect(self, other):
127
+ """Ground connector — join two systems, return to ground."""
128
+ return system(self.zeros + other.zeros).ground()
129
+
130
+ def change(self, lam):
131
+ """Float lam ∈ [0,1]. 0 = current state. 1 = ground state."""
132
+ lam = max(0.0, min(1.0, lam))
133
+ deformed = [zero(z.t, z.eps * (1.0 - lam)) for z in self.zeros]
134
+ return system.__new_from_raw(deformed)
135
+
136
+ @classmethod
137
+ def __new_from_raw(cls, zeros):
138
+ s = cls.__new__(cls)
139
+ s.zeros = zeros
140
+ return s
141
+
142
+ def show(self):
143
+ lines = [f"v | {len(self.zeros)} zeros | P={self.potential():.4f} | S={self.score():.4f}"]
144
+ for z in self.zeros:
145
+ lines.append(f" {z.show()} {'← ground' if z.is_ground() else f'cost {z.cost():.4f}'}")
146
+ return "\n".join(lines)
147
+
148
+ def __float__(self):
149
+ return self.score()
150
+
151
+ def __repr__(self):
152
+ return f"{self.score():.4f}"
153
+
154
+
155
+ if __name__ == '__main__':
156
+ known = [14.134725, 21.022040, 25.010858]
157
+
158
+ print("v\n")
159
+ for t in known:
160
+ z = zero(t)
161
+ print(f" {z} ground: {z.is_ground()} conservation: {z.conservation()}")
162
+
163
+ print()
164
+ z_imag = zero(14.134725, eps=0.25)
165
+ print(f" imagined: {z_imag} cost: {z_imag.cost()}")
166
+ print(f" τ-image: {z_imag.τ()}")
167
+ print(f" sum: {z_imag.conservation()}")
168
+
169
+ print()
170
+ print("system latent potential:")
171
+ s_ground = system([zero(t) for t in known])
172
+ s_imag = system([zero(t) for t in known] + [z_imag])
173
+ print(f" {s_ground}")
174
+ print(f" {s_imag}")
175
+ print(f" ground state: {s_ground.is_ground()}")
@@ -0,0 +1,25 @@
1
+ Metadata-Version: 2.4
2
+ Name: zerozero
3
+ Version: 0.3.0
4
+ Summary: language of zeros
5
+ Author: Diego Rincón
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Provides-Extra: laserbrain
9
+ Requires-Dist: numpy; extra == "laserbrain"
10
+
11
+ # v
12
+
13
+ language of zeros.
14
+
15
+ ```python
16
+ import v
17
+
18
+ s = v.system([v.plant(14.134725)])
19
+ s.state() # {'zeros': 2, 'potential': 0.0, 'score': 1.0, 'ground': True}
20
+ s.verify() # {'verified': True, ...}
21
+ ```
22
+
23
+ grammar G = ℤ/2 × ℤ/2. conservation law `Re(ρ) + Re(τ(ρ)) = 1`. ground/wind state. RH in code.
24
+
25
+ — Diego Rincón
@@ -0,0 +1,11 @@
1
+ v/0.py,sha256=qzK9hg4tuO5ya839pCw58CU5p6Pg2rDM-HaIZOsTwcM,501
2
+ v/H.py,sha256=EmeZbgJNF8z-fQRGquhKmcjLXnTzrN81SBAx2Ea9fhs,1682
3
+ v/__init__.py,sha256=-MI_Ik206WUoOeg3imP0NvmcGryAwNbGjycVKm1YDBE,204
4
+ v/laserbrain.py,sha256=ku-6LkDqdCTuOT4_6uzeVL_LtPBGU8FP4IVI1QjqIW0,1333
5
+ v/run.py,sha256=fKMqNuKRk4OG6r4TPIKHwVmCMPXbsl0B-FxPNjbmlts,582
6
+ v/tao.py,sha256=J0C3m6QnjWEuoerUHeDjHsgBYjFIkmtGlJHwxfL2H6Q,820
7
+ v/v.py,sha256=U8mwjA5vHRevFV4VjUwI0jAi0wad9zFx29UPt8TmMqA,5283
8
+ zerozero-0.3.0.dist-info/METADATA,sha256=w_wtdfA80wdaSEfOXXRqwKebUuU8w2x6WZfBVFeyZl8,558
9
+ zerozero-0.3.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
10
+ zerozero-0.3.0.dist-info/top_level.txt,sha256=czJOGrHbcu6etP3xyQpYbWfgCrWDMNHL_qJuzQp3-k0,2
11
+ zerozero-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ v