Skip to content

Commit fa5615c

Browse files
authored
Merge pull request #1607 from cryspen/lean-update-printer
Update Lean printer to new infrastructure
2 parents 2a418d2 + 6f30e9a commit fa5615c

File tree

8 files changed

+410
-716
lines changed

8 files changed

+410
-716
lines changed

hax-lib/proof-libs/lean/Hax/Lib.lean

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ instance {β} : Coe (α -> i32 -> β) (α -> Nat -> β) where
221221
instance : OfNat (Result Nat) n where
222222
ofNat := pure (n)
223223

224+
instance {α n} [i: OfNat α n] : OfNat (Result α) n where
225+
ofNat := pure (i.ofNat)
224226

225227
/-
226228
@@ -889,7 +891,9 @@ end Fold
889891
Rust arrays, are represented as Lean `Vector` (Lean Arrays of known size)
890892
891893
-/
892-
section Array
894+
section RustArray
895+
896+
abbrev RustArray := Vector
893897

894898
inductive array_TryFromSliceError where
895899
| array_TryFromSliceError
@@ -943,7 +947,7 @@ theorem convert_TryInto_try_success_spec {α n} (a: Array α) :
943947
split <;> grind
944948

945949

946-
end Array
950+
end RustArray
947951

948952
/-
949953
@@ -1133,6 +1137,8 @@ Rust vectors are represented as Lean Arrays (variable size)
11331137
-/
11341138
section RustVectors
11351139

1140+
abbrev RustVector := Array
1141+
11361142
def alloc_Global : Type := Unit
11371143
def vec_Vec (α: Type) (_Allocator:Type) : Type := Array α
11381144

rust-engine/src/ast/identifiers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub mod global_id {
105105
/// Tests if the raw output is reduced to "_". Should be used only for
106106
/// testing. See https://github.com/cryspen/hax/issues/1599
107107
pub fn is_empty(&self) -> bool {
108-
self.to_debug_string() == "_".to_string()
108+
self.to_debug_string() == "_"
109109
}
110110

111111
/// Extract the raw `DefId` from a `GlobalId`.

rust-engine/src/backends.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub trait Backend {
5151

5252
/// The AST phases to apply before printing.
5353
///
54-
/// Backends can override this to add transformations.
54+
/// Backends can override this to add transformations.
5555
/// The default is an empty list (no transformations).
5656
fn phases(&self) -> Vec<Box<dyn crate::phase::Phase>> {
5757
vec![]
@@ -111,10 +111,15 @@ mod prelude {
111111
//! Importing this prelude saves repetitive `use` lists in per-backend
112112
//! modules without forcing these names on downstream users.
113113
pub use super::Backend;
114+
pub use crate::ast::identifiers::*;
115+
pub use crate::ast::literals::*;
116+
pub use crate::ast::resugared::*;
114117
pub use crate::ast::*;
115118
pub use crate::printer::*;
119+
pub use crate::symbol::Symbol;
116120
pub use hax_rust_engine_macros::prepend_associated_functions_with;
117121
pub use pretty::DocAllocator;
122+
pub use pretty::DocBuilder;
118123
pub use pretty::Pretty;
119124
pub use pretty_ast::install_pretty_helpers;
120125
}

0 commit comments

Comments
 (0)