Partial fractions by Chinese remaindering exist, are unique and are computed correctly full
This proof shows: correctness, termination.
Fix a field K and work in K[x], one variable, with deg0=−∞. Let b1,…,bk have degree at least 1 and be pairwise coprime, let ei≥1, let b=∏ibiei, d=degb, and let a∈K[x]. Write Bi=biei and ci=b/Bi.
Fact 1 (coprimality). gcd(ci,Bi)=1. If an irreducible p divides Bi then p∣bi. If p also divided ci=∏j=ibjej, then p∣bj for some j=i, so p divides gcd(bi,bj)=1, which is impossible.
Termination. Line L2 is one division with remainder. The loop of line L3 runs k times. In each pass, line L4 is one exact division (it is exact because Bi∣b), line L5 is one run of the extended Euclidean algorithm, which stops because the degrees of the remainders strictly decrease, line L6 is one division, and the inner loop of line L7 runs exactly ei times, each a single division. So the algorithm stops.
Line L5 succeeds. By Fact 1 the extended Euclidean algorithm on ci and Bi returns si,ti with sici+tiBi=1, so sici≡1(modBi).
Claim 1. After line L2, aold=qb+a with dega<d, by the division identity. So aold/b=q+a/b, and it remains to decompose the proper fraction a/b.
Claim 2. With ri=(asi)modBi from line L6, a=∑i=1krici. Let S=∑irici. Fix i. For j=i, Bi∣cj, so rjcj≡0(modBi). Also rici≡asici≡a(modBi) by line L5. Hence S≡a(modBi) for each i. The Bi are pairwise coprime (Fact 1 applied to any pair), so their product b divides S−a. Now deg(rici)<degBi+degci=d, so deg(S−a)<d, and a multiple of b of degree less than d is 0. So S=a. Dividing by b gives a/b=∑iri/Bi.
Claim 3. The inner loop of lines L7 and L8 produces aiei,…,ai1 with degaij<degbi and ri=∑j=1eiaijbiei−j. Let ρ0=ri and let the pass with index j compute ρei−j+1=ρei−jquobi and aij=ρei−jrembi. By the division identity ρt=ai,ei−t+ρt+1bi for t=0,…,ei−1, with each degaij<degbi. Substituting repeatedly gives ri=∑t=0ei−1ai,ei−tbit+ρeibiei. Since degri<degBi=eidegbi and each division by bi lowers the degree by degbi, we get degρei<0, so ρei=0. With j=ei−t this is the claim. Dividing by Bi=biei gives ri/Bi=∑j=1eiaij/bij.
Claims 1 to 3 together give aold/b=q+∑i∑jaij/bij with degaij<degbi, which is the required output.
Uniqueness. Suppose q+∑i,jaij/bij=q′+∑i,jaij′/bij, both with numerator degrees below degbi. Multiply by b and set δij=aij−aij′. Then (q−q′)b=−∑i,jδijbiei−jci. The right side has degree less than d, because deg(δijbiei−j)<eidegbi, so q=q′ and ∑iRici=0 with Ri=∑jδijbiei−j. Reducing modulo Bi gives Rici≡0(modBi), and since ci is invertible modulo Bi, Bi∣Ri. But degRi<degBi, so Ri=0. Finally Ri=0 is a base bi expansion of 0 with digits of degree below degbi: the lowest digit δiei=Rirembi=0, and dividing by bi and repeating shows every δij=0. So the decomposition is unique, and the algorithm returns it. ■