Skip to content

Commit

Permalink
Merge branch 'rems-project:sail2' into lean/Arch-class
Browse files Browse the repository at this point in the history
  • Loading branch information
lfrenot authored Feb 10, 2025
2 parents 71badc2 + 31eba37 commit e971e3e
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 19 deletions.
4 changes: 3 additions & 1 deletion src/sail_lean_backend/pretty_print_lean.ml
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,9 @@ let doc_reg_info env global registers =
[register_enums registers; type_enum ctx registers; string "open RegisterRef"; inhabit_enum ctx type_map; empty]

let doc_monad_abbrev (has_registers : bool) =
let pp_register_type = if has_registers then string "PreSailM RegisterType" else string "StateM Unit" in
let pp_register_type =
if has_registers then string "PreSailM RegisterType" else string "PreSailM (fun (x : PEmpty.{1}) => nomatch x)"
in
separate space [string "abbrev"; string "SailM"; coloneq; pp_register_type] ^^ hardline ^^ hardline

let pp_ast_lean (env : Type_check.env) effect_info ({ defs; _ } as ast : Libsail.Type_check.typed_ast) o =
Expand Down
2 changes: 1 addition & 1 deletion src/sail_lean_backend/sail_plugin_lean.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ let opt_lean_output_dir : string option ref = ref None

let opt_lean_force_output : bool ref = ref false

let lean_version : string = "lean4:nightly-2025-01-22"
let lean_version : string = "lean4:nightly-2025-02-05"

let lean_options =
[
Expand Down
2 changes: 1 addition & 1 deletion test/lean/atom_bool.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def foo (lit : Unit) : Bool :=
true
Expand Down
2 changes: 1 addition & 1 deletion test/lean/bitvec_operation.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def bitvector_eq (x : (BitVec 16)) (y : (BitVec 16)) : Bool :=
(Eq x y)
Expand Down
2 changes: 1 addition & 1 deletion test/lean/enum.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inductive E where | A | B | C

open E

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def undefined_E (lit : Unit) : SailM E := do
sorry
Expand Down
2 changes: 1 addition & 1 deletion test/lean/extern.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def extern_add (lit : Unit) : Int :=
(Int.add 5 4)
Expand Down
2 changes: 1 addition & 1 deletion test/lean/extern_bitvec.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def extern_const (lit : Unit) : (BitVec 64) :=
(0xFFFF000012340000 : (BitVec 64))
Expand Down
2 changes: 1 addition & 1 deletion test/lean/implicit.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

/-- Type quantifiers: k_n : Int, m : Int, m ≥ k_n -/
def EXTZ {m : _} (v : (BitVec k_n)) : (BitVec m) :=
Expand Down
2 changes: 1 addition & 1 deletion test/lean/let.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def foo (lit : Unit) : (BitVec 16) :=
let z := (HOr.hOr (0xFFFF : (BitVec 16)) (0xABCD : (BitVec 16)))
Expand Down
2 changes: 1 addition & 1 deletion test/lean/option.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def match_option (x : (Option (BitVec 1))) : (BitVec 1) :=
match x with
Expand Down
2 changes: 1 addition & 1 deletion test/lean/range.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

/-- Type quantifiers: x : Nat, 0 ≤ x ∧ x ≤ 31 -/
def f_int (x : Nat) : Int :=
Expand Down
2 changes: 1 addition & 1 deletion test/lean/struct.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ structure Mem_write_request
value : (Option (BitVec (8 * k_n)))
tag : (Option Bool)

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def undefined_My_struct (lit : Unit) : SailM My_struct := do
(pure { field1 := sorry
Expand Down
2 changes: 1 addition & 1 deletion test/lean/struct_of_enum.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ open e_test
structure s_test where
f : e_test

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def undefined_e_test (lit : Unit) : SailM e_test := do
sorry
Expand Down
2 changes: 1 addition & 1 deletion test/lean/trivial.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def foo (y : Unit) : Unit :=
y
Expand Down
2 changes: 1 addition & 1 deletion test/lean/tuples.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def tuple1 (lit : Unit) : (Int × Int × ((BitVec 2) × Unit)) :=
(3, 5, ((0b10 : (BitVec 2)), ()))
Expand Down
2 changes: 1 addition & 1 deletion test/lean/type_kid.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

/-- Type quantifiers: k_a : Type -/
def foo (x : k_a) : (k_a × k_a) :=
Expand Down
2 changes: 1 addition & 1 deletion test/lean/typedef.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ abbrev xlen_bytes : Int := 8

abbrev xlenbits := (BitVec 64)

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

/-- Type quantifiers: k_n : Int, m : Int, m ≥ k_n -/
def EXTZ {m : _} (v : (BitVec k_n)) : (BitVec m) :=
Expand Down
2 changes: 1 addition & 1 deletion test/lean/typquant.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Out.Sail.Sail

open Sail

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

/-- Type quantifiers: n : Int -/
def foo (n : Int) : (BitVec 4) :=
Expand Down
2 changes: 1 addition & 1 deletion test/lean/union.expected.lean
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inductive my_option (k_a : Type) where

open my_option

abbrev SailM := StateM Unit
abbrev SailM := PreSailM (fun (x : PEmpty.{1}) => nomatch x)

def undefined_rectangle (lit : Unit) : SailM rectangle := do
(pure { width := sorry
Expand Down

0 comments on commit e971e3e

Please sign in to comment.