The Legendre Symbol (Z/Pz) to (Z/P Z) Quadratic Reciprocity the Second Supplement

Total Page:16

File Type:pdf, Size:1020Kb

The Legendre Symbol (Z/Pz) to (Z/P Z) Quadratic Reciprocity the Second Supplement × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement The Legendre Symbol R. C. Daileda Trinity University Number Theory Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Definitions Given an odd prime p and a 2 Z with p - a, we say a is a quadratic residue of p if a ≡ b2 (mod p) for some b. Otherwise a is a quadratic nonresidue. The Legendre symbol of a at p is ( a 1 if a is a quadratic residue of p; = p −1 otherwise. a is clearly p-periodic in a. Thus we can view p · :( =p )× ! {±1g: p Z Z Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Euler's criterion immediately implies the next result. Theorem Let p be an odd prime, p - a. Then a ≡ a(p−1)=2 (mod p): p We can use this theorem to prove the following important fact. Theorem The Legendre symbol is completely multiplicative and induces a surjective homomorphism · :( =p )× ! {±1g: p Z Z Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Proof. × We have already seen that exactly half of the elements of (Z=pZ) are squares a.k.a. quadratic residues. · Therefore p is surjective. Let a; b 2 Z be coprime to p. Then so is ab and ab a b ≡ (ab)(p−1)=2 ≡ a(p−1)=2b(p−1)=2 ≡ (mod p): p p p · Because the values of p belong to {±1g, ab a b − = 0; ±2: p p p But the left-hand side is divisible by the odd prime p, so ±2 are impossible. This proves the result. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Quadratic Reciprocity, First Supplement: a = −1 When a = −1, the first theorem tells us that −1 ≡ (−1)(p−1)=2 (mod p): (1) p Both sides of the congruence belong to {±1g. Because p is odd, 1 6≡ −1(mod p). Hence (1) must actually be an equality. Theorem (Quadratic Reciprocity, First Supplement) Let p be an odd prime. Then −1 = (−1)(p−1)=2: p Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Reduction to Prime Argument Q ni Given a coprime to p, write a = i qi with qi 6= p distinct primes, 2 {±1g. According to the preceding theorem ni a Y qi Y qi = = : p p p p p i i ni odd The First Supplement evaluates p . The Second Supplement will 2 evaluate p . q We are therefore reduced to evaluating p where q 6= p is an odd prime. This is the subject of the Law of Quadratic Reciprocity. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Back to (Z=pmZ)× a Let a 2 Z be coprime to p. It turns out that p controls whether m or not a is a square (mod p ) for all m 2 N! Theorem a Suppose p = 1. Then there is a sequence of integers b1; b2; b3;::: so that: m bm+1 ≡ bm (mod p ) for all m ≥ 1; 2 m bm ≡ a (mod p ) for all m ≥ 1. m m × In particular, a + p Z 2 (Z=p Z) is a square for all m ≥ 1. Remark: These conditions imply that the sequence fb g1 p m m=1 converges in the ring Zp of p-adic integers to a. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Proof: We recursively construct the sequence of b's. 2 Since a is a quadratic residue of p, there is a b1 so that a ≡ b1 (mod p). Suppose we have found b1; b2;:::; bm as in the theorem. m m Consider bm + kp , which is ≡ bm (mod p ) for any choice of k. Moreover m 2 2 m 2 2m (bm + kp ) = bm + 2bmkp + k p 2 m m+1 ≡ bm + 2bmkp (mod p ) m m m+1 ≡ a + `p + 2bmkp (mod p ) m m+1 ≡ a + (` + 2bmk)p (mod p ): We need to choose k so that pj` + 2bmk, i.e. 2bmk ≡ −`(mod p). Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement 2bmk ≡ −`(mod p) is a linear congruence in the variable k. Since p - 2bm, we have (2bm; p) = 1, which means the congruence has a unique solution (mod p). Choose any element k of the solution set and define m bm+1 = bm + kp . Then bm+1 has the desired properties. Continuing this process indefinitely yields the sought after sequence. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Example Example Show that −1 is a square (mod 625) and find its two square roots. We have −1 = (−1)(5−1)=2 = (−1)2 = 1: 5 Hence −1 is a square (mod 5m) for all m ≥ 1. To find its square roots we implement the algorithm in the proof. 2 Since −1 ≡ 4(mod 5), clearly b1 = 2. And since 2 = −1 + 1 · 5, ` = 1. So b2 = b1 + 5k where 2b1k ≡ −` (mod 5) ) 4k ≡ −1 (mod 5) ) k ≡ 1 (mod 5); i.e. b2 = 7. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement 2 2 Now b2 = −1 + 2 · 5 so that ` = 2. So we need to solve 2b2k ≡ −` (mod 5) ) 4k ≡ −2 (mod 5) ) k ≡ 2 (mod 5); 2 and b3 = b2 + 5 k = 57. 2 3 Finally, b3 = −1 + 26 · 5 yields ` = 26 and we solve for k: 2b3k ≡ −` (mod 5) ) 4k ≡ −1 (mod 5) ) k ≡ 1 (mod 5): 3 Thus b4 = b3 + 5 k = 182. Therefore the two square roots of −1(mod 625) are ±182 (mod 625) : Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Gauss' Lemma Let's finally start heading toward the Law of Quadratic Reciprocity. Our first auxiliary result is the following. Lemma (Gauss' Lemma) Let p be an odd prime and suppose that p - a. For each p − 1 r 2 a; 2a; 3a;:::; a 2 n p−1 p−3 p−1 o choose the unique sr 2 − 2 ; − 2 ;:::; −1; 1; 2;:::; 2 so that r ≡ sr (mod p). Then a = (−1)ν; p where ν is the number of negative values of sr . Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Proof of Gauss' Lemma n p−1 p−3 p−1 o Let Ip = − 2 ; − 2 ;:::; −1; 1; 2;:::; 2 . Note that if s 6= t 2 Ip then: (s; p) = (t; p) = 1; 0 < js − tj ≤ p − 1 < p ) p - s − t ) s 6≡ t (mod p); jIpj = p − 1 = '(p). Therefore the map × Ip ! (Z=pZ) s 7! s + pZ is a bijection and sr is well-defined. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement 0 Suppose sr = −sr 0 . Then r ≡ −r (mod p). p−1 Thus ai ≡ −aj (mod p) for some 1 ≤ i; j ≤ 2 . Since (a; p) = 1, we can cancel it to obtain i ≡ −j (mod p) or i + j ≡ 0 (mod p) ) pji + j: But 0 < i + j < p − 1, so this is impossible. Therefore fsr g cannot contain both s and −s for any s 2 Ip. It follows that p − 1 fsr g = 1 · 1; 2 · 2; 3 · 3; : : : ; p−1 · 2 2 where each i 2 {±1g. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Now multiply together all of the r's and sr 's: (p−1)=2 p − 1 p − 1 a ! ≡ 12 ··· p−1 ! (mod p) 2 2 2 | {z } | {z } the r's the sr 's By an earlier theorem we therefore have a a ≡ (−1)ν (mod p) ) = (−1)ν p p since both sides belong to {±1g and p is odd. Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Example p−1 Consider p = 11 and a = 7. We have 2 = 5 and 7 ≡ −4 (mod 11); 2 · 7 ≡ 3 (mod 11); 3 · 7 ≡ −1 (mod 11); 4 · 7 ≡ −5 (mod 11); 5 · 7 ≡ 2 (mod 11): Therefore, by Gauss' Lemma, 7 = (−1)3 = −1; 11 and 7 is a quadratic nonresidue (mod 11). Daileda The Legendre Symbol × m × The Legendre Symbol (Z=pZ) to (Z=p Z) Quadratic Reciprocity The Second Supplement Remark n p−1 o Let r 2 a; 2a; 3a;:::; 2 a . Use the Division Algorithm to write r = qp + r 0; 0 ≤ r 0 < p: 0 Since r ≡ r (mod p), the uniqueness of sr implies: 0 p 0 If r < 2 , then sr = r . 0 p p 0 0 If r > 2 , then − 2 < r − p < 0 and r ≡ r − p (mod p). 0 Hence sr = r − p. It follows that ν in Gauss' Lemma is the number of r 0 that exceed p=2. This alternate characterization of ν can sometimes be useful.
Recommended publications
  • Chapter 2 Introduction to Classical Propositional
    CHAPTER 2 INTRODUCTION TO CLASSICAL PROPOSITIONAL LOGIC 1 Motivation and History The origins of the classical propositional logic, classical propositional calculus, as it was, and still often is called, go back to antiquity and are due to Stoic school of philosophy (3rd century B.C.), whose most eminent representative was Chryssipus. But the real development of this calculus began only in the mid-19th century and was initiated by the research done by the English math- ematician G. Boole, who is sometimes regarded as the founder of mathematical logic. The classical propositional calculus was ¯rst formulated as a formal ax- iomatic system by the eminent German logician G. Frege in 1879. The assumption underlying the formalization of classical propositional calculus are the following. Logical sentences We deal only with sentences that can always be evaluated as true or false. Such sentences are called logical sentences or proposi- tions. Hence the name propositional logic. A statement: 2 + 2 = 4 is a proposition as we assume that it is a well known and agreed upon truth. A statement: 2 + 2 = 5 is also a proposition (false. A statement:] I am pretty is modeled, if needed as a logical sentence (proposi- tion). We assume that it is false, or true. A statement: 2 + n = 5 is not a proposition; it might be true for some n, for example n=3, false for other n, for example n= 2, and moreover, we don't know what n is. Sentences of this kind are called propositional functions. We model propositional functions within propositional logic by treating propositional functions as propositions.
    [Show full text]
  • COMPSCI 501: Formal Language Theory Insights on Computability Turing Machines Are a Model of Computation Two (No Longer) Surpris
    Insights on Computability Turing machines are a model of computation COMPSCI 501: Formal Language Theory Lecture 11: Turing Machines Two (no longer) surprising facts: Marius Minea Although simple, can describe everything [email protected] a (real) computer can do. University of Massachusetts Amherst Although computers are powerful, not everything is computable! Plus: “play” / program with Turing machines! 13 February 2019 Why should we formally define computation? Must indeed an algorithm exist? Back to 1900: David Hilbert’s 23 open problems Increasingly a realization that sometimes this may not be the case. Tenth problem: “Occasionally it happens that we seek the solution under insufficient Given a Diophantine equation with any number of un- hypotheses or in an incorrect sense, and for this reason do not succeed. known quantities and with rational integral numerical The problem then arises: to show the impossibility of the solution under coefficients: To devise a process according to which the given hypotheses or in the sense contemplated.” it can be determined in a finite number of operations Hilbert, 1900 whether the equation is solvable in rational integers. This asks, in effect, for an algorithm. Hilbert’s Entscheidungsproblem (1928): Is there an algorithm that And “to devise” suggests there should be one. decides whether a statement in first-order logic is valid? Church and Turing A Turing machine, informally Church and Turing both showed in 1936 that a solution to the Entscheidungsproblem is impossible for the theory of arithmetic. control To make and prove such a statement, one needs to define computability. In a recent paper Alonzo Church has introduced an idea of “effective calculability”, read/write head which is equivalent to my “computability”, but is very differently defined.
    [Show full text]
  • Chapter 9 Quadratic Residues
    Chapter 9 Quadratic Residues 9.1 Introduction Definition 9.1. We say that a 2 Z is a quadratic residue mod n if there exists b 2 Z such that a ≡ b2 mod n: If there is no such b we say that a is a quadratic non-residue mod n. Example: Suppose n = 10. We can determine the quadratic residues mod n by computing b2 mod n for 0 ≤ b < n. In fact, since (−b)2 ≡ b2 mod n; we need only consider 0 ≤ b ≤ [n=2]. Thus the quadratic residues mod 10 are 0; 1; 4; 9; 6; 5; while 3; 7; 8 are quadratic non-residues mod 10. Proposition 9.1. If a; b are quadratic residues mod n then so is ab. Proof. Suppose a ≡ r2; b ≡ s2 mod p: Then ab ≡ (rs)2 mod p: 9.2 Prime moduli Proposition 9.2. Suppose p is an odd prime. Then the quadratic residues coprime to p form a subgroup of (Z=p)× of index 2. Proof. Let Q denote the set of quadratic residues in (Z=p)×. If θ :(Z=p)× ! (Z=p)× denotes the homomorphism under which r 7! r2 mod p 9–1 then ker θ = {±1g; im θ = Q: By the first isomorphism theorem of group theory, × jkerθj · j im θj = j(Z=p) j: Thus Q is a subgroup of index 2: p − 1 jQj = : 2 Corollary 9.1. Suppose p is an odd prime; and suppose a; b are coprime to p. Then 1. 1=a is a quadratic residue if and only if a is a quadratic residue.
    [Show full text]
  • Thinking Recursively Part Four
    Thinking Recursively Part Four Announcements ● Assignment 2 due right now. ● Assignment 3 out, due next Monday, April 30th at 10:00AM. ● Solve cool problems recursively! ● Sharpen your recursive skillset! A Little Word Puzzle “What nine-letter word can be reduced to a single-letter word one letter at a time by removing letters, leaving it a legal word at each step?” Shrinkable Words ● Let's call a word with this property a shrinkable word. ● Anything that isn't a word isn't a shrinkable word. ● Any single-letter word is shrinkable ● A, I, O ● Any multi-letter word is shrinkable if you can remove a letter to form a word, and that word itself is shrinkable. ● So how many shrinkable words are there? Recursive Backtracking ● The function we wrote last time is an example of recursive backtracking. ● At each step, we try one of many possible options. ● If any option succeeds, that's great! We're done. ● If none of the options succeed, then this particular problem can't be solved. Recursive Backtracking if (problem is sufficiently simple) { return whether or not the problem is solvable } else { for (each choice) { try out that choice. if it succeeds, return success. } return failure } Failure in Backtracking S T A R T L I N G Failure in Backtracking S T A R T L I N G S T A R T L I G Failure in Backtracking S T A R T L I N G S T A R T L I G Failure in Backtracking S T A R T L I N G Failure in Backtracking S T A R T L I N G S T A R T I N G Failure in Backtracking S T A R T L I N G S T A R T I N G S T R T I N G Failure in Backtracking S T A R T L I N G S T A R T I N G S T R T I N G Failure in Backtracking S T A R T L I N G S T A R T I N G Failure in Backtracking S T A R T L I N G S T A R T I N G S T A R I N G Failure in Backtracking ● Returning false in recursive backtracking does not mean that the entire problem is unsolvable! ● Instead, it just means that the current subproblem is unsolvable.
    [Show full text]
  • Chapter 6 Formal Language Theory
    Chapter 6 Formal Language Theory In this chapter, we introduce formal language theory, the computational theories of languages and grammars. The models are actually inspired by formal logic, enriched with insights from the theory of computation. We begin with the definition of a language and then proceed to a rough characterization of the basic Chomsky hierarchy. We then turn to a more de- tailed consideration of the types of languages in the hierarchy and automata theory. 6.1 Languages What is a language? Formally, a language L is defined as as set (possibly infinite) of strings over some finite alphabet. Definition 7 (Language) A language L is a possibly infinite set of strings over a finite alphabet Σ. We define Σ∗ as the set of all possible strings over some alphabet Σ. Thus L ⊆ Σ∗. The set of all possible languages over some alphabet Σ is the set of ∗ all possible subsets of Σ∗, i.e. 2Σ or ℘(Σ∗). This may seem rather simple, but is actually perfectly adequate for our purposes. 6.2 Grammars A grammar is a way to characterize a language L, a way to list out which strings of Σ∗ are in L and which are not. If L is finite, we could simply list 94 CHAPTER 6. FORMAL LANGUAGE THEORY 95 the strings, but languages by definition need not be finite. In fact, all of the languages we are interested in are infinite. This is, as we showed in chapter 2, also true of human language. Relating the material of this chapter to that of the preceding two, we can view a grammar as a logical system by which we can prove things.
    [Show full text]
  • Number Theory Summary
    YALE UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE CPSC 467: Cryptography and Computer Security Handout #11 Professor M. J. Fischer November 13, 2017 Number Theory Summary Integers Let Z denote the integers and Z+ the positive integers. Division For a 2 Z and n 2 Z+, there exist unique integers q; r such that a = nq + r and 0 ≤ r < n. We denote the quotient q by ba=nc and the remainder r by a mod n. We say n divides a (written nja) if a mod n = 0. If nja, n is called a divisor of a. If also 1 < n < jaj, n is said to be a proper divisor of a. Greatest common divisor The greatest common divisor (gcd) of integers a; b (written gcd(a; b) or simply (a; b)) is the greatest integer d such that d j a and d j b. If gcd(a; b) = 1, then a and b are said to be relatively prime. Euclidean algorithm Computes gcd(a; b). Based on two facts: gcd(0; b) = b; gcd(a; b) = gcd(b; a − qb) for any q 2 Z. For rapid convergence, take q = ba=bc, in which case a − qb = a mod b. Congruence For a; b 2 Z and n 2 Z+, we write a ≡ b (mod n) iff n j (b − a). Note a ≡ b (mod n) iff (a mod n) = (b mod n). + ∗ Modular arithmetic Fix n 2 Z . Let Zn = f0; 1; : : : ; n − 1g and let Zn = fa 2 Zn j gcd(a; n) = 1g. For integers a; b, define a⊕b = (a+b) mod n and a⊗b = ab mod n.
    [Show full text]
  • Appendices A. Quadratic Reciprocity Via Gauss Sums
    1 Appendices We collect some results that might be covered in a first course in algebraic number theory. A. Quadratic Reciprocity Via Gauss Sums A1. Introduction In this appendix, p is an odd prime unless otherwise specified. A quadratic equation 2 modulo p looks like ax + bx + c =0inFp. Multiplying by 4a, we have 2 2ax + b ≡ b2 − 4ac mod p Thus in studying quadratic equations mod p, it suffices to consider equations of the form x2 ≡ a mod p. If p|a we have the uninteresting equation x2 ≡ 0, hence x ≡ 0, mod p. Thus assume that p does not divide a. A2. Definition The Legendre symbol a χ(a)= p is given by 1ifa(p−1)/2 ≡ 1modp χ(a)= −1ifa(p−1)/2 ≡−1modp. If b = a(p−1)/2 then b2 = ap−1 ≡ 1modp,sob ≡±1modp and χ is well-defined. Thus χ(a) ≡ a(p−1)/2 mod p. A3. Theorem a The Legendre symbol ( p ) is 1 if and only if a is a quadratic residue (from now on abbre- viated QR) mod p. Proof.Ifa ≡ x2 mod p then a(p−1)/2 ≡ xp−1 ≡ 1modp. (Note that if p divides x then p divides a, a contradiction.) Conversely, suppose a(p−1)/2 ≡ 1modp.Ifg is a primitive root mod p, then a ≡ gr mod p for some r. Therefore a(p−1)/2 ≡ gr(p−1)/2 ≡ 1modp, so p − 1 divides r(p − 1)/2, hence r/2 is an integer. But then (gr/2)2 = gr ≡ a mod p, and a isaQRmodp.
    [Show full text]
  • Lecture 10: Quadratic Residues
    Lecture 10: Quadratic residues Rajat Mittal IIT Kanpur n Solving polynomial equations, anx + ··· + a1x + a0 = 0 , has been of interest from a long time in mathematics. For equations up to degree 4, we have an explicit formula for the solutions. It has also been shown that no such explicit formula can exist for degree higher than 4. What about polynomial equations modulo p? Exercise 1. When does the equation ax + b = 0 mod p has a solution? This lecture will focus on solving quadratic equations modulo a prime number p. In other words, we are 2 interested in solving a2x +a1x+a0 = 0 mod p. First thing to notice, we can assume that every coefficient ai can only range between 0 to p − 1. In the assignment, you will show that we only need to consider equations 2 of the form x + a1x + a0 = 0. 2 Exercise 2. When will x + a1x + a0 = 0 mod 2 not have a solution? So, for further discussion, we are only interested in solving quadratic equations modulo p, where p is an odd prime. For odd primes, inverse of 2 always exists. 2 −1 2 −2 2 x + a1x + a0 = 0 mod p , (x + 2 a1) = 2 a1 − a0 mod p: −1 −2 2 Taking y = x + 2 a1 and b = 2 a1 − a0, 2 2 Exercise 3. solving quadratic equation x + a1x + a0 = 0 mod p is same as solving y = b mod p. The small amount of work we did above simplifies the original problem. We only need to solve, when a number (b) has a square root modulo p, to solve quadratic equations modulo p.
    [Show full text]
  • Notes on Mathematical Logic David W. Kueker
    Notes on Mathematical Logic David W. Kueker University of Maryland, College Park E-mail address: [email protected] URL: http://www-users.math.umd.edu/~dwk/ Contents Chapter 0. Introduction: What Is Logic? 1 Part 1. Elementary Logic 5 Chapter 1. Sentential Logic 7 0. Introduction 7 1. Sentences of Sentential Logic 8 2. Truth Assignments 11 3. Logical Consequence 13 4. Compactness 17 5. Formal Deductions 19 6. Exercises 20 20 Chapter 2. First-Order Logic 23 0. Introduction 23 1. Formulas of First Order Logic 24 2. Structures for First Order Logic 28 3. Logical Consequence and Validity 33 4. Formal Deductions 37 5. Theories and Their Models 42 6. Exercises 46 46 Chapter 3. The Completeness Theorem 49 0. Introduction 49 1. Henkin Sets and Their Models 49 2. Constructing Henkin Sets 52 3. Consequences of the Completeness Theorem 54 4. Completeness Categoricity, Quantifier Elimination 57 5. Exercises 58 58 Part 2. Model Theory 59 Chapter 4. Some Methods in Model Theory 61 0. Introduction 61 1. Realizing and Omitting Types 61 2. Elementary Extensions and Chains 66 3. The Back-and-Forth Method 69 i ii CONTENTS 4. Exercises 71 71 Chapter 5. Countable Models of Complete Theories 73 0. Introduction 73 1. Prime Models 73 2. Universal and Saturated Models 75 3. Theories with Just Finitely Many Countable Models 77 4. Exercises 79 79 Chapter 6. Further Topics in Model Theory 81 0. Introduction 81 1. Interpolation and Definability 81 2. Saturated Models 84 3. Skolem Functions and Indescernables 87 4. Some Applications 91 5.
    [Show full text]
  • Formal Languages
    Formal Languages Discrete Mathematical Structures Formal Languages 1 Strings Alphabet: a finite set of symbols – Normally characters of some character set – E.g., ASCII, Unicode – Σ is used to represent an alphabet String: a finite sequence of symbols from some alphabet – If s is a string, then s is its length ¡ ¡ – The empty string is symbolized by ¢ Discrete Mathematical Structures Formal Languages 2 String Operations Concatenation x = hi, y = bye ¡ xy = hibye s ¢ = s = ¢ s ¤ £ ¨© ¢ ¥ § i 0 i s £ ¥ i 1 ¨© s s § i 0 ¦ Discrete Mathematical Structures Formal Languages 3 Parts of a String Prefix Suffix Substring Proper prefix, suffix, or substring Subsequence Discrete Mathematical Structures Formal Languages 4 Language A language is a set of strings over some alphabet ¡ Σ L Examples: – ¢ is a language – ¢ is a language £ ¤ – The set of all legal Java programs – The set of all correct English sentences Discrete Mathematical Structures Formal Languages 5 Operations on Languages Of most concern for lexical analysis Union Concatenation Closure Discrete Mathematical Structures Formal Languages 6 Union The union of languages L and M £ L M s s £ L or s £ M ¢ ¤ ¡ Discrete Mathematical Structures Formal Languages 7 Concatenation The concatenation of languages L and M £ LM st s £ L and t £ M ¢ ¤ ¡ Discrete Mathematical Structures Formal Languages 8 Kleene Closure The Kleene closure of language L ∞ ¡ i L £ L i 0 Zero or more concatenations Discrete Mathematical Structures Formal Languages 9 Positive Closure The positive closure of language L ∞ i L £ L
    [Show full text]
  • Consecutive Quadratic Residues and Quadratic Nonresidue Modulo P
    Consecutive Quadratic Residues And Quadratic Nonresidue Modulo p N. A. Carella Abstract: Let p be a large prime, and let k log p. A new proof of the existence of ≪ any pattern of k consecutive quadratic residues and quadratic nonresidues is introduced in this note. Further, an application to the least quadratic nonresidues np modulo p shows that n (log p)(log log p). p ≪ 1 Introduction Given a prime p 2, a nonzero element u F is called a quadratic residue, equiva- ≥ ∈ p lently, a square modulo p whenever the quadratic congruence x2 u 0mod p is solvable. − ≡ Otherwise, it called a quadratic nonresidue. A finite field Fp contains (p + 1)/2 squares = u2 mod p : 0 u < p/2 , including zero. The quadratic residues are uniformly R { ≤ } distributed over the interval [1,p 1]. Likewise, the quadratic nonresidues are uniformly − distributed over the same interval. Let k 1 be a small integer. This note is concerned with the longest runs of consecutive ≥ quadratic residues and consecutive quadratic nonresidues (or any pattern) u, u + 1, u + 2, . , u + k 1, (1) − in the finite field F , and large subsets F . Let N(k,p) be a tally of the number of p A ⊂ p sequences 1. Theorem 1.1. Let p 2 be a large prime, and let k = O (log p) be an integer. Then, the ≥ finite field Fp contains k consecutive quadratic residues (or quadratic nonresidues or any pattern). Furthermore, the number of k tuples has the asymptotic formulas p 1 k 1 (i) N(k,p)= 1 1+ O , if k 1.
    [Show full text]
  • Propositional Logic: Semantics and an Example
    Recap: Syntax PDC: Semantics Using Logic to Model the World Proofs Propositional Logic: Semantics and an Example CPSC 322 { Logic 2 Textbook x5.2 Propositional Logic: Semantics and an Example CPSC 322 { Logic 2, Slide 1 Recap: Syntax PDC: Semantics Using Logic to Model the World Proofs Lecture Overview 1 Recap: Syntax 2 Propositional Definite Clause Logic: Semantics 3 Using Logic to Model the World 4 Proofs Propositional Logic: Semantics and an Example CPSC 322 { Logic 2, Slide 2 Definition (body) A body is an atom or is of the form b1 ^ b2 where b1 and b2 are bodies. Definition (definite clause) A definite clause is an atom or is a rule of the form h b where h is an atom and b is a body. (Read this as \h if b.") Definition (knowledge base) A knowledge base is a set of definite clauses Recap: Syntax PDC: Semantics Using Logic to Model the World Proofs Propositional Definite Clauses: Syntax Definition (atom) An atom is a symbol starting with a lower case letter Propositional Logic: Semantics and an Example CPSC 322 { Logic 2, Slide 3 Definition (definite clause) A definite clause is an atom or is a rule of the form h b where h is an atom and b is a body. (Read this as \h if b.") Definition (knowledge base) A knowledge base is a set of definite clauses Recap: Syntax PDC: Semantics Using Logic to Model the World Proofs Propositional Definite Clauses: Syntax Definition (atom) An atom is a symbol starting with a lower case letter Definition (body) A body is an atom or is of the form b1 ^ b2 where b1 and b2 are bodies.
    [Show full text]