(* ========================================================================= *)
(* Products of real numbers. *)
(* ========================================================================= *)
prioritize_real();;
(* ------------------------------------------------------------------------- *)
(* Definition of infinite product. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Various elementary properties (should add more comprehensive list). *)
(* ------------------------------------------------------------------------- *)
let PRODUCT_CLAUSES_NUMSEG = prove
(`(!m. product(m..0) f = if m = 0 then f(0) else &1) /\
(!m n. product(m..SUC n) f = if m <= SUC n then product(m..n) f * f(SUC n)
else product(m..n) f)`,
let PRODUCT_LE_NUMSEG = prove
(`!f m n. (!i. m <= i /\ i <= n ==> &0 <= f(i) /\ f(i) <= g(i))
==> product(m..n) f <= product(m..n) g`,
let PRODUCT_CLOSED = prove
(`!P f:A->real s.
P(&1) /\ (!x y. P x /\ P y ==> P(x * y)) /\ (!a. a
IN s ==> P(f a))
==> P(product s f)`,
(* ------------------------------------------------------------------------- *)
(* Extend congruences. *)
(* ------------------------------------------------------------------------- *)
let th = prove
(`(!f g s. (!x. x
IN s ==> f(x) = g(x))
==> product s (\i. f(i)) = product s g) /\
(!f g a b. (!i. a <= i /\ i <= b ==> f(i) = g(i))
==> product(a..b) (\i. f(i)) = product(a..b) g) /\
(!f g p. (!x. p x ==> f x = g x)
==> product {y | p y} (\i. f(i)) = product {y | p y} g)`,