• No results found

Basic Algorithms In Computer Algebra

N/A
N/A
Protected

Academic year: 2022

Share "Basic Algorithms In Computer Algebra"

Copied!
12
0
0

Loading.... (view fulltext now)

Full text

(1)

Basic Algorithms In Computer Algebra

Kaiserslautern SS 2011

Prof. Dr. Wolfram Decker

(2)
(3)

References

• Cohen, H.: A Course in Computational Algebraic Number Theory. Springer, 1993.

• Cox, D.; Little, J.; O’Shea, D.: Ideals, Varieties, and Algorithms. Springer, 2007.

• Forster, O.: Algorithmische Zahlentheorie, Vieweg, 1996.

• Gerhard, J.; von zur Gathen, J.: Modern Computer Algebra. Cambridge Press, 2003.

• Greuel, F.-M.; Pfister, G.: A Singular introduction to Commutative Algebra.

2nd ed., Springer, 2007.

• Kaplan, M.: Computer Algebra. Springer, 2008.

• Knuth, D.E.: The Art of Computer Programming. Volumes 1,2,3. Addison-Wesley, 1998.

• Lidl, H.; Niederreiter, H.: Introduction to Finite Fields. Cambridge University Press, 1986.

• PYTHON documentation, 2011. http://www.python.org/

• SINGULAR 3-1-3 Online Manual, 2011. http://www.singular.uni-kl.de/

(4)
(5)

0 Introduction

Computer algebra is a discipline between mathematics and computer science which deals with designing, analyzing, implementing, and applying algebraic algorithms.

We comment on this in more detail in what follows.

0.1 Application Areas

Computer algebra is interdisciplinary in nature, with links to quite a number of are- as in mathematics, with applications in mathematics, other branches of science, and engineering:

• Through computer algebra methods, a number of mathematical disciplines become accessible to experiments. This is in particular true for various parts of algebra, number theory, and geometry. See

http://www.claymath.org/millennium/Birch and Swinnerton-Dyer Conjecture/

for a famous conjecture in number theory which is based on computer experiments.

• Algebraic algorithms open up new ways of computing in classical application areas of mathematics in science (physics, chemistry, biology). A pioneering and prominent example is work by Veltman and t’Hooft who won a Nobel price in physics in 1999 (awarded ‘for having placed particle physics theory on a firmer mathematical foundation’).

• Modern application areas of mathematics such as cryptography, coding theory, CAD, robotics, algebraic statistics, and algebraic biology heavily rely on computer algebra.

0.2 Implementations

There is a large variety of computer algebra systems suiting different needs. See http://orms.mfo.de/

and the slides from the first lecture of this course at

http://www.mathematik.uni-kl.de/ decker/Lehre/SS11/pramaSymbol/index.html.

The practical sessions accompanying the course feature the modern programming lan- guage Python (see http://www.python.org/) and the computer algebra system Sin- gular (see http://www.singular.uni-kl.de/).

(6)

0 INTRODUCTION

0.3 Analyzing Algorithms

One way of measuring the efficiency of an algorithm is to give assymptotic bounds on its running time which depend on the size of the input. For this, we will use the

“big-Oh” notation.

0.4 Designing Algorithms

When designing algorithms, we will describe them in a somewhat informal way which makes use of the structural conventions of a programming language. We refer to such a description as pseudocode. Here is a classical example which should be familiar from the beginner’s course Algebraische Strukturen:

Algorithm 1Euclid’s Algorithm

Input: m, n∈ R, n 6= 0, where R is an Euclidean domain Output: gcd(m, n)

a:= m, b := n while(b 6= 0) do

r := rem(a, b) // division with remainder a:= b, b := r

a:= n(a) // normal form return (a)

Some comments on this are in order. In any Euclidean domain R, with Euclidean function v, if a, b ∈ R with b 6= 0, and if

a = q · b + r, with r = 0 or v(r) < v(b), we write

quo(a, b) = q and rem(a, b) = r

for the quotient q and the remainder r, respectively. Note, however, that q and r need not be unique. If R = Z, with v given by the absolute value, uniqueness is achieved by the additional requirement that r ≥ 0. In the case where R = K[x] is the polynomial ring over a field K, with v given by the degree, q and r are unique without further requirement.

Remark 0.5. If R is any integral domain, and if a greatest common divisor c of two elements a, b ∈ R exists, all such divisors are obtained by multyplying c with a unit of R.

That is, the greatest common divisors form an equivalence class under being associated (see the first sheet of exercises). In this lecture, we always assume that in each such equivalence class a normal form is selected. If the class is represented by a ∈ R, we write n(a) for the normal form. Here, we set n(0) = 0 and n(1) = 1 (the normal form of the units in R), and require that n(a · b) = n(a) · n(b). If a 6= 0, then a = u(a) · n(a) for a uniquely determined unit u(a) ∈ R. By convention, u(0) = 0. Given two elements a, b ∈ R for which greatest common divisors exist, gcd(a, b) will denote the greatest common divisor in normal form. Similarly, for the least common multiple lcm(a, b). In

6

(7)

0.4 DESIGNING ALGORITHMS a unique factorization domain (UFD), greatest common divisors and lowest common multiples always exist, as we know from the course Algebraische Strukturen. Basic examples of UFDs are principal ideal domains such as Z and K[x]. Recall that every Euclideam domain is a principal ideal domain.

Example 0.6. (i) In Z, only ±1 are units. We choose the integers ≥ 0 as normal forms.

(ii) In a field K, all nonzero elements are units. Their normal form is, thus, 1.

(iii) Given any ring R in which normal forms are distinguished, the normal forms in the polynomial ring R[x] are the polynomials whose leading coefficients are normal forms in R. If R = K is a field, we get the monic polynomials.

Now, we give an example of Euclid’s algorithm at work:

Example 0.7. In Z, we have gcd(18, 30) = 6:

r a b

− 18 30 18 30 18 12 18 12 6 12 6

0 6 0

The computation of greatest common divisors in Z[x] can, in principle, be reduced to that in Q[x] using Gauss’ lemma (we will see this later). A problem with this approach is intermediate coefficient swell, see the slide from the second lecture of the course at

http://www.mathematik.uni-kl.de/ decker/Lehre/SS11/pramaSymbol/index.html.

Modular algorithms provide a solution to this problem. Their basic idea is to reduce the given polynomials modulo one (or several) prime numbers, compute their greatest common divisors in the corresponding prime fields Z/pZ, and lift the results to Z[x]

(for example, by Chinese remaindering).

To demonstrate the general use of modular computations, we give two examples from elementary number theory:

Example 0.8. We show that the equation

x2+ y2 = 4z + 3

has no integer solutions. The idea is to reduce the equation modulo 4:

x2+ y2 = 3.

In Z/4Z = {0, 1, 2, 3}, only 0, 1 are squares:

a 0 1 2 3 a2 0 1 0 1

Hence, the possible values for x2+ y2 in Z/4Z are 0, 1, 2, but not 3.

(8)

0 INTRODUCTION

Example 0.9. In 1732, Euler proved that the 5th Fermat number F5 = 225 + 1 is not prime. In fact, Euler showed that 641 is a factor of F5. His idea was to show that F5

modulo 641 is zero. For this, we first write

641 = 640 + 1 = 5 · 27+ 1 641 = 625 + 16 = 54+ 24 Then

5 · 27 = 640 ≡ −1 mod 641 , hence 54· 228 ≡ 1 mod 641 ,

and

54 ≡ −24 mod 641 . This implies

1 ≡ 54· 228 ≡ −24 · 228 = −232 mod 641 and, thus,

F5 = 232+ 1 ≡ 0 mod 641 .

0.10 What are Algebraic Algorithms?

Algebraic algorithms deal with algebraic objects, make us of algebraic methods, and are based on algebraic theorems. Objects are represented exactly and calculations are carried through exactly (no approximation is applied at any step).

0.11 What is an Algorithm?

An algorithm is a set of instructions for solving a particular problem in finitely many, well–defined steps. Starting from a given input, the instructions describe a computation which eventually will produce an output and terminate. The tran- sition from one step to the next one is not necessarily deterministic: probabilistic algorithms incorporate random input, which may lead to random performance and random output.

0.12 A First Motivating Example: The RSA Cryptosystem

Cryptology is the science of secure communication. Its basic scenario is:

8

(9)

0.12 A FIRST MOTIVATING EXAMPLE: THE RSA CRYPTOSYSTEM

m e s s a g e

Eve

Alice receiver Bob

sender

eavesdropper

Its basic idea is to encrypt the message:

sender

key K

plaintext

algorithm

encryption

ciphertext transmitted

PSfrag replacements

ε

algorithm receiver

key L

decryption

decrypted text transmitted

cipher text

PSfrag replacements

δ

In a symmetric cryptosystem, K = L.

Example 0.13 (Caesar Shift). Replace each letter of the plain text by a fixed number of positions down the alphabet. For instance:

A B C · · · X Y Z

↓ ↓ ↓ ↓ ↓ ↓ shift 3

D E F A B C

To decrypt, reverse the shift.

(10)

0 INTRODUCTION

Example 0.14. The German Enigma is an electro-mechanical rotor machine which was used for the encryption and decryption of secret messages during World War II.

See

http://www.youtube.com/watch?v=DnBsndE1IkA for a demonstration.

A major problem coming with symmetric cryptosystems is the initial exchange of one or more keys. Modern public key cryptosystems are asymmetric and avoid, thus, this problem: Alice creates both a public key and an associated private key, and publishes the public key. Bob uses the public key to encrypt his plain text, and Alice her private key to decrypt the transmitted cypher text.

Example 0.15 (RSA Cryptosystem). Two basic facts and one conjecture prepare the way:

Fact 1: It is easy to find a random prime number of a given size.

We can use modern probabilistic algorithms.

Fact 2: Multiplying large numbers is easy.

There are many efficient ways for multiplication.

Conjecture 3: Given a large integer, it is hard to find its prime factors.

Algorithms for factorizing are still expensive.

Based on all this, Alice proceeds as follows:

1. Generate two large, roughly equal random primes p 6= q (1024 bits each).

2. Compute the modulus N = p · q.

3. Select a (small) public exponent e satisfying gcd(e, (p − 1)(q − 1)) = 1.

4. Use the extended Euclidean algorithm to compute a private exponent d satisfying de ≡ 1 mod (p − 1)(q − 1).

5. Publish (N, e) as the public key and hide (N, d) as the private key.

Before exchanging messages, Bob and Alice agree on a way of encoding pieces of text as integers between 0 and N − 1 (long messages are broken into pieces). Using, say

A ↔ 0, B ↔ 1, · · · , Z ↔ 25 and the 26 -ary number system, CAESAR is encoded as

2 · 260+ 0 · 261+ 4 · 262+ 18 · 263+ 0 · 264+ 17 · 265 = 202 302 466 . Then Bob encrypts a piece of text x as

ε(x) := y := xe mod N (using repeated squaring). Alice decrypts y as

δ(y) := yd mod N (also using repeated squaring). This makes sense since

δ(y) = x (as we will see in the exercises).

10

(11)

0.17 A SECOND MOTIVATING EXAMPLE: ROBOTICS Remark 0.16. Among others, the RSA system can be used to solve the initial key exchange problem for a modern, computer based symmetric cryptosystem such as AES.

See

http://de.wikipedia.org/wiki/Pretty Good Privacy and

http://de.wikipedia.org/wiki/Advanced Encryption Standard.

0.17 A Second Motivating Example: Robotics

The inverse kinematic problem is to find all joint angles that place the hand of a robot in a desired position.

Example 0.18 (A Planar Robot). Consider the following robot arm which only moves in the plane:

PSfrag replacements

length l1

length l2

length l3

θ1

θ2

θ3

If (a, b) is the point to be reached by the robot’s hand, the corresponding angles satisfy the polynomial system of equations below (to simplify the system, we ignore the orientation of the hand, that is, the angle θ3):

a = l3(c1c2− s1s2) + l2c1 , b = l3(c1s2+ c2s1+ l2s1 , 0 = c21+ s21− 1 ,

0 = c22+ s22− 1 , where

ci = cos θ1 , si = sin θ1 .

Computing a Gr¨obner Basis as in the Singular example on the slides from the first lecture, we get an equivalent system which can be easily solved for the ci and si (to simplify the presentation of the result, we suppose that l2 = l3 = 1).

(12)

0 INTRODUCTION

c2a2+b22−2 ,

s2+ a2+ba 2s1a2b+b2a 3 , c1+abs1a22a+b2 ,

s21+ (aa22b+b+b23)s1+ (a24(a+b22)+b2−4a2) 2 . See Cox, Little, and O’Shea for details.

We refer to the homepage of Charles Wampler (see http://www.nd.edu/∼cwample1/) for movies featuring Robonaut2 and for the slides from a lecture on Kinematics and Numerical Algebraic Geometry which in particular include a discussion of possible robot joints.

12

References

Related documents

I wonder if it would be worth trying holding a telephone conference in advance of the main meeting where people not able to attend could provide input to the chair (or other officer)

This suggests that, while pre-migration experiences and information about the ideology of the home country’s government can play some role for migration decision-making (Just,

Metis involvement as interpreters, diplomats, and witnesses at the numbered treaties demonstrates the Metis played a crit cal role in forging a relationship between the First

program intervention not caused the replacement. No survival rate studies have been recently conducted to determine this estimate for many measures. Per D.12.05.015 at 347, the

Many housing associations that let properties through this scheme also offer an option to buy a share in the property on a New Build HomeBuy basis at a later date. Some

While Bybee's fears distorted his moral reasoning in the Torture Memo, it is clear that not all lawyers put into the same situation of advising (or trying

This study examines the degree to which the anonymity of users affects their tendency to engage in flaming behavior in online news forums through a qualitative analysis of

Mirroring the scenarios considered in the ants experiments, simulation of pedestrians under panic were considered for cases with/without a column near the exit of a room and for