| -- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS | |
| -- [con_ron_core]: external functions. | |
| -- Holes filled by hand (con-ron): DESIGN.md §3.2, the `Arc` model. | |
| import Aeneas | |
| import ConRon.Generated.Types | |
| open Aeneas Aeneas.Std Result ControlFlow Error | |
| set_option linter.dupNamespace false | |
| set_option linter.hashCommand false | |
| set_option linter.unusedVariables false | |
| set_option linter.style.whitespace false | |
| set_option linter.style.setOption false | |
| set_option linter.style.longLine false | |
| /- You can set the `maxHeartbeats` value with the `-max-heartbeats` CLI option -/ | |
| set_option maxHeartbeats 1000000 | |
| /- You can set the `maxRecDepth` value with the `-max-recdepth` CLI option -/ | |
| set_option maxRecDepth 2048 | |
| open ConRon.Generated | |
| /-- [alloc::sync::{alloc::sync::Arc<T>}::new]: | |
| Source: '/rustc/library/alloc/src/sync.rs', lines 437:4-437:33 | |
| Name pattern: [alloc::sync::{alloc::sync::Arc<@T>}::new] | |
| Visibility: public -/ | |
| @[rust_fun "alloc::sync::{alloc::sync::Arc<@T>}::new"] | |
| def alloc.sync.Arc.new {T : Type} (x : T) : Result (alloc.sync.Arc T) := ok x | |
| /- Modeled as `false`: the model always takes the slow path (DESIGN.md | |
| §3.2). Sound for the accept direction *provided* every walk that uses | |
| `ptr_eq` as a shortcut is reflexive, which is an ordinary lemma about the | |
| model, proved once per call site (Lean's own `withPtrEq` discipline). -/ | |
| /-- [alloc::sync::{alloc::sync::Arc<T>}::ptr_eq]: | |
| Source: '/rustc/library/alloc/src/sync.rs', lines 2172:4-2172:52 | |
| Name pattern: [alloc::sync::{alloc::sync::Arc<@T>}::ptr_eq] | |
| Visibility: public -/ | |
| @[rust_fun "alloc::sync::{alloc::sync::Arc<@T>}::ptr_eq"] | |
| def alloc.sync.Arc.ptr_eq | |
| {T : Type} (_A : Type) (_a _b : alloc.sync.Arc T) : Result Bool := ok false | |
| /-- [alloc::sync::{impl core::clone::Clone for alloc::sync::Arc<T>}::clone]: | |
| Source: '/rustc/library/alloc/src/sync.rs', lines 2405:4-2405:32 | |
| Name pattern: [alloc::sync::{core::clone::Clone<alloc::sync::Arc<@T>>}::clone] | |
| Visibility: public -/ | |
| @[rust_fun "alloc::sync::{core::clone::Clone<alloc::sync::Arc<@T>>}::clone"] | |
| def alloc.sync.Arc.Insts.CoreCloneClone.clone | |
| {T : Type} {A : Type} (_coreallocAllocatorCloneInst : | |
| core.alloc.AllocatorClone A) (x : alloc.sync.Arc T) : | |
| Result (alloc.sync.Arc T) := ok x | |
| /-- [alloc::sync::{impl core::ops::deref::Deref<T> for alloc::sync::Arc<T>}::deref]: | |
| Source: '/rustc/library/alloc/src/sync.rs', lines 2453:4-2453:25 | |
| Name pattern: [alloc::sync::{core::ops::deref::Deref<alloc::sync::Arc<@T>, @T>}::deref] | |
| Visibility: public -/ | |
| @[rust_fun | |
| "alloc::sync::{core::ops::deref::Deref<alloc::sync::Arc<@T>, @T>}::deref"] | |
| def alloc.sync.Arc.Insts.CoreOpsDerefDeref.deref | |
| {T : Type} (_A : Type) (x : alloc.sync.Arc T) : Result T := ok x | |
| /- The fifth hole, and the only one that is not an `Rc` operation (task #43). | |
| It is **not** a trust assumption: Aeneas models `Str` as `Slice U8` | |
| (`Aeneas/Std/StringDef.lean`), so the bytes of a `&str` *are* the value, and | |
| `as_bytes` is the identity. `kernel::pins_decode::decode_embedded` is the | |
| only caller — `PINS_TEXT.as_bytes()`, the embedded pin text handed to the | |
| byte decoder — and the hole exists because Rust offers no other way to index | |
| a `&str`: the alternative, a `b"..."` byte constant, extracts to a | |
| 532 456-element array literal that Lean cannot elaborate (DESIGN.md, | |
| task #43's measurement). -/ | |
| /-- [core::str::{str}::as_bytes]: | |
| Source: '/rustc/library/core/src/str/mod.rs', lines 514:4-514:41 | |
| Name pattern: [core::str::{str}::as_bytes] | |
| Visibility: public -/ | |
| @[rust_fun "core::str::{str}::as_bytes"] | |
| def core.str.Str.as_bytes (s : Str) : Result (Slice Std.U8) := ok s | |
| /- ## `ExprView.ofKind`: NOT a hole, and here because it used to be one | |
| `kernel::expr::view` is the projection every reader of the core goes | |
| through, and between tasks #94 and #97-SWAP-2 it was an axiom: the kind | |
| lived in a tagged handle's low bits, `ron::node` was opaque to Charon, and | |
| this bijection was what its model was written in. Task #97-SWAP-2 put | |
| `Expr` back on `ron::ptr::P` = `std::sync::Arc`, so `view` is an ordinary | |
| translated definition (`Generated/Funs.lean`: one `Arc::deref` and a | |
| `match`) and the whole `ron::node` block of holes is gone — the crate's | |
| external surface is `std`'s again, one type and five functions. | |
| What is left of that block is this one `def`, which is not an axiom and | |
| carries no trust: `ExprView` and `ExprKind` are two distinct inductives | |
| with the same ten arms (the first's fields are the shared borrows Aeneas | |
| erases to values), and `view` is `ofKind` after the deref. | |
| `Refine/Abs.lean`'s `expr_view_eq` is that equation, by `cases`, and the | |
| 719 proof sites that read a reader's `match` in terms of `ofKind k` are | |
| unchanged by the swap for exactly that reason. It lives in this file | |
| rather than in `Refine/Abs.lean` so that it keeps the name it had, in the | |
| namespace the generated model is in. -/ | |
| /-- [con_ron_core::kernel::expr::ExprView]: the projection's target, as the | |
| `ExprKind` it mirrors arm for arm. -/ | |
| def kernel.expr.ExprView.ofKind : | |
| kernel.expr.ExprKind → kernel.expr.ExprView | |
| | .Bvar i => .Bvar i | |
| | .Fvar idx ty => .Fvar idx ty | |
| | .«Sort» u => .«Sort» u | |
| | .Const n us => .Const n us | |
| | .App f a => .App f a | |
| | .Lam ty b => .Lam ty b | |
| | .ForallE ty b => .ForallE ty b | |
| | .LetE ty v b => .LetE ty v b | |
| | .Lit l => .Lit l | |
| | .Proj s i e => .Proj s i e |