diff options
author | Son HO | 2023-07-31 16:15:58 +0200 |
---|---|---|
committer | GitHub | 2023-07-31 16:15:58 +0200 |
commit | 887d0ef1efc8912c6273b5ebcf979384e9d7fa97 (patch) | |
tree | 92d6021eb549f7cc25501856edd58859786b7e90 /tests/lean/PoloniusList.lean | |
parent | 53adf30fe440eb8b6f58ba89f4a4c0acc7877498 (diff) | |
parent | 9b3a58e423333fc9a4a5a264c3beb0a3d951e86b (diff) |
Merge pull request #31 from AeneasVerif/son_lean_backend
Improve the Lean backend
Diffstat (limited to 'tests/lean/PoloniusList.lean')
-rw-r--r-- | tests/lean/PoloniusList.lean | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/lean/PoloniusList.lean b/tests/lean/PoloniusList.lean new file mode 100644 index 00000000..1453c275 --- /dev/null +++ b/tests/lean/PoloniusList.lean @@ -0,0 +1,34 @@ +-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS +-- [polonius_list] +import Base +open Primitives +namespace polonius_list + +/- [polonius_list::List] -/ +inductive List (T : Type) := +| Cons : T → List T → List T +| Nil : List T + +/- [polonius_list::get_list_at_x]: forward function -/ +divergent def get_list_at_x (ls : List U32) (x : U32) : Result (List U32) := + match ls with + | List.Cons hd tl => + if hd = x + then Result.ret (List.Cons hd tl) + else get_list_at_x tl x + | List.Nil => Result.ret List.Nil + +/- [polonius_list::get_list_at_x]: backward function 0 -/ +divergent def get_list_at_x_back + (ls : List U32) (x : U32) (ret0 : List U32) : Result (List U32) := + match ls with + | List.Cons hd tl => + if hd = x + then Result.ret ret0 + else + do + let tl0 ← get_list_at_x_back tl x ret0 + Result.ret (List.Cons hd tl0) + | List.Nil => Result.ret ret0 + +end polonius_list |