-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapThroughWf.v
More file actions
32 lines (25 loc) · 757 Bytes
/
MapThroughWf.v
File metadata and controls
32 lines (25 loc) · 757 Bytes
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
(** * Well-Founded MapThrough *)
Require Import Coq.Lists.List Coq.Program.Wf Psatz.
Require Import Coq.Init.Nat.
Import ListNotations.
Section MapThroughWf.
Definition mappedT(A B : Set) : Set :=
A -> forall (xs : list A), B * sig (fun xs' : list A => length xs' <= length xs).
Program Fixpoint mapThroughWf{A B : Set}(f:mappedT A B)(xs : list A) { measure (length xs) } : list B :=
match xs with
[] => []
| hd :: tl =>
let '(b, exist _ c pf) := f hd tl in
b :: mapThroughWf f c
end.
Next Obligation.
simpl.
lia.
Qed.
(*
Print mapThroughWf. (* 6 *)
Print mapThroughWf_func. (*102*)
Print mapThroughWf_func_obligation_1. (*68*)
Print mapThroughWf_func_obligation_2. (*4*)
*)
End MapThroughWf.