U64 BitOr preservation evidence
===============================

Scope
-----

This record pins the source-to-model chain for the external declaration bound
to Tablet/ModelU64BitOr.  The commands below were run from the repository root
on 2026-09-24.  They use the frozen generated.lean and the approved tools
recorded in modeling-input/manifest.json and modeling-input/tool-identities.json.

1. Fresh native-boundary inspection
-----------------------------------

Command:

  python3 .trellis/scripts/pv_modeling.py inspect-native .

The command reported 24 declarations and wrote its full index to:

  .trellis/scratch/inspect-native-1790259866184055823.json

SHA-256 identities:

  49949682d8e6c7a75a58e7f2535322d51f0af7513b8dad0f865ff3fa4387b692  generated.lean
  1e4419e9c0fff857cbff6848d8e4d0b54267d4f2f3307ee139f058f88930ee77  .trellis/scratch/inspect-native-1790259866184055823.json

These identities are reproduced with:

  sha256sum generated.lean \
    .trellis/scratch/inspect-native-1790259866184055823.json

The exact U64 BitOr entry in that index is:

  name: U64.Insts.CoreOpsBitBitOrU64U64.bitor
  extracted_signature: : Std.U64 → Std.U64 → Result Std.U64
  rust_symbol: core::ops::bit::{impl core::ops::bit::BitOr<u64, u64> for u64}::bitor
  source: /rustc/library/core/src/ops/bit.rs, lines 282:12-282:41
  raw_declaration_sha256: 85930775e3fde73729bff04aa86624f11a9b03b31d18a49dc74ce7bae71b4ed6

The indexed raw declaration is:

  /-- [core::ops::bit::{impl core::ops::bit::BitOr<u64, u64> for u64}::bitor]:
      Source: '/rustc/library/core/src/ops/bit.rs', lines 282:12-282:41
      Name pattern: [core::ops::bit::{core::ops::bit::BitOr<u64, u64, u64>}::bitor]
      Visibility: public -/
  @[rust_fun "core::ops::bit::{core::ops::bit::BitOr<u64, u64, u64>}::bitor"]
  axiom U64.Insts.CoreOpsBitBitOrU64U64.bitor
    : Std.U64 → Std.U64 → Result Std.U64

The declaration hash is reproducible directly from the fresh JSON index:

  jq -jr '.declarations[] | select(.name == "U64.Insts.CoreOpsBitBitOrU64U64.bitor") | .source_utf8' \
    .trellis/scratch/inspect-native-1790259866184055823.json | sha256sum

Output:

  85930775e3fde73729bff04aa86624f11a9b03b31d18a49dc74ce7bae71b4ed6  -

Thus the inspected external is exactly the u64/u64 operation, has the stated
total-looking Result signature, and is traced by extraction to the Rust source
span used below.  This inventory fact identifies the boundary; the next two
sections establish its semantics.

2. Approved Rust implementation
-------------------------------

Toolchain and compiler identity:

  toolchain: nightly-2026-06-01-x86_64-unknown-linux-gnu
  rustc path: /home/leanagent/.rustup/toolchains/nightly-2026-06-01-x86_64-unknown-linux-gnu/bin/rustc
  rustc SHA-256: 162c2a2d2d89b94e5bc2ec6b179a49d12a7ea1527db9ff1df20b5d09c432924b
  rustc 1.98.0-nightly (14210df0e 2026-05-31)
  commit-hash: 14210df0e27ccd7d9e6a05b8085cbd438e4bbc65
  host: x86_64-unknown-linux-gnu

Reproduction commands:

  RUSTC=/home/leanagent/.rustup/toolchains/nightly-2026-06-01-x86_64-unknown-linux-gnu/bin/rustc
  "$RUSTC" -vV
  "$RUSTC" --print sysroot
  sha256sum "$RUSTC"

The installed rust-src component is under the same sysroot.  Its relevant file
and hash are:

  path: /home/leanagent/.rustup/toolchains/nightly-2026-06-01-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/bit.rs
  SHA-256: 31db8c3d227e01a9f60f37221d258dc1b2c8274163264602837bb3f3851c2a4d

The file identity and quoted line range are reproduced with:

  RUSTSRC=/home/leanagent/.rustup/toolchains/nightly-2026-06-01-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/bit.rs
  sha256sum "$RUSTSRC"
  nl -ba "$RUSTSRC" | sed -n '274,291p'

The pinned source says at lines 274-289:

  macro_rules! bitor_impl {
      ($($t:ty)*) => ($(
          #[stable(feature = "rust1", since = "1.0.0")]
          #[rustc_const_unstable(feature = "const_ops", issue = "143802")]
          impl const BitOr for $t {
              type Output = $t;

              #[inline]
              fn bitor(self, rhs: $t) -> $t { self | rhs }
          }

          forward_ref_binop! { impl BitOr, bitor for $t, $t,
          #[stable(feature = "rust1", since = "1.0.0")]
          #[rustc_const_unstable(feature = "const_ops", issue = "143802")] }
      )*)
  }

and line 291 instantiates that implementation for u64:

  bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

Consequently the extracted Rust symbol's u64 implementation returns the
primitive bounded u64 disjunction `self | rhs` for every pair of u64 values;
there is no source guard, failure branch, or reachability precondition.

3. Pinned Aeneas scalar meaning
-------------------------------

Repository identity:

  repository: https://github.com/AeneasVerif/aeneas.git
  revision: fa699427cdfa8f604b891fb0223ef42883dd7dc4
  aeneas binary SHA-256: 9f446d2aaf59e8e705e36d05cb993f1c6ab0e97f8dc6fd2f19907a86ede30922

Reproduction commands (with each relative file path listed below substituted
for PATH):

  AENEAS=/home/leanagent/pv_spike/tools/aeneas
  git -C "$AENEAS" rev-parse HEAD
  git -C "$AENEAS" remote -v
  sha256sum "$AENEAS/bin/aeneas"
  git -C "$AENEAS" diff --quiet fa699427cdfa8f604b891fb0223ef42883dd7dc4 -- PATH
  sha256sum "$AENEAS/PATH"
  git -C "$AENEAS" ls-tree fa699427cdfa8f604b891fb0223ef42883dd7dc4 PATH

`git diff --quiet fa699427cdfa8f604b891fb0223ef42883dd7dc4 -- <path>`
returned status 0 for each file recorded below, so the inspected worktree files
are the files at the pinned revision.

File:

  backends/lean/Aeneas/Std/Scalar/Core.lean
  SHA-256: a1c26c125a59bba635a2b2c170186ce07168c43308bcf386d508ebd77f01520e
  git blob: f8582928fe49a0ce75e143b46bb0a8826d7fddae

Its definitions at lines 28-34, 45-53, 65-69, and 650-656 include:

  inductive UScalarTy where
  | Usize
  | U8
  | U16
  | U32
  | U64
  | U128

  def UScalarTy.numBits (ty : UScalarTy) : Nat :=
    match ty with
    | Usize => System.Platform.numBits
    | U8 => 8
    | U16 => 16
    | U32 => 32
    | U64 => 64
    | U128 => 128

  structure UScalar (ty : UScalarTy) where
    bv : BitVec ty.numBits

  abbrev U64 := UScalar .U64

Thus Std.U64 is exactly a UScalar whose sole data field is a BitVec 64.

File:

  backends/lean/Aeneas/Std/Scalar/Bitwise.lean
  SHA-256: 63e4b1d0906c972fb4fef953d8d8a60410dcf5313261d2583b1170b4a1a5ce29
  git blob: d3eb5022efc22d1d6c3ac055965f612c7f2fbca9

Its definitions at lines 118-126 and theorem at line 275 are:

  def UScalar.or {ty} (x y : UScalar ty) : UScalar ty :=
    ⟨ x.bv ||| y.bv ⟩

  instance {ty} : HOr (UScalar ty) (UScalar ty) (UScalar ty) where
    hOr x y := UScalar.or x y

  theorem UScalar.bv_or {ty} (x y : UScalar ty) :
      (x ||| y).bv = x.bv ||| y.bv := by rfl

For an explicit bit-level characterization of the BitVec operation used there,
the same pinned repository contains:

  backends/lean/Aeneas/Data/BitVec.lean
  SHA-256: 66d6e1922a45beff2d75e71e10dc6e8294c7cbf69f95b22dc22f98c5667382a7
  git blob: f7bc57109569cdd0fb0c3323021c73673dcfcd33

Lines 141-146 prove, for every width and bit index:

  theorem BitVec.getElem!_or {w} (x y : BitVec w) (i : Nat) :
      (x ||| y)[i]! = (x[i]! || y[i]!) := by
    by_cases i < w
    . simp only [getElem!_eq_getElem, getElem_or, *]
    . simp_all only [not_lt, getElem!_eq_false, Bool.or_self]

Therefore `x ||| y` on Std.U64 constructs the unique 64-bit vector whose bit
at every position is the Boolean disjunction of the corresponding operand
bits.  It is total and introduces neither overflow nor a failure condition.
