diff options
author | Son HO | 2023-08-07 10:42:15 +0200 |
---|---|---|
committer | GitHub | 2023-08-07 10:42:15 +0200 |
commit | 1cbc7ce007cf3433a6df9bdeb12c4e27511fad9c (patch) | |
tree | c15a16b591cf25df3ccff87ad4cd7c46ddecc489 /tests/lean/Hashmap | |
parent | 887d0ef1efc8912c6273b5ebcf979384e9d7fa97 (diff) | |
parent | 9e14cdeaf429e9faff2d1efdcf297c1ac7dc7f1f (diff) |
Merge pull request #32 from AeneasVerif/son_arrays
Add support for arrays/slices and const generics
Diffstat (limited to 'tests/lean/Hashmap')
-rw-r--r-- | tests/lean/Hashmap/Funs.lean | 5 | ||||
-rw-r--r-- | tests/lean/Hashmap/Properties.lean | 4 | ||||
-rw-r--r-- | tests/lean/Hashmap/Types.lean | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/tests/lean/Hashmap/Funs.lean b/tests/lean/Hashmap/Funs.lean index 870693b5..d6796932 100644 --- a/tests/lean/Hashmap/Funs.lean +++ b/tests/lean/Hashmap/Funs.lean @@ -3,6 +3,7 @@ import Base import Hashmap.Types open Primitives + namespace hashmap /- [hashmap::hash_key]: forward function -/ @@ -238,7 +239,7 @@ def HashMap.contains_key let hash ← hash_key key let i := Vec.len (List T) self.slots let hash_mod ← hash % i - let l ← Vec.index (List T) self.slots hash_mod + let l ← Vec.index_shared (List T) self.slots hash_mod HashMap.contains_key_in_list T key l /- [hashmap::HashMap::{0}::get_in_list]: loop 0: forward function -/ @@ -261,7 +262,7 @@ def HashMap.get (T : Type) (self : HashMap T) (key : Usize) : Result T := let hash ← hash_key key let i := Vec.len (List T) self.slots let hash_mod ← hash % i - let l ← Vec.index (List T) self.slots hash_mod + let l ← Vec.index_shared (List T) self.slots hash_mod HashMap.get_in_list T key l /- [hashmap::HashMap::{0}::get_mut_in_list]: loop 0: forward function -/ diff --git a/tests/lean/Hashmap/Properties.lean b/tests/lean/Hashmap/Properties.lean index 3652f608..ab95b854 100644 --- a/tests/lean/Hashmap/Properties.lean +++ b/tests/lean/Hashmap/Properties.lean @@ -284,6 +284,10 @@ def mk_opaque {α : Sort u} (x : α) : { y : α // y = x} := attribute [pp_dot] List.length -- use the dot notation when printing set_option pp.coercions false -- do not print coercions with ↑ (this doesn't parse) +-- The proof below is a bit expensive, so we need to increase the maximum number +-- of heart beats +set_option maxHeartbeats 400000 + theorem insert_no_resize_spec {α : Type} (hm : HashMap α) (key : Usize) (value : α) (hinv : hm.inv) (hnsat : hm.lookup key = none → hm.len_s < Usize.max) : ∃ nhm, hm.insert_no_resize α key value = ret nhm ∧ diff --git a/tests/lean/Hashmap/Types.lean b/tests/lean/Hashmap/Types.lean index 6606cf9e..6455798d 100644 --- a/tests/lean/Hashmap/Types.lean +++ b/tests/lean/Hashmap/Types.lean @@ -2,6 +2,7 @@ -- [hashmap]: type definitions import Base open Primitives + namespace hashmap /- [hashmap::List] -/ |