Fixpoint len(l:list):nat:=
match l with
lam => 0%nat
| cons _ _ l0 => ((len l0) + 1)%nat
end.
Definition first(l:list):dart*dart :=
match l with
lam => (nil,nil)
| cons x x' _ => (x,x')
end.
Definition tail(l:list):list :=
match l with
lam => lam
| cons _ _ l0 => l0
end.
Fixpoint last(l:list):dart*dart :=
match l with
lam => (nil,nil)
| cons x x' l0 =>
match l0 with
lam => (x, x')
| cons _ _ l1 => last l0
end
end.
Fixpoint nth(l:list)(k:nat){struct l}:dart*dart :=
match l with
lam => (nil,nil)
| cons x x' l0 =>
match k with
0%nat => (nil,nil)
| S 0%nat => (x,x')
| S (S k0) => nth l0 (S k0)
end
end.
Fixpoint double_link_list(m:fmap)(l:list){struct l}:Prop:=
match l with
lam => True
| cons x x' l0 => double_link m x x'
/\ double_link_list m l0
end.
(* BREAKING THE 0-LINKS IN A MAP m ALONG A DOUBLE-LINK LIST l: *)
Fixpoint Br(m:fmap)(l:list){struct l}:fmap:=
match l with
lam => m
| cons x x' l0 => Br (Br1 m x x') l0
end.

(* Specifications: *)
Lemma exd_Br:forall(l:list)(m:fmap)(z:dart),
exd m z <-> exd (Br m l) z.