Download 201005281935512

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Big O notation wikipedia , lookup

List of first-order theories wikipedia , lookup

Location arithmetic wikipedia , lookup

Arithmetic wikipedia , lookup

Algorithm wikipedia , lookup

Horner's method wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Algebra wikipedia , lookup

Vincent's theorem wikipedia , lookup

Polynomial wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

System of polynomial equations wikipedia , lookup

Factorization of polynomials over finite fields wikipedia , lookup

Transcript
Exploiting Vanishing
Polynomials for Equivalence
Verification of Fixed-Size
Arithmetic Datapaths
GIEE , NTU
ALCom Lab
Presenter:陳炳元
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Bit-Vector Arithmetic = %2m Algebra
Represent integers as a vector of bits
Bit x0 represents values 0 or 1
Vector X[1:0] = {x1, x0} represents integers
00, 01, 10, 11
Bit-vector of size m: integer values in 0,…, 2m-1
Vector X[m-1 : 0] represents integers reduced %
2m
Fixed-Size (m) Data-path: Modeling
•Control the datapath size: Fixed size bit-vectors (m)
•Bit-vector of size m: integer values in 0,…, 2m-1
Fixed-size (m)
bit-vector
arithmetic
Polynomials
reduced %2m
Algebra over
the ring Z2m
Anti-Aliasing Function
F1[15:0] = 156x6 + 62724x5 + 17968x4 + 18661x3 + 43593 x2
+ 40244x +13281
F2[15:0] = 156x6 + 5380x5 + 1584x4 + 10469x3 + 27209 x2 +
7456x + 13281
Now that polynomially F1F2 because they have different
coefficients;
But because the datapath size is fixed to 16 bits F1[15:0]=
F2[15:0],or in other words F1 % 216 = F2 % 216
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Binary Relation
•Let A be a set,R is a subset of AA,we say that R is a binary
relation on A
•Let R be a binary relation. We sometimes write aRb for (a,b)R
•A binary relation R on A is called reflexive
if(x,x)R for all xA
•A binary relation R on A is called symmetric
if(x,y)R(y,x)R for all x,yA
•A binary relation R on A is called transitive
if(x,y)R and (y,z)R(x,z)R for all x,y,zA
Equivalence Relation
•A binary relation R on A is called equivalence relation if it is
reflexive,symmetric,transitive
•
•A equivalence relation R on A.We define the equivalence class
of a,[a]={bA| (a,b)R }
•Example:
Let A=Z ,if (a,b)Rab mod n.
Then [0],[1],…,[n-1] are all equivalence class
Partition
•Let A be a set. A partition of A is a collection of disjoint
nonempty subsets of A. The equivalence classes of
R on A form a partition of A.
Lemma1:
Let R be an equivalence relation on A. The following statements
are equivalence:
(1) (a,b)R
(2) [a]=[b]
(3) [a][b]{}
Partition
•Theorem1:
Let R be an equivalence relation on A.P={[a]| aA}
P is partition of A
pf:
顯然  [a]  A
aA
Claim:[a][b],then [a][b]={}
If [a][b]{}
By the lemma1,we have [a]=[b]
故P為A之一partition

Partition
•Example:
•Let A=Z ,if (a,b)Rab mod n.
Then corresponding to equivalence class set Zn={[0],[1],…,[n-1]}
Note:
We sometimes write Zn={0,1,…,n-1}
Binary Operation
•Let S be a set. :SSS function,then we say that  is a binary
operation on S
•if  is a binary operation on S then we will write ab rather than
(a,b).
•(S,1, 2,…, K) is a set S together with k binary operation
1, 2,…, K on S
Introduction to Rings
•A ring (R,+,‧) is a set,R together with two binary operation
+, ‧on R called addition and multiplication,satisfying the following
properties:
(1)(R,+) is an abelin group.
We write the identity element 0
(2)Multiplication is associative,means that
a(bc)=(ab)c a,b,cR
(3)The left and right distributive laws hold,means that
a(b+c)=ab+ac and (a+b)c=ac+bc a,b,cR
Introduction to Rings
•Example:
我們在Z上定義一個equivalence relation,若(a,b)Rab mod n
對應之equivalence class set Zn={[0],[1],…,[n-1]}.
在Zn上定義兩個binary operation +,  by
[a]+[b]=[a+b mod n]與[a][b]=[ab mod n]
(Zn+,‧):ring
NOTE:
(1) [a],[b] Zn,[a]+[b]=[a+b mod n]=[b+a mod n]=[b]+[a]
and [a][b]=[ab mod n]=[ba mod n]=[b][a]
(2) [a] Zn,[a]+[0]=]=[a+0 mod n]=[a mod n]=[a]
and [a][1]=[a1 mod n]=[a mod n]=[a]
Introduction to Rings
•A ring R is called a commutative ring if ab=ba a,bR
•A ring R is called a ring with unity 1 if there is an element 10 in
R such that 1a=a=a1 aR
Example:
(1) Z,Q,R,C:commutative ring with unity 1 where the ring
operations are the usual addition and multiplication.
(2)Let n be a positive integer. Then the set Zn={0,1,…,n-1},under
addition and multiplication modulo n is commutative ring with
unity 1.
Introduction to Rings
•Let (R,+,‧) be a ring,define by
R[X]={anxn+an-1xn-1+· · ·+a1x+a0|n,aiR,i=1, 2,...,n} is called
the ring of polynomials over R
In fact,R[X] is ring
Example:
(Z3,+,‧),f(x)=2x3+1, g(x)=x+2
f(x)+g(x)= 2x3+x
and
f(x)g(x)=2x4+x3+x+2=2x4+2x+2
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Vanishing Polynomials
•Vanishing Polynomial
f(x) Z2m[X],x Z2m  f(x)=0
•f(x),g(x) Z2m[X]
if(f-g): vanishing means that 2m | (f-g)
•n! divides a product of n consecutive numbers
4! divides 99 X 100 X 101 X 102
•Find least n  2m|n!
Smarandache Function (SF)
SF(23) = 4, since 23|4!
2m divides the product of n = SF(2m) consecutive numbers
Basic Number Theory
•Let f(x),g(x) Z23 [X], if (f-g): vanishing
(1)23|(f - g) in Z23
(2) 23|4!
(3) 4! divides the product of 4 consecutive numbers
(4) xZ23, 4!|(x+1)(x+2)(x+3)(x+4)
•Write (f-g) as a product of SF(2m) = n consecutive numbers
Basis for factorization
Y0(x) = 1
Y1(x) = (x + 1)
Y2(x) = (x + 1)(x + 2)
: Product of 2 consecutive numbers
Y3(x) = (x + 1)(x + 2)(x + 3) : Product of 3 consecutive numbers
…
…
Yn(x) = Yn-1(x) (x + n)
: Product of n consecutive numbers
Basis for factorization
•Theorem2:
Sn(x) is vanishing in Z2m[X], where n = SF(2m).
•Example:
•f = x4 +2x3 + 3x2 + 2xZ23 [X]; SF(23) = 4
•f can be written as a product of 4 consecutive numbers.
f= (x+1)(x+2)(x+3)(x+4) = Y4(x)
•f is a vanishing polynomial.
Constraints on the Coefficient
•Example:
•h(x) = 4x2 + 4x = 4(x+1)(x+2) = 4S2(x)Z23[X]; SF(23) = 4
•h(x) =0 xZ23
•h is a vanishing polynomial.
•But h(x) not equal to S4(x)
•Theorem3:
2m/gcd(k!, 2m) Yk(x)=0 in Z2m[X],0kSF(2m),2m/gcd(k!, 2m) 為使
2m/gcd(k!, 2m) Yk(x)=0之min
NOTE:
b  Yk(x)=0 in Z2m[X] 2m/gcd(k!, 2m) |b
Constraints on the Coefficient
•Example:
•h(x) = 4x2 + 4x = 4(x+1)(x+2) = 4Y2(x)Z23[X]
•23/gcd(2!, 23) | 4
•h is a vanishing polynomial.
Deciding Vanishing Polynomials
•Theorem4:
•Let F be a polynomial in Z2m[X].Then F is vanishes
F = FnYn + Σn-1ak bk Yk
k=0
Theorem2
Theorem3
n = SF(2m), i.e. the least n such that 2m|n!
Fn is an arbitrary polynomial in Z2m[x]
ak is an arbitrary integer
bk = 2m/gcd(k!,2m)
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Algorithm
Procedure zero_Identifi(polynomial, 2m)
1. Calculate n = SF(2m)
2. k = n: Reduce according to Throrem2
Divide by Sn
If remainder is zero,then F = FnYn,
else Continue
Algorithm
3. Reduce according to Theorem3. Divide by
Yn-1 to Y0
Check if quotient is a multiple of
bk = 2m/gcd(k!,2m)
If remainder is zero,then stop.
else continue
Example 1
p= 4x2 + 4x in Z23
1. n = SF(23) = 4
2. k = 4: Divide by Y4
deg(p) = 2< deg(Y4)= 4
quo = 0, rem = 4x2 + 4x
F4 = 0; Continue
3.
k = 3: Divide by S3
deg(p) = 2<deg(S3) = 3
quo= 0, rem = 4x2 + 4x
continue
4. k = 2: Divide by Y2
quo = 4; rem = 0
b2 = 23/gcd(2!,23) = 4
a2 = quo/ b2 =1 Z
p is a vanishing polynomial in Z23
Example 2
p= 5x2 + 3x + 7 in Z23
1. n = SF(23) = 4
3.
k = 3: Divide by Y3
deg(p) = 2<deg(Y3) = 3
quo= 0, rem = 5x2+3x + 7
continue
2. k = 4: Divide by Y4
deg(p) = 2< deg(Y4) = 4
4. k = 2: Divide by Y2
quo = 0,rem=5x2+3x + 7
quo = 5; rem = 4x+5
F4 = 0; Continue
b2 = 23/gcd(2!,23) = 4
a2 = quo/ b2 =5/4 Z
p is not a vanishing polynomial in Z23
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Multiple Polynomial
•Definition:
•(1) Let R be a ring, define the ring R[x1,…,xn ] of
polynomial in the indeterminates x1,…,xn recursively
as follows:
R[x1,…,xn ] = (R[x1,…,xn-1])[xn]
•(2) x1i1…xnin is called monomial , ax1i1…xnin is called
monomial term, where a為此term之coefficient
•(3) The degree of x1i1…xnin is (i1,…,in)n denote
deg(x1i1…xnin)
Multiple Polynomial
If R is a commutative and f(x1,…,xn)R[x1,…,xn ], then
the mapping  : RR given by (a1,…,an)(a1,…,an)
The mapping is called polyfunction.
In this problem, : Z2n1… Z2nd Z2m
•Definition:
Let k=(k1,k2,…,kd)n, we define Yk=yk1(x1)…ykd(xd),
where yki(xi) is the falling factor of degree ki in xi
Example
•F(x1, x2)=x14x2 + 2x13x2+ 3x12x2+ 2x1x2 over
Z22[x1,…,xn ]
1. sf(22)=4
2. F=Y(4,1) (x1, x2)=Y4(x1)Y1(x2)=0 in Z22
•We wish to generalize these results to analyze
polyfunctions over Z2n1… Z2nd Z2m
Lemma8
(1)Z2 then Y2ni (xi)=0, i=1, 2, …, d
(2)Let n=sf(2m) then Yn(x)=0
Take i=min{2ni,sf(2m)} , i=1, 2, …, d
then YiZ2 is vanshing polynomial
ni
ni
•Lemma: Let k=(k1,k2,…,kd)n, then
Yk=0kii,for some i
Example
•F(x1, x2)=x12x2 - x1x2 be a polynomial corresponding
to the polyfunction : Z21 Z22 Z23 . We show that F is a
vanshing polynomial.
1. sf(23)=4, 1=2, 2=4
2. x12x2 - x1x2 =x1(x1-1) x2=Y(2,1) (x1, x2)
3. k1 1=2
The condition in lemma is satisfied,
Hence F is vanshing polynomial
Constraints on the Coefficient
•Theorem8:
•The expression ckYk=0 in Z2m[X]
d
m
2 /gcd(i=1 ki!, 2m) | ck
ck Z2m
k=(k1,k2,…,kd)n such that kii, i=1,2,…,d
Example
•F(x1, x2)=4x1x22 + 4x1x2 be a polynomial
corresponding to the polyfunction : Z21 Z22 Z23 . We
show that F is a vanshing polynomial.
1. 2n1=2, 2n2=4, sf(23)=4, 1=2, 2=4,
2. 4x1x22 + x1x2 =4x1x2 (x1-1) = c(1,2) Y(1,2) (x1, x2)
3. 8/gcd( 1!x2!, 8) | c(1,2)且k11=2, k22=4
The condition in lemma is satisfied,
Hence F is vanshing polynomial
Deciding Vanishing Polynomials
•Theorem:
Let F be a polynomial representation for the
function  from Z2n1… Z2nd to Z2m . Then F is vanishes
d
F = i=1QiY(i) + ΣakbkYk
Lemma8
Theorem8
n = SF(2m), i.e. the least n such that 2m|n!
k=(k1,k2,…,kd)n, for each ki=1,2,…, i
Y(i) is falling factor of degree i
Qi is an arbitrary polynomial
ak is an arbitrary integer
bk = 2m/gcd(k!,2m)
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Example
Outline
•Introduction
•Modeling
•Univariate Vanishing Polynomials
•Algorithm of Univariate
•Multi-varite Vanishing Polynomials
•Algorithm of Multi-varite
•Conclusions and Future Work
Conclusions and Future Work
Thank You