[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-107568":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":28,"discoverSource":29},107568,"turbo-lean","Th0rgal\u002Fturbo-lean","Th0rgal","High-performance, distributed build, verification, and counterexample tooling for Lean 4",null,"Rust",60,7,51,21,0,2,8,44.51,"MIT License",false,"main",true,[],"2026-11-17 16:19:21","2026-11-19 11:52:41","\u003Cp align=\"center\">\n  \u003Cimg src=\"logo.svg\" width=\"160\" alt=\"turbo-lean\" \u002F>\n\u003C\u002Fp>\n\n\u003Ch1 align=\"center\">turbo-lean\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>Incremental verification, counterexample triage, and verified native\u002FSIMD\u002FGPU\u002FTPU compilation for Lean 4.\u003C\u002Fstrong>\n\u003C\u002Fp>\n\n`turbo-lean` unifies the incremental verification oracle (`TurboLean`) and the verified native compiler (`LeanNative`) on top of [`lean-sys`](https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Flean-sys):\n1. **Sub-2ms Agent & Proof Verification Loops**: Verify edited theorems in **`~2 ms`** via warm `ZygoteWorker` checkpoints, reject false lemmas in **`\u003C 1 ms`** on CPU SIMD \u002F CUDA \u002F Metal, and certify & triage counterexamples (`CandidateBug | SpecTooStrong | ReferenceDiscrepancy`) in **`~3 ns`** via in-process C-ABI gates.\n2. **Verified Native Compilation & Acceleration Plugins (`@[simd]`, `@[gpu]`, `@[tpu]`, `@[superopt]`)**: Lower pure Lean 4 \u002F `LNIR` kernels to zero-copy C99\u002FRust FFI, AVX2 \u002F AVX-512 \u002F ARM64 NEON SIMD, NVIDIA CUDA PTX, Apple Metal 3.0 MSL, and Google Cloud TPU v6e (`StableHLO` \u002F `Pallas`) with **547 unique `LeanNative.*` theorems audited in `AxiomAudit.lean`** (`1,913` total `theorem`\u002F`lemma` declarations across `lean\u002FLeanNative\u002F`, `\u003C!-- inventory:leannative_tight_specs -->124\u002F124\u003C!-- \u002Finventory:leannative_tight_specs -->` tight specs in `LeanNative\u002FSpec.lean`, `0 sorryAx`).\n3. **Adversarial Anti-Reward-Hacking Gate**: Enforce in-kernel transitive axiom checks (`{propext, Quot.sound, Classical.choice}`), block macro-hidden `sorryAx` \u002F `native_decide` \u002F `extern` \u002F `implemented_by` \u002F `unsafe` bypasses, pin theorem statements in `\u003C 10 µs`, and emit Ed25519\u002FBLAKE3 receipts.\n\n---\n\n## Execution Modes (`check`, `eval`, and `LeanNative` Compilation)\n\n1. **Adversarial Proof Verification (`turbo-lean check` \u002F `ci-verify` \u002F `pr-verify` \u002F `agent-step`)**:\n   - Audits untrusted theorem proofs in the Lean 4 kernel (`0 sorryAx`, `0 native_decide` \u002F `Lean.ofReduceBool` \u002F `Lean.trustCompiler`, no `unsafe`, `@[extern]`, `@[implemented_by]`, unapproved `axiom`, or nested inductive types) with `\u003C 10 µs` `ConstantInfo.type` Statement Pinning.\n   - Projects that accept the auxiliary axioms of `native_decide` \u002F `bv_decide` in some proofs allow them in `turbo-lean.toml` (`[axioms] allow = [\"*._native.native_decide.ax_*\", \"*._native.bv_decide.ax_*\"]`, `*` globs, never `sorryAx` or `Lean.trustCompiler`); `check`, `agent-step`, trusted `ci-verify` and `pr-verify` (which reads the policy at `--base`) apply it. Audited compiler replacements use `[csimp] allow = [\"MyModule.fast_eq\"]` (theorem-name `*` globs); `pr-verify` passes only the policy at `--base` to the compiled auditor. Untrusted `ci-verify --base \u003Cgit-ref>` uses the same policy revision; without `--base` it ignores checkout policy (explicit caller environment allowlists remain supported).\n   - Only an edit confined to theorem proof bodies is checked per declaration (proof irrelevance). Any other edit (statement, `def`, instance, attribute, option, import, new or deleted file; for `--decl`, a change of that theorem's statement) makes `pr-verify`, `check` and `agent-step` re-check the edited modules and every module that imports them (`bwrap`-sandboxed native module compilation + `--audit-modules` in `pr-verify --mode untrusted`; the resolved toolchain’s `lake build` in trusted mode), so dependents in other files are checked; without a Lake config they refuse to pass.\n   - Verifier tools (`lean`, `lake`, `leanc`) are absolute siblings in the installed toolchain, including helper compilation and fast-check prewarm. Missing siblings fail closed. Verifier subprocesses use only the toolchain and `\u002Fusr\u002Fbin:\u002Fbin` on PATH; cached Lake environments and project `[lake] build_command` wrappers cannot select executables. Direct developer-shell `lake build` \u002F `lake env` behavior is unchanged. The low-level compiler resolver still supports developer overrides for non-verification callers; verdict-producing commands use installed toolchains only.\n   - Per-theorem zygote timeout: `check --timeout \u003Csecs>`, `[zygote] timeout_secs` in `turbo-lean.toml`, or `TURBO_LEAN_TIMEOUT_MS` (default 30 s); daemons and their HTTP clients follow it. Module `.olean` audits and `--decl-identity` declaration-identity confirmation share the audit wall-clock budget (`TURBO_LEAN_AUDIT_TIMEOUT_SECS`, default 120 s untrusted \u002F 300 s trusted), capped by any active request timeout (`TURBO_LEAN_TIMEOUT_MS` \u002F `--timeout`).\n2. **Deterministic Evaluation (`turbo-lean eval \u003Cfile.lean> [--lean-path ...] [--timeout-ms ...] [--verify-determinism]`)**:\n   - Drop-in **`~660x–700x`-faster** replacement for `lean \u003Cfile.lean>` on specification & mutation benchmarks (`rsgb`), preserving 100% of `MessageLog` diagnostics, captured `stdout`, and transitive `.olean` dependency hashes (`Law 6`).\n3. **Verified Native & Accelerator Compilation (`lean\u002FLeanNative` — `lean-native` \u002F `lean-native-core`)**:\n   - **Segregated Acceleration Plugins (`@[simd]`, `@[gpu]`, `@[tpu]`, `@[superopt]`)**: Rewrites and lowers `LNIR` (`letBind`, `incRef`, `decRef`, `call`, `parFor`, 256-bit EVM\u002FUInt256 arithmetic) with Alive2-style symbolic translation validation (`SymbolicTV.lean`) and cost-guided superoptimization (`Superopt.lean`).\n   - **Zero-Runtime C-ABI & Multi-Target Codegen**: Emits standalone `.c` \u002F `.h` \u002F `.rs` static libraries (`--emit-c-abi`), LLVM IR (`x86_64` AVX2\u002FAVX-512, `aarch64` NEON), CUDA PTX (`sm_80`\u002F`sm_90`), Apple Metal 3.0 (`.metal`), and Cloud TPU v6e (`StableHLO` MLIR & JAX `Pallas`).\n   - **System Interactions via [`lean-sys`](https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Flean-sys)**: `LeanNative` focuses on pure compute and hardware acceleration. If your compiled native Lean 4 program needs to interact with the operating system (POSIX I\u002FO, crash-atomic WAL\u002FCAS storage, composite-key tables, `\u002Fdev\u002Fshm` shared-memory IPC, subprocess sandboxing, or HTTP\u002F1.1 & JSON-RPC 2.0 servers with `0 import Lean` and `libleanrt.a`-only), pair it with [`lean-sys`](https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Flean-sys).\n\n---\n\n## Architecture & Soundness Guarantees\n\n1. **In-Process C-ABI Oracle & Counterexample Triage (`libturbo_spec_cabi.a`)**\n   - Links **\u003C!-- inventory:turbo_cabi_exports -->78\u003C!-- \u002Finventory:turbo_cabi_exports --> zero-runtime C-ABI symbols** (\u003C!-- inventory:turbo_cabi_breakdown -->`41 turbo_spec_*` + `26 leansys_*` + `11 leannative_*`\u002F`lean_native_*`\u003C!-- \u002Finventory:turbo_cabi_breakdown -->) directly into the binary, verified at compile time via `nm` (`owner_count == 1`, `0` undefined symbols).\n   - Evaluates candidate counterexamples in-process through `leannative_certify_cex_witnesses`, `leannative_fastcheck_rewrite_step`, and `leansys_verify_counterexample_triage`, classifying every falsified conjecture into `CandidateBug`, `SpecTooStrong` (vacuous precondition), or `ReferenceDiscrepancy` (domain hazard such as div\u002Fmod by zero or shift `>= 64`).\n2. **Multi-Agent CAS & Memory Governor (`~\u002F.cache\u002Fturbo-lean\u002F`)**\n   - Coalesces concurrent builds across worktrees via `flock` singleflight, shares immutable `BLAKE3`-addressed `.olean`\u002Fshard blobs via reflinks\u002Fhardlinks, and bounds RAM (`--max-memory-mb`) with `have`-block proof fission.\n3. **Tight Formal Specifications (`0 sorryAx`)**\n   - **\u003C!-- inventory:turbo_tight_specs -->94\u002F94\u003C!-- \u002Finventory:turbo_tight_specs --> tight specs** in [`lean\u002FTurboLean\u002FSpec.lean`](lean\u002FTurboLean\u002FSpec.lean), **\u003C!-- inventory:leannative_tight_specs -->124\u002F124\u003C!-- \u002Finventory:leannative_tight_specs --> tight specs** in [`lean\u002FLeanNative\u002FSpec.lean`](lean\u002FLeanNative\u002FSpec.lean), and **37\u002F37 tight specs** in [`lean-sys`](https:\u002F\u002Fgithub.com\u002FTh0rgal\u002Flean-sys).\n\n---\n\n## Assurance (Proven vs. Tested vs. Trusted)\n\n### Formal Verification Boundary (`Lean 4 -> Target IR`)\n\n- **Inside the formal boundary (`Lean 4 -> Target IR`, `LeanNative` scope)**: Under standard Lean 4 axioms `{propext, Quot.sound, Classical.choice}` (`0 sorryAx`, `0 native_decide`, `0 trustCompiler`), `LeanNative` verifies end-to-end semantic refinement from upstream `Lean.Compiler.LCNF` through `LNIR`, acceleration plugins (`@[simd]`, `@[gpu]`, `@[tpu]`, `@[superopt]`), `HeapObj` \u002F `lean.h` reference-counting layout (`54\u002F54` PASS), and typed backend AST lowering up to **LLVM IR**, **NVIDIA CUDA PTX**, **Apple Metal MSL**, **Google TPU StableHLO \u002F Pallas**, and **C99 ABI** (completed across `C1`–`C8` and extended in `D0`–`D6` in [`docs\u002FROADMAP.md`](docs\u002FROADMAP.md)).\n- **Trusted downstream (`Target IR -> Silicon`, TCB)**: Vendor backend compilers and runtimes — `clang`\u002FLLVM, `ptxas`\u002FCUDA, Apple's Metal compiler, XLA\u002FPallas, the C compiler, OS loader, and hardware — belong to the Trusted Computing Base; `turbo-lean` performs **no** ISA or binary machine-code verification below Target IR and carries **zero** external Cranelift\u002FISA proof-repository or CI dependencies.\n\nStatus as of `main` (`a95e505`, with D0–D6 merged). For Track A, the completed `C1`–`C8` `Lean 4 -> Target IR` program, the Next-Gen `D0`–`D6` roadmap and open soundness PRs, see [`docs\u002FROADMAP.md`](docs\u002FROADMAP.md). Wave 3 measurements and coverage limits are in [`docs\u002FBENCH_RUST_PARITY.md`](docs\u002FBENCH_RUST_PARITY.md). Every proof listed below is audited in the Lean 4 kernel (`#verify_lean_native_axioms` in `lean\u002FLeanNative\u002FProofs\u002FAxiomAudit.lean`, covering 552 unique `auditedTheoremNames`: 547 `LeanNative.*` plus 5 `ConLeche`\u002F`TurboLean.ElabAudit` theorems) against `allowedStandardAxioms = [propext, Quot.sound, Classical.choice]` and `forbiddenAxioms` (`sorryAx`, `Lean.ofReduceBool`, `Lean.ofReduceNat`, `Lean.trustCompiler`). Audit results are elaborated in chunks of at most 32 entries.\n\n| Component | What is PROVEN (theorem + file) | What is only TESTED (test \u002F CI step) | What is TRUSTED |\n| :--- | :--- | :--- | :--- |\n| **LNIR evaluator, LCNF bridge & IR passes** | `Val.beq_refl` (`lean\u002FLeanNative\u002FSemantics\u002FValue.lean:46`) over `Val` (`:10`) and unified `HeapObj` (`:167`); `ScalarExprEquiv` (`lean\u002FLeanNative\u002FSemantics\u002FRefinement.lean:11`), `ExprRefines` (`:31`), `CodeRefines` (`:78`) over `evalBinOp` (`lean\u002FLeanNative\u002FSemantics\u002FEval.lean:16`), `evalScalarExpr` (`:158`), `evalParKernelLoop` (`:496`), `evalCode` (`:545`); `applyRewriteTable_sound` (`lean\u002FLeanNative\u002FProofs\u002FPeepholeProofs.lean:679`); `optimizeEqSatCode_sound` (`lean\u002FLeanNative\u002FTransform\u002FEqSat.lean:40`); `unboxTupleProj0_sound` \u002F `unboxTupleProj1_sound` (`lean\u002FLeanNative\u002FProofs\u002FLoopOptProofs.lean:16,27`), `evalParKernelLoop_append` (`:407`); `scheduleStructuredLoop_sound` (`lean\u002FLeanNative\u002FTransform\u002FLoopSchedule.lean:157`); `elideAndMutateRC_sound` (`lean\u002FLeanNative\u002FTransform\u002FOwnershipRC.lean:140`); closure\u002FADT\u002Fslice\u002Ffusion passes `defunctionalizeClosure_sound` \u002F `lowerAdtMatch_sound` (`lean\u002FLeanNative\u002FProofs\u002FClosureADTProofs.lean:141,169`), `lowerSliceFold_sound` (`lean\u002FLeanNative\u002FProofs\u002FSliceViewProofs.lean:248`), `fuseParForKernels_sound` (`lean\u002FLeanNative\u002FProofs\u002FKernelFusionProofs.lean:556`); and real `Lean.Compiler.LCNF -> LNIR` bridge soundness `lowerRealLCNFCode_sound` \u002F `lowerRealLCNFDecl_sound` (`lean\u002FLeanNative\u002FProofs\u002FRealLCNFBridgeProofs.lean:470,479`). | 3-way differential conformance (`scripts\u002Fverify_roadmap_contract.sh:167`, `.github\u002Fworkflows\u002Froadmap-conformance.yml:71`) and scalar\u002Ftuple\u002FStage-1D frontend tests (`scripts\u002Ftest_scalar_frontend.py` at `.github\u002Fworkflows\u002Froadmap-conformance.yml:74`). | Adequacy of the LCNF\u002FLNIR operational model (`evalCode` and upstream `Lean.Compiler.LCNF` intrinsic mapping) with respect to the Lean C runtime (`lean.h`). |\n| **Backends (`LLVM` \u002F `PTX` \u002F `Metal` \u002F `StableHLO` \u002F `C-ABI`)** | Typed Target-IR AST semantics (`LLVMAst` `BitVec`+poison, `PTXAst` & `MetalAst` SIMT warp\u002Fthread execution, `StableHLOAst`) and end-to-end lowering soundness `lowerToLLVM_sound` (`lean\u002FLeanNative\u002FProofs\u002FLLVMLowerProofs.lean:109`), `lowerToStableHLO_sound` (`lean\u002FLeanNative\u002FProofs\u002FStableHLOLowerProofs.lean:81`), `lowerToPTX_sound` (`lean\u002FLeanNative\u002FProofs\u002FPTXDeclProofs.lean:160`), `lowerToMetal_sound` (`lean\u002FLeanNative\u002FProofs\u002FMetalDeclProofs.lean:160`), GPU emitter mutant kills `kill_emitter_mutant_M6..M10` (`lean\u002FLeanNative\u002FProofs\u002FGPUEmitterMutantProofs.lean:187`), and C99 ABI \u002F zero-copy host-device dispatch `validateHybridDispatch_sound` & `execZeroCopySliceIoHostCall_ok_sound` (`lean\u002FLeanNative\u002FProofs\u002FHybridCAbiProofs.lean:1049,1342`). | Production text\u002Fobject emitters — `emitLLVMModule` (`lean\u002FLeanNative\u002FBackend\u002FLLVM.lean`), `emitMLIRModule` \u002F `emitPTXModule` \u002F `emitStableHLOModule` \u002F `emitTPUPallasModule` (`lean\u002FLeanNative\u002FBackend\u002FMLIRGPU.lean`), `emitMetalModule` (`lean\u002FLeanNative\u002FBackend\u002FMetal.lean`), `emitHybridHostGlue` \u002F `emitMetalZeroCopyHostGlue` (`lean\u002FLeanNative\u002FBackend\u002FHybrid.lean`), `verifyObjectBytesForTarget` (`lean\u002FLeanNative\u002FDriver\u002FCAbiEmit.lean`), and `buildExeLLVMGate?` (`lean\u002FLeanNative\u002FDriver\u002FBuildExe.lean`) — are tested via `lean-native-core self-test` (`.github\u002Fworkflows\u002Fci.yml:82`), `10\u002F10` B-3 emitter mutant kills, and 3-way ASan\u002FUBSan conformance (`.github\u002Fworkflows\u002Froadmap-conformance.yml:20-74`). | Vendor `Target IR -> Silicon` toolchains (`clang`\u002FLLVM, MLIR, `ptxas`\u002FCUDA, Apple Metal compiler, XLA\u002FPallas, C compiler); external Target-IR \u002F ABI specifications (LLVM IR, PTX, MSL, StableHLO, System V \u002F Darwin C99 ABI); header-only ELF\u002FMach-O\u002FWASM checks (`lean\u002FLeanNative\u002FDriver\u002FCAbiEmit.lean`). |\n| **Translation validation (`SymbolicTV`) & superoptimizer (`@[superopt]`)** | `symbolicCodeRefines_sound` \u002F `symbolicValidatedDeclOpt_sound` (`lean\u002FLeanNative\u002FProofs\u002FSymbolicTVRefinesSoundness.lean`), `symExecCode_pureU64_denotes` \u002F `symExecCode_pureU64_eval_eq` (`lean\u002FLeanNative\u002FProofs\u002FSymbolicTVCodeSoundness.lean`), `normSymExpr_pureU64_denotes` \u002F `symEvalScalarRes_pureU64_sound` \u002F `validateTranslationDeclSound_of_passed` \u002F `checkSingleSample_sound` (`lean\u002FLeanNative\u002FProofs\u002FSymbolicTVSoundness.lean`), `checkSuperoptScalarVerified_sound` \u002F `superoptDecl_sound` \u002F `superoptModule_sound` (`lean\u002FLeanNative\u002FProofs\u002FSuperoptSoundness.lean`). `TranslationValidated` stays the explicit label for TV-only extended candidates outside the kernel-checked subset. | Exercised by `lean-native-core verify-certs` and adversarial plugin gates (`scripts\u002Fverify_roadmap_contract.sh:144-164`), `scripts\u002Ftest_scalar_frontend.py` (`.github\u002Fworkflows\u002Froadmap-conformance.yml:74`), and fuel-exhaustion fail-closed regressions `symtv_fuel_exhaustion_fails_closed` \u002F `symtv_source_fuel_exhaustion_fails_closed` (`docs\u002FHEAPOBJ_CONTRACT.md`). | Bounded symbolic execution (`symExecDecl`) whenever accepting `TranslationValidated` rather than `--verified-kernel-only` (`scripts\u002Fverify_roadmap_contract.sh:144-156`). |\n| **`HeapObj` contract (`C6`, `#292`, `#300`, `#331`)** | Buffer RC lemmas `decRefBuf_one_frees_buffer`, `decRefBuf_none_error`, `incRefBuf_none_error` plus `lean.h` ABI header\u002Ftag\u002Fboxing and COW RC preservation theorems `unbox_box_id`, `box_ne_aligned_ptr`, `unpack_pack_header_id`, `unique_dec_ref_triggers_free`, `shared_dec_ref_stays_live`, `cowWriteField_matches_pureClone_payload`, `cowWriteField_result_exclusive`, and `cowWriteField_preserves_live_alias` (`lean\u002FLeanNative\u002FProofs\u002FHeapObjAbiProofs.lean`). | Normative contract (`docs\u002FHEAPOBJ_CONTRACT.md`) + **54\u002F54 PASS** (`0 XFAIL`, `0 UNCOVERED`) named `#guard` regressions in `lean\u002FLeanNative\u002FTests\u002FHeapObjContract.lean` and `lean\u002FLeanNative\u002FTests\u002FHeapObj5b.lean`, enforced structurally and via elaborated `MetaM` checks (`scripts\u002Fci_verify.sh:29-230`). | Alignment between the formalized `HeapObjAbi` header\u002Ffield layout and Lean 4.35.0's C `lean.h` runtime allocator (`m_rc == 0` persistent objects). |\n| **Shadow-semantics checker (Track B0, `#296`, `#332`)** | None (meta-level dependency\u002Fbody\u002Fnamespace checker, not a kernel theorem). | `scripts\u002Fcheck_shadow_semantics.lean` (`docs\u002FSHADOW_SEMANTICS.md`), `scripts\u002Fshadow_inventory.json`, and **empty** `scripts\u002Fshadow_allowlist.json` (`0` entries) run with `--self-test` in `.github\u002Fworkflows\u002Fci.yml`. | Alpha-equivalence scope (eta-expanded, `let`-rewritten, or reordered-match copies are out of scope; `docs\u002FSHADOW_SEMANTICS.md:17-18`). |\n| **Emitter mutation report (B-3, `#293`, `#334`)** | In-kernel formal mutant-kill theorems `mutant_m1_killed..mutant_m5_killed`, `hlo_mutant_h1_killed..hlo_mutant_h3_killed`, `ptx_mutant_m7_killed`, `ptx_mutant_m8_killed`, `metal_mutant_m9_killed`, `metal_mutant_m10_killed`, and `kill_emitter_mutant_M6..M10` (`lean\u002FLeanNative\u002FProofs\u002FAxiomAudit.lean:327-362`). | `scripts\u002Femitter_mutants.py` + `scripts\u002Femitter_mutants.json` (`M1..M11` across `llvm`\u002F`mlir`\u002F`ptx`\u002F`metal`\u002F`c-abi`, **`10\u002F10` applicable mutants killed** + `M11` `NOT_APPLICABLE`, `4\u002F4` `F1..F4` fixtures passing). | Adequacy of the seeded mutation operators `M1..M11` as a proxy for emitter defect classes. |\n| **Verification cache & kernel gate (`TurboLean`)** | Tight gate specs (`lean\u002FTurboLean\u002FSpec.lean`, `\u003C!-- inventory:turbo_tight_specs -->94\u002F94\u003C!-- \u002Finventory:turbo_tight_specs -->`); `inferType_sound`, `con_leche_verify_decl_sound`, `olean_mmap_bridge_sound` (`lean\u002FTurboLean\u002FConLeche.lean:372,485,512`) and `header_pin_prevents_statement_spoofing`, `cas_proof_replay_sound` (`lean\u002FTurboLean\u002FElabAudit.lean:115,128`) **over the self-contained `ConLeche` CIC model (`lean\u002FTurboLean\u002FConLeche.lean:11`), not Lean 4's C++ kernel or real `.olean` files**. | In-kernel `inspectConstant` \u002F `Lean.collectAxioms` (`lean\u002FTurboLean\u002FInspector.lean:160,176`), canonical `statement-v1` statement hashing & sandboxed lexical declaration-identity attestation (`lean\u002FTurboLean\u002FStatementHash.lean:10,62`, `kernelStatementHash` at `lean\u002FTurboLean\u002FZygoteWorker.lean:755`, `confirm_decl_identity` at `crates\u002Fturbo-lean\u002Fsrc\u002Fcheck.rs:221`, `#288`, `#318`), independent `Kernel.Environment.replay` & strict Lean option policy (`kernelReplayNewDecls` at `lean\u002FTurboLean\u002FZygoteWorker.lean:725`, `applyEncodedLeanArgs` at `:206`, `is_allowed_lean_arg` at `crates\u002Fturbo-lean\u002Fsrc\u002Fmodule_builder.rs:5876`, `ZYGOTE_REPLAY_VERSION` at `crates\u002Fturbo-lean\u002Fsrc\u002Fzygote.rs:86`, `eval-shm:v8` at `:7050`, `theorem-shard-v8:` at `crates\u002Fturbo-lean\u002Fsrc\u002Flake_build.rs:731`, `fission-v8:` at `crates\u002Fturbo-lean\u002Fsrc\u002Fcheck.rs:2620`, `http-shard-context-v9:` at `crates\u002Fturbo-lean\u002Fsrc\u002Fserver.rs:1552`, `#305`, `#301`), content-verified imported-env & closure memo (`closure_snapshot_root` at `crates\u002Fturbo-lean\u002Fsrc\u002Fzygote.rs:2052`, `#322`), pinned toolchain executables (`outside_checkout` \u002F `MIN_GIT` at `crates\u002Fturbo-lean\u002Fsrc\u002Ftrusted_tools.rs:11,115`, `#308`), kernel-audited shard fallback (`run_audited_lean_shard` at `crates\u002Fturbo-lean\u002Fsrc\u002Fzygote.rs:3897`, `IMPORT_UNAVAILABLE_CODE` at `:6884`, `auditModuleSlice` at `lean\u002FTurboLean\u002FZygoteWorker.lean:1499`, `#311`), and stderr panic-scan provenance (`ZYGOTE_SCANNER_VERSION` \u002F `panicked_since` at `crates\u002Fturbo-lean\u002Fsrc\u002Fzygote.rs:78,1066`, `#306`), tested via `cargo test --release` and self-verification (`.github\u002Fworkflows\u002Fci.yml:87,130-156`) plus `scripts\u002Ftest_p0_trust_boundary.py` \u002F `scripts\u002Ftest_kernel_gate_audit.py` (`scripts\u002Fverify_roadmap_contract.sh:169-170`). | Rust host orchestrator (`crates\u002Fturbo-lean\u002F`), `bwrap` sandbox, BLAKE3\u002FEd25519 receipt plumbing, filesystem\u002FCAS durability, and open soundness\u002Fparity items tracked in [`docs\u002FROADMAP.md`](docs\u002FROADMAP.md) (`#320`, `#340`, `#342`, `#343`). |\n| **Trusted computing base (TCB)** | — | Toolchain & C-ABI symbol ownership checks (`nm` single-owner check in `crates\u002Fturbo-lean\u002Fbuild.rs`, `scripts\u002Fsync_docs_inventory.py:18-27`). | Lean 4.35.0 kernel & runtime (`lean\u002Flean-toolchain:1`), axioms `[propext, Quot.sound, Classical.choice]` (`lean\u002FLeanNative\u002FProofs\u002FAxiomAudit.lean:50-51`), `elan`\u002FLake, Rust\u002F`rustc`, downstream `Target IR -> Silicon` compilers (`clang`\u002FLLVM, `ptxas`\u002FCUDA, Apple Metal compiler, XLA\u002FPallas, C compiler), OS loader\u002Fkernel, and hardware. |\n\n---\n\n## CLI Usage\n\n```bash\n# 1. Incremental Build, Theorem Check & Deterministic Eval\nturbo-lean build [target...] [--seed-shards] [--project-dir \u003Cdir>]\nturbo-lean check \u003Cfile-or-dir> [--decl \u003Cid>] [--jobs \u003CN>] [--max-memory-mb \u003CMB>]\nturbo-lean eval \u003Cfile.lean> [--lean-path \u003Cpaths>] [--timeout-ms \u003Cms>] [--verify-determinism]\n\n# 2. Agent Loop, Fast-Check (with Counterexample Triage) & Spec Audit\nturbo-lean agent-step \u003Cfile.lean> [--decl \u003Cid>] [--max-memory-mb \u003CMB>]\nturbo-lean fast-check \u003Cfile.lean|kernel.cu> [--decl \u003Cid>] [--samples \u003CN>]\nturbo-lean audit-spec \u003Cfile.lean>\n\n# 3. Native & Accelerator Compilation + Multi-Threaded Native Orchestrator (in `lean\u002F`)\n(cd lean && lake exe lean-native-core --target llvm|ptx|metal|mlir|c-abi \u003Cinput.lean> -o \u003Cout>)\n(cd lean && lake exe lean-native-core self-test)\n(cd lean && lake exe turbo-lean-native self-test)\n\n# 4. PR\u002FCI Verification, Cryptographic Receipts & Portable CAS (.tlpack)\nturbo-lean pr-verify [--base \u003Cgit-ref>] [--mode untrusted|trusted] [--receipt \u003Cout.json>]\nturbo-lean ci-verify [--base \u003Cgit-ref>] [--mode untrusted|trusted] [--receipt \u003Cout.json>]\nturbo-lean export -o cache.tlpack && turbo-lean import cache.tlpack\n\n# 5. Telemetry & Local Agent Analytics\nturbo-lean telemetry [status|enable|disable|local]\nturbo-lean --no-telemetry check \u003Cfile.lean>\n```\n\n---\n\n## Telemetry & Privacy\n\n- **Local-only by default**: Out of the box (`enabled = true`, `remote = false`, `mode = \"metrics\"`), `turbo-lean` records local timing, cache-hit, and token-compaction counters in `\u002Fdev\u002Fshm` (`turbo-lean analytics`) and `~\u002F.cache\u002Fturbo-lean\u002Ftelemetry\u002F` without making any network requests or storing raw source blobs.\n- **Opt-in remote reporting**: Remote metrics upload is disabled unless explicitly enabled via `turbo-lean telemetry enable`, `--telemetry opt-in` \u002F `--telemetry remote`, `TURBO_LEAN_TELEMETRY=remote`, or `remote = true` in `[telemetry]`. A telemetry token alone does not enable it.\n- **Existing installations**: Remote reporting now defaults off even if a token was already configured; existing explicit opt-ins still apply. CLI `check` and `fast-check` emit no telemetry in either mode. Emitting MCP tools resolve project consent from request `project_dir`, then server `mcp --project-dir`, then the input file's parent, then CWD.\n- **Full disable**: Pass `--no-telemetry` (or `--telemetry off`), set `TURBO_LEAN_TELEMETRY=off` (`0`\u002F`false`\u002F`no`), run `turbo-lean telemetry disable` (persists to `~\u002F.config\u002Fturbo-lean\u002Fconfig.toml`), or configure `\u003Cproject_dir>\u002Fturbo-lean.toml`:\n  ```toml\n  [telemetry]\n  enabled = false   # disables all local and remote telemetry\n  remote = false    # keep false unless opting into remote reporting\n  mode = \"off\"      # \"off\" | \"local\" | \"metrics\" | \"full\"\n  ```\n\nTelemetry consent precedence is defaults → hub JSON → user TOML → trusted project TOML → environment modes (`SANDBOXED_TELEMETRY_MODE`, `SANDBOXED_TELEMETRY`, `TURBO_LEAN_TELEMETRY`, in that order) → `TURBO_LEAN_TELEMETRY_REMOTE`. CLI `--telemetry` replaces `TURBO_LEAN_TELEMETRY`; `--no-telemetry` takes precedence and disables all emission. Presence of `TURBO_LEAN_NO_REMOTE_TELEMETRY` vetoes remote emission at every layer. `TURBO_LEAN_TRUST_PROJECT_TELEMETRY=0` and untrusted verification exclude project telemetry settings.\n\n## Worktree artifact preservation\n\nPass the global `--no-auto-worktree-link` flag, set `TURBO_LEAN_NO_WORKTREE_LINK=1`, or set `[worktree] auto_link = false` in the nearest `turbo-lean.toml` (also accepts `.turbo-lean.toml`). Any opt-out wins; an environment false value cannot override the project opt-out. Without an opt-out, automatic artifact sharing remains enabled.\n\nThese controls suppress main-clone build\u002Fpackage copying and linking, build-output permission\u002Finode normalization during CAS ingestion, and the entire explicit `worktree-dedup` operation (including package chmod\u002Flink\u002Fcopy and cleanup). Shared CAS cache hits in build, CI\u002FPR verification and module builds validate existing bytes without replacing files or regenerating module sidecars. Missing or different cached outputs fail with instructions to build with Lake first; opted-out native module builds also refuse cache misses. Staging can still copy bytes into the external CAS. Module builds apply the caller's project opt-out to external dependencies too. Under opt-out, stale imports are an error and must be rebuilt explicitly with Lake; turbo-lean does not auto-rebuild them. GC can still prune previously installed CAS hardlinks by inode when expiring tracked worktrees; opting out does not undo those installations.\n\n---\n\n## GitHub Action (`uses: Th0rgal\u002Fturbo-lean@main`)\n\n```yaml\n- name: Incremental Lean 4 PR Verification\n  uses: Th0rgal\u002Fturbo-lean@main\n  with:\n    project-dir: \".\"\n    mode: \"pr-verify\"\n    trust-mode: \"untrusted\"\n    disallow-statement-changes: \"true\"\n    receipt-path: \"receipt.json\"\n    verify-receipt: \"true\"\n```\n\n---\n\n## Benchmarks\n\n**Wave 3 native parity:** [`Rust vs LeanNative report`](docs\u002FBENCH_RUST_PARITY.md)\nmeasures the eight actual canonical LNIR kernels on Boat Zen 5: optimized\nLeanNative\u002FRust time geomean **0.875412×** (114.23% relative throughput), with\nalgorithm-sensitive EVM wins and array-kernel gaps. This is native execution,\nseparate from the proof-verification benchmarks below. Reproduce with\n`python3 scripts\u002Fbench_rust_parity.py --trials 7 --json \u002Ftmp\u002Fbench_rust_parity.json`.\n\n| Workload \u002F Operation | Baseline `lake env lean` | `turbo-lean` | Speedup \u002F Notes |\n| :--- | ---: | ---: | :--- |\n| **`lfglabs-dev\u002Fverity` (`Uint256.add_comm`, 1\u002F53 decls)** | `3,587.5 ms` | **`2.80 ms`** | **`1,280x`** (warm `ZygoteWorker`) |\n| **`lfglabs-dev\u002Fverity` (`pr-verify --base HEAD`, 9,275 shards)** | `9,999.4 ms` | **`23.89 ms`** | **`419x`** (full-suffix BLAKE3 + statement pinning) |\n| **`verify-receipt` (695 files, 9,275 shards)** | `> 10,000 ms` | **`0.58 ms`** | **`17,390x`** |\n| **In-Process C-ABI `FastCheck` & Counterexample Triage** | `40 µs` (IPC) | **`~0.003 µs` (`3 ns`)** | **`~13,000x`** vs JSON-RPC subprocess |\n| **1M-State 256-Bit GPU `fast-check` (NVIDIA GB10)** | — | **`0.71 ms`** | **`1,410 M states\u002Fs`** (`CuDenote` on `dgx-spark`) |\n| **293-Mutant × 10k-Tx GPU Campaign (NVIDIA GB10)** | — | **`2.97 ms`** | **`292 \u002F 293` mutants killed (`99.7%`)** |\n\n---\n\n## Repository Structure\n\n- [`lean\u002FTurboLean\u002F`](lean\u002FTurboLean\u002F) — Incremental verification specifications, multi-threaded native orchestrator (`Orchestrator.lean`), & C-ABI gates in [`PolicyGates.lean`](lean\u002FTurboLean\u002FPolicyGates.lean) ([`Kernel.lean`](lean\u002FTurboLean\u002FKernel.lean) is an export alias), plus kernel tools (`Spec.lean`, `StatementHash.lean`, `Assembler.lean`, `Inspector.lean`, `ZygoteWorker.lean`, `Reflection.lean`, `FastCheck.lean`).\n- [`lean\u002FLeanNative\u002F`](lean\u002FLeanNative\u002F) — Verified `LNIR` native compiler, `@[simd]`\u002F`@[gpu]`\u002F`@[tpu]`\u002F`@[superopt]` plugins (`Transform\u002FPlugins.lean`, `Superopt.lean`), semantics & 547 unique `AxiomAudit`-verified `LeanNative.*` theorems (552 unique audited theorems overall; `1,913` total `theorem`\u002F`lemma` declarations across `lean\u002FLeanNative\u002F`, `Semantics\u002FEval.lean`, `Proofs\u002F`), and multi-backend Target-IR codegen (`Backend\u002FLLVM.lean`, `LLVMLower.lean`, `GPUIR.lean`, `MLIRGPU.lean`, `PTXLower.lean`, `Metal.lean`, `MetalLower.lean`, `StableHLOLower.lean`, `Hybrid.lean`, `FastCheck.lean`).\n- [`crates\u002Fturbo-lean\u002Fsrc\u002F`](crates\u002Fturbo-lean\u002Fsrc\u002F) — CLI & system orchestrator (`c_abi.rs` bridge to the \u003C!-- inventory:turbo_cabi_exports -->78\u003C!-- \u002Finventory:turbo_cabi_exports -->-export archive (75 Rust extern bindings), `module_builder.rs` event-driven ready-queue DAG scheduler, `accelerators.rs` & `gpu_fastcheck.rs` multi-domain `UInt`\u002F`BitVec`\u002F`Word256`\u002F`Nat` counterexample engines, `zygote.rs`, `splitter.rs`, `pr_verify.rs`, `mcp.rs`).\n- [`roadmap\u002F`](roadmap\u002FREADME.md) — Autonomous research & verification roadmap separating North-Star technical goals ([`GOALS.md`](roadmap\u002FGOALS.md)), cheat-proof theorem contracts ([`VALIDATION_CONTRACTS.md`](roadmap\u002FVALIDATION_CONTRACTS.md)), 3-way non-FV differential conformance ([`CONFORMANCE_SUITE.md`](roadmap\u002FCONFORMANCE_SUITE.md)), and Maxwell\u002FOrb execution strategies ([`MAXWELL_STRATEGIES.md`](roadmap\u002FMAXWELL_STRATEGIES.md)); see [`docs\u002FROADMAP.md`](docs\u002FROADMAP.md) for current Track A \u002F Track B and open soundness PR status.\n\nLean compiler flags use the static Lake allowlist in `module_builder::is_allowed_lean_arg`\nfor package\u002Flibrary\u002Fexecutable `moreLeanArgs`, `weakLeanArgs`, and `leanOptions` in\nboth Lake formats. HTTP and zygote requests and PR\u002FCI shard subprocesses validate\nagainst that same policy before filtering flags or using cached results. Trusted\nPR verification also validates Lake configuration when the diff is unchanged.\n`warn.sorry` must be exactly `true`; `debug.skipKernelTC` may only be `false`.\nThe raw Lean worker forces these two safety settings after decoding options, as\nthe native compiler subprocesses do. Other `debug.*`, `internal.*`, diagnostic\nredirection, arbitrary `pp.*`, program\u002Ffile options, and plugin\u002Ftrust flags remain\nrestricted by the allowlist; repeated `weak.` prefixes cannot bypass it.\nSource certification also rejects all `set_option debug.*` and `weak.*` settings,\n`warn.sorry` values other than `true`, and `run_elab`\u002F`run_cmd`\u002F`run_meta`, including\nscoped commands and worker prefixes. Benign options such as `maxHeartbeats` remain\nallowed. Every worker declaration and compiled artifact must independently replay\nthrough the kernel before it can produce a verified result or cache entry.\n","turbo-lean 是一个面向 Lean 4 的高性能分布式构建、验证与反例分析工具链。它支持亚毫秒级增量定理验证（~2 ms）、纳秒级反例分类（如候选缺陷、规范过强、参考偏差），并提供经形式化审计的原生编译能力，可将 Lean 4 代码安全降级为 SIMD、CUDA、Metal 和 TPU（StableHLO\u002FPallas）目标。其核心基于 Rust 实现，集成 ZygoteWorker 快照机制、C-ABI 内联门控及对抗性公理检查，确保验证过程不可绕过（零 sorryAx、零 unsafe、零未授权 extern）。适用于对可靠性与性能均有严苛要求的定理证明工程、可信编译器开发及形式化验证驱动的高性能计算场景。","2026-11-24 04:32:15","CREATED_QUERY"]