Section SF_seq.
Context {T : Type}.
Record SF_seq := mkSF_seq {SF_h : R ; SF_t : seq (R * T)}.
Definition SF_lx (s : SF_seq) : seq R := (SF_h s)::(unzip1 (SF_t s)).
Definition SF_ly (s : SF_seq) : seq T := unzip2 (SF_t s).
Definition SF_make (lx : seq R) (ly : seq T) (Hs : size lx = S (size ly)) : SF_seq :=
mkSF_seq (head 0 lx) (zip (behead lx) ly).
(** ** Constructors *)
Definition SF_nil (x0 : R) : SF_seq := mkSF_seq x0 [::].
Definition SF_cons (h : R*T) (s : SF_seq) :=
mkSF_seq (fst h) ((SF_h s,snd h)::(SF_t s)).
Definition SF_rcons (s : SF_seq) (t : R*T) :=
mkSF_seq (SF_h s) (rcons (SF_t s) t).
(** ** SF_seq and seq *)
(** ** SF_size *)
Definition SF_size (s : SF_seq) := size (SF_t s).
(** ** SF_rev *)
Definition SF_rev (s : SF_seq) : SF_seq :=
SF_make (rev (SF_lx s)) (rev (SF_ly s)) (SF_rev_0 s).

Lemma SF_rev_cons (h : R*T) (s : SF_seq) :
SF_rev (SF_cons h s) = SF_rcons (SF_rev s) h.