42 end |
42 end |
43 |
43 |
44 lemma fps_zero_nth [simp]: "0 $ n = 0" |
44 lemma fps_zero_nth [simp]: "0 $ n = 0" |
45 unfolding fps_zero_def by simp |
45 unfolding fps_zero_def by simp |
46 |
46 |
47 lemma fps_nonzero_nth: "f \<noteq> 0 \<longleftrightarrow> (\<exists> n. f $n \<noteq> 0)" |
47 lemma fps_nonzero_nth: "f \<noteq> 0 \<longleftrightarrow> (\<exists> n. f $ n \<noteq> 0)" |
48 by (simp add: expand_fps_eq) |
48 by (simp add: expand_fps_eq) |
49 |
49 |
50 lemma fps_nonzero_nth_minimal: "f \<noteq> 0 \<longleftrightarrow> (\<exists>n. f $ n \<noteq> 0 \<and> (\<forall>m < n. f $ m = 0))" |
50 lemma fps_nonzero_nth_minimal: "f \<noteq> 0 \<longleftrightarrow> (\<exists>n. f $ n \<noteq> 0 \<and> (\<forall>m < n. f $ m = 0))" |
51 (is "?lhs \<longleftrightarrow> ?rhs") |
51 (is "?lhs \<longleftrightarrow> ?rhs") |
52 proof |
52 proof |
410 shows "n < subdegree f \<Longrightarrow> (f * g) $ n = 0" |
410 shows "n < subdegree f \<Longrightarrow> (f * g) $ n = 0" |
411 and "n < subdegree g \<Longrightarrow> (f * g) $ n = 0" |
411 and "n < subdegree g \<Longrightarrow> (f * g) $ n = 0" |
412 by (auto simp: fps_mult_nth_conv_inside_subdegrees) |
412 by (auto simp: fps_mult_nth_conv_inside_subdegrees) |
413 |
413 |
414 |
414 |
415 subsection \<open>Formal power series form a commutative ring with unity, if the range of sequences |
415 subsection \<open>Ring structure\<close> |
416 they represent is a commutative ring with unity\<close> |
|
417 |
416 |
418 instance fps :: (semigroup_add) semigroup_add |
417 instance fps :: (semigroup_add) semigroup_add |
419 proof |
418 proof |
420 fix a b c :: "'a fps" |
419 fix a b c :: "'a fps" |
421 show "a + b + c = a + (b + c)" |
420 show "a + b + c = a + (b + c)" |
537 by standard simp |
536 by standard simp |
538 |
537 |
539 instance fps :: (semiring_1_cancel) semiring_1_cancel .. |
538 instance fps :: (semiring_1_cancel) semiring_1_cancel .. |
540 |
539 |
541 |
540 |
542 subsection \<open>Selection of the nth power of the implicit variable in the infinite sum\<close> |
|
543 |
|
544 lemma fps_square_nth: "(f^2) $ n = (\<Sum>k\<le>n. f $ k * f $ (n - k))" |
541 lemma fps_square_nth: "(f^2) $ n = (\<Sum>k\<le>n. f $ k * f $ (n - k))" |
545 by (simp add: power2_eq_square fps_mult_nth atLeast0AtMost) |
542 by (simp add: power2_eq_square fps_mult_nth atLeast0AtMost) |
546 |
543 |
547 lemma fps_sum_nth: "sum f S $ n = sum (\<lambda>k. (f k) $ n) S" |
544 lemma fps_sum_nth: "sum f S $ n = sum (\<lambda>k. (f k) $ n) S" |
548 proof (cases "finite S") |
545 proof (cases "finite S") |
552 case False |
549 case False |
553 then show ?thesis by simp |
550 then show ?thesis by simp |
554 qed |
551 qed |
555 |
552 |
556 |
553 |
557 subsection \<open>Injection of the basic ring elements and multiplication by scalars\<close> |
|
558 |
|
559 definition "fps_const c = Abs_fps (\<lambda>n. if n = 0 then c else 0)" |
554 definition "fps_const c = Abs_fps (\<lambda>n. if n = 0 then c else 0)" |
560 |
555 |
561 lemma fps_nth_fps_const [simp]: "fps_const c $ n = (if n = 0 then c else 0)" |
556 lemma fps_nth_fps_const [simp]: "fps_const c $ n = (if n = 0 then c else 0)" |
562 unfolding fps_const_def by simp |
557 unfolding fps_const_def by simp |
563 |
558 |
789 lemma subdegree_power [simp]: |
782 lemma subdegree_power [simp]: |
790 "subdegree ((f :: ('a :: semiring_1_no_zero_divisors) fps) ^ n) = n * subdegree f" |
783 "subdegree ((f :: ('a :: semiring_1_no_zero_divisors) fps) ^ n) = n * subdegree f" |
791 by (cases "f = 0"; induction n) simp_all |
784 by (cases "f = 0"; induction n) simp_all |
792 |
785 |
793 |
786 |
794 subsection \<open>The efps_Xtractor series fps_X\<close> |
|
795 |
|
796 lemma minus_one_power_iff: "(- (1::'a::ring_1)) ^ n = (if even n then 1 else - 1)" |
787 lemma minus_one_power_iff: "(- (1::'a::ring_1)) ^ n = (if even n then 1 else - 1)" |
797 by (induct n) auto |
788 by (induct n) auto |
798 |
789 |
799 definition "fps_X = Abs_fps (\<lambda>n. if n = 1 then 1 else 0)" |
790 definition "fps_X = Abs_fps (\<lambda>n. if n = 1 then 1 else 0)" |
800 |
791 |
1470 then show ?thesis |
1461 then show ?thesis |
1471 unfolding lim_sequentially by blast |
1462 unfolding lim_sequentially by blast |
1472 qed |
1463 qed |
1473 |
1464 |
1474 |
1465 |
1475 subsection \<open>Inverses and division of formal power series\<close> |
1466 subsection \<open>Division\<close> |
1476 |
1467 |
1477 declare sum.cong[fundef_cong] |
1468 declare sum.cong[fundef_cong] |
1478 |
1469 |
1479 fun fps_left_inverse_constructor :: |
1470 fun fps_left_inverse_constructor :: |
1480 "'a::{comm_monoid_add,times,uminus} fps \<Rightarrow> 'a \<Rightarrow> nat \<Rightarrow> 'a" |
1471 "'a::{comm_monoid_add,times,uminus} fps \<Rightarrow> 'a \<Rightarrow> nat \<Rightarrow> 'a" |
1481 where |
1472 where |
1482 "fps_left_inverse_constructor f a 0 = a" |
1473 "fps_left_inverse_constructor f a 0 = a" |
1483 | "fps_left_inverse_constructor f a (Suc n) = |
1474 | "fps_left_inverse_constructor f a (Suc n) = |
1484 - sum (\<lambda>i. fps_left_inverse_constructor f a i * f$(Suc n - i)) {0..n} * a" |
1475 - sum (\<lambda>i. fps_left_inverse_constructor f a i * f$(Suc n - i)) {0..n} * a" |
1485 |
1476 |
1486 \<comment> \<open>This will construct a left inverse for f in case that x * f$0 = 1\<close> |
1477 \<comment> \<open>This will construct a left inverse for f in case that \<^prop>\<open>x * f$0 = 1\<close>\<close> |
1487 abbreviation "fps_left_inverse \<equiv> (\<lambda>f x. Abs_fps (fps_left_inverse_constructor f x))" |
1478 abbreviation "fps_left_inverse \<equiv> (\<lambda>f x. Abs_fps (fps_left_inverse_constructor f x))" |
1488 |
1479 |
1489 fun fps_right_inverse_constructor :: |
1480 fun fps_right_inverse_constructor :: |
1490 "'a::{comm_monoid_add,times,uminus} fps \<Rightarrow> 'a \<Rightarrow> nat \<Rightarrow> 'a" |
1481 "'a::{comm_monoid_add,times,uminus} fps \<Rightarrow> 'a \<Rightarrow> nat \<Rightarrow> 'a" |
1491 where |
1482 where |
1492 "fps_right_inverse_constructor f a 0 = a" |
1483 "fps_right_inverse_constructor f a 0 = a" |
1493 | "fps_right_inverse_constructor f a n = |
1484 | "fps_right_inverse_constructor f a n = |
1494 - a * sum (\<lambda>i. f$i * fps_right_inverse_constructor f a (n - i)) {1..n}" |
1485 - a * sum (\<lambda>i. f$i * fps_right_inverse_constructor f a (n - i)) {1..n}" |
1495 |
1486 |
1496 \<comment> \<open>This will construct a right inverse for f in case that f$0 * y = 1\<close> |
1487 \<comment> \<open>This will construct a right inverse for f in case that \<^prop>\<open>f$0 * y = 1\<close>\<close> |
1497 abbreviation "fps_right_inverse \<equiv> (\<lambda>f y. Abs_fps (fps_right_inverse_constructor f y))" |
1488 abbreviation "fps_right_inverse \<equiv> (\<lambda>f y. Abs_fps (fps_right_inverse_constructor f y))" |
1498 |
1489 |
1499 instantiation fps :: ("{comm_monoid_add,inverse,times,uminus}") inverse |
1490 instantiation fps :: ("{comm_monoid_add,inverse,times,uminus}") inverse |
1500 begin |
1491 begin |
1501 |
1492 |
1719 by (simp add: fps_mult_nth sum.atLeast_Suc_atMost mult.assoc f0[symmetric]) |
1710 by (simp add: fps_mult_nth sum.atLeast_Suc_atMost mult.assoc f0[symmetric]) |
1720 thus "(f * fps_right_inverse f y) $ n = 1 $ n" by (simp add: Suc) |
1711 thus "(f * fps_right_inverse f y) $ n = 1 $ n" by (simp add: Suc) |
1721 qed (simp add: f0 fps_inverse_def) |
1712 qed (simp add: f0 fps_inverse_def) |
1722 qed |
1713 qed |
1723 |
1714 |
1724 \<comment> \<open> |
1715 text \<open> |
1725 It is possible in a ring for an element to have a left inverse but not a right inverse, or |
1716 It is possible in a ring for an element to have a left inverse but not a right inverse, or |
1726 vice versa. But when an element has both, they must be the same. |
1717 vice versa. But when an element has both, they must be the same. |
1727 \<close> |
1718 \<close> |
1728 lemma fps_left_inverse_eq_fps_right_inverse: |
1719 lemma fps_left_inverse_eq_fps_right_inverse: |
1729 fixes f :: "'a::ring_1 fps" |
1720 fixes f :: "'a::ring_1 fps" |
1730 assumes f0: "x * f$0 = 1" "f $ 0 * y = 1" |
1721 assumes f0: "x * f$0 = 1" "f $ 0 * y = 1" |
1731 \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close> |
1722 \<comment> \<open>These assumptions imply that $x$ equals $y$, but no need to assume that.\<close> |
1732 shows "fps_left_inverse f x = fps_right_inverse f y" |
1723 shows "fps_left_inverse f x = fps_right_inverse f y" |
1733 proof- |
1724 proof- |
1734 from f0(2) have "f * fps_right_inverse f y = 1" |
1725 from f0(2) have "f * fps_right_inverse f y = 1" |
1735 by (simp add: fps_right_inverse) |
1726 by (simp add: fps_right_inverse) |
1736 hence "fps_left_inverse f x * f * fps_right_inverse f y = fps_left_inverse f x" |
1727 hence "fps_left_inverse f x * f * fps_right_inverse f y = fps_left_inverse f x" |
1749 by (simp add: mult.commute) |
1740 by (simp add: mult.commute) |
1750 |
1741 |
1751 lemma fps_left_inverse': |
1742 lemma fps_left_inverse': |
1752 fixes f :: "'a::ring_1 fps" |
1743 fixes f :: "'a::ring_1 fps" |
1753 assumes "x * f$0 = 1" "f$0 * y = 1" |
1744 assumes "x * f$0 = 1" "f$0 * y = 1" |
1754 \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close> |
1745 \<comment> \<open>These assumptions imply $x$ equals $y$, but no need to assume that.\<close> |
1755 shows "fps_right_inverse f y * f = 1" |
1746 shows "fps_right_inverse f y * f = 1" |
1756 using assms fps_left_inverse_eq_fps_right_inverse[of x f y] fps_left_inverse[of x f] |
1747 using assms fps_left_inverse_eq_fps_right_inverse[of x f y] fps_left_inverse[of x f] |
1757 by simp |
1748 by simp |
1758 |
1749 |
1759 lemma fps_right_inverse': |
1750 lemma fps_right_inverse': |
1760 fixes f :: "'a::ring_1 fps" |
1751 fixes f :: "'a::ring_1 fps" |
1761 assumes "x * f$0 = 1" "f$0 * y = 1" |
1752 assumes "x * f$0 = 1" "f$0 * y = 1" |
1762 \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close> |
1753 \<comment> \<open>These assumptions imply $x$ equals $y$, but no need to assume that.\<close> |
1763 shows "f * fps_left_inverse f x = 1" |
1754 shows "f * fps_left_inverse f x = 1" |
1764 using assms fps_left_inverse_eq_fps_right_inverse[of x f y] fps_right_inverse[of f y] |
1755 using assms fps_left_inverse_eq_fps_right_inverse[of x f y] fps_right_inverse[of f y] |
1765 by simp |
1756 by simp |
1766 |
1757 |
1767 lemma inverse_mult_eq_1 [intro]: |
1758 lemma inverse_mult_eq_1 [intro]: |
1806 by (simp add: fps_inverse_def) |
1797 by (simp add: fps_inverse_def) |
1807 |
1798 |
1808 lemma fps_left_inverse_idempotent_ring1: |
1799 lemma fps_left_inverse_idempotent_ring1: |
1809 fixes f :: "'a::ring_1 fps" |
1800 fixes f :: "'a::ring_1 fps" |
1810 assumes "x * f$0 = 1" "y * x = 1" |
1801 assumes "x * f$0 = 1" "y * x = 1" |
1811 \<comment> \<open>These assumptions imply y equals f$0, but no need to assume that.\<close> |
1802 \<comment> \<open>These assumptions imply $y$ equals \<open>f$0\<close>, but no need to assume that.\<close> |
1812 shows "fps_left_inverse (fps_left_inverse f x) y = f" |
1803 shows "fps_left_inverse (fps_left_inverse f x) y = f" |
1813 proof- |
1804 proof- |
1814 from assms(1) have |
1805 from assms(1) have |
1815 "fps_left_inverse (fps_left_inverse f x) y * fps_left_inverse f x * f = |
1806 "fps_left_inverse (fps_left_inverse f x) y * fps_left_inverse f x * f = |
1816 fps_left_inverse (fps_left_inverse f x) y" |
1807 fps_left_inverse (fps_left_inverse f x) y" |
1829 by (simp add: mult.commute) |
1820 by (simp add: mult.commute) |
1830 |
1821 |
1831 lemma fps_right_inverse_idempotent_ring1: |
1822 lemma fps_right_inverse_idempotent_ring1: |
1832 fixes f :: "'a::ring_1 fps" |
1823 fixes f :: "'a::ring_1 fps" |
1833 assumes "f$0 * x = 1" "x * y = 1" |
1824 assumes "f$0 * x = 1" "x * y = 1" |
1834 \<comment> \<open>These assumptions imply y equals f$0, but no need to assume that.\<close> |
1825 \<comment> \<open>These assumptions imply $y$ equals \<open>f$0\<close>, but no need to assume that.\<close> |
1835 shows "fps_right_inverse (fps_right_inverse f x) y = f" |
1826 shows "fps_right_inverse (fps_right_inverse f x) y = f" |
1836 proof- |
1827 proof- |
1837 from assms(1) have "f * (fps_right_inverse f x * fps_right_inverse (fps_right_inverse f x) y) = |
1828 from assms(1) have "f * (fps_right_inverse f x * fps_right_inverse (fps_right_inverse f x) y) = |
1838 fps_right_inverse (fps_right_inverse f x) y" |
1829 fps_right_inverse (fps_right_inverse f x) y" |
1839 by (simp add: fps_right_inverse mult.assoc[symmetric]) |
1830 by (simp add: fps_right_inverse mult.assoc[symmetric]) |
2992 with unbounded show ?thesis by simp |
2983 with unbounded show ?thesis by simp |
2993 qed (simp_all add: fps_Lcm Lcm_eq_0_I) |
2984 qed (simp_all add: fps_Lcm Lcm_eq_0_I) |
2994 |
2985 |
2995 |
2986 |
2996 |
2987 |
2997 subsection \<open>Formal Derivatives, and the MacLaurin theorem around 0\<close> |
2988 subsection \<open>Formal Derivatives\<close> |
2998 |
2989 |
2999 definition "fps_deriv f = Abs_fps (\<lambda>n. of_nat (n + 1) * f $ (n + 1))" |
2990 definition "fps_deriv f = Abs_fps (\<lambda>n. of_nat (n + 1) * f $ (n + 1))" |
3000 |
2991 |
3001 lemma fps_deriv_nth[simp]: "fps_deriv f $ n = of_nat (n + 1) * f $ (n + 1)" |
2992 lemma fps_deriv_nth[simp]: "fps_deriv f $ n = of_nat (n + 1) * f $ (n + 1)" |
3002 by (simp add: fps_deriv_def) |
2993 by (simp add: fps_deriv_def) |
3194 by (induct k arbitrary: f) (simp_all add: field_simps) |
3185 by (induct k arbitrary: f) (simp_all add: field_simps) |
3195 |
3186 |
3196 lemma fps_deriv_lr_inverse: |
3187 lemma fps_deriv_lr_inverse: |
3197 fixes x y :: "'a::ring_1" |
3188 fixes x y :: "'a::ring_1" |
3198 assumes "x * f$0 = 1" "f$0 * y = 1" |
3189 assumes "x * f$0 = 1" "f$0 * y = 1" |
3199 \<comment> \<open>These assumptions imply x equals y, but no need to assume that.\<close> |
3190 \<comment> \<open>These assumptions imply $x$ equals $y$, but no need to assume that.\<close> |
3200 shows "fps_deriv (fps_left_inverse f x) = |
3191 shows "fps_deriv (fps_left_inverse f x) = |
3201 - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x" |
3192 - fps_left_inverse f x * fps_deriv f * fps_left_inverse f x" |
3202 and "fps_deriv (fps_right_inverse f y) = |
3193 and "fps_deriv (fps_right_inverse f y) = |
3203 - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y" |
3194 - fps_right_inverse f y * fps_deriv f * fps_right_inverse f y" |
3204 proof- |
3195 proof- |
3620 (fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n) $ k" |
3611 (fps_const (inverse (of_nat (Suc n))) * fps_X ^ Suc n) $ k" |
3621 by (cases k) simp_all |
3612 by (cases k) simp_all |
3622 qed |
3613 qed |
3623 |
3614 |
3624 |
3615 |
3625 subsection \<open>Composition of FPSs\<close> |
3616 subsection \<open>Composition\<close> |
3626 |
3617 |
3627 definition fps_compose :: "'a::semiring_1 fps \<Rightarrow> 'a fps \<Rightarrow> 'a fps" (infixl "oo" 55) |
3618 definition fps_compose :: "'a::semiring_1 fps \<Rightarrow> 'a fps \<Rightarrow> 'a fps" (infixl "oo" 55) |
3628 where "a oo b = Abs_fps (\<lambda>n. sum (\<lambda>i. a$i * (b^i$n)) {0..n})" |
3619 where "a oo b = Abs_fps (\<lambda>n. sum (\<lambda>i. a$i * (b^i$n)) {0..n})" |
3629 |
3620 |
3630 lemma fps_compose_nth: "(a oo b)$n = sum (\<lambda>i. a$i * (b^i$n)) {0..n}" |
3621 lemma fps_compose_nth: "(a oo b)$n = sum (\<lambda>i. a$i * (b^i$n)) {0..n}" |
3720 by (induct k arbitrary: a) (simp_all add: fps_XD_def fps_eq_iff field_simps del: One_nat_def) |
3711 by (induct k arbitrary: a) (simp_all add: fps_XD_def fps_eq_iff field_simps del: One_nat_def) |
3721 |
3712 |
3722 |
3713 |
3723 subsubsection \<open>Rule 3\<close> |
3714 subsubsection \<open>Rule 3\<close> |
3724 |
3715 |
3725 text \<open>Rule 3 is trivial and is given by \<open>fps_times_def\<close>.\<close> |
3716 text \<open>Rule 3 is trivial and is given by \texttt{fps\_times\_def}.\<close> |
3726 |
3717 |
3727 |
3718 |
3728 subsubsection \<open>Rule 5 --- summation and "division" by (1 - fps_X)\<close> |
3719 subsubsection \<open>Rule 5 --- summation and ``division'' by $1 - X$\<close> |
3729 |
3720 |
3730 lemma fps_divide_fps_X_minus1_sum_lemma: |
3721 lemma fps_divide_fps_X_minus1_sum_lemma: |
3731 "a = ((1::'a::ring_1 fps) - fps_X) * Abs_fps (\<lambda>n. sum (\<lambda>i. a $ i) {0..n})" |
3722 "a = ((1::'a::ring_1 fps) - fps_X) * Abs_fps (\<lambda>n. sum (\<lambda>i. a $ i) {0..n})" |
3732 proof (rule fps_ext) |
3723 proof (rule fps_ext) |
3733 define f g :: "'a fps" |
3724 define f g :: "'a fps" |
3757 lemma fps_divide_fps_X_minus1_sum: |
3748 lemma fps_divide_fps_X_minus1_sum: |
3758 "a /((1::'a::division_ring fps) - fps_X) = Abs_fps (\<lambda>n. sum (\<lambda>i. a $ i) {0..n})" |
3749 "a /((1::'a::division_ring fps) - fps_X) = Abs_fps (\<lambda>n. sum (\<lambda>i. a $ i) {0..n})" |
3759 using fps_divide_fps_X_minus1_sum_ring1[of a] by simp |
3750 using fps_divide_fps_X_minus1_sum_ring1[of a] by simp |
3760 |
3751 |
3761 |
3752 |
3762 subsubsection \<open>Rule 4 in its more general form: generalizes Rule 3 for an arbitrary |
3753 subsubsection \<open>Rule 4 in its more general form\<close> |
3763 finite product of FPS, also the relvant instance of powers of a FPS\<close> |
3754 |
|
3755 text \<open>This generalizes Rule 3 for an arbitrary |
|
3756 finite product of FPS, also the relevant instance of powers of a FPS.\<close> |
3764 |
3757 |
3765 definition "natpermute n k = {l :: nat list. length l = k \<and> sum_list l = n}" |
3758 definition "natpermute n k = {l :: nat list. length l = k \<and> sum_list l = n}" |
3766 |
3759 |
3767 lemma natlist_trivial_1: "natpermute n 1 = {[n]}" |
3760 lemma natlist_trivial_1: "natpermute n 1 = {[n]}" |
3768 proof - |
3761 proof - |
4617 fps_radical r k (inverse a) = fps_radical r k 1 / fps_radical r k a" |
4610 fps_radical r k (inverse a) = fps_radical r k 1 / fps_radical r k a" |
4618 using radical_divide[where k=k and r=r and a=1 and b=a, OF k ] ra0 r1 a0 |
4611 using radical_divide[where k=k and r=r and a=1 and b=a, OF k ] ra0 r1 a0 |
4619 by (simp add: divide_inverse fps_divide_def) |
4612 by (simp add: divide_inverse fps_divide_def) |
4620 |
4613 |
4621 |
4614 |
4622 subsection \<open>Derivative of composition\<close> |
4615 subsection \<open>Chain rule\<close> |
4623 |
4616 |
4624 lemma fps_compose_deriv: |
4617 lemma fps_compose_deriv: |
4625 fixes a :: "'a::idom fps" |
4618 fixes a :: "'a::idom fps" |
4626 assumes b0: "b$0 = 0" |
4619 assumes b0: "b$0 = 0" |
4627 shows "fps_deriv (a oo b) = ((fps_deriv a) oo b) * fps_deriv b" |
4620 shows "fps_deriv (a oo b) = ((fps_deriv a) oo b) * fps_deriv b" |
4655 finally show ?thesis |
4648 finally show ?thesis |
4656 unfolding th0 by simp |
4649 unfolding th0 by simp |
4657 qed |
4650 qed |
4658 then show ?thesis by (simp add: fps_eq_iff) |
4651 then show ?thesis by (simp add: fps_eq_iff) |
4659 qed |
4652 qed |
4660 |
|
4661 |
|
4662 subsection \<open>Finite FPS (i.e. polynomials) and fps_X\<close> |
|
4663 |
4653 |
4664 lemma fps_poly_sum_fps_X: |
4654 lemma fps_poly_sum_fps_X: |
4665 assumes "\<forall>i > n. a$i = 0" |
4655 assumes "\<forall>i > n. a$i = 0" |
4666 shows "a = sum (\<lambda>i. fps_const (a$i) * fps_X^i) {0..n}" (is "a = ?r") |
4656 shows "a = sum (\<lambda>i. fps_const (a$i) * fps_X^i) {0..n}" (is "a = ?r") |
4667 proof - |
4657 proof - |
5740 show ?thesis |
5730 show ?thesis |
5741 using nz by (simp add: field_simps sum_distrib_left) |
5731 using nz by (simp add: field_simps sum_distrib_left) |
5742 qed |
5732 qed |
5743 |
5733 |
5744 |
5734 |
5745 subsubsection \<open>Formal trigonometric functions\<close> |
5735 subsubsection \<open>Trigonometric functions\<close> |
5746 |
5736 |
5747 definition "fps_sin (c::'a::field_char_0) = |
5737 definition "fps_sin (c::'a::field_char_0) = |
5748 Abs_fps (\<lambda>n. if even n then 0 else (- 1) ^((n - 1) div 2) * c^n /(of_nat (fact n)))" |
5738 Abs_fps (\<lambda>n. if even n then 0 else (- 1) ^((n - 1) div 2) * c^n /(of_nat (fact n)))" |
5749 |
5739 |
5750 definition "fps_cos (c::'a::field_char_0) = |
5740 definition "fps_cos (c::'a::field_char_0) = |