Lecture of January 10, 2007 the Definition of Lexicographic Order Is
Total Page:16
File Type:pdf, Size:1020Kb
Load more
Recommended publications
-
MA/CSSE 473 Day 15 Return Exam
MA/CSSE 473 Day 15 Return Exam Student questions Towers of Hanoi Subsets Ordered Permutations MA/CSSE 473 Day 13 • Student Questions on exam or anything else •Towers of Hanoi • Subset generation –Gray code • Permutations and order 1 Towers of Hanoi •Move all disks from peg A to peg B •One at a time • Never place larger disk on top of a smaller disk •Demo •Code • Recurrence and solution Towers of Hanoi code Recurrence for number of moves, and its solution? 2 Permutations and order number permutation number permutation •Given a permutation 0 0123 12 2013 of 0, 1, …, n‐1, can 1 0132 13 2031 2 0213 14 2103 we directly find the 3 0231 15 2130 next permutation in 4 0312 16 2301 the lexicographic 5 0321 17 2310 sequence? 6 1023 18 3012 7 1032 19 3021 •Given a permutation 8 1203 20 3102 of 0..n‐1, can we 9 1230 21 3120 determine its 10 1302 22 3201 11 1320 23 3210 permutation sequence number? •Given n and i, can we directly generate the ith permutation of 0, …, n‐1? Subset generation • Goal: generate all subsets of {0, 1, 2, …, N‐1} • Bottom‐up (decrease‐by‐one) approach •First generate Sn‐1, the collection of all subsets of {0, …, N‐2} •Then Sn = Sn‐1 { Sn‐1 {n‐1} : sSn‐1} 3 Subset generation • Numeric approach: Each subset of {0, …, N‐1} corresponds to an bit string of length N where the ith bit is 1 iff i is in the subset. •So each subset can be represented by N bits. -
1 (15 Points) Lexicosort
CS161 Homework 2 Due: 22 April 2016, 12 noon Submit on Gradescope Handed out: 15 April 2016 Instructions: Please answer the following questions to the best of your ability. If you are asked to show your work, please include relevant calculations for deriving your answer. If you are asked to explain your answer, give a short (∼ 1 sentence) intuitive description of your answer. If you are asked to prove a result, please write a complete proof at the level of detail and rigor expected in prior CS Theory classes (i.e. 103). When writing proofs, please strive for clarity and brevity (in that order). Cite any sources you reference. 1 (15 points) LexicoSort In class, we learned how to use CountingSort to efficiently sort sequences of values drawn from a set of constant size. In this problem, we will explore how this method lends itself to lexicographic sorting. Let S = `s1s2:::sa' and T = `t1t2:::tb' be strings of length a and b, respectively (we call si the ith letter of S). We say that S is lexicographically less than T , denoting S <lex T , if either • a < b and si = ti for all i = 1; 2; :::; a, or • There exists an index i ≤ min fa; bg such that sj = tj for all j = 1; 2; :::; i − 1 and si < ti. Lexicographic sorting algorithm aims to sort a given set of n strings into lexicographically ascending order (in case of ties due to identical strings, then in non-descending order). For each of the following, describe your algorithm clearly, and analyze its running time and prove cor- rectness. -
Total Ordering on Subgroups and Cosets
Total Ordering on Subgroups and Cosets ∗ Alexander Hulpke Steve Linton Department of Mathematics Centre for Interdisciplinary Research in Colorado State University Computational Algebra 1874 Campus Delivery University of St Andrews Fort Collins, CO 80523-1874 The North Haugh [email protected] St Andrews, Fife KY16 9SS, U.K. [email protected] ABSTRACT permutation is thus the identity element ( ).) In the sym- We show how to compute efficiently a lexicographic order- metric group Sn this comparison of elements takes at most ing for subgroups and cosets of permutation groups and, n point comparisons. In a similar way a total order on a field F induces a to- more generally, of finite groups with a faithful permutation n representation. tal lexicographic order on the n-dimensional row space F which in turn induces a total (again lexicographic) order on the set F n×n of n×n matrices with entries in F . A compar- Categories and Subject Descriptors ison of two matrices takes at most n2 comparisons of field F[2]: 2; G [2]: 1; I [1]: 2 elements. As a third case we consider the automorphism group G of a (finite) group A. A total order on the elements of A again General Terms induces a total order on the elements of G by lexicographic Algorithms comparison of the images of a generating list L of A. (It can be convenient to take L to be sorted as well. The most Keywords “generic” choice is probably L = A.) Comparison of two automorphisms will take at most |L| comparisons of images. -
Implementing Language-Dependent Lexicographic Orders in Scheme
Implementing Language-Dependent Lexicographic Orders in Scheme Jean-Michel HUFFLEN LIFC (EA CNRS 4157) — University of Franche-Comté 16, route de Gray — 25030 BESANÇON CEDEX — FRANCE Abstract algorithm related to Unicode, an industry standard designed to al- The lexicographical order relations used within dictionaries are low text and symbols from all of the writing systems of the world to language-dependent, and we explain how we implemented such be consistently represented [2006]. Our method can be generalised orders in Scheme. We show how our sorting orders are derived to other alphabets. In addition, let us mention that if a document from the Unicode collation algorithm. Since the result of a Scheme cites some works written using the Latin alphabet and some writ- function can be itself a function, we use generators of sorting ten using another alphabet (Arabic, Cyrillic, . ), they are usually orders. Specifying a sorting order for a new natural language has itemised in two separate bibliography sections. So this limitation is been made as easy as possible and can be done by a programmer not too restrictive within MlBIBTEX’s purpose. who just has basic knowledge of Scheme. We also show how The next section of this article is devoted to some examples Scheme data structures allow our functions to be programmed in order to give some idea of this task’s complexity. We briefly efficiently. recall the principles of the Unicode collation algorithm [2006a] in Section 3 and explain how we adapted it in Scheme in Section 4. Keywords Lexicographical order relations, collation algorithm, Section 5 discusses some points, gives some limitations of our Unicode, MlBIBTEX, Scheme. -
Groebner Bases
1 Monomial Orders. In the polynomial algebra over F a …eld in one variable x; F [x], we can do long division (sometimes incorrectly called the Euclidean algorithm). If f(x) = n a0 + a1x + ::: + anx F [x] with an = 0 then we write deg f(x) = n and 2 6 LC(f(x)) = am. If g(x) is another element of F [x] then we have f(x) = h(x)g(x) + r(x) with h(x); r(x) F [x] and deg r[x] < m. This expression is unique. This result can be vari…ed2 by long division. As with all divisions we assume g(x) = 0. Which we will recall as a pseudo code (such code terminates on a return)6 the input being f; g and the output h and r: f0 = f; h0 = 0; k = 0; m = deg g; Repeat: If deg(fk(x) < deg(g(x) return hk(x); fk(x);n = deg fk; LC(fk(x)) n m fk+1(x) = fk(x) x g(x) LC(g(x)) LC(fk(x)) n m hk+1(x) = hk(x) + LC(g(x)) x ; k = k + 1; Continue; We note that this code terminates since at each step when there is no return then the new value of the degree of fx(x) has strictly decreased. The theory of Gröbner bases is based on a generalization of this algorithm to more than one variable. Unfortunately there is an immediate di¢ culty. The degree of a polynomial does not determine the highest degree part of the poly- nomial up to scalar multiple. -
A Versatile Algorithm to Generate Various Combinatorial Structures
A Versatile Algorithm to Generate Various Combinatorial Structures Pramod Ganapathi,∗ Rama B† August 23, 2018 Abstract Algorithms to generate various combinatorial structures find tremen- dous importance in computer science. In this paper, we begin by reviewing an algorithm proposed by Rohl [24] that generates all unique permutations of a list of elements which possibly contains repetitions, taking some or all of the elements at a time, in any imposed order. The algorithm uses an auxiliary array that maintains the number of occurrences of each unique element in the input list. We provide a proof of correctness of the algo- rithm. We then show how one can efficiently generate other combinatorial structures like combinations, subsets, n-Parenthesizations, derangements and integer partitions & compositions with minor changes to the same algorithm. 1 Introduction Algorithms which generate combinatorial structures like permutations, combi- nations, etc. come under the broad category of combinatorial algorithms [16]. These algorithms find importance in areas like Cryptography, Molecular Bi- ology, Optimization, Graph Theory, etc. Combinatorial algorithms have had a long and distinguished history. Surveys by Akl [1], Sedgewick [27], Ord Smith [21, 22], Lehmer [18], and of course Knuth’s thorough treatment [12, 13], arXiv:1009.4214v2 [cs.DS] 30 Sep 2010 successfully capture the most important developments over the years. The lit- erature is clearly too large for us to do complete justice. We shall instead focus on those which have directly impacted our work. The well known algorithms which solve the problem of generating all n! per- mutations of a list of n unique elements are Heap Permute [9], Ives [11] and Johnson-Trotter [29]. -
A New Method for Generating Permutations in Lexicographic Order
科學與工程技術期刊 第五卷 第四期 民國九十八年 21 Journal of Science and Engineering Technology, Vol. 5, No. 4, pp. 21-29 (2009) A New Method for Generating Permutations in Lexicographic Order TING KUO Department of International Trade, Takming University of Science and Technology No. 56, Sec.1, HuanShan Rd., Neihu, Taipei, Taiwan 11451, R.O.C. ABSTRACT First, an ordinal representation scheme for permutations is defined. Next, an “unranking” algorithm that can generate a permutation of n items according to its ordinal representation is designed. By using this algorithm, all permutations can be systematically generated in lexicographic order. Finally, a “ranking” algorithm that can convert a permutation to its ordinal representation is designed. By using these “ranking” and “unranking” algorithms, any permutation that is positioned in lexicographic order, away from a given permutation by any specific distance, can be generated. This significant benefit is the main difference between the proposed method and previously published alternatives. Three other advantages are as follows: First, not being restricted to sequentially numbering the n items from one to n, this method can even handle items with non-numeral marks without the aid of mapping. Second, this approach is well suited to a wide variety of permutation generations such as alternating permutations and derangements. Third, the proposed method can also be extended to a multiset. Key Words: lexicographic order, ordinal representation, permutation, ranking, unranking 一個依字母大小序產生排列的新方法 郭定 德明財經科技大學國際貿易系 11451 臺北市內湖區環山路一段 56 號 摘 要 首先,我們為排列問題定義一個順序表示法。第二,我們設計一個定序演算法,它可以根 據一個 n 項目的順序表示產生其對應的排列。藉由此演算法,我們可以依字母大小序地系統化 產生所有的 n 項目排列。第三,我們設計一個解序演算法,它可以根據一個 n 項目的排列產生 其對應的順序表示。藉由此兩個演算法,我們可以產生離一個 n 項目的排列任意距離,依字母 大小序而言,的另一個排列;此特點是我們的方法與其它研究最不同的地方。我們的方法還有 另三項優點如下:第一,它不限制於必須是 1 至 n 的連續數目,甚至於可以無需藉由轉換而直 接處理非數字的排列。第二,它也很適合用在其它的排列問題上,例如產生交替排列與錯位排 列。第三,它也可擴展至針對含有重複元素的集合之排列問題上。 22 Journal of Science and Engineering Technology, Vol. -
KRULL DIMENSION and MONOMIAL ORDERS Introduction Let R Be An
KRULL DIMENSION AND MONOMIAL ORDERS GREGOR KEMPER AND NGO VIET TRUNG Abstract. We introduce the notion of independent sequences with respect to a mono- mial order by using the least terms of polynomials vanishing at the sequence. Our main result shows that the Krull dimension of a Noetherian ring is equal to the supremum of the length of independent sequences. The proof has led to other notions of indepen- dent sequences, which have interesting applications. For example, we can show that dim R=0 : J 1 is the maximum number of analytically independent elements in an arbi- trary ideal J of a local ring R and that dim B ≤ dim A if B ⊂ A are (not necessarily finitely generated) subalgebras of a finitely generated algebra over a Noetherian Jacobson ring. Introduction Let R be an arbitrary Noetherian ring, where a ring is always assumed to be commu- tative with identity. The aim of this paper is to characterize the Krull dimension dim R by means of a monomial order on polynomial rings over R. We are inspired of a result of Lombardi in [13] (see also Coquand and Lombardi [4], [5]) which says that for a positive integer s, dim R < s if and only if for every sequence of elements a1; : : : ; as in R, there exist nonnegative integers m1; : : : ; ms and elements c1; : : : ; cs 2 R such that m1 ms m1+1 m1 m2+1 m1 ms−1 ms+1 a1 ··· as + c1a1 + c2a1 a2 + ··· + csa1 ··· as−1 as = 0: This result has helped to develop a constructive theory for the Krull dimension [6], [7], [8]. -
Implementing Language-Dependent Lexicographic Orders in Scheme Jean-Michel Hufflen
Implementing Language-Dependent Lexicographic Orders in Scheme Jean-Michel Hufflen To cite this version: Jean-Michel Hufflen. Implementing Language-Dependent Lexicographic Orders in Scheme. Proc.of the 8th Workshop on and , 2007, Germany. pp.139–144. hal-00661897 HAL Id: hal-00661897 https://hal.archives-ouvertes.fr/hal-00661897 Submitted on 20 Jan 2012 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Implementing Language-Dependent Lexicographic Orders in Scheme Jean-Michel HUFFLEN LIFC (EA CNRS 4157) — University of Franche-Comté 16, route de Gray — 25030 BESANÇON CEDEX — FRANCE huffl[email protected] Abstract algorithm related to Unicode, an industry standard designed to al- The lexicographical order relations used within dictionaries are low text and symbols from all of the writing systems of the world language-dependent, and we explain how we implemented such to be consistently represented [2006]. Our method can be gener- orders in Scheme. We show how our sorting orders are derived alised to other alphabets than the Latin one. In addition, let us men- from the Unicode collation algorithm. Since the result of a Scheme tion that if a document cites some works written using the Latin function can be itself a function, we use generators of sorting alphabet and some written using another alphabet (Arabic, Cyril- orders. -
1. Fields Fields and Vector Spaces. Typical Vector Spaces: R, Q, C. for Infinite Dimensional Vector Spaces, See Notes by Karen Smith
1. Fields Fields and vector spaces. Typical vector spaces: R; Q; C. For infinite dimensional vector spaces, see notes by Karen Smith. Important to consider a field as a vector space over a sub-field. Also have: algebraic closure of Q. Galois fields: GF (pa). Don't limit what field you work over. 2. Polynomial rings over a field Notation for a polynomial ring: K[x1; : : : ; xn]. α1 α2 αn Monomial: x1 x2 ··· xn n Set α = (α1; : : : ; αn) 2 N . α α1 α2 αn Write x for x1 x2 ··· xn . α A term is a monomial multiplied by a field element: cαx . A polynomial is a finite K-linear combination of monomials: X α f = cαx ; α so a polynomial is a finite sum of terms. The support of f are the monomials that appear (with non-zero coefficients) in the polynomial f. If α = (α1; : : : ; αn), put jαj = α1 + ··· + αn. α If f 2 K[x1; : : : ; xn], deg(f) = maxfjαj : x is in the support of fg. Example 2.1. f = 7x3y2z + 11xyz2 deg(f) = maxf6; 4g = 6. 7x3y2z is a term. x3y2z is a monomial. n Given f 2 K[x1; : : : ; xn], evaluation is the map Ff : K ! K given by (c1; : : : ; cn) ! f(c1; : : : ; cn). When is Ff the zero map? Example 2.2. If K is a finite field, Ff can be the zero map without f being the zero polynomial. For instance take the field with two elements, K = Z=2Z, and consider the polynomial f = x2 + x = x(x + 1). Then f is not zero in the ring K[x], however f(c) = 0 for all c 2 K (there are only two to check!). -
Gröbner Bases Tutorial
Gröbner Bases Tutorial David A. Cox Gröbner Basics Gröbner Bases Tutorial Notation and Definitions Gröbner Bases Part I: Gröbner Bases and the Geometry of Elimination The Consistency and Finiteness Theorems Elimination Theory The Elimination Theorem David A. Cox The Extension and Closure Theorems Department of Mathematics and Computer Science Prove Extension and Amherst College Closure ¡ ¢ £ ¢ ¤ ¥ ¡ ¦ § ¨ © ¤ ¥ ¨ Theorems The Extension Theorem ISSAC 2007 Tutorial The Closure Theorem An Example Constructible Sets References Outline Gröbner Bases Tutorial 1 Gröbner Basics David A. Cox Notation and Definitions Gröbner Gröbner Bases Basics Notation and The Consistency and Finiteness Theorems Definitions Gröbner Bases The Consistency and 2 Finiteness Theorems Elimination Theory Elimination The Elimination Theorem Theory The Elimination The Extension and Closure Theorems Theorem The Extension and Closure Theorems 3 Prove Extension and Closure Theorems Prove The Extension Theorem Extension and Closure The Closure Theorem Theorems The Extension Theorem An Example The Closure Theorem Constructible Sets An Example Constructible Sets 4 References References Begin Gröbner Basics Gröbner Bases Tutorial David A. Cox k – field (often algebraically closed) Gröbner α α α Basics x = x 1 x n – monomial in x ,...,x Notation and 1 n 1 n Definitions α ··· Gröbner Bases c x , c k – term in x1,...,xn The Consistency and Finiteness Theorems ∈ k[x]= k[x1,...,xn] – polynomial ring in n variables Elimination Theory An = An(k) – n-dimensional affine space over k The Elimination Theorem n The Extension and V(I)= V(f1,...,fs) A – variety of I = f1,...,fs Closure Theorems ⊆ nh i Prove I(V ) k[x] – ideal of the variety V A Extension and ⊆ ⊆ Closure √I = f k[x] m f m I – the radical of I Theorems { ∈ |∃ ∈ } The Extension Theorem The Closure Theorem Recall that I is a radical ideal if I = √I. -
Polynomial Rings
Polynomial Rings All rings in this note are commutative. 1. Polynomials in Several Variables over a Field and Grobner¨ Bases Example: 3 2 f1 = x y − xy + 1 2 2 3 f2 = x y − y − 1 g = x + y 2 I(f1; f2) Find a(x; y), b(x; y) such that a(x; y)f1 + b(x; y)f2 = g 3 2 3 2 3 ) y(f1 = x y − xy + 1) =) yf1 = x y − xy + y 2 2 3 3 2 3 yf1 − xf2 = x + y −x(f2 = x y − y − 1) =) xf2 = x y − xy − x α1 α2 αn β1 β2 βn Definition: A monomial ordering on x1 x2 ···xn > x1 x2 ··· xn total order that satisfies "well q " q ~x~α define ~xβ~ ordering hypothesis" xαxβ then ~x~γ · ~x~α > ~x~γ · ~xβ~. Lexicographic = dictionary order on the exponents 2 3 1 1 3 2 x1x2x3 > x1x2x3 lex 2 2 4 3 2 2 2 x1x2x3 > x1x2x3x4 lex Looking at exponents ~α = (α1; α2; ··· ; αn) and β~ = (β1; β2; ··· βn), α β x > x if α1 > β1 and (α2; ··· ; αn) > (β2; ··· βn): lex lex Definition: Fix a monomial ordering on the polynomial ring F [x1; x2; ··· ; xn]. (1) The leading term of a nonzero polynomial p(x) in F [x1; x2; ··· ; xn], denoted LT (p(x)), is the monomial term of maximal order in p(x) and the leading term of p(x) = 0 is 0. X ~α ~α If p(x) = c~α~x then LT (p(x)) = max~α c~α~x . α (2) If I is an ideal in F [x1; x2; ··· ; xn], the ideal of leading terms, denoted LT (I), is the ideal generated by the leading terms of all the elements in the ideal, i.e., LT (I) = hLT (p(x)) : p(x) 2 Ii.