Files
floop/RUNLOG.md
T
onibot d0942bdc69 floop v0.1: design docs + executable dspy draft
Root: README, PIPELINE, ALGORITHM, GAPS, RUNLOG (design + first executable runs). code/: v0.1 draft on dspy 3.4 (INIT/ROUTE/EXPERT/MISSING/ANSWER as dspy calls, machine as fixed code, stub engines — honest Unverified). knowledge/: DESIGN.md for the KG-first knowledge expert (pre-implementation).
2026-10-13 13:39:31 +02:00

189 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# FLOOP — Virtual run log
**Question (depth 0):** *"Quants qubits cal que tingui un ordinador quàntic per minar un bloc de bitcoin?"*
**Format:** each entry `[T<turn> | depth=<d> | <component>]` with input / output / cost / notes.
- `[REAL]` = a real tool call was executed. `[NARRATED]` = step walked by hand, no tool ran.
- T0–T2 are reconstructed after the fact (the walkthrough predates this log). From T3 on: live.
- Budget unit: calls (informal — GAP-6 still open).
- Evidence ids carry over from run 1 with provenance intact; E5 RETRACTED (GAP-7 case). Run 1's flaws are in GAPS.md, not here.
## Carried evidence
| id | type | content | provenance | status |
|---|---|---|---|---|
| E1 | Citation | difficulty ≈ 132.7×10¹²; hashrate ~950 EH/s (Oct 2026) | startmining.io, pickaxe.io | live |
| E2 | Citation | Aggarwal: PoW resistant to near-term QC; ASIC clock ≫ QC clock | arXiv:1710.10377 | live |
| E3 | Citation | Amy et al. (Waterloo): cost estimates for generic quantum preimage attacks on SHA-2/SHA-3 | PQCrypto 2016 | live |
| E4 | Citation | Zalka: Grover optimal; parallelization = space partition; (π/4)√N oracle calls | arXiv:quant-ph/9711070 | live |
| E5 | Citation | "1,151 logical qubits, ~1.3M Toffoli — Bitcoin attack halved" | shattered.io | **RETRACTED** (Shor/ECDSA ≠ mining) |
| E6 | Citation | reversible double-SHA-256 oracle ≈ 3×10⁵ non-Clifford T gates per Grover iteration; magic-state factories: thousands of physical qubits (surface code) | arXiv:2603.25519 | live |
| E7 | Algorithm | function: double-SHA-256(header 80B); variable: nonce 4B + extraNonce; condition: hash ≤ target (nBits) | UserReply (load-bearing, confirmed vs E2+E6 — GAP-9) | live |
| E8 | QuantumAlgo | Grover; search_space: nonce 2³² ⇒ register ⌈log₂⌉ = 32 qubits (derivable); oracle: double-SHA-256 reversible (E6); iterations: (π/4)·√N | Delgado 2022 (MDPI Entropy 24(3):323), E4, E6 | live |
## T0 — INIT (depth 0)
`[T0 | depth=0 | INIT — LLM translate stage]` `[NARRATED]` — 1 call
- **input:** user question (NL)
- **output:**
- GoalSchema{ quantity: n = "qubits d'un ordinador quàntic que pot minar un bloc de bitcoin"; answer_type: **OPEN**; criterion: every factor of n carries a source }
- subquestions (dependency chain, epistemic closure per GAP-8):
- **m1** "quin algorisme computacional mina un bloc?" → Algorithm
- **m2** "quin és l'equivalent quàntic de #m1?" (template) → QuantumAlgo
- **m3** "quants qubits necessita la màquina que executa #m2?" (template) → QubitCount
- **notes:** the run-1 INIT imported domain vocabulary + the competitive time framing (GAP-8) and inflated the answer; this is the corrected INIT.
## T1 — turn 1: m1 (child run, depth 1)
`[T1.a | depth=0 | stop-check]` goal derivable from table? → **NO** (no Algorithm row). `[NARRATED]`
`[T1.b | depth=0 | route]` m1 + declared type Algorithm → attendant: **floop child (depth 1)** — bare `knowledge` also defensible; the child adds the typed adequacy contract. `[NARRATED]`
`[T1.c | depth=1 | INIT]` input: "com és l'algorisme per minar bitcoins?" + parent context ("per comptar qubits") → 1 subquestion typed `Algorithm{function, input, variable, success_condition}`. `[NARRATED]` — 1 call
`[T1.d | depth=1 | stop-check on open question]` type vs visible table → 4/4 fields coverable (E2, E6, user row); 2 fields covered only by the user row → GAP-9: load-bearing → cheap confirm. `[NARRATED]`
`[T1.e | depth=1 | EXPERT knowledge]` input: "confirm mining mechanism, attach citation" → **E7 Algorithm — PASS arrival check**. `[NARRATED — no real call: piggybacked on E2/E6 provenance; a live run does one search+fetch here]`
- **result:** m1 done. cost: ~3 LLM calls + 1 knowledge call.
## T2 — turn 2: m2 (child run, depth 1)
`[T2.a | depth=0 | stop-check]` → **NO** (no QuantumAlgo row yet). `[NARRATED]`
`[T2.b | depth=1 | INIT]` input: "quin és l'equivalent quàntic de #E7?" + context → 1 subquestion typed `QuantumAlgo{primitive, search_space, oracle, iterations}`. `[NARRATED]` — 1 call
`[T2.c | depth=1 | stop-check]` 3/4 fields derivable (E4: primitive + iterations; E6: oracle); `search_space` ✗ → **targeted retry**, not decomposition (GAP-10b). `[NARRATED]`
`[T2.d | depth=1 | EXPERT knowledge]` input: "quin espai de cerca recorre Grover al minatge? què va en superposició?" → **E8 QuantumAlgo — PASS**. `[REAL: web_search ×2 → Delgado 2022, MDPI Entropy 24(3):323 — "the entire search space of the golden nonce can be queried at once"]`
- **result:** m2 done. Adequacy note: `iterations` carries an **unbound N** → flagged; becomes m3's business.
## T3 — turn 3: m3 (child run, depth 1) — LIVE from here
`[T3.a | depth=1 | INIT]` input: "quants qubits necessita la màquina que executa #E8?" + parent context ("l'objectiu és respondre la pregunta de l'usuari, no una fita intermèdia").
Decomposition driven by the **declared type + the table's holes** — the generic machine scaffold says: machine = state register (✓ E8: 32 qubits) + oracle circuit width (✗ no row) + error correction (✗ no row):
- **m3.1** "quina amplada (qubits lògics) té el circuit oracle reversible de #E8?" → `CircuitWidth{width, included, font}` [knowledge]
- **m3.2** "quants qubits físics calen per qubit lògic segons #E6?" → `ECOverhead{ratio, scheme, font}` [knowledge]
- **m3.3** template (waits for both slots): `n_logical = 32 + #m3.1 ; n_physical = n_logical × #m3.2` [analytic]
`[NARRATED]` — 1 call. **Fork flagged (GAP-2):** "tenir qubits" suggests physical; the literature quotes logical — but both readings share every subquestion except the final ×ratio → **answer both, don't ask** (refinement logged in GAPS.md).
### T3.b — m3.1 (circuit width) `[REAL]`
`[T3.b | depth=1 | EXPERT knowledge]` input: "quina amplada (qubits lògics) té el circuit oracle reversible de #E8?"
- **calls:** web_search ×3 + GitHub README fetch + arXiv HTML extract (curl ×2) — 6 tool calls, 1 turn
- **output → E9** `CircuitWidth{ width: [1,346 .. 4,418] logical qubits per machine, register INCLUDED,
sources: [arXiv:2603.25519 ("1,346 logical qubits per iteration once the search register and
comparison ancillas join the 1,153-qubit hash pipeline"), slothgar/quantum-bitcoin-miner
("4,417 qubits, double SHA-256 fully reversible" / "Logical qubits: 4,418 — verified vs
genesis block, zero dirty ancillas"), Amy et al. arXiv:1603.09383 (SHA-256 preimage width
≈ 2^12.6 ≈ 6,208 — same band, third source)] }` — **PASS** (3 independent sources, band 10³–10⁴)
- **notes:** the slothgar repo is executable primary evidence (circuit runs, CI-verified against
the genesis block) — stronger than a paper quote. Its README states the design thesis verbatim:
*"The honest gap is width, not fidelity — and width is exactly what matters."*
### T3.c — m3.2 (error-correction overhead) `[REAL]`
`[T3.c | depth=1 | EXPERT knowledge]` (same calls as T3.b, one search round) → **E10**
`ECOverhead{ ratio: [1,000 .. ~1,450] physical:logical, scheme: surface code d≤27,
sources: [literature "1,000:1 or higher" (quantumintel.tech summary), slothgar "physical
~6.4M / logical 4,418 at d=27" → 1,449, arXiv:2603.25519 (Litinski framework, T-factory
sizing)] }` — **PASS**
- **notes:** the interval comes from *concrete instances*, not vibes: d=27 is a real design point.
### T3.d — arrival check & template correction `[NARRATED]`
`[T3.d | depth=1 | CHECK]` proposed template said `n_logical = 32 + #m3.1`. **E9's `included`
field says the register is already in the width** → adding 32 would double-count the nonce
register. Template corrected by evidence: `n_logical = #m3.1` (not additive). The typed field
`CircuitWidth.included` is what allows the composer to catch this — LLM proposal amended, not
blindly applied. *(Logged as a working mechanism, candidate PIPELINE §5 note.)*
### T3.e — m3.3 (composition) `[REAL]`
`[T3.e | depth=1 | EXPERT analytic+numeric]` input: compose QubitCount from E9 × E10 (SymPy,
no mental arithmetic — engine run, output verbatim):
```
n_logical ∈ [1,346 .. 4,418]
ratio ∈ [1,000 .. 1,449] (surface code, d≤27)
n_physical∈ [1.35e6 .. 6.40e6] per machine
cross-checks: slothgar direct quote 4,418 → ~6.4M MATCH
Amy et al. 2^12.6 ≈ 6,208 logical (same band) OK
```
→ **E11** `QubitCount{ n_logical: [1,346..4,418], n_physical: [1.35×10⁶..6.4×10⁶],
reading: per-machine width, nonce-only Grover (partial preimage, b=32),
answer_type: INTERVAL }` — **PASS** (dimensions: qubits = qubits × 1 ✓)
### T4 — depth-0 stop-check → ANSWER `[NARRATED]`
`[T4 | depth=0 | PROVER]` goal "how many qubits to mine a block" derivable from table?
- **E11 exists, typed, sourced, composed** (derivation chain E8→E9/E10→E11 all provenance-linked) → **YES**.
- `answer_type` tightens OPEN → **INTERVAL**. D (difficulty) **does not enter the width**: the
hash function fixes the width; difficulty only scales iterations (time). The parameter run-1
imported turned out to be irrelevant to this reading — GAP-8 vindicated by payoff.
- Honest complements already in table: competitive framing → fleet ~10²³ physical (arXiv:2603.25519
at Jan-2025 difficulty); nonce-only partial preimage b=32 → ~10⁸ physical (same paper). Both are
the *time-collapsed* variants of the same machine — quoted as context, marked as alternative
framings, not merged into E11 (type separation prevents the merge).
- **Unresolved fork (GAP-2), logged not asked:** "tenir qubits" = machine size (E11). If the user
meant "beat the network", the answer is the fleet variant. Both readings carried into ANSWER.
`[T5 | depth=0 | ANSWER]` — final synthesis (LLM, one formal→NL pass over the table):
**"Per minar un bloc (una màquina, sense cursa contra el temps): ~1.400–4.400 qubits lògics,
~1,4–6,4 milions de qubits físics amb surface code (d≤27). L'amplada la fixa SHA-256 reversible,
no la dificultat; la dificultat només allarga el rellotge. La lectura competitiva (guanyar el
bloc de 10 min) és una altra pregunta: ~10²³ físics a dificultat actual."** Marked: verified for
the machine-size reading; the competitive reading quoted from source, not derived.
---
## Run summary (as logged)
- **Turns:** T0–T5. **Real calls:** 1 (T2.d searches) + 6 (T3.b/c) + 1 analytic engine run (T3.e).
Everything else narrated (LLM calls not executed — a live run spends ~8 more LLM calls: INITS, routes, checks).
- **Depth reached:** 1 (m1, m2, m3 as child runs; no depth-2 needed — m3's decomposition stayed inside the child).
- **Evidence:** E1–E11 (E5 RETRACTED). E7 carries user provenance (confirmed). E11 composed, derivation-linked.
- **Design lessons this run:**
1. T3.d — typed `included` fields let evidence correct an LLM proposal (double-count caught).
2. T4 — difficulty never entered the width answer: a parameter imported by run-1's INIT was
irrelevant under the honest reading. The epistemic closure (GAP-8) pays off concretely.
3. The stop-check doubling as cache (GAP-10) fired twice: m1 closed with zero searches, m2 with one.
4. The fork at m3 resolved by *typing the answer both ways* rather than asking (interval band
shared by both readings except the ×ratio term) — GAP-2 criterion refined: **ask only when
readings diverge in kind, not when they diverge in one multiplicative term.**
- **Open items:** GAP-6 (budget units still informal), GAP-2 (fork criterion refinement to merge),
GAP-10 (adequacy contract) — all logged in GAPS.md.
---
# Executable runs (v0.1 draft, `code/`)
**2026-10-10. First executable run.** dspy 3.4.0 over OpenAI-compatible endpoints; every LLM
stage (INIT, ROUTE, EXPERT, MISSING, ANSWER) is a dspy call; check layer, prover and engines
are stubs — so everything is honestly `Unverified`. LM: local `qwen3.8:27b` (hub 127.0.0.1:11435).
## Run A — question with no answerable evidence (honesty demo)
`"How many physical qubits would be needed to break RSA-2048, and what makes the estimate uncertain?"`
- INIT → 3 subquestions (logical qubit count → EC overhead → uncertainty sources), deps typed.
- ROUTE → knowledge ×3. The stub knowledge engine cannot retrieve (no search in the draft),
the question states no literals, so E1 = UNKNOWN → arrival check refuses → Q1 failed →
Q2, Q3 cascade-fail (dependency-directed failure). Stop = stack terminal (prover stub).
- ANSWER (UNVERIFIED): correctly refuses to invent a number, cites E1.
- 3 LLM calls + 1 engine call, 132 s. **The honest fallback path works end-to-end.**
## Run B — answerable-from-question-literals (happy path)
`"A train travels 120 kilometers in 90 minutes. What is its average speed in km/h?"`
- INIT → Q1 "90 min in hours?" [CONSTANT, numeric] → Q2 "formula for average speed?"
[FUNCTION, knowledge] → Q3 "average speed using converted time + distance" [FUNCTION, numeric],
dependency chain Q1→Q3.
- Q3's question text referenced Q1's slot and was instantiated with E1's value at execution
time (plan-on-slots working).
- E1=1.5 h (stub:numeric, quote = question literal), E2=formula (stub:knowledge),
E3=80 km/h (stub:numeric). ANSWER (UNVERIFIED): "80 km/h" with every claim cited to E1–E3.
- 8 LLM calls (init 1 + route 3 + engines 3 + answer 1), 154 s — budget accounting exact.
**Design lessons (executable run 1):**
1. The failure cascade (Run A) is the design working: no retrieval engine → honest UNKNOWN →
no invented answer. The next vertical (`knowledge` with real search) is what unlocks
Run-A-class questions.
2. Slot instantiation (#E refs substituted at execution, not planning) kept hops visible in
question text — matching the PIPELINE law that multi-hop lives in the plan.
3. dspy 3.4 + litellm: model ids need the `openai/` prefix for OpenAI-compatible endpoints;
the class is `dspy.LM` (not `dspy.LLM`). Wrapped once in `floop/llm.py`.
4. Budget must charge engine LLM calls too (the engine IS an LLM call in the draft) —
fixed after Run A showed engines riding for free.