aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / om / qwen-native / model / checks / Bounds.lean
| 1 | import Std.Tactic |
| 2 | namespace QwenNative |
| 3 | /-- A positive size is rounded up to the number of 128-element blocks. -/ |
| 4 | def blocks (n : Nat) := (n + 127) / 128 |
| 5 | theorem scale_coordinate {x n : Nat} (h : x < n) : x / 128 < blocks n := by |
| 6 | unfold blocks |
| 7 | omega |
| 8 | /-- model/profile.om reserves 1600 slots per layer; an expert owns three consecutive slots. -/ |
| 9 | def expertSlot (expert projection : Nat) := 32 + expert * 3 + projection |
| 10 | theorem expert_range {e p : Nat} (he : e < 256) (hp : p < 3) : |
| 11 | 32 ≤ expertSlot e p ∧ expertSlot e p < 1020 := by |
| 12 | unfold expertSlot |
| 13 | omega |
| 14 | theorem expert_unique {e f p q : Nat} (hp : p < 3) (hq : q < 3) |
| 15 | (h : expertSlot e p = expertSlot f q) : e = f ∧ p = q := by |
| 16 | unfold expertSlot at h |
| 17 | omega |
| 18 | theorem layer_slots_disjoint {i j a b : Nat} (hij : i < j) (ha : a < 1600) : |
| 19 | i * 1600 + a < j * 1600 + b := by omega |
| 20 | /-- Sequential generation consumes at most prompt + cap - 1 positions. -/ |
| 21 | theorem context_bound {prompt cap j : Nat} (hcap : 0 < cap) |
| 22 | (hadmit : prompt + (cap - 1) ≤ 8192) (hj : j + 1 < cap) : |
| 23 | prompt + j < 8192 := by omega |
| 24 | end QwenNative |