Encyclopedia Lnal Lnal Instr Cost Instr Cost
Lnal Instr Cost Instr Cost
A small table in a machine-checked library assigns a recognition cost to each primitive instruction, and the table's meaning is narrower than it looks.
The instruction cost table
In a machine-checked library of formal statements, the declaration instrCost defines a function from primitive instructions to integers. The function assigns a cost to each instruction, where the cost is a plain number in dimensionless units. The definition is a table: a FOLD with direction 0 costs 0, any other FOLD costs 1, a BRAID or MERGE with a delta token costs that delta, a SEED with a set token costs the given cost, and everything else costs 0. The table is a definitional choice, not a proven statement.
The name comes from the framework's idea of a ledger, a discrete record of events. In that picture, each primitive instruction is a recognition event, and the cost is the price the ledger pays to recognize it. The table sets those prices. It does not derive them from anything else; it simply chooses them. The declaration is a model of how costs attach to instructions, not a claim about what costs must be.
What the table does not claim is as important as what it does. It does not claim that these costs are the only possible costs, or that they are optimal, or that they match any measured physical quantity. It does not claim that the costs are derived from the forcing chain that produces constants like the golden ratio. The declaration is a local definition, used as a building block for later statements about instruction sequences. Its role is to give a concrete cost function, so that other statements can talk about total costs of programs.
In plain terms: the declaration says "here is how much each instruction costs," and nothing more. It is a starting point, not a conclusion. A reader who wants to know why these costs, or what they imply, must look at the statements that use this table, not at the table itself.
MODEL instrCost · IndisputableMonolith/LNAL/InstrCost.lean
/-- J-cost rate for a primitive instruction (dimensionless units). -/
def instrCost : LInstr → Int
| ⟨Opcode.FOLD, OpcodeArg.fold dir⟩ => if dir = 0 then 0 else 1
| ⟨Opcode.FOLD, _⟩ => 1
| ⟨Opcode.BRAID, OpcodeArg.token (TokenAction.delta d)⟩ => d
| ⟨Opcode.MERGE, OpcodeArg.token (TokenAction.delta d)⟩ => d
| ⟨Opcode.SEED, OpcodeArg.token (TokenAction.set _ cost)⟩ => cost
| _ => 0
MODEL instrCost · IndisputableMonolith/LNAL/InstrCost.lean
/-- J-cost rate for a primitive instruction (dimensionless units). -/
def instrCost : LInstr → Int
| ⟨Opcode.FOLD, OpcodeArg.fold dir⟩ => if dir = 0 then 0 else 1
| ⟨Opcode.FOLD, _⟩ => 1
| ⟨Opcode.BRAID, OpcodeArg.token (TokenAction.delta d)⟩ => d
| ⟨Opcode.MERGE, OpcodeArg.token (TokenAction.delta d)⟩ => d
| ⟨Opcode.SEED, OpcodeArg.token (TokenAction.set _ cost)⟩ => cost
| _ => 0
MODEL instrCost · IndisputableMonolith/LNAL/InstrCost.lean
/-- J-cost rate for a primitive instruction (dimensionless units). -/
def instrCost : LInstr → Int
| ⟨Opcode.FOLD, OpcodeArg.fold dir⟩ => if dir = 0 then 0 else 1
| ⟨Opcode.FOLD, _⟩ => 1
| ⟨Opcode.BRAID, OpcodeArg.token (TokenAction.delta d)⟩ => d
| ⟨Opcode.MERGE, OpcodeArg.token (TokenAction.delta d)⟩ => d
| ⟨Opcode.SEED, OpcodeArg.token (TokenAction.set _ cost)⟩ => cost
| _ => 0
What this page does not claim
The costs are not derived from the forcing chain or any other statement. The costs are not claimed to be optimal or unique. The costs are not claimed to match any measured physical quantity.
Verify this page
Every tagged claim above names its theorem. To check one yourself rather than trust this page, elaborate the source module with Lean 4 and audit its axiom basis:
$ lake env lean IndisputableMonolith/LNAL/InstrCost.lean
expected axiom basis: [propext, Classical.choice, Quot.sound] (the Lean kernel's standard three; no RS-specific axioms)
A page whose claims cannot be reproduced this way does not ship. In production, every anchor links to the exact declaration in the public source release, and this block carries the build receipt for the page itself.
Derived articles
This page is generated by a question-recursion engine: the questions its answers raise become the next pages. The current agenda, with open targets marked red:
- What statements use the instrCost table to prove total costs of programs?
- How does the instrCost table relate to the framework's forcing chain that produces constants like the golden ratio?
- What is the intended interpretation of a FOLD with direction 0 costing 0 versus any other FOLD costing 1?
MACHINE LAYER · GROUNDED CLAIM TABLE · CLICK TO EXPAND
MODEL instrCost · IndisputableMonolith/LNAL/InstrCost.lean
/-- J-cost rate for a primitive instruction (dimensionless units). -/ def instrCost : LInstr → Int | ⟨Opcode.FOLD, OpcodeArg.fold dir⟩ => if dir = 0 then 0 else 1 | ⟨Opcode.FOLD, _⟩ => 1 | ⟨Opcode.BRAID, OpcodeArg.token (TokenAction.delta d)⟩ => d | ⟨Opcode.MERGE, OpcodeArg.token (TokenAction.delta d)⟩ => d | ⟨Opcode.SEED, OpcodeArg.token (TokenAction.set _ cost)⟩ => cost | _ => 0The declaration instrCost defines a function from primitive instructions to integers. instrCost · IndisputableMonolith/LNAL/InstrCost.leanMODEL instrCost · IndisputableMonolith/LNAL/InstrCost.lean
/-- J-cost rate for a primitive instruction (dimensionless units). -/ def instrCost : LInstr → Int | ⟨Opcode.FOLD, OpcodeArg.fold dir⟩ => if dir = 0 then 0 else 1 | ⟨Opcode.FOLD, _⟩ => 1 | ⟨Opcode.BRAID, OpcodeArg.token (TokenAction.delta d)⟩ => d | ⟨Opcode.MERGE, OpcodeArg.token (TokenAction.delta d)⟩ => d | ⟨Opcode.SEED, OpcodeArg.token (TokenAction.set _ cost)⟩ => cost | _ => 0The function assigns a cost to each instruction, where the cost is a plain number in dimensionless units. instrCost · IndisputableMonolith/LNAL/InstrCost.leanMODEL instrCost · IndisputableMonolith/LNAL/InstrCost.lean
/-- J-cost rate for a primitive instruction (dimensionless units). -/ def instrCost : LInstr → Int | ⟨Opcode.FOLD, OpcodeArg.fold dir⟩ => if dir = 0 then 0 else 1 | ⟨Opcode.FOLD, _⟩ => 1 | ⟨Opcode.BRAID, OpcodeArg.token (TokenAction.delta d)⟩ => d | ⟨Opcode.MERGE, OpcodeArg.token (TokenAction.delta d)⟩ => d | ⟨Opcode.SEED, OpcodeArg.token (TokenAction.set _ cost)⟩ => cost | _ => 0The table is a definitional choice, not a proven statement. instrCost · IndisputableMonolith/LNAL/InstrCost.lean