Skip to content

Research: Bloomberg Crane OwnershipIR and post-lowering move/borrow validators (kill-first) #465

Open

Description

@PhysShell

Classification

P3 / bounded research / REUSE-FIRST / KILL-FIRST / READ-ONLY / NOT ADOPTED. No production code, dependency, IR rewrite, CI change, or automatic diagnostic policy change is authorized by this issue.

Narrow research question

Can one existing Own.NET ownership or lifetime diagnostic become more reliable or easier to audit by borrowing a small, testable mechanism from Crane's ownership planning + independently checked lowering contracts, without transplanting Rocq/C++ ownership semantics into C#?

Crane extracts verified Rocq programs into C++ but its extractor is not formally verified: source theorem, extraction equivalence, final C++ behavior and external effect implementations have distinct trust boundaries. It is an architecture donor, not a production-proven ownership checker for C#.

Specific upstream mechanisms to inspect

  1. src/ownership_ir/region.mli: region-level last-use analysis, move/copy/borrow decisions, order-of-evaluation, captures, recursion frames, reuse tokens.
  2. src/ownership_ir/move_check.mli: independent validation of moved-read, stale-reference and argument convention after C++ IR lowering (CRANE_CHECK_IR).
  3. src/cpp_passes/pipeline.ml: explicit representation obligations and traced pre-/post-materialization passes; src/control_to_cpp/loopify.ml: recursion-to-loop/frame lowering.
  4. Generated typed AST C++ and reuse example as concrete checks of emitted behavior.
  5. Design principles: explicit pragmatic trust, compiler/extractor correctness via empirical differential/static testing.

Overlap / preflight gate

Bounded experiment (read-only by default)

Deliverables / acceptance

  • One pinned Crane mechanism | source/tests | Own.NET counterpart | demonstrated gap? | cheapest counterexample | verdict evidence table.
  • A reproducible counterexample or a documented NO-GAP result, with matching positive control.
  • Verdict BORROW SMALL IDEA / DEFER / REJECT / DUPLICATE. No follow-up code without a separate issue anchored in a failing test and measurable benefit.

Non-goals: formal verification of all Own.NET, new Rocq-to-C++ toolchain, C++/Rust ownership semantic equivalence, rewriting OwnIR or claiming that CRANE_CHECK_IR formally proves compiler correctness.

Activity

  1. PhysShell commented on Nov 28, 2026

    @PhysShell
    OwnerAuthor

    2026-11-28 — borrIR and low-level ownership semantics (additional prior art)

    RESEARCH / REUSE-FIRST / KILL-FIRST / NOT ADOPTED / NO IMPLEMENTATION AUTHORIZED. This is a donor for the existing post-lowering validator investigation, not a separate solver or an OwnIR rewrite.

    • Farid Zakaria, Programming languages are for humans; borrIR, README (read 2026-11-28; README blob SHA 77c25d347bd7f13414310a39e5caf153478d9917; commit not pinned), WASM playground. MIT per README. Author describes project as LLM-generated. Rust engine checks raw LLVM IR: CFG, pointer-root provenance through GEP/bitcast/phi/select, backward SSA liveness, forward fixed-point ownership analysis, function-local contracts, diagnostics and DOT export. README reports E0001–E0008 (move/free, alias conflicts, readonly writes, stack escape, mutation during borrow, leak, branch merge) and W0001 for lost provenance.
    • Siddharth Priya & Arie Gurfinkel, Ownership in low-level intermediate representation, FMCAD 2024. SEABMC preserves explicit ownership semantics and switches between pointer caches and byte address maps in bit-precise bounded model checking; C examples use macros to supply ownership information. Authors report 1.3–5x SMT-solving speedup on their benchmarks, not speedup for Own.NET or proof of borrIR.
    • Article's premise (agents should emit LLVM IR) is an untested hypothesis. LLVM noalias/readonly are not Rust borrow semantics; check contract assumptions, unknown calls, integer round-trips, memory/field aliases and control-flow joins. A green checker is not proof of total memory safety, race freedom or semantic correctness.

    Bounded extension of #465, not a competing investigation: compare at most three mechanisms against current OwnIR and #441/#430/#444/#464/#468: (1) provenance through alias/phi/select vs resource identity; (2) last-use support and merge conflicts vs current transfer/join, especially one-branch disposal or ownership escape; (3) explicit lowered contracts and independent checker diagnostics vs existing method summaries and validator. Start with one existing C# IDisposable fixture, matching safe/unsafe controls, independently adjudicated expected behavior and unknown contract case. Distinguish GC lifetime from resource obligations, and explicit ownership from inferred effects. Reuse existing evidence table, pin source HEADs before execution. If no real uncovered invariant or nonduplicate counterexample: ALREADY COVERED / DEFER / KILL. No runtime or code changes. Source inspection only; no tests or upstream execution performed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions