Taylor commited on
Commit
e3ca06c
·
1 Parent(s): 6bda18c

feat: Quark-Arranged Skyrms Walker Personality Model

Browse files

Five walkers (Try/Choose/Commit/LetGo/Learn) interact pairwise
via ten boson channels (5 choose 2 = 10). Settlement to Nash
equilibrium via Skyrms rejection dynamics.

Visualizations:
- Radar chart of five walker values
- Bar chart of ten boson tensions (red/yellow/green)
- Energy convergence + walker trajectory plots
- Full text analysis with theorem references

Presets: Explorer, Builder, Creative, Anxious, Balanced.
Custom sliders for each walker dimension.

Proved in Lean 4 (zero sorry):
THM-FIVE-MAP-TO-FIVE
THM-NO-FREE-QUARKS (confinement)
THM-GAUGE-WALKER-AGREE
THM-WIREFRAME-IS-VACUUM

Files changed (3) hide show
  1. README.md +6 -7
  2. app.py +336 -0
  3. requirements.txt +3 -0
README.md CHANGED
@@ -1,12 +1,11 @@
1
  ---
2
  title: Quark Personality
3
- emoji: 💻
4
- colorFrom: yellow
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 6.9.0
 
8
  app_file: app.py
9
- pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Quark Personality
3
+ emoji: "\u2699\uFE0F"
4
+ colorFrom: blue
5
+ colorTo: blue
6
  sdk: gradio
7
+ sdk_version: 5.23.0
8
+ python_version: "3.11"
9
  app_file: app.py
10
+ pinned: true
11
  ---
 
 
app.py ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Quark-Arranged Skyrms Walker Personality Model
3
+ Five walkers. Ten bosons. Quark confinement. Settlement to Nash equilibrium.
4
+
5
+ A personality is not what you are. It is what you are not.
6
+ The void boundary -- the accumulated rejections across five dimensions
7
+ of irreversible choice -- IS the person.
8
+
9
+ Hot off Lean 4. Zero sorry.
10
+ """
11
+
12
+ import gradio as gr
13
+ import numpy as np
14
+ import matplotlib
15
+ matplotlib.use("Agg")
16
+ import matplotlib.pyplot as plt
17
+ from dataclasses import dataclass, field
18
+ import json
19
+
20
+ # ─── AeonOS Dark Theme ──────────────────────────────────────────────────────
21
+ DARK_RC = {
22
+ "figure.facecolor": "#09090b", "axes.facecolor": "#111114",
23
+ "axes.edgecolor": "#1f1f23", "axes.labelcolor": "#a1a1aa",
24
+ "text.color": "#fafafa", "xtick.color": "#71717a", "ytick.color": "#71717a",
25
+ "grid.color": "#1f1f23", "grid.alpha": 0.3, "figure.dpi": 100,
26
+ "savefig.facecolor": "#09090b", "font.family": "sans-serif",
27
+ }
28
+
29
+ WALKER_NAMES = ["Try", "Choose", "Commit", "LetGo", "Learn"]
30
+ WALKER_COLORS = ["#3b82f6", "#22c55e", "#a855f7", "#ef4444", "#f59e0b"]
31
+ PRIMITIVES = ["Fork", "Race", "Fold", "Vent", "Interfere"]
32
+ PARAMS = ["eta", "temperature", "commitGain", "decayRate", "feedbackGain"]
33
+
34
+ BOSON_PAIRS = [
35
+ (0,1,"Try↔Choose"), (0,2,"Try↔Commit"), (0,3,"Try↔LetGo"), (0,4,"Try↔Learn"),
36
+ (1,2,"Choose↔Commit"), (1,3,"Choose↔LetGo"), (1,4,"Choose↔Learn"),
37
+ (2,3,"Commit↔LetGo"), (2,4,"Commit↔Learn"), (3,4,"LetGo↔Learn"),
38
+ ]
39
+
40
+ PRESETS = {
41
+ "Explorer": [0.9, 0.4, 0.3, 0.7, 0.8],
42
+ "Builder": [0.4, 0.7, 0.9, 0.2, 0.6],
43
+ "Creative": [0.8, 0.3, 0.4, 0.8, 0.9],
44
+ "Anxious": [0.3, 0.2, 0.7, 0.1, 0.5],
45
+ "Balanced": [0.5, 0.5, 0.5, 0.5, 0.5],
46
+ "Custom": [0.6, 0.6, 0.6, 0.6, 0.6],
47
+ }
48
+
49
+ # ─── Core Model ──────────────────────────────────────────────────────────────
50
+
51
+ def compute_bosons(walkers):
52
+ """Compute ten boson tensions (|w_a - w_b| for all pairs)."""
53
+ bosons = []
54
+ for a, b, _ in BOSON_PAIRS:
55
+ bosons.append(abs(walkers[a] - walkers[b]))
56
+ return np.array(bosons)
57
+
58
+ def system_energy(bosons):
59
+ """Total system energy = sum of all boson tensions."""
60
+ return float(np.sum(bosons))
61
+
62
+ def is_confined(walkers):
63
+ """All walkers must be present (> 0). The sliver guarantees this."""
64
+ return all(w > 0 for w in walkers)
65
+
66
+ def complement_distribution(void_boundary, eta=3.0):
67
+ """Compute complement target from void boundary (rejection counts)."""
68
+ weights = np.array([max(1, total - rej + 1) for total, rej in
69
+ zip([sum(void_boundary)] * len(void_boundary), void_boundary)], dtype=float)
70
+ # Softmax with eta
71
+ exp_w = np.exp(eta * (weights / max(weights.max(), 1e-8) - 0.5))
72
+ return exp_w / exp_w.sum()
73
+
74
+ def settle_personality(initial_walkers, max_rounds=100, epsilon=0.001):
75
+ """Settle five walkers to Skyrms Nash equilibrium via rejection."""
76
+ walkers = np.array(initial_walkers, dtype=float)
77
+ walkers = np.clip(walkers, 0.01, 0.99) # the sliver
78
+
79
+ # Per-walker void boundaries (20 levels each)
80
+ resolution = 20
81
+ voids = [np.zeros(resolution) for _ in range(5)]
82
+ history = [walkers.copy()]
83
+ energies = [system_energy(compute_bosons(walkers))]
84
+ gaits = [["stand"] * 5]
85
+
86
+ for round_idx in range(max_rounds):
87
+ new_walkers = walkers.copy()
88
+ round_gaits = []
89
+
90
+ for i in range(5):
91
+ # Propose new value from complement distribution
92
+ dist = complement_distribution(voids[i])
93
+ proposal_idx = np.random.choice(resolution, p=dist)
94
+ proposal = (proposal_idx + 0.5) / resolution
95
+
96
+ # Would this reduce energy?
97
+ test = new_walkers.copy()
98
+ test[i] = proposal
99
+ old_energy = system_energy(compute_bosons(walkers))
100
+ new_energy = system_energy(compute_bosons(test))
101
+
102
+ if new_energy < old_energy:
103
+ # Accept: update walker
104
+ new_walkers[i] = proposal
105
+ gait = "gallop" if (old_energy - new_energy) > 0.1 else "trot"
106
+ else:
107
+ # Reject: update void boundary
108
+ reject_idx = min(int(walkers[i] * resolution), resolution - 1)
109
+ voids[i][reject_idx] += 1
110
+ gait = "stand"
111
+
112
+ round_gaits.append(gait)
113
+
114
+ walkers = np.clip(new_walkers, 0.01, 0.99)
115
+ bosons = compute_bosons(walkers)
116
+ energy = system_energy(bosons)
117
+ history.append(walkers.copy())
118
+ energies.append(energy)
119
+ gaits.append(round_gaits)
120
+
121
+ # Convergence check
122
+ if len(energies) > 2 and abs(energies[-1] - energies[-2]) < epsilon:
123
+ break
124
+
125
+ return {
126
+ "walkers": walkers.tolist(),
127
+ "bosons": compute_bosons(walkers).tolist(),
128
+ "energy": system_energy(compute_bosons(walkers)),
129
+ "confined": is_confined(walkers),
130
+ "rounds": len(history) - 1,
131
+ "history": [h.tolist() for h in history],
132
+ "energies": energies,
133
+ "gaits": gaits,
134
+ "voids": [v.tolist() for v in voids],
135
+ }
136
+
137
+ # ─── Visualization ──────────────────────────────────────────────────────────
138
+
139
+ def plot_walkers(result):
140
+ """Radar chart of final walker values."""
141
+ with plt.rc_context(DARK_RC):
142
+ fig, ax = plt.subplots(figsize=(6, 6), subplot_kw=dict(projection='polar'))
143
+ angles = np.linspace(0, 2 * np.pi, 5, endpoint=False).tolist()
144
+ angles += angles[:1]
145
+ values = result["walkers"] + [result["walkers"][0]]
146
+
147
+ ax.plot(angles, values, 'o-', color='#06b6d4', linewidth=2, markersize=8)
148
+ ax.fill(angles, values, alpha=0.15, color='#06b6d4')
149
+ ax.set_xticks(angles[:-1])
150
+ ax.set_xticklabels([f"{n}\n({p})" for n, p in zip(WALKER_NAMES, PRIMITIVES)], size=9)
151
+ ax.set_ylim(0, 1)
152
+ ax.set_title("Five Walkers (Settled)", pad=20, fontsize=14, color='#fafafa')
153
+ ax.grid(True, alpha=0.2)
154
+ fig.tight_layout()
155
+ return fig
156
+
157
+ def plot_bosons(result):
158
+ """Bar chart of ten boson tensions."""
159
+ with plt.rc_context(DARK_RC):
160
+ fig, ax = plt.subplots(figsize=(10, 4))
161
+ labels = [bp[2] for bp in BOSON_PAIRS]
162
+ values = result["bosons"]
163
+ colors = ['#ef4444' if v > 0.3 else '#f59e0b' if v > 0.15 else '#22c55e' for v in values]
164
+ bars = ax.bar(range(10), values, color=colors, alpha=0.8, edgecolor='#1f1f23')
165
+ ax.set_xticks(range(10))
166
+ ax.set_xticklabels(labels, rotation=45, ha='right', fontsize=7)
167
+ ax.set_ylabel("Tension |w_a - w_b|")
168
+ ax.set_title(f"Ten Bosons (Energy = {result['energy']:.3f})", fontsize=12)
169
+ ax.set_ylim(0, 1)
170
+ ax.axhline(y=0.3, color='#ef4444', linestyle='--', alpha=0.3, label='High tension')
171
+ fig.tight_layout()
172
+ return fig
173
+
174
+ def plot_convergence(result):
175
+ """Energy convergence over settlement rounds."""
176
+ with plt.rc_context(DARK_RC):
177
+ fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 4))
178
+ # Energy
179
+ ax1.plot(result["energies"], color='#06b6d4', linewidth=2)
180
+ ax1.set_xlabel("Round")
181
+ ax1.set_ylabel("System Energy")
182
+ ax1.set_title(f"Settlement ({result['rounds']} rounds)", fontsize=12)
183
+ ax1.grid(True, alpha=0.2)
184
+
185
+ # Walker trajectories
186
+ history = np.array(result["history"])
187
+ for i in range(5):
188
+ ax2.plot(history[:, i], color=WALKER_COLORS[i], linewidth=1.5, label=WALKER_NAMES[i])
189
+ ax2.set_xlabel("Round")
190
+ ax2.set_ylabel("Walker Value")
191
+ ax2.set_title("Walker Trajectories", fontsize=12)
192
+ ax2.legend(loc='upper right', fontsize=8)
193
+ ax2.set_ylim(0, 1)
194
+ ax2.grid(True, alpha=0.2)
195
+ fig.tight_layout()
196
+ return fig
197
+
198
+ def format_summary(result):
199
+ """Text summary of the settled personality."""
200
+ w = result["walkers"]
201
+ lines = [
202
+ "QUARK-ARRANGED SKYRMS WALKER PERSONALITY",
203
+ "=" * 50, "",
204
+ f"Settlement: {result['rounds']} rounds | Energy: {result['energy']:.4f} | Confined: {result['confined']}",
205
+ "",
206
+ "FIVE WALKERS (settled values):",
207
+ ]
208
+ for i, (name, prim, param) in enumerate(zip(WALKER_NAMES, PRIMITIVES, PARAMS)):
209
+ bar = "█" * int(w[i] * 20)
210
+ lines.append(f" {name:8s} ({prim:10s}) = {w[i]:.3f} {bar}")
211
+
212
+ lines.extend(["", "TEN BOSONS (pairwise tensions):"])
213
+ for i, (a, b, label) in enumerate(BOSON_PAIRS):
214
+ v = result["bosons"][i]
215
+ indicator = "🔴" if v > 0.3 else "🟡" if v > 0.15 else "🟢"
216
+ lines.append(f" {indicator} {label:20s} = {v:.3f}")
217
+
218
+ lines.extend(["", "THEOREMS (all proved in Lean 4, zero sorry):",
219
+ " THM-FIVE-MAP-TO-FIVE: walkers = primitives = hyperparameters",
220
+ " THM-NO-FREE-QUARKS: cannot remove one walker (confinement)",
221
+ " THM-GAUGE-WALKER-AGREE: gauge field peak = walker peak",
222
+ f" THM-WIREFRAME-IS-VACUUM: all equal → energy = 0 (balanced = {result['energy'] < 0.01})",
223
+ ])
224
+
225
+ # Dominant personality interpretation
226
+ dominant = WALKER_NAMES[np.argmax(w)]
227
+ weakest = WALKER_NAMES[np.argmin(w)]
228
+ lines.extend(["", f"INTERPRETATION:",
229
+ f" Dominant axis: {dominant} (strongest pull)",
230
+ f" Shadow axis: {weakest} (most rejected, deepest void)",
231
+ f" The void boundary of {weakest} contains the most information.",
232
+ ])
233
+
234
+ return "\n".join(lines)
235
+
236
+ # ─── Gradio App ──────────────────────────────────────────────────────────────
237
+
238
+ def run_settlement(preset, try_v, choose_v, commit_v, letgo_v, learn_v, max_rounds):
239
+ if preset != "Custom":
240
+ vals = PRESETS[preset]
241
+ try_v, choose_v, commit_v, letgo_v, learn_v = vals
242
+
243
+ result = settle_personality(
244
+ [try_v, choose_v, commit_v, letgo_v, learn_v],
245
+ max_rounds=int(max_rounds),
246
+ )
247
+
248
+ return (
249
+ plot_walkers(result),
250
+ plot_bosons(result),
251
+ plot_convergence(result),
252
+ format_summary(result),
253
+ try_v, choose_v, commit_v, letgo_v, learn_v,
254
+ )
255
+
256
+
257
+ CSS = """
258
+ .gradio-container { max-width: 1100px !important; margin: 0 auto !important; }
259
+ .gradio-container, .dark { background: #09090b !important; }
260
+ footer { display: none !important; }
261
+ """
262
+
263
+ with gr.Blocks(css=CSS, theme=gr.themes.Base(primary_hue="cyan", neutral_hue="zinc"),
264
+ title="Quark Personality") as demo:
265
+
266
+ gr.HTML("""
267
+ <div style="text-align:center; padding:2rem 0 1rem">
268
+ <h1 style="font-size:2.2rem; font-weight:300; color:#fafafa; margin:0">
269
+ Quark-Arranged <span style="color:#06b6d4">Skyrms Walker</span> Personality
270
+ </h1>
271
+ <p style="color:#71717a; font-size:.9rem; margin-top:.5rem; line-height:1.6">
272
+ Five walkers. Ten bosons. Quark confinement. Settlement to Nash equilibrium.<br>
273
+ A personality is not what you are. It is what you are not.<br>
274
+ The void boundary -- accumulated rejections across five dimensions of irreversible choice -- IS the person.<br>
275
+ Hot off Lean 4. Zero sorry.
276
+ </p>
277
+ </div>
278
+ """)
279
+
280
+ with gr.Row():
281
+ preset = gr.Dropdown(choices=list(PRESETS.keys()), value="Explorer", label="Preset", scale=1)
282
+ max_rounds = gr.Slider(10, 500, value=100, step=10, label="Max settlement rounds", scale=1)
283
+ run_btn = gr.Button("Settle Personality", variant="primary", scale=1)
284
+
285
+ with gr.Row():
286
+ try_v = gr.Slider(0.01, 0.99, value=0.9, step=0.01, label="Try (Fork)")
287
+ choose_v = gr.Slider(0.01, 0.99, value=0.4, step=0.01, label="Choose (Race)")
288
+ commit_v = gr.Slider(0.01, 0.99, value=0.3, step=0.01, label="Commit (Fold)")
289
+ letgo_v = gr.Slider(0.01, 0.99, value=0.7, step=0.01, label="LetGo (Vent)")
290
+ learn_v = gr.Slider(0.01, 0.99, value=0.8, step=0.01, label="Learn (Interfere)")
291
+
292
+ with gr.Row():
293
+ walker_plot = gr.Plot(label="Five Walkers")
294
+ boson_plot = gr.Plot(label="Ten Bosons")
295
+
296
+ convergence_plot = gr.Plot(label="Settlement Convergence")
297
+
298
+ with gr.Accordion("Full Analysis", open=False):
299
+ summary = gr.Textbox(lines=30, show_label=False, interactive=False)
300
+
301
+ def on_preset(p):
302
+ vals = PRESETS.get(p, PRESETS["Custom"])
303
+ return vals
304
+
305
+ preset.change(on_preset, [preset], [try_v, choose_v, commit_v, letgo_v, learn_v])
306
+
307
+ run_btn.click(
308
+ run_settlement,
309
+ [preset, try_v, choose_v, commit_v, letgo_v, learn_v, max_rounds],
310
+ [walker_plot, boson_plot, convergence_plot, summary, try_v, choose_v, commit_v, letgo_v, learn_v],
311
+ )
312
+
313
+ demo.load(
314
+ run_settlement,
315
+ [preset, try_v, choose_v, commit_v, letgo_v, learn_v, max_rounds],
316
+ [walker_plot, boson_plot, convergence_plot, summary, try_v, choose_v, commit_v, letgo_v, learn_v],
317
+ )
318
+
319
+ gr.HTML("""
320
+ <div style="text-align:center; padding:2rem 0; border-top:1px solid #1f1f23; margin-top:2rem; font-size:.8rem; color:#52525b">
321
+ <p style="color:#a1a1aa; margin-bottom:.5rem">
322
+ THM-FIVE-MAP-TO-FIVE &middot; THM-NO-FREE-QUARKS &middot; THM-GAUGE-WALKER-AGREE &middot; THM-WIREFRAME-IS-VACUUM
323
+ </p>
324
+ <p>
325
+ <a href="https://forkracefold.com/" style="color:#06b6d4; text-decoration:none">Whitepaper</a> &middot;
326
+ <a href="https://huggingface.co/spaces/forkjoin-ai/the-void" style="color:#06b6d4; text-decoration:none">The Void</a> &middot;
327
+ <a href="https://huggingface.co/spaces/forkjoin-ai/glossolalia" style="color:#06b6d4; text-decoration:none">Glossolalia</a> &middot;
328
+ <a href="https://huggingface.co/spaces/forkjoin-ai/metacog" style="color:#06b6d4; text-decoration:none">Metacog</a> &middot;
329
+ <a href="https://huggingface.co/spaces/forkjoin-ai/five-bules" style="color:#06b6d4; text-decoration:none">Five Bules</a>
330
+ </p>
331
+ <p style="margin-top:.5rem">&phi;&sup2; = &phi; + 1</p>
332
+ </div>
333
+ """)
334
+
335
+ if __name__ == "__main__":
336
+ demo.launch(server_name="0.0.0.0", server_port=7860)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio>=5.0.0,<6.0.0
2
+ numpy
3
+ matplotlib