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.
Random generation of words
with fixed occurrences of symbols
in regular languages
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
OUTPUT: A random word
with occurrences of
THE RGFOL PROBLEM
Fix a language
Is there an algorithm ?
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 )
Minimal automaton for L
Language recognized by
A VERY SIMPLE EXAMPLE
, minimal automaton has one state
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
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.
RandomGen(n1,n2) runs in time (and space) O(n1+n2)
In the gridthere are O(n1+n2) points where the coefficients of recurrences of type (2) vanish.
RandomGen(n1,n2) calls SmartMove() O(n1+n2) times
The cost (time and space) of a call SmartMove (M(x,y),dir) that occurs inside RandomGen(n1,n2) is O(n1+n2)
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))
There exists an O(n1+n2) algorithm for the RGFOL problem(under uniform cost criterion) when is regular.