Section SF_fun.
Context {T : Type}.
Fixpoint SF_fun_aux (h : R*T) (s : seq (R*T)) (y0 : T) (x : R) :=
match s with
| [::] => match Rle_dec x (fst h) with
| left _ => snd h
| right _ => y0
end
| h0 :: s0 => match Rlt_dec x (fst h) with
| left _ => snd h
| right _ => SF_fun_aux h0 s0 y0 x
end
end.
Definition SF_fun (s : SF_seq) (y0 : T) (x : R) :=
SF_fun_aux (SF_h s,y0) (SF_t s) y0 x.
End SF_fun.
(** * Particular SF_seq *)
Definition SF_seq_f1 {T : Type} (f1 : R -> T) (P : seq R) : SF_seq :=
mkSF_seq (head 0 P) (pairmap (fun x y => (y, f1 x)) (head 0 P) (behead P)).
Definition SF_seq_f2 {T : Type} (f2 : R -> R -> T) (P : seq R) : SF_seq :=
mkSF_seq (head 0 P) (pairmap (fun x y => (y, f2 x y)) (head 0 P) (behead P)).

Lemma SF_lx_f2 {T : Type} (f2 : R -> R -> T) P :
(0 < size P)%nat ->
SF_lx (SF_seq_f2 f2 P) = P.