# FLOOP — Gap log (step-by-step replay) Running log of design gaps found while virtually executing FLOOP on: *"Quants qubits cal que tingui un ordinador quàntic per minar un bloc de bitcoin?"* Each entry: what's missing → where it bites → proposed resolution → which doc to patch. Status: **proposed**. Nothing patched yet — resolutions get merged into PIPELINE.md / ALGORITHM.md at the end of the replay, once the walkthrough is complete. --- ## Found at INIT (step 1) ### GAP-1 — Goal schema undefined `ALGORITHM.md` says INIT emits a "goal formula", but nothing defines its vocabulary or shape. **Bites:** `PROVER.derivable` can only check goals written in the same sorted language the evidence will be formalized into; left free-form, the LLM invents predicates the prover cannot consume. No home for: answer type, free parameters, success criterion, presupposition flags. **Resolution:** new core type `GoalSchema { quantity, unit?, answer_type, params[], criterion, presuppositions[] }`. INIT emits it; `ANSWER` validates its output against it; flagged presuppositions may become milestones (e.g. an m0 "frame check") at the planner's discretion. **Patch:** ALGORITHM.md §0, §3; PIPELINE.md §3. ### GAP-2 — `Assumption` type and ask-vs-assume criterion missing In the first replay, LLM-authored defaults entered the evidence table disguised as `UserReply` (provenance: "assumption") — type pollution that violates invariant #1 in spirit: LLM prose entering the table through the user channel. **Resolution:** new evidence type `Assumption { author: llm, marked: true, weakens_verification }`. Formal criterion for `ask_user`: a free parameter whose plausible range moves the answer by ≥ 1 order of magnitude → ask; otherwise assume + mark. A verified answer must list every Assumption it depends on. **Patch:** PIPELINE.md §5; ALGORITHM.md §0. ### GAP-3 — Milestone acceptance criteria unspecified Who validates an LLM-proposed decomposition? Nothing guarantees m1..mk ⇒ goal — proving that would require solving the problem itself. **Resolution:** acceptance check = formula well-sorted + usable as a planner subgoal. State explicitly in the docs that **decomposition is heuristic**: system soundness rests on the final PROVER check + replanning, not on decomposition soundness. (Honest limitation to declare, not a bug to fix away.) **Patch:** PIPELINE.md §4; ALGORITHM.md §3. ### GAP-4 — Answer typing (constant | interval | function) The replay's goal had a free parameter (t_or) but ANSWER returned scenario constants — presenting a function as bare numbers is exactly what made the answer feel wrong ("massa gran?"). The system should have *refused* to print a single number. **Resolution:** `GoalSchema.answer_type ∈ {constant, interval, function}`; ANSWER must match it; when later evidence bounds a parameter, function → interval → constant (the answer tightens as evidence arrives). **Patch:** ALGORITHM.md §6. ### GAP-5 — Fractal-table mapping bug (PIPELINE.md §3) The orchestrator row maps CHECK → `PROVER.derivable`. But in the generic expert, CHECK gates the *formalization before the engine runs*; derivability is the engine's goal test (the stop condition). The table conflates the two. **Resolution:** orchestrator's formalization check = GoalSchema validity (GAP-1); engine goal-test = derivability (stop condition). Fix the table. **Patch:** PIPELINE.md §3. ### GAP-6 — Budget policy undefined Termination depends on `budget.exhausted()` but nothing sets the initial budget or its units. **Resolution:** budget = cost units of the meta-domain price list (§5); set by user or system default at INIT; logged per run; `ask_user` priced high (human latency). **Patch:** ALGORITHM.md §3, §5. ### GAP-7 — Assumption branching & dependency-directed backtracking (TMS-lite) Backtracking exists at search level (A* explores/prunes the plan space every turn, cheap), but there is no machinery for branching over **hypotheses across turns**: a factual hypothesis opens a world-branch that lives until evidence refutes or confirms it; on contradiction the branch must die *including everything built on top of it*. Current design only replans the active branch — nothing retracts downstream rows derived from a refuted premise. **Bites:** the evidence table is a single linear world; a refuted premise leaves contradictory rows alive; contradictions linger and poison the prover's derivability checks. **Resolution:** - Distinguish **factual hypotheses** (refutable by evidence → branch: explore, kill or confirm; a refuted row is marked RETRACTED) from **parameter assumptions** (GAP-2; not refutable by any evidence → scenario contexts, dimensions of the answer function, never branches). Criterion: *if no possible evidence could refute it, it is a parameter, not a hypothesis*. - Consistency CHECK on every append; on contradiction, **dependency-directed backtracking** (not chronological): walk the provenance graph from the contradictory rows → find culprit assumptions → mark RETRACTED → transitively retract every row whose provenance includes a culprit → replan the affected branch only. - The provenance graph the table already carries for auditability **doubles as the TMS justification graph** (Doyle 1979; ATMS de Kleer 1986 = the multi-world v2 option — keep all assumption contexts alive in parallel). - Append-only + retraction marks preserve the corpse: the dead-branch log (hypothesis, what refuted it, what it cost) is exactly the training data for the learned v2 router. **Worked example from the replay:** E5 ("the 1,151-qubit article measures the mining oracle") was a factual hypothesis; CHECK flagged it; one targeted knowledge call refuted it (it was Shor on ECDSA); the row died, nothing downstream depended on it. The machinery to do this automatically is what this gap adds. **Patch:** PIPELINE.md §4, §5; ALGORITHM.md §3. ### GAP-8 — INIT must be epistemically closed over the question's vocabulary The replay's INIT emitted a goal full of domain predicates (`minQubits(T,D,t_or)`, `N_c = D·2³²`, Grover, Zalka) — LLM world knowledge dressed as formalism, i.e. domain content entering through the back door at t=0, before ANY evidence exists. Same disease as CYC, one level up. Also: INIT imported the *competitive* framing (T = 600 s), which inflated the answer by ~17 orders of magnitude — the user's "massa gran" was the symptom. **Resolution (user's correction, adopted):** - INIT may use ONLY: (a) concepts literally present in the question, (b) a small generic planning scaffold (number, method, machine, resources, dependencies). No domain predicates, no parameters, no time, no answer structure. - **GoalSchema shrinks**: `{quantity, of, answer_type: OPEN, criterion}`. `answer_type` starts OPEN — constant vs function vs interval is *discovered by the plan* when evidence reveals dependencies, and tightens OPEN → FUNCTION → INTERVAL → CONSTANT. - **Milestones become epistemic questions**, not formulas: `Milestone{question, produces, deps}` — done = a sourced answer exists in the table. Dependency chains make milestones *templates over slots* (ReWOO at milestone level): m2 cannot even be instantiated until #m1 is filled. The first branch therefore has exactly ONE concrete step. - Domain structure (including whether time matters!) enters ONLY via evidence rows; if evidence at m3 says "the count depends on clock / parallelization policy", THEN the planner opens parameters (and GAP-2's criterion decides ask_user — a machine-vs-fleet spread of ≥10⁹ fires ask_user, which the first run skipped and decided alone). **Patch:** PIPELINE.md §3, §4; ALGORITHM.md §0, §3, §6. Deepest gap so far — affects fractality: the orchestrator's "formalization" is now question decomposition (a linguistic skill, domain-independent), not domain modeling. ### GAP-9 — Semantics of user-supplied knowledge (UserReply rows) In the replay, the user volunteered domain knowledge from memory (how the mining threshold works) via chat. The docs define `UserReply` as a type but never say what the system does with user-provided *facts* (as opposed to user-provided *scope decisions*, which the ask_user action was designed for). **Bites:** (a) Is a user fact a premise immediately, or does it need verification? (b) What happens when cited evidence contradicts a user row? GAP-7's retraction machinery assumes the culprit is a machine-checkable assumption — but you cannot "retract" the user. (c) ANSWER ships sources: "the user told me" is provenance, but a reader cannot audit it. **Resolution (proposed):** - User rows are premises (user is the authority on intent and scope) but are typed `UserReply{claim, marked: true}` and ALWAYS carry `provenance: user` into the final answer — user-asserted facts are listed separately from source-cited facts. - If a user fact is **load-bearing** for the goal (the derivation would collapse without it) and verification is cheap, the planner may schedule a confirm-call to `knowledge` — the row stays, the citation gets attached. - On conflict between a user row and sourced evidence: **never silent-pick**. Fire `ask_user` presenting the discrepancy verbatim (quote + user claim). The user is the tie-breaker on facts, not the system. **Patch:** PIPELINE.md §5; ALGORITHM.md §0. ### REDESIGN-1 — The orchestrator's engine is recursion into FLOOP (no symbolic planner in v1) User proposal, adopted: INIT is a single LLM call ("what do I need to know to answer this?"); subquestions too big for one expert are solved by a recursive FLOOP run that knows it serves a parent goal. The A*/clingo meta-planner was over-engineering: with dependent questions, execution order = dependency order — nothing to search. Division of labour now: decomposition proposal = LLM (linguistic, epistemically closed per GAP-8); sequencing/budget/depth/retries/ retraction = fixed code; stop = prover; expert-vs-recursion-vs-user per question = one cheap LLM judgement over the expert catalogue (which now contains floop itself as the decomposition expert, and the user as expert of last resort). A* returns only in v2 (budget competition between parallel branches / learned routing costs). Supersedes the PLANNER-centric sections of both docs — ALGORITHM.md rewritten as a prose description of the machine. ### GAP-10 — Adequacy contract & the decomposition criterion (found at depth-1 replay) Walking the child run exposed three things the docs left implicit: (a) **Who decides "is this question primitive or does it need decomposition?"** — no criterion existed. Working answer: decompose only when a single expert call cannot produce an answer of the declared type; prefer routing first and decomposing **on failure** (type-check miss / shallow quotes), not by upfront inspection. (b) **Adequacy for the parent lives in the declared answer type.** The child knows why it is asked (parent context), and the parent's need is expressed as the fields of the declared type (e.g. `Algorithm{function, input, variable, success_condition}`). A quote that fills 3 of 4 fields fails the arrival check → targeted retry/decomposition of just the missing field. The type IS the parent-child interface. (c) **Derivability degenerates for descriptive questions**: no real logical derivation, just "an adequate typed, sourced row exists". Formal rigor concentrates where composition happens (analytic/numeric levels). State this honestly — the prover is not equally strong at all nodes of the tree. **Also discovered (not a gap — a freebie):** the stop-check runs on newly-opened questions too, so a child whose answer already exists in the visible table terminates with zero or one confirm calls. The stop-check IS the cache/dedup of the architecture. **Patch:** PIPELINE.md §3, §4; ALGORITHM.md §2, §4. --- ## Notes from the replay (not gaps — lessons) - The E5 rejection (Shor-on-ECDSA article posing as "quantum attack on Bitcoin") was the type checker doing its job — the fleet config's `check` caught a cross-type confusion. Keep per-expert checks that know the *failure shapes* of their sources. - The knowledge expert ran degraded (search snippets only — page extraction unavailable) and should have downgraded confidence accordingly. Degraded-source confidence policy is a small open question, related to GAP-2. - The honest answer to the demo question is a function of t_or (and weakly of D, T); the literature-standard constant (~2.4k–13k logical qubits, one machine, no deadline) is the collapse of that function under "no clock constraints".