summaryrefslogtreecommitdiff
path: root/tests/fstar/misc/PoloniusList.fst
blob: 12618dbbefc65b6a1576452fafec2db2b4e2d52b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *)
(** [polonius_list] *)
module PoloniusList
open Primitives

#set-options "--z3rlimit 50 --fuel 1 --ifuel 1"

(** [polonius_list::List] *)
type list_t (t : Type0) =
| ListCons : t -> list_t t -> list_t t
| ListNil : list_t t

(** [polonius_list::get_list_at_x] *)
let rec get_list_at_x_fwd (ls : list_t u32) (x : u32) : result (list_t u32) =
  begin match ls with
  | ListCons hd tl ->
    if hd = x then Return (ListCons hd tl) else get_list_at_x_fwd tl x
  | ListNil -> Return ListNil
  end

(** [polonius_list::get_list_at_x] *)
let rec get_list_at_x_back
  (ls : list_t u32) (x : u32) (ret : list_t u32) : result (list_t u32) =
  begin match ls with
  | ListCons hd tl ->
    if hd = x
    then Return ret
    else
      begin match get_list_at_x_back tl x ret with
      | Fail e -> Fail e
      | Return tl0 -> Return (ListCons hd tl0)
      end
  | ListNil -> Return ret
  end