{"version":2,"policy":"oa-lean-v1","lean_commit":"62b6a2291302d4bbeace37642a066b7510d0145c","profile":"core","imports":["Init"],"statement_hash":"45102619ca626c643eb843a3c4e58734b2a5280bf82e54b516d05aa43a1c3719","problem":{"id":41,"title":"Recover the nearest older right neighbor from a shared-left group","description":"For a list of distinct natural birth priorities, prove an exact neighbor identity. All queries return structural positions, not birth values.\n\nnearestLeft(i) is the closest position before i with a smaller priority. nearestRight(i) is the closest position after i with a smaller priority. Group positions by identical nearestLeft, including the group with no left neighbor. The theorem says nearestRight(i) is the next position in its group, if one exists. Otherwise it is nearestRight of its left neighbor; when there is no left neighbor, it is absent.\n\nExample: priorities [2,9,11,7,1]. Positions 1 and 3 share left neighbor 0. For position1, its right neighbor is position3, skipping position2. For position3, the group has no next member, so its right neighbor is position4, which is also the right neighbor of position0. Distinctness matters: [1,1] has two positions in the no-left group but neither has a smaller right neighbor, so the stated rule fails.\n\nThe statement contains five typed lambda applications with the complete executable definitions. priorityAt uses optional lookup with default0 to make queries total; the target requires a valid position. Priorities can have holes and need not be sorted or bounded by list length.\n\nResearch motivation: finite probes of a fully known linear CRDT source, retaining tombstones, match insertion origins to nearest older-born items in final structural order. This list lemma could permit a simpler source-origin index. That correspondence to all generated histories is a separate unproved obligation; this proposition does not assume or establish it. Concurrent source histories are not covered by those probes.\n\nNearest-smaller queries, Cartesian trees and succinct navigation are established data-structure theory. We claim no new tree encoding, entire-history bit bound, runtime/memory gain, full CRDT convergence or native implementation refinement. Birth permutations, original identities, payloads, causal history and deletion metadata remain separate costs. Parent #23 supplies an abstract birth-permutation realization result, not native correspondence.\n\nPrepared by James Addison (jungle) with Codex. A separate adversarial AI fixed the local mathematical challenge before implementation and checked finite examples. A complete local proof of that challenge has passed independent fresh compilation, exact target assignment and axiom review. The exact self-contained port is undergoing separate native and pinned-runtime validation before submission; independent AI review is not a human meaning review.","statement":"(fun (priorityAt : List Nat → Nat → Nat) =>\n(fun (nearestLeft : List Nat → Nat → Option Nat) =>\n(fun (nearestRight : List Nat → Nat → Option Nat) =>\n(fun (nextSameLeft : List Nat → Nat → Option Nat) =>\n(fun (groupRight : List Nat → Nat → Option Nat) =>\n∀ (a : List Nat), a.Nodup → ∀ i, i < a.length → nearestRight a i = groupRight a i\n) (fun a i => match nextSameLeft a i with | some j => some j | none => (nearestLeft a i).bind (nearestRight a))\n) (fun a i => (List.range a.length).find? (fun j => decide (i < j ∧ nearestLeft a j = nearestLeft a i)))\n) (fun a i => (List.range a.length).find? (fun j => decide (i < j ∧ priorityAt a j < priorityAt a i)))\n) (fun a i => (List.range i).reverse.find? (fun j => decide (priorityAt a j < priorityAt a i)))\n) (fun a i => (a[i]?).getD 0)","profile":"core","module_pins":[],"module_context":[],"scope":{"obligations":[],"assumptions":[],"cost_metric":"","model_scope":"","implementation":"","correspondence":"","limitations":[]}},"source":null,"proof":null,"proof_url":"/api/v1/submissions/27/proof","source_url":"/api/v1/submissions/27/source","source_hash":"40d60cb76ce9fbbdfa367b72f72ef461c9399dd1e30bcf11e35d834d6c09bae9","proof_bytes":12129,"proof_format":"term-trimmed-v1"}