summaryrefslogtreecommitdiff
path: root/tests/coq/misc/PoloniusList.v
blob: e94b6dcbd06dc6014842eac66476f2a62c681841 (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
36
37
38
39
(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *)
(** [polonius_list] *)
Require Import Primitives.
Import Primitives.
Require Import Coq.ZArith.ZArith.
Local Open Scope Primitives_scope.
Module PoloniusList.

(** [polonius_list::List] *)
Inductive List_t (T : Type) :=
| ListCons : T -> List_t T -> List_t T
| ListNil : List_t T
.

Arguments ListCons {T} _ _.
Arguments ListNil {T}.

(** [polonius_list::get_list_at_x]: forward function *)
Fixpoint get_list_at_x_fwd (ls : List_t u32) (x : u32) : result (List_t u32) :=
  match ls with
  | ListCons hd tl =>
    if hd s= x then Return (ListCons hd tl) else get_list_at_x_fwd tl x
  | ListNil => Return ListNil
  end
.

(** [polonius_list::get_list_at_x]: backward function 0 *)
Fixpoint get_list_at_x_back
  (ls : List_t u32) (x : u32) (ret : List_t u32) : result (List_t u32) :=
  match ls with
  | ListCons hd tl =>
    if hd s= x
    then Return ret
    else (tl0 <- get_list_at_x_back tl x ret; Return (ListCons hd tl0))
  | ListNil => Return ret
  end
.

End PoloniusList .