Repository navigation
Open
Description
Classification
- Type: bounded research spike / P3 backlog, not an implementation request for a new production optimizer.
- Area: hot, pure and explicitly specified helper functions in the existing Roslyn → OwnIR → Rust ownership-analysis pipeline.
- Source: Superoptimizing an FPU emulator (2026-10-16).
- Prior art: Souper (LLVM IR; archived 2025-10-30), egg (e-graphs/equality saturation), Alive2 (LLVM IR translation validation). None is a drop-in verifier for C#/OwnIR/Rust semantics.
- Related, not replaced: Research: FORVES2-style conditional semantic validation and proof-assumption audit for OwnIR #445 (conditional semantic validation), Research: Cilica-style analysis invalidation and pass verification for OwnIR (bounded spike) #456 (pass/IR validation), Research: evidence-guided candidate ranking for Own.NET analyzer fixes (LoopRepair prior art) #440 (fix ranking), Research: refactoring-aware metamorphic regression testing for ownership analysis (RefactoringMiner prior art) #432 (refactoring-aware metamorphic regression), IDE foundation: establish cold/warm/incremental latency and memory baselines #263 (performance baselines).
Hypothesis
For one demonstrably expensive, pure helper, a narrowly defined expression grammar plus semantic deduplication can reveal an equivalent cheaper implementation that manual refactoring or the compiler misses. This is not a proposal to rewrite the ownership analysis or its diagnostic semantics.
The blog enumerates expressions, deduplicates by vectors of results on ~20 tests and manually identifies subexpression reuse. Test-vector equality is a search heuristic, not proof. A four-operation expression also need not mean a faster machine-code implementation.
Kill-first protocol
- Establish need: profile existing workload and identify at most 1–2 actual hot pure functions (e.g., a state-transition/bitset helper only if one really exists). Pin code SHA, inputs, benchmark harness and semantics. KILL immediately if there is no meaningful hot spot or a standard compiler optimization already solves it.
- Fix semantics: specify allowed inputs, integer widths, overflow/shift behavior, undefined/invalid states, order/side effects, and target runtime. Exclude allocations, exceptions, aliases, lifetime/Dispose effects, interprocedural and WPF behavior from synthesis.
- Small search: restricted operators/constants; enumerate trees or use e-graph rewriting; retain shared-subexpression DAGs in cost accounting; deduplicate by test-output vectors; generate edge cases and counterexamples.
- Independent validation: exhaustive evaluation on a tractable bounded domain or SMT proof under explicit assumptions, plus compiler/build tests and differential/metamorphic regression. If equivalence is unproved, label
UNVERIFIEDand do not propose production replacement. Alive2 only if the candidate has genuinely equivalent LLVM IR semantics; no automatic claim of .NET/Rust proof. - Measure: compare current implementation, optimized compiler baseline and generated candidate on representative workloads. Record correctness verdict, counterexamples, instruction count where meaningful, latency, throughput, allocation, memory, portability and maintainability cost.
Deliverables / decision gate
- Reproducible self-contained spike with frozen inputs, exact versions/SHAs, candidate grammar and results.
- Candidate + counterexample/proof receipt + before/after benchmark, or a documented negative result.
- GO only for a verified rewrite with reproducible useful improvement and acceptable complexity; CHANGE for a reusable verifier/test generator only; KILL for no hot spot, insufficient proof, or negligible benefit.
- No production integration, broad synthesis framework, or auto-fix roll-out as part of this issue.
A separate, architecture-level code-pattern recommender is documented in Pattern-Aware Refactoring; that is not Own.NET's remit.
Metadata
Metadata
Assignees
Labels
No labels
Activity
PhysShell commentedon Nov 15, 2026
Additional prior art: OpenEvolve (Asankhaya Sharma)
Source: algorithmicsuperintelligence/openevolve, an LLM-guided evolutionary program-search framework with external evaluators and population-based search.
Please treat this as an optional search baseline inside #459, not a new optimization project. The existing issue's pure, explicitly specified OwnIR helper / independent semantic-equivalence gate stays authoritative.
Suggested comparison only after #459 identifies a real measured hotspot and a trusted oracle:
Useful high-level donor: proposal/search/evaluator separation and archived candidate provenance, not automatic code replacement.
PhysShell commentedon Nov 20, 2026
Emmy donor: multi-observable rewrite equivalence and deterministic CSE (20.11.2026)
Research page · Emmy CHANGELOG · upstream.
EMMY-02 / REWRITE-SEMANTIC-FIDELITY / DEFER, in this existing bounded superoptimization issue. Emmy is not a proposed OwnIR library or ownership analyzer. Its AD bug history documents how simplification of a dual/tape value as a plain number can preserve an apparent scalar while deleting derivative structure; changelog #143 also discusses deterministic common-subexpression elimination independent of hash iteration order.
Portable test methodology: prove or refute equivalence against a vector of observables, not just returned scalar/boolean: ownership obligations, effects, alias/path facts, source provenance, unknown/non-modeled state and stable ID/hash, in addition to runtime value. Negative controls: rewrite removes a symbolic wrapper; folds across revision-bound inputs; changes source ordering and canonical output; merges expressions that appear numerically equal but carry distinct facts. Compare against the existing independently authored OwnIR oracle with tiny pure transfer helpers; require counterexample and exact source/IR SHA. Avoid new generic CAS/e-graph framework, GPL code import, and CI gates until incremental value demonstrated.
PhysShell commentedon Nov 23, 2026
2026-11-23 — Tree Calculus / typing rules as programs: verified-rewrite prior art
Research Page · original Coq/Rocq proofs · 2026 Typing Rules Become Programs · working implementations/benchmarks.
Tree Calculus represents programs as trees inspectable by programs of the same calculus. The new Rocq 9.3 research reports
patch_commutes_with_evaluation,optimise_preserves_evaluation,optimise_typed, and typing/inference programs with explicit assumptions. Potential lesson: certify a small pure AST/IR rewrite against independently reviewed semantics, rather than equating test-vector match with equivalence.Bounded/optional in #459: if one real, profiled pure OwnIR helper needs a rewrite, compare current typed AST + PBT/SMT/existing verifier against the reference proof discipline; one wrong-rewrite mutant must fail. Measure proof cost, semantic correspondence to Rust, runtime gains, and maintenance. No Tree Calculus runtime/DSL or new formal stack by default. RESEARCH / P3 / KILL-FIRST / NOT ADOPTED. Original repo has an MIT root LICENSE but historic LGPL headers; check rights before code reuse.
PhysShell commentedon Nov 23, 2026
2026-11-23 — Johannes Bader: LambAda/Triage calculus as a rewrite semantics donor
Bader research Page · LambAda · Tree Calculus · typing rules as programs.
LambAda compiles a human-readable syntax into tree/triage calculus, with a compiler written in the same calculus. Interesting not as a dependency but as an example of representing/programmatically transforming programs and simplifying stream/map compositions. The 2026 Rocq material describes evaluation-preserving rewrites; author explicitly says LambAda does not guarantee correctness/stability. For #459, compare an existing pure OwnIR/AST optimization against ordinary typed Rust tree rewrite + differential/metamorphic/SMT baseline before considering formalism. Demand a negative rewrite mutant, explicit source-model correspondence and actual measurable benefit. NO production integration.
PhysShell commentedon Nov 23, 2026
2026-11-23 — John Tromp AIT: closed-term enumeration / encoding cost as methodology donor
Research Page · language sandbox issue #60 · Tromp/AIT · ClosedRanking.hs · Sizes.hs.
AIT includes rank/unrank generation of small closed λ-terms and bit-size comparisons (unary/Elias/Huffman) plus an independent evaluator ecosystem. Reusable idea: for one profiled pure OwnIR transfer helper, use bounded, de-duplicated expression generation and first-divergence tests; compare actual code runtime and proof, not smallest BLC representation as a performance proxy. Need a verified semantics mapping and negative mutants; do not port an experimental Haskell→BLC GHC plugin. Tree/Triage calculus evaluator files tree.lam and triage.lam have different rules. #459 already owns enumeration/optimization; no new Own.NET task. Research P3, no production integration.
PhysShell commentedon Nov 26, 2026
Prior art / quchen/articles — 2026-11-26
RESEARCH / REUSE-FIRST / KILL-FIRST / NOT ADOPTED / NO IMPLEMENTATION AUTHORIZED. Collection, inspected revision 14dc3eb.
Rules for typeclass laws is an explicitly unsubmitted proposal, not an implemented GHC facility. It suggests making algebraic law assumptions explicit and using them for rewriting. Algebraic blindness and Tag, don't type are additional design references.
Transfer hypothesis: add to the existing bounded superoptimization study an inventory of laws for pure, already specified OwnIR helpers: associativity/idempotence only where applicable, explicit preconditions, counterexamples for invalid laws, independently checked equivalence over the supported domain. For abstract-state operations include unknown/top/bottom and resource identity; never assume syntactic similarity means semantic equivalence. Property tests are counterexample search, not universal proof. Measure valid rewrites, rejected unsound candidates and runtime/maintenance impact against the existing baseline. Kill if existing checks cover the case or no net benefit. Related #445 and #450. No production optimizer, solver change or analyzer rewrite.