This theory aims at formalizing sufficient background to be able to state and prove the binomial theorem.
The binomial theorem asserts that for any two elements of a commutative ring the n-th power of the sum \(x+y\) can be written as a sum of certain multiplicities of terms \(x^{n-k}y^k\), where \(k \in 0..n\). In this section we setup the notation and prove basic properties of such multiplicities and powers of ring elements. We show the binomial theorem as an application.
The next locale (context) extends the ring0 locale with notation for powers, multiplicities and sums and products of finite lists of ring elements.
locale ring3 = ring0 +
defines \( \prod s \equiv \text{Fold}(M,1 ,s) \)
defines \( x^{n} \equiv \prod \{\langle k,x\rangle .\ k\in n\} \)
A ring with addition forms a monoid, hence all propositions proven in the monoid1 locale (defined in the Monoid_ZF_1 theory) can be used in the ring3 locale, applied to the additive operation.
using ringAssum unfolding IsAring_def, IsAgroup_def, monoid1_def, monoid0_def
A ring with multiplication forms a monoid, hence all propositions proven in the monoid1 locale (defined in the Monoid_ZF_1 theory) can be used in the ring3 locale, applied to the multiplicative operation. (For some reason the sublocale below is not seen by Isabelle when we try to use it).
using ringAssum unfolding IsAring_def, IsAgroup_def, monoid1_def, monoid0_def
The assumptions of the monoid1 context hold in the ring0 context
lemma (in ring0) monoid0_valid_in_ring0:
shows \( monoid1(R,A) \) using ringAssum unfolding IsAring_def, IsAgroup_def, monoid1_def, monoid0_def\(0\cdot x = 0\) and \(x^0=1\). It is a bit surprising that we do not need to assume that \(x\in R\) (i.e. \(x\) is an element of the ring). These properties are really proven in the Monoid_ZF_1 theory where there is no assumption that \(x\) is an element of the monoid.
lemma (in ring3) mult_pow_zero:
shows \( 0\cdot x = 0 \) and \( x^{0} = 1 \) using monoid0_valid_in_ring0, nat_mult_zero, nat_mult_zeroNatural multiple and power of a ring element is a ring element.
lemma (in ring3) mult_pow_type:
assumes \( n\in nat \), \( x\in R \)
shows \( n\cdot x \in R \) and \( x^{n} \in R \) using assms, monoid0_valid_in_ring0, nat_mult_type, nat_mult_typeThe usual properties of multiples and powers: \((n+1)x = nx+x\) and \(x^n+1=x^n x\). These are just versions of nat_mult_add_one from Monoid_ZF_1 writtent in the notation defined in the ring3 locale.
lemma (in ring3) nat_mult_pow_add_one:
assumes \( n\in nat \), \( x\in R \)
shows \( (n + 1)\cdot x = (n\cdot x) + x \) and \( x^{n + 1} = x^{n}\cdot x \) using assms, monoid0_valid_in_ring0, nat_mult_add_one, nat_mult_add_oneAssociativity for the multiplication by natural number and the ring multiplication:
lemma (in ring3) nat_mult_assoc:
assumes \( n\in nat \), \( x\in R \), \( y\in R \)
shows \( n\cdot x\cdot y = n\cdot (x\cdot y) \)proofAddition of natural numbers is distributive with respect to natural multiple. This is essentially lemma nat_mult_add from Monoid_ZF_1.thy, just transferred to the ring3 locale.
lemma (in ring3) nat_add_mult_distrib:
assumes \( n\in nat \), \( m\in nat \), \( x\in R \)
shows \( (n + m)\cdot x = n\cdot x + m\cdot x \) using assms, monoid0_valid_in_ring0, nat_mult_addAssociativity for the multiplication by natural number and the ring multiplication extended to three elements of the ring:
lemma (in ring3) nat_mult_assoc1:
assumes \( n\in nat \), \( x\in R \), \( y\in R \), \( z\in R \)
shows \( n\cdot x\cdot y\cdot z = n\cdot (x\cdot y\cdot z) \) using assms, Ring_ZF_1_L4(3), nat_mult_assocWhen we multiply an expression whose value belongs to a ring by a ring element and we get an expression whose value belongs to a ring.
lemma (in ring3) mult_elem_ring_type:
assumes \( n\in nat \), \( x\in R \) and \( \forall k\in n.\ q(k) \in R \)
shows \( \forall k\in n.\ q(k)\cdot x \in R \) and \( (\sum \{\langle k,q(k)\cdot x\rangle .\ k\in n\}) \in R \) using assms, Ring_ZF_1_L4(3), monoid0_valid_in_ring0, sum_in_monoThe sum of expressions whose values belong to a ring is an expression whose value belongs to a ring.
lemma (in ring3) sum_expr_ring_type:
assumes \( n\in nat \), \( \forall k\in n.\ q(k) \in R \), \( \forall k\in n.\ p(k) \in R \)
shows \( \forall k\in n.\ q(k) + p(k) \in R \) and \( (\sum \{\langle k,q(k) + p(k)\rangle .\ k\in n\}) \in R \) using assms, Ring_ZF_1_L4(1), monoid0_valid_in_ring0, sum_in_monoCombining mult_elem_ring_type and sum_expr_ring_type we obtain that a (kind of) linear combination of expressions whose values belong to a ring belongs to the ring.
lemma (in ring3) lin_comb_expr_ring_type:
assumes \( n\in nat \), \( x\in R \), \( y\in R \), \( \forall k\in n.\ q(k) \in R \), \( \forall k\in n.\ p(k) \in R \)
shows \( \forall k\in n.\ q(k)\cdot x + p(k)\cdot y \in R \) and \( (\sum \{\langle k,q(k)\cdot x + p(k)\cdot y\rangle .\ k\in n\}) \in R \)proofA ring3 version of seq_sum_pull_one_elem from Monoid_ZF_1:
lemma (in ring3) rng_seq_sum_pull_one_elem:
assumes \( j \in nat \), \( \forall k\in j + 1.\ q(k) \in R \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = q(0) + (\sum \{\langle k,q(k + 1)\rangle .\ k\in j\}) \), \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = (\sum \{\langle k,q(k)\rangle .\ k\in j\}) + q(j) \) using assms, monoid0_valid_in_ring0, seq_sum_pull_one_elemDistributive laws for finite sums in a ring: \((\sum_{k=0}^{n-1}q(k))\cdot x = \sum_{k=0}^{n-1}q(k)\cdot x\) and \(x\cdot (\sum_{k=0}^{n-1}q(k)) = \sum_{k=0}^{n-1}x\cdot q(k)\).
theorem (in ring3) fin_sum_distrib:
assumes \( x\in R \), \( n\in nat \), \( \forall k\in n.\ q(k) \in R \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in n\})\cdot x = \sum \{\langle k,q(k)\cdot x\rangle .\ k\in n\} \), \( x\cdot (\sum \{\langle k,q(k)\rangle .\ k\in n\}) = \sum \{\langle k,x\cdot q(k)\rangle .\ k\in n\} \)proofIn rings we have \(\sum_{k=0}^{n-1}q(k) + p(k) = (\sum_{k=0}^{n-1} p(k)) + (\sum_{k=0}^{n-1} q(k))\). This is the same as theorem sum_comm_distrib in Monoid_ZF_1.thy, except that we do not need the assumption about commutativity of the operation as addition in rings is always commutative.
lemma (in ring3) sum_ring_distrib:
assumes \( n\in nat \) and \( \forall k\in n.\ p(k) \in R \), \( \forall k\in n.\ q(k) \in R \)
shows \( (\sum \{\langle k,p(k) + q(k)\rangle .\ k\in n\}) = (\sum \{\langle k,p(k)\rangle .\ k\in n\}) + (\sum \{\langle k,q(k)\rangle .\ k\in n\}) \) using assms, Ring_ZF_1_L1(3), monoid0_valid_in_ring0, sum_comm_distribTo shorten the notation in the proof of the binomial theorem we give a name to the binomial term \({n \choose k} x^{n-k} y^k\).
definition (in ring3)
\( \text{BT}(n,k,x,y) \equiv {{n}\choose {k}}\cdot x^{n - k}\cdot y^{k} \)
If \(n,k\) are natural numbers and \(x,y\) are ring elements then the binomial term is an element of the ring.
lemma (in ring3) bt_type:
assumes \( n\in nat \), \( k\in nat \), \( x\in R \), \( y\in R \)
shows \( \text{BT}(n,k,x,y) \in R \) using assms, mult_pow_type, binom_in_nat, Ring_ZF_1_L4(3) unfolding BT_defThe binomial term is \(1\) when the \(n=0\) and \(k=0\). Somehow we do not need the assumption that \(x,y\) are ring elements.
lemma (in ring3) bt_at_zero:
shows \( \text{BT}(0,0,x,y) = 1 \) using binom_zero_zero, mult_pow_zero(2), monoid0_valid_in_ring0, nat_mult_one, Ring_ZF_1_L2(2), Ring_ZF_1_L3(5) unfolding BT_defThe binomial term is \(x^n\) when \(k=0\).
lemma (in ring3) bt_at_zero1:
assumes \( n\in nat \), \( x\in R \)
shows \( \text{BT}(n,0,x,y) = x^{n} \) unfolding BT_def using assms, mult_pow_zero(2), binom_left_boundary, mult_pow_type(2), monoid0_valid_in_ring0, nat_mult_one, Ring_ZF_1_L3(5)When \(k=0\) multiplying the binomial term by \(x\) is the same as adding one to \(n\).
lemma (in ring3) bt_at_zero2:
assumes \( n\in nat \), \( x\in R \)
shows \( \text{BT}(n,0,x,y)\cdot x = \text{BT}(n + 1,0,x,y) \) using assms, bt_at_zero1, nat_mult_pow_add_one(2)The binomial term is \(y^n\) when \(k=n\).
lemma (in ring3) bt_at_right:
assumes \( n\in nat \), \( y\in R \)
shows \( \text{BT}(n,n,x,y) = y^{n} \) unfolding BT_def using assms, binom_right_boundary, mult_pow_zero(2), monoid0_valid_in_ring0, nat_mult_one, Ring_ZF_1_L2(2), mult_pow_type(2), Ring_ZF_1_L3(6)When \(k=n\) multiplying the binomial term by \(x\) is the same as adding one to \(n\).
lemma (in ring3) bt_at_right1:
assumes \( n\in nat \), \( y\in R \)
shows \( \text{BT}(n,n,x,y)\cdot y = \text{BT}(n + 1,n + 1,x,y) \) using assms, bt_at_right, nat_mult_pow_add_one(2)A key identity for binomial terms needed for the proof of the binomial theorem:
lemma (in ring3) bt_rec_identity:
assumes \( M \text{ is commutative on } R \), \( j\in nat \), \( k\in j \), \( x\in R \), \( y\in R \)
shows \( \text{BT}(j,k + 1,x,y)\cdot x + \text{BT}(j,k,x,y)\cdot y = \text{BT}(j + 1,k + 1,x,y) \)proofThe binomial theorem: if \(x,y\) are elements of a commutative ring, \(n\in \mathbb{N}\) then \((x+y)^n = \sum_{k=0}^{n} {n \choose k} x^{n-k} y^k\).
theorem (in ring3) binomial_theorem:
assumes \( M \text{ is commutative on } R \), \( n\in nat \), \( x\in R \), \( y\in R \)
shows \( (x + y)^{n} = \sum \{\langle k,{{n}\choose {k}}\cdot x^{n - k} \cdot y^{k}\rangle .\ k\in n + 1\} \)proofassumes \( n\in nat \), \( x\in G \)
shows \( n\cdot x \in G \)assumes \( n\in nat \), \( x\in G \)
shows \( (n + 1)\cdot x = n\cdot x \oplus x \) and \( (n + 1)\cdot x = x \oplus n\cdot x \)assumes \( x\in R \)
shows \( 0 \cdot x = 0 \), \( x\cdot 0 = 0 \)assumes \( n\in nat \), \( x\in R \)
shows \( (n + 1)\cdot x = (n\cdot x) + x \) and \( x^{n + 1} = x^{n}\cdot x \)assumes \( n\in nat \), \( x\in R \)
shows \( n\cdot x \in R \) and \( x^{n} \in R \)assumes \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a\cdot (b + c) = a\cdot b + a\cdot c \), \( (b + c)\cdot a = b\cdot a + c\cdot a \)assumes \( a\in R \), \( b\in R \)
shows \( a + b \in R \), \( a - b \in R \), \( a\cdot b \in R \), \( a + b = b + a \)assumes \( n\in nat \) and \( P(0) \) and \( \forall k\in nat.\ P(k)\longrightarrow P(k + 1) \)
shows \( P(n) \)assumes \( n\in nat \), \( m\in nat \), \( x\in G \)
shows \( (n + m)\cdot x = n\cdot x \oplus m\cdot x \)assumes \( n\in nat \), \( x\in R \), \( y\in R \)
shows \( n\cdot x\cdot y = n\cdot (x\cdot y) \)assumes \( n\in nat \), \( \forall k\in n.\ q(k)\in G \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in n\}) \in G \)assumes \( a\in R \), \( b\in R \)
shows \( a + b \in R \), \( a - b \in R \), \( a\cdot b \in R \), \( a + b = b + a \)assumes \( n\in nat \), \( x\in R \) and \( \forall k\in n.\ q(k) \in R \)
shows \( \forall k\in n.\ q(k)\cdot x \in R \) and \( (\sum \{\langle k,q(k)\cdot x\rangle .\ k\in n\}) \in R \)assumes \( n\in nat \), \( \forall k\in n.\ q(k) \in R \), \( \forall k\in n.\ p(k) \in R \)
shows \( \forall k\in n.\ q(k) + p(k) \in R \) and \( (\sum \{\langle k,q(k) + p(k)\rangle .\ k\in n\}) \in R \)assumes \( n \in nat \), \( \forall k\in n + 1.\ q(k) \in G \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in n + 1\}) = q(0) \oplus (\sum \{\langle k,q(k + 1)\rangle .\ k\in n\}) \), \( (\sum \{\langle k,q(k)\rangle .\ k\in n + 1\}) = (\sum \{\langle k,q(k)\rangle .\ k\in n\}) \oplus q(n) \)assumes \( s:0\rightarrow G \)
shows \( (\sum s) = 0 \)assumes \( x\in R \)
shows \( 0 \cdot x = 0 \), \( x\cdot 0 = 0 \)assumes \( n \in nat \) and \( k\in n \)
shows \( k \lt n \), \( k \in nat \), \( k \leq n \), \( \langle k,n\rangle \in Le \)assumes \( n \in nat \), \( k\in n \)
shows \( k + 1 \subseteq n \)assumes \( n \in nat \), \( \forall k\in n + 1.\ q(k) \in G \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in n + 1\}) = q(0) \oplus (\sum \{\langle k,q(k + 1)\rangle .\ k\in n\}) \), \( (\sum \{\langle k,q(k)\rangle .\ k\in n + 1\}) = (\sum \{\langle k,q(k)\rangle .\ k\in n\}) \oplus q(n) \)assumes \( n\in nat \) and \( P(0) \) and \( \forall j\in n.\ P(j)\longrightarrow P(j + 1) \)
shows \( \forall k\in n + 1.\ P(k) \) and \( P(n) \)assumes \( x\in R \)
shows \( 0 \cdot x = 0 \), \( x\cdot 0 = 0 \)assumes \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a\cdot (b + c) = a\cdot b + a\cdot c \), \( (b + c)\cdot a = b\cdot a + c\cdot a \)assumes \( f \text{ is commutative on } G \), \( n\in nat \) and \( \forall k\in n.\ p(k) \in G \), \( \forall k\in n.\ q(k) \in G \)
shows \( (\sum \{\langle k,p(k)\oplus q(k)\rangle .\ k\in n\}) = (\sum \{\langle k,p(k)\rangle .\ k\in n\}) \oplus (\sum \{\langle k,q(k)\rangle .\ k\in n\}) \)assumes \( n\in nat \)
shows \( {{n}\choose {k}} \in nat \)assumes \( x\in G \)
shows \( 1\cdot x = x \)assumes \( a\in R \)
shows \( ( - a) \in R \), \( ( - ( - a)) = a \), \( a + 0 = a \), \( 0 + a = a \), \( a\cdot 1 = a \), \( 1 \cdot a = a \), \( a - a = 0 \), \( a - 0 = a \), \( 2 \cdot a = a + a \), \( ( - a) + a = 0 \)assumes \( n\in nat \)
shows \( {{n}\choose {0}} = 1 \)assumes \( n\in nat \), \( x\in R \)
shows \( n\cdot x \in R \) and \( x^{n} \in R \)assumes \( n\in nat \), \( x\in R \)
shows \( \text{BT}(n,0,x,y) = x^{n} \)assumes \( n\in nat \), \( x\in R \)
shows \( (n + 1)\cdot x = (n\cdot x) + x \) and \( x^{n + 1} = x^{n}\cdot x \)assumes \( n\in nat \)
shows \( {{n}\choose {n}} = 1 \)assumes \( a\in R \)
shows \( ( - a) \in R \), \( ( - ( - a)) = a \), \( a + 0 = a \), \( 0 + a = a \), \( a\cdot 1 = a \), \( 1 \cdot a = a \), \( a - a = 0 \), \( a - 0 = a \), \( 2 \cdot a = a + a \), \( ( - a) + a = 0 \)assumes \( n\in nat \), \( y\in R \)
shows \( \text{BT}(n,n,x,y) = y^{n} \)assumes \( n\in nat \), \( x\in R \), \( y\in R \), \( z\in R \)
shows \( n\cdot x\cdot y\cdot z = n\cdot (x\cdot y\cdot z) \)assumes \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a + b + c = a + (b + c) \), \( a\cdot b\cdot c = a\cdot (b\cdot c) \)assumes \( M \text{ is commutative on } R \) and \( a\in R \), \( b\in R \), \( c\in R \)
shows \( a\cdot (b\cdot c) = a\cdot c\cdot b \) and \( a\cdot b\cdot c = a\cdot c\cdot b \)assumes \( n\in nat \), \( k\in n \)
shows \( n - (k + 1) + 1 = n - k \)assumes \( n\in nat \), \( m\in nat \), \( x\in R \)
shows \( (n + m)\cdot x = n\cdot x + m\cdot x \)assumes \( n\in nat \), \( k \in n + 1 \)
shows \( {{n + 1}\choose {k + 1}} = {{n}\choose {k + 1}} + {{n}\choose {k}} \)assumes \( n \in nat \), \( i\in n \)
shows \( succ(i) \in succ(n) \), \( i + 1 \in n + 1 \), \( i \in n + 1 \)assumes \( q(0) \in G \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in 1\}) = q(0) \)assumes \( n\in nat \), \( k\in nat \), \( x\in R \), \( y\in R \)
shows \( \text{BT}(n,k,x,y) \in R \)assumes \( x\in R \), \( n\in nat \), \( \forall k\in n.\ q(k) \in R \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in n\})\cdot x = \sum \{\langle k,q(k)\cdot x\rangle .\ k\in n\} \), \( x\cdot (\sum \{\langle k,q(k)\rangle .\ k\in n\}) = \sum \{\langle k,x\cdot q(k)\rangle .\ k\in n\} \)assumes \( j \in nat \), \( \forall k\in j + 1.\ q(k) \in R \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = q(0) + (\sum \{\langle k,q(k + 1)\rangle .\ k\in j\}) \), \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = (\sum \{\langle k,q(k)\rangle .\ k\in j\}) + q(j) \)assumes \( j \in nat \), \( \forall k\in j + 1.\ q(k) \in R \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = q(0) + (\sum \{\langle k,q(k + 1)\rangle .\ k\in j\}) \), \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = (\sum \{\langle k,q(k)\rangle .\ k\in j\}) + q(j) \)assumes \( a\in R \), \( b\in R \), \( c\in R \), \( d\in R \)
shows \( a - (b + 1 )\cdot c = (a - d - c) + (d - b\cdot c) \), \( a + b + (c + d) = a + b + c + d \), \( a + b + (c + d) = a + (b + c) + d \)assumes \( n\in nat \) and \( \forall k\in n.\ p(k) \in R \), \( \forall k\in n.\ q(k) \in R \)
shows \( (\sum \{\langle k,p(k) + q(k)\rangle .\ k\in n\}) = (\sum \{\langle k,p(k)\rangle .\ k\in n\}) + (\sum \{\langle k,q(k)\rangle .\ k\in n\}) \)assumes \( M \text{ is commutative on } R \), \( j\in nat \), \( k\in j \), \( x\in R \), \( y\in R \)
shows \( \text{BT}(j,k + 1,x,y)\cdot x + \text{BT}(j,k,x,y)\cdot y = \text{BT}(j + 1,k + 1,x,y) \)assumes \( j \in nat \), \( \forall k\in j + 1.\ q(k) \in R \)
shows \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = q(0) + (\sum \{\langle k,q(k + 1)\rangle .\ k\in j\}) \), \( (\sum \{\langle k,q(k)\rangle .\ k\in j + 1\}) = (\sum \{\langle k,q(k)\rangle .\ k\in j\}) + q(j) \)assumes \( n\in nat \), \( x\in R \)
shows \( \text{BT}(n,0,x,y)\cdot x = \text{BT}(n + 1,0,x,y) \)assumes \( n\in nat \), \( y\in R \)
shows \( \text{BT}(n,n,x,y)\cdot y = \text{BT}(n + 1,n + 1,x,y) \)