Definition sf_SF_val_fun (f : R -> R) (a b : R) (n : nat) : StepFun a b.

Lemma SF_val_fun_rw (f : R -> R) (a b : R) (n : nat) (x : R) (Hx : a <= x <= b) :
SF_val_fun f a b n x =
match (unif_part_nat a b n x Hx) with
| inleft H => f (a + (INR (proj1_sig H) + /2) * (b-a) / (INR n + 1))
| inright _ => f (a + (INR n + /2) * (b-a) / (INR n + 1))
end.