(* ========================================================================= *) (* Products of natural numbers and real numbers. *) (* ========================================================================= *) prioritize_num();; (* ------------------------------------------------------------------------- *) (* Products over natural numbers. *) (* ------------------------------------------------------------------------- *)let nproduct = new_definition `nproduct = iterate(( * ):num->num->num)`;;let NPRODUCT_SUPPORT =prove (`!f s. nproduct (support ( * ) f s) f = nproduct s f`,let NPRODUCT_ADD_SPLIT =prove (`!f m n p. m <= n + 1 ==> (nproduct (m..(n+p)) f = nproduct(m..n) f * nproduct(n+1..n+p) f)`,let NPRODUCT_POS_LT_NUMSEG =prove (`!f m n. (!x. m <= x /\ x <= n ==> 0 < f x) ==> 0 < nproduct(m..n) f`,let NPRODUCT_OFFSET =prove (`!f m p. nproduct(m+p..n+p) f = nproduct(m..n) (\i. f(i + p))`,let NPRODUCT_SING =prove (`!f x. nproduct {x} f = f(x)`,let NPRODUCT_SING_NUMSEG =prove (`!f n. nproduct(n..n) f = f(n)`,let NPRODUCT_CLAUSES_NUMSEG =prove (`(!m. nproduct(m..0) f = if m = 0 then f(0) else 1) /\ (!m n. nproduct(m..SUC n) f = if m <= SUC n then nproduct(m..n) f * f(SUC n) else nproduct(m..n) f)`,let NPRODUCT_EQ_NUMSEG =prove (`!f g m n. (!i. m <= i /\ i <= n ==> (f(i) = g(i))) ==> (nproduct(m..n) f = nproduct(m..n) g)`,let NPRODUCT_EQ_0_NUMSEG =prove (`!f m n. nproduct(m..n) f = 0 <=> ?x. m <= x /\ x <= n /\ f(x) = 0`,let NPRODUCT_LE_NUMSEG =prove (`!f m n. (!i. m <= i /\ i <= n ==> 0 <= f(i) /\ f(i) <= g(i)) ==> nproduct(m..n) f <= nproduct(m..n) g`,let NPRODUCT_EQ_1_NUMSEG =prove (`!f m n. (!i. m <= i /\ i <= n ==> (f(i) = 1)) ==> (nproduct(m..n) f = 1)`,let NPRODUCT_MUL_NUMSEG =prove (`!f g m n. nproduct(m..n) (\x. f x * g x) = nproduct(m..n) f * nproduct(m..n) g`,let NPRODUCT_ONE =prove (`!s. nproduct s (\n. 1) = 1`,let NPRODUCT_CLAUSES_LEFT =prove (`!f m n. m <= n ==> nproduct(m..n) f = f(m) * nproduct(m+1..n) f`,let NPRODUCT_CLAUSES_RIGHT =prove (`!f m n. 0 < n /\ m <= n ==> nproduct(m..n) f = nproduct(m..n-1) f * f(n)`,(* ------------------------------------------------------------------------- *) (* Now products over real numbers. *) (* ------------------------------------------------------------------------- *) prioritize_real();;let NPRODUCT_PAIR =prove (`!f m n. nproduct(2*m..2*n+1) f = nproduct(m..n) (\i. f(2*i) * f(2*i+1))`,let product = new_definition `product = iterate (( * ):real->real->real)`;;let PRODUCT_SUPPORT =prove (`!f s. product (support ( * ) f s) f = product s f`,let PRODUCT_ADD_SPLIT =prove (`!f m n p. m <= n + 1 ==> (product (m..(n+p)) f = product(m..n) f * product(n+1..n+p) f)`,let PRODUCT_POS_LE_NUMSEG =prove (`!f m n. (!x. m <= x /\ x <= n ==> &0 <= f x) ==> &0 <= product(m..n) f`,let PRODUCT_POS_LT_NUMSEG =prove (`!f m n. (!x. m <= x /\ x <= n ==> &0 < f x) ==> &0 < product(m..n) f`,let PRODUCT_OFFSET =prove (`!f m p. product(m+p..n+p) f = product(m..n) (\i. f(i + p))`,let PRODUCT_SING =prove (`!f x. product {x} f = f(x)`,let PRODUCT_SING_NUMSEG =prove (`!f n. product(n..n) f = f(n)`,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_EQ_NUMSEG =prove (`!f g m n. (!i. m <= i /\ i <= n ==> (f(i) = g(i))) ==> (product(m..n) f = product(m..n) g)`,let PRODUCT_EQ_0_NUMSEG =prove (`!f m n. product(m..n) f = &0 <=> ?x. m <= x /\ x <= n /\ f(x) = &0`,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_EQ_1_NUMSEG =prove (`!f m n. (!i. m <= i /\ i <= n ==> (f(i) = &1)) ==> (product(m..n) f = &1)`,let PRODUCT_MUL_NUMSEG =prove (`!f g m n. product(m..n) (\x. f x * g x) = product(m..n) f * product(m..n) g`,let PRODUCT_CONST_NUMSEG =prove (`!c m n. product (m..n) (\x. c) = c pow ((n + 1) - m)`,let PRODUCT_CONST_NUMSEG_1 =prove (`!c n. product(1..n) (\x. c) = c pow n`,let PRODUCT_NEG_NUMSEG =prove (`!f m n. product(m..n) (\i. --(f i)) = --(&1) pow ((n + 1) - m) * product(m..n) f`,let PRODUCT_NEG_NUMSEG_1 =prove (`!f n. product(1..n) (\i. --(f i)) = --(&1) pow n * product(1..n) f`,let PRODUCT_DIV_NUMSEG =prove (`!f g m n. product(m..n) (\x. f x / g x) = product(m..n) f / product(m..n) g`,let PRODUCT_ONE =prove (`!s. product s (\n. &1) = &1`,let PRODUCT_CLAUSES_LEFT =prove (`!f m n. m <= n ==> product(m..n) f = f(m) * product(m+1..n) f`,let PRODUCT_CLAUSES_RIGHT =prove (`!f m n. 0 < n /\ m <= n ==> product(m..n) f = product(m..n-1) f * f(n)`,(* ------------------------------------------------------------------------- *) (* Extend congruences. *) (* ------------------------------------------------------------------------- *)let PRODUCT_PAIR =prove (`!f m n. product(2*m..2*n+1) f = product(m..n) (\i. f(2*i) * f(2*i+1))`,