Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/bootstrap/formal-oracles/lean/MutantKvModels.lean # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / bootstrap / formal-oracles / lean / MutantKvModels.lean` 32 lines · 1587 bytes Raw Blame History 1 import AienKv.Corpus 2 /-! 3 # Deliberate mutants of the KV layout (each must break one required rule) 4 5 WRONG on purpose. Each mutant model compiles; the matching claim file must not. 6 -/ 7 namespace AienKv 8 9 /-- MUTANT 1 (kv_planes_overlap): layer stride is one plane, so the V plane starts inside the next layer. -/ 10 def Cfg.layerM1 (c : Cfg) : Nat := c.plane 11 12 /-- MUTANT 2 (total_one_block_short): the allocation is one block too small. -/ 13 def Cfg.totalM2 (c : Cfg) : Nat := c.numBlocks * c.block - c.block 14 15 /-- MUTANT 3 (token_stride_forgets_element_size): token stride = heads * dim, not heads * dim * bytes. -/ 16 def Cfg.tokenM3 (c : Cfg) : Nat := c.numKvHeads * c.headDim 17 18 /-- MUTANT 4 (validity_off_by_one): the K/V selector is allowed to be 0, 1 or 2. -/ 19 def Cfg.ValidM4 (c : Cfg) (b l v t h d : Nat) : Prop := 20 b < c.numBlocks ∧ l < c.numLayers ∧ v < 3 ∧ t < c.blockSize ∧ h < c.numKvHeads ∧ d < c.headDim 21 22 /-- MUTANT 5 (block_stride_short): consecutive blocks are placed one byte too close. -/ 23 def Cfg.blockStrideM5 (c : Cfg) : Nat := c.block - 1 24 25 theorem m1_witness : (tiny 4).plane = (tiny 4).layerM1 ∧ (tiny 4).layerM1 < 2 * (tiny 4).plane := by decide 26 theorem m2_witness : (tiny 4).totalM2 < (tiny 4).block * 4 := by decide 27 theorem m3_witness : (tiny 4).tokenM3 < (tiny 4).head * 4 := by decide 28 theorem m4_witness : (tiny 4).off 0 0 2 0 0 0 + 4 ≤ (tiny 4).total ∧ ¬ (tiny 4).Valid 0 0 2 0 0 0 := by 29 refine ⟨by decide, ?_⟩; unfold Cfg.Valid; decide 30 theorem m5_witness : 1 * (tiny 4).blockStrideM5 + (tiny 4).block > 1 * (tiny 4).block := by decide 31 32 end AienKv