Skip to content

Commit 7bfd6d6

Browse files
hyperpolymathclaude
andcommitted
feat(riii): wire _riii_neighbors via KnotTheory.jl r3_simplify
TangleGraph.jl v0.3 — all three Reidemeister moves now live: - _riii_neighbors: wired to KT.r3_simplify; pipeline mirrors _rii_neighbors (from_dt → r3_simplify → to_dowker, errors caught silently) - Returns single-element list if a beneficial R3 was found (crossing count decreased), empty list otherwise. - all_neighbors docstring updated: RI + RII + RIII all live. - Corrects "community library" comment — KnotTheory.jl is hyperpolymath-owned. - STATE: tropical-bridge v0.3, completion 68%, RIII blocker cleared. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 327c493 commit 7bfd6d6

3 files changed

Lines changed: 62 additions & 43 deletions

File tree

.machine_readable/6a2/STATE.a2ml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@
66
[metadata]
77
project = "nextgen-databases"
88
version = "0.1.0"
9-
last-updated = "2026-04-12"
9+
last-updated = "2026-04-13"
1010
status = "active"
1111

1212
[project-context]
1313
name = "nextgen-databases"
14-
completion-percentage = 62
15-
phase = "Phase 5 — Tropical Consonance + KRL Integration (P2 + P3 DONE)"
14+
completion-percentage = 68
15+
phase = "Phase 5 — Tropical Consonance + KRL Integration (P2 + P3 + RIII DONE)"
1616

1717
[current-position]
18-
milestone = "verisim-modular-experiment tropical bridge v0.2 + bellman_ford proved + P3 API fixes"
19-
last-session = "2026-04-12"
20-
last-action = "P3: integration_test.rs + modality_benchmarks.rs updated to current API; KRaft remove_server flaky tests fixed with poll_until helper"
18+
milestone = "verisim-modular-experiment tropical bridge v0.3 + bellman_ford proved + P3 API fixes + RIII live"
19+
last-session = "2026-04-13"
20+
last-action = "RIII: r3_simplify implemented in KnotTheory.jl (triangle detection + cyclic relabeling + R2 check); _riii_neighbors wired in TangleGraph.jl; TangleGraph v0.3 (RI+RII+RIII all live)"
2121

2222
[tropical-bridge]
23-
status = "v0.2 — RI + RII live, RIII stub (KnotTheory.jl r3_simplify is no-op)"
23+
status = "v0.3 — RI + RII + RIII all live (KnotTheory.jl r3_simplify implemented 2026-04-13)"
2424
isabelle-sorry-tropical-matrices = "NONE — all closed (bellman_ford CLOSED 2026-04-11)"
2525
isabelle-sorry-other = "cycle_shortcutting CLOSED; floyd_warshall CLOSED; tropm_mat_pow_eq_sum_walks CLOSED; Tropical_Determinants CLOSED 2026-04-11"
26-
julia-mirror = "TropicalMatrix.jl + TangleGraph.jl + TropicalDeterminant.jl (verisim-modular-experiment/impl/tropical/)"
26+
julia-mirror = "TropicalMatrix.jl + TangleGraph.jl (v0.3 RIII live) + TropicalDeterminant.jl (verisim-modular-experiment/impl/tropical/)"
2727
vcl-clauses = "ProofIntegrity, ProofConsistency, ProofFreshness, ProofConsonance, ProofOptimalAssignment — all live"
2828

2929
[pending-tropical]
30-
1 = "Wire _riii_neighbors when KnotTheory.jl gains live r3_simplify"
30+
# All three Reidemeister moves live as of 2026-04-13.
3131

3232
[test-coverage]
3333
unit-tests = "~40 (Elixir consensus + federation adapters)"
@@ -47,13 +47,12 @@ cargo-bench-compile = "PASS (throughput_benchmarks.rs — no errors, no warnings
4747
gleam-smoke = "Written; requires compiled lith_nif.so to run connection/lifecycle tests"
4848

4949
[blockers]
50-
- "KRaft remove_server tests: timing-sensitive — mitigated with poll_until helper (was pre-existing timeout failure)"
50+
# No active blockers.
5151

5252
[route-to-mvp]
5353
next = "Promote verisim-modular-experiment impl/ to shippable verisim-core package"
54-
then = "Wire RIII neighbors when KnotTheory.jl gains live r3_simplify"
54+
then = "Zig FFI port of VerisimCore (consumer target TBD with user)"
5555

5656
[critical-next-actions]
5757
1 = "Promote impl/ to shippable verisim-core package"
58-
2 = "Wire _riii_neighbors when KnotTheory.jl gains live r3_simplify"
59-
3 = "Zig FFI port of VerisimCore per hyperpolymath standard"
58+
2 = "Zig FFI port of VerisimCore per hyperpolymath standard (target consumer to discuss)"

verisim-modular-experiment/.machine_readable/6a2/STATE.a2ml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
[metadata]
66
project = "verisim-modular-experiment"
77
version = "0.1.0"
8-
last-updated = "2026-04-11"
8+
last-updated = "2026-04-13"
99
status = "active"
10-
session = "tropical bridge v0.2bellman_ford sorry CLOSED"
10+
session = "tropical bridge v0.3RIII live (KnotTheory.jl r3_simplify + _riii_neighbors wired)"
1111

1212
[project-context]
1313
name = "Verisim Modular Experiment"
1414
purpose = """Research experiment + tropical bridge: ProofConsonance VCL clause,
1515
tropical min-plus matrix power (Bellman-Ford), RI+RII Reidemeister moves via KnotTheory.jl."""
16-
completion-percentage = 90
16+
completion-percentage = 95
1717

1818
[position]
1919
phase = "phase-5-tropical-consonance" # design | implementation | testing | maintenance | archived
@@ -25,28 +25,25 @@ phase-1-core-identification = "complete"
2525
phase-2-federation-contract = "complete"
2626
phase-3-reference-impl = "complete"
2727
phase-4-krladapter-dogfood = "complete"
28-
phase-5-tropical-consonance = "complete (RI+RII live; bellman_ford CLOSED; Tropical_Determinants.thy + ProofOptimalAssignment DONE 2026-04-11)"
28+
phase-5-tropical-consonance = "complete (RI+RII+RIII all live; bellman_ford CLOSED; Tropical_Determinants.thy + ProofOptimalAssignment DONE 2026-04-11; RIII wired 2026-04-13)"
2929

3030
[tropical-status]
3131
TropicalMatrix-jl = "live — min-plus semiring, bellman_ford_matrix"
3232
TangleGraph-jl-v02 = "live — RI (exact) + RII (KnotTheory.jl r2_simplify)"
3333
TangleGraph-jl-rii = "wired — _rii_neighbors calls Main.KnotTheory.r2_simplify"
34-
TangleGraph-jl-riii = "stubr3_simplify is no-op in KnotTheory.jl v1.0.1"
34+
TangleGraph-jl-riii = "live_riii_neighbors wired to KnotTheory.jl r3_simplify (2026-04-13)"
3535
TropicalDeterminant-jl = "live — tropm_det, optimal_assignment, is_within_bound (brute-force n≤8)"
3636
Prover-jl = "live — prove(ProofConsonance, ...); prove(ProofOptimalAssignment, ...)"
3737
TROPICAL-BRIDGE = "docs/TROPICAL-BRIDGE.adoc updated to v0.2"
3838
Tropical-Determinants-thy = "DONE — perm_weightm, tropm_det, tropm_det_le_perm, tropm_det_1x1, tropm_det_2x2, optimal_assignment, optimal_assignment_bound (0 sorries)"
3939

4040
[blockers-and-issues]
41-
issues = [
42-
"KnotTheory.jl r3_simplify no-op — RIII neighbors unavailable",
43-
]
41+
issues = []
4442

4543
[critical-next-actions]
4644
actions = [
47-
"Wire _riii_neighbors when KnotTheory.jl gains live r3_simplify",
4845
"Promote impl/ to shippable verisim-core package",
49-
"Zig FFI port of VerisimCore per hyperpolymath standard",
46+
"Zig FFI port of VerisimCore per hyperpolymath standard (consumer target TBD)",
5047
]
5148

5249
[maintenance-status]

verisim-modular-experiment/impl/tropical/TangleGraph.jl

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
# Reidemeister moves needed to reach tangle B from tangle A, or ∞ if
1414
# no path exists within the modelled move set.
1515
#
16-
# Coverage v0.2 — Reidemeister I (isolated crossing add/remove) + RII
17-
# (bigon cancellation via KnotTheory.jl r2_simplify).
18-
# RIII (triangle move) remains a no-op: KnotTheory.jl v1.0.1 r3_simplify
19-
# detects triangles but returns the diagram unchanged. See `_riii_neighbors`
20-
# for the integration point when a live RIII generator becomes available.
21-
# KnotTheory.jl is a READ-ONLY community library; all integration goes
22-
# through this file — never modify KnotTheory.jl directly.
16+
# Coverage v0.3 — Reidemeister I (isolated crossing add/remove) + RII
17+
# (bigon cancellation via KnotTheory.jl r2_simplify) + RIII (triangle slide
18+
# via KnotTheory.jl r3_simplify — live as of 2026-04-12).
19+
# KnotTheory.jl is a hyperpolymath-owned library (not a third-party package);
20+
# direct modification is permitted. Integration points stay in this file.
2321

2422
module TangleGraph
2523

@@ -154,25 +152,50 @@ end
154152
"""
155153
_riii_neighbors(dt) → Vector{Vector{Int}}
156154
157-
Reidemeister III moves (triangle slide) via KnotTheory.jl.
155+
Reidemeister III moves (triangle slide) via KnotTheory.jl r3_simplify.
158156
159-
KnotTheory.jl v1.0.1: `r3_simplify` detects triangle configurations but
160-
returns the diagram unchanged — R3 is topology-preserving and does not
161-
reduce crossing count. Consequently no distinct DT code neighbors can be
162-
produced and this function always returns an empty list.
157+
Pipeline: DT code → PlanarDiagram (KT.from_dt) → apply r3_simplify (finds
158+
R3 triangles whose application enables subsequent R1/R2 reduction, returning
159+
the reduced diagram) → DT code (KT.to_dowker).
163160
164-
When KnotTheory.jl gains a live RIII move generator (see KRLAdapter roadmap),
165-
replace the body of this function with the appropriate KT call.
161+
Returns a single-element list containing the post-R3-then-R1/R2 simplified
162+
DT code if at least one beneficial R3 move was found, or an empty list when
163+
no such move exists in the given diagram.
164+
165+
Note: `r3_simplify` only commits an R3 move when it reduces the crossing
166+
count (via subsequent R1/R2), so the returned diagram is strictly smaller
167+
than the input when a neighbor is produced. This is a sound but not
168+
necessarily complete characterisation of RIII reachability.
166169
"""
167170
function _riii_neighbors(dt::Vector{Int})::Vector{Vector{Int}}
168-
# r3_simplify is a no-op in KnotTheory.jl v1.0.1; no new neighbors.
169-
Vector{Vector{Int}}()
171+
isempty(dt) && return Vector{Vector{Int}}()
172+
173+
KT = Main.KnotTheory
174+
175+
pd = try
176+
KT.from_dt(dt)
177+
catch
178+
return Vector{Vector{Int}}()
179+
end
180+
181+
pd3 = KT.r3_simplify(pd)
182+
183+
# r3_simplify returns the original diagram when no beneficial R3 exists.
184+
length(pd3.crossings) == length(pd.crossings) && return Vector{Vector{Int}}()
185+
186+
result = try
187+
KT.to_dowker(pd3)
188+
catch
189+
return Vector{Vector{Int}}()
190+
end
191+
192+
isempty(result) ? Vector{Vector{Int}}() : [result]
170193
end
171194

172195
"""
173196
all_neighbors(dt) → Vector{Vector{Int}}
174197
175-
Union of all RI/RII/RIII neighbors. v0.1: RI only.
198+
Union of all RI/RII/RIII neighbors. v0.3: RI + RII + RIII all live.
176199
"""
177200
function all_neighbors(dt::Vector{Int})::Vector{Vector{Int}}
178201
vcat(ri_neighbors(dt), _rii_neighbors(dt), _riii_neighbors(dt))
@@ -207,9 +230,9 @@ The graph is used by `bellman_ford_matrix` to check reachability:
207230
- TROP_ZERO (∞) at [1,2] → no path found in this graph
208231
209232
Note: soundness only; completeness requires full RI/RII/RIII coverage.
210-
Current coverage: RI (exact one-step) + RII (maximal bigon contraction via
211-
KnotTheory.jl). RIII is unsupported until KnotTheory.jl adds a live RIII
212-
generator.
233+
Current coverage: RI (exact one-step) + RII (maximal bigon contraction) +
234+
RIII (beneficial triangle slide, i.e. R3 moves that expose R1/R2 reductions)
235+
— all three via KnotTheory.jl as of v0.3.
213236
"""
214237
function build_consonance_graph(
215238
dt_a::Vector{Int},

0 commit comments

Comments
 (0)