110 likes | 202 Views
Random generation of words with fixed occurrences of symbols in regular languages. 2. 1. 1. A. Bertoni P. Massazza R. Radicioni 1 Università degli Studi di Milano, Dipartimento di Scienze dell'Informazione, via Comelico 39, 20135 Milano, Italy.
E N D
Random generation of words with fixed occurrences of symbols in regular languages 2 1 1 A. Bertoni P. Massazza R. Radicioni 1 Università degli Studi di Milano, Dipartimento di Scienze dell'Informazione, via Comelico 39, 20135 Milano, Italy. 2 Università dell’Insubria, Dipartimento di Informatica e Comunicazione, via Mazzini 5, 21100 Varese, Italy MIUR-COFIN: Ravello, september 19-21
INPUT: Integers OUTPUT: A random word with occurrences of THE RGFOL PROBLEM Fix a language • APPLICATIONS: • Approximate counting • Testing and complexity analysis • Statistical analysis of biological sequences
Is there an algorithm ? OUR CONTRIBUTION Answer is YESforL regular, M = 2 RANDOM GENERATION AND COUNTING Deep correlation with counting [Flajolet, Van Cutsem, Zimmermann 1994] Best algorithm for regular languages working in time [Denise, Roques, Termier 2000]
arithmetical operations (due to the precomputation of all ) STANDARD TECHNIQUE Minimal automaton for L Language recognized by
ALTERNATIVE SOLUTION: Arithmetical ops (1’) 21 6 0 1 1 1 1 1 A VERY SIMPLE EXAMPLE , minimal automaton has one state STANDARD TECHNIQUE: Arithmetical ops 1 1 (1) 1 4 1 3 6 1 2 3 4 0 1 1 1 1 1 (2)
Alternative solution uses equations of type Theorem:If Lis regular, then there exist polynomials s.t. verifies recurrences of type (2). RECURRENCES WITH 1-dim SHIFTS Standard technique uses equations of type
THE FUNCTION “MOVE” Def.: Move( , s, sense) computes a matrix of coefficients from M by means of recurrences of type (2),depending on direction s and on sense sense. An Forward (Backward) move in the direction s uses Example: M=2, Move( , 1 , forward)
A FIRST ATTEMPT Given , we first compute (GB Bases) Then, an algorithm holds if the coefficients do not vanish in for Phase 1: Computation of Phase 2: Random generation
W W W SW SW SW S S S What if the leading and the least coefficients vanish? SOLUTION for M=2: Consider the recurrence equation (with constant coefficients) directly associated with a rational function and define a procedureSmartMove(M,dir)that smartly uses recurrence (3) whenever it is not possible to compute from by means of recurrences of type (2). Fact:A matrix of coefficients M can be computed by (3) if are known. Examples:
Theorem RandomGen(n1,n2) runs in time (and space) O(n1+n2) Fact 1 In the gridthere are O(n1+n2) points where the coefficients of recurrences of type (2) vanish. Fact 2 RandomGen(n1,n2) calls SmartMove() O(n1+n2) times Fact 3 The cost (time and space) of a call SmartMove (M(x,y),dir) that occurs inside RandomGen(n1,n2) is O(n1+n2) Fact 4 The cost (time and space) of h calls SmartMove(M(xh,yh),dirh) that occur inside RandomGen(n1,n2) is O(max(h, n1+n2))
CONCLUSIONS There exists an O(n1+n2) algorithm for the RGFOL problem(under uniform cost criterion) when is regular. Future Works • Extension of the general case to arbitrary alphabets (M>2). • Extension to unambiguous context-free languages. • Deep investigation on the nature of recurrences • Complexity analysis under log. cost criterion.