From Monadic Second-Order Definable String Transformations to Transducers

Similar documents
Regular transformations of data words through origin information

First-order Definable String Transformations

FO-Definable Transformations of Infinite Strings

Automata, Logic and Games: Theory and Application

Büchi Automata and Their Determinization

Nondeterministic Streaming String Transducers

The Parikh image of languages and linear constraints

Copyful Streaming String Transducers

arxiv: v5 [cs.fl] 21 Feb 2012

Languages, logics and automata

An algebraic characterization of unary two-way transducers

Lecturecise 22 Weak monadic second-order theory of one successor (WS1S)

The theory of regular cost functions.

Decision Problems for Additive Regular Functions

On the use of guards for logics with data

Complexity of Regular Functions

Logic and Automata I. Wolfgang Thomas. EATCS School, Telc, July 2014

DReX: A Declarative Language for Efficiently Evaluating Regular String Transformations

Tree Automata and Rewriting

CS256/Spring 2008 Lecture #11 Zohar Manna. Beyond Temporal Logics

Logical Characterization of Weighted Pebble Walking Automata

CHURCH SYNTHESIS PROBLEM and GAMES

Streaming Tree Transducers

What You Must Remember When Processing Data Words

Modal Logic XIII. Yanjing Wang

Uniformization in Automata Theory

Monadic Second Order Logic and Automata on Infinite Words: Büchi s Theorem

Finite and Algorithmic Model Theory II: Automata-Based Methods

Automata for Branching and Layered Temporal Structures

Deciding the weak definability of Büchi definable tree languages

Partially Ordered Two-way Büchi Automata

Aperiodic String Transducers

Alternating nonzero automata

Rabin Theory and Game Automata An Introduction

Automata-based Verification - III

On the Accepting Power of 2-Tape Büchi Automata

On the Satisfiability of Two-Variable Logic over Data Words

Verifying qualitative and quantitative properties with LTL over concrete domains

Temporal logics and explicit-state model checking. Pierre Wolper Université de Liège

The Complexity of Transducer Synthesis from Multi-Sequential Specifications

Weighted Automata and Logics on Infinite Graphs

On decision problems for timed automata

The Non-Deterministic Mostowski Hierarchy and Distance-Parity Automata

Lecture 2: Connecting the Three Models

Applied Automata Theory

First-order definability of rational transductions: An algebraic approach

Automata theory. An algorithmic approach. Lecture Notes. Javier Esparza

Automata-based Verification - III

On the bisimulation invariant fragment of monadic Σ 1 in the finite

Weak Cost Monadic Logic over Infinite Trees

From Liveness to Promptness

Algorithmic Analysis of Array-Accessing Programs

Ehrenfeucht-Fraïssé goes elementarily automatic for structures of bounded degree

On Recognizable Languages of Infinite Pictures

Chapter 1. Automata over infinite alphabets

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Counter Automata and Classical Logics for Data Words

Duality in Logic. Duality in Logic. Lecture 2. Mai Gehrke. Université Paris 7 and CNRS. {ε} A ((ab) (ba) ) (ab) + (ba) +

Regularity Problems for Visibly Pushdown Languages

Real-Time Systems. Lecture 15: The Universality Problem for TBA Dr. Bernd Westphal. Albert-Ludwigs-Universität Freiburg, Germany

Mathematical Preliminaries. Sipser pages 1-28

A Logical Characterization for Weighted Event-Recording Automata

Cost Functions Definable by Min/Max Automata

Two-Way Cost Automata and Cost Logics over Infinite Trees

Note on winning positions on pushdown games with omega-regular winning conditions

Weak Alternating Automata Are Not That Weak

The State Explosion Problem

A Generalization of Cobham s Theorem to Automata over Real Numbers 1

PSL Model Checking and Run-time Verification via Testers

LTL with Arithmetic and its Applications in Reasoning about Hierarchical Systems

ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear:

Finite Automata and Languages

A Generalization of Cobham s Theorem to Automata over Real Numbers

Linear Temporal Logic and Büchi Automata

Model Theoretic Complexity of Automatic Structures (Extended Abstract)

The MSO Theory of Connectedly Communicating Processes

Spectra of Monadic Second-Order Formulas with One Unary Function

Variable Automata over Infinite Alphabets

Duality and Automata Theory

On Recognizable Languages of Infinite Pictures

Chapter XIII Monadic Second-Order Theories

Unary Automatic Graphs: An Algorithmic Perspective 1

On the use of guards for logics with data

Decidability of WS1S and S1S (An Exposition) Exposition by William Gasarch-U of MD

Pumping for Ordinal-Automatic Structures *

Article begins on next page

Introduction to Tree Logics

Overlapping tile automata:

A Unified Approach to Boundedness Properties in MSO

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

Acceptance of!-languages by Communicating Deterministic Turing Machines

Deciding Safety and Liveness in TPTL

Unranked Tree Automata with Sibling Equalities and Disequalities

Strategy Logic. 1 Introduction. Krishnendu Chatterjee 1, Thomas A. Henzinger 1,2, and Nir Piterman 2

Automata, Logic and Games: Theory and Application

A Weak Bisimulation for Weighted Automata

Halting and Equivalence of Program Schemes in Models of Arbitrary Theories

Tree languages defined in first-order logic with one quantifier alternation

AUTOMATIC STRUCTURES OF BOUNDED DEGREE REVISITED

Finite Universes. L is a fixed-length language if it has length n for some

Transcription:

From Monadic Second-Order Definable String Transformations to Transducers Rajeev Alur 1 Antoine Durand-Gasselin 2 Ashutosh Trivedi 3 1 University of Pennsylvania 2 LIAFA, Université Paris Diderot 3 Indian Institute of Technology Bombay June 21, 2013 Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 1 / 31

Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Computational model Finite state automata Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Computational model Finite state automata Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Regular Word Transformation Logically Definition using MSO Transformations of words ϕ : Σ Σ Computational model Finite state automata Computational model Streaming Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Regular Word Transformation Logically Definition using MSO Transformations of words ϕ : Σ Σ Equi-expressiveness Computational model Finite state automata Computational model Streaming Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Words are interpreted structures: e.g. ([1, 10], >, P a, P b, P c ) w = a b b a b c a b c c P a = { 1, 4, 7} P b = { 2, 3, 5, 8} P c = { 6, 9, 10} Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Words are interpreted structures: e.g. ([1, 10], >, P a, P b, P c ) w = a b b a b c a b c c P a = { 1, 4, 7} P b = { 2, 3, 5, 8} P c = { 6, 9, 10} Formulas are defined inductively: Atomic: x 1 < x 2, P(x 1 ), X (x),... Boolean connectives: ϕ 1 ϕ 2, ϕ 3,... First-order quantification: x.ϕ Second-order quantification: X.ϕ Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Words are interpreted structures: e.g. ([1, 10], >, P a, P b, P c ) w = a b b a b c a b c c P a = { 1, 4, 7} P b = { 2, 3, 5, 8} P c = { 6, 9, 10} Formulas are defined inductively: Atomic: x 1 < x 2, P(x 1 ), X (x),... Boolean connectives: ϕ 1 ϕ 2, ϕ 3,... First-order quantification: x.ϕ Second-order quantification: X.ϕ An MSO formula with no free variables defines a language Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Appealing computational model: Finite State Automata Theorem [Büchi, 1960] A language is MSO definable iff it is accepted by a finite-state automaton. Deterministic automata are a computational model to analyse words: process sequentially a word input by jumping from state to state Can be efficiently manipulated Automata can be determinized LSPACE algorithm to check if a word is accepted by an automaton Minimization (equivalence in time O(n log log n)) Product of automata (language union, intersection,...) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 4 / 31

Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Regular Word Transformation Logically Definition using MSO Transformations of words ϕ : Σ Σ Equi-expressiveness Computational model Finite state automata Computational model Streaming Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 5 / 31

Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 6 / 31

Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 7 / 31

MSO-definable Transformations [Courcelle, 1994] Defining Graph Transformations using MSO A labeled graph transformation using MSO is specified by: input and output alphabets; an MSO formula specifying the domain of the transformation; output is specified using a finite number of copies of nodes of input graph; the node labels are specified using MSO formulas; and the existence of edges between nodes of various copies is specified using MSO formulas Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 8 / 31

MSO-definable Transformations [Courcelle, 1994] Defining Graph Transformations using MSO A labeled graph transformation using MSO is specified by: input and output alphabets; an MSO formula specifying the domain of the transformation; output is specified using a finite number of copies of nodes of input graph; the node labels are specified using MSO formulas; and the existence of edges between nodes of various copies is specified using MSO formulas Example Let Σ = {a, b, #}. Consider a transformation f 1 : Σ Σ where u is reverse of u. u 1 #u 2 #... u n 1 #u n #v u 1 u 1 #... #u n u n #v. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 8 / 31

MSO-definable Transformations input: a b c b b # a a b # c c a a # b copy 1: a b c b b a a b c c a a copy 2: a b c b b # a a b # c c a a # b Σ = Γ = {a, b, c, #}, C = {1, 2}, and Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31

MSO-definable Transformations input: a b c b b # a a b # c c a a # b copy 1: a b c b b a a b c c a a copy 2: a b c b b # a a b # c c a a # b Σ = Γ = {a, b, c, #}, C = {1, 2}, and Node Label Formulas ( Γ. C formulas) Label c1 α (x) = Label inp α (x) Label inp # (x) reach #(x) Label c2 α (x) = Label inp (x) α Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31

MSO-definable Transformations input: a b c b b # a a b # c c a a # b copy 1: a b c b b a a b c c a a copy 2: a b c b b # a a b # c c a a # b Σ = Γ = {a, b, c, #}, C = {1, 2}, and Node Label Formulas ( Γ. C formulas) Label c1 α (x) = Label inp α (x) Label inp # (x) reach #(x) Label c2 α (x) = Label inp α (x) Edge Label Formulas ( C 2 formulas) Edge c1,c1 (x, y) = Edge inp (y, x) Label inp # (x) Labelinp # (y). Edge c2,c2 (x, y) = Edge inp (x, y) ( Label inp # (x) (Labelinp # (x) reach #(x))) Edge 1,2 (x, y)=(x=y) (first(x) z(label inp # (z) Edgeinp (z, x))) Edge 2,1 (x, y)=label inp # (x) reach #(x) ( z(edge inp (y, z) Label inp # (z))) ( z((path(x, z) path(z, y)) Labelinp # (z))) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31

Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D with an update function ρ : Q Σ X T (X, f 1,..., f k ) T (X, f 1,..., f k ) denotes terms obtained with functions f 1,..., f k registers. and Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D with an update function ρ : Q Σ X T (X, f 1,..., f k ) T (X, f 1,..., f k ) denotes terms obtained with functions f 1,..., f k and registers. Its configurations will be a state together with a valuation of each register Q [X D] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D with an update function ρ : Q Σ X T (X, f 1,..., f k ) T (X, f 1,..., f k ) denotes terms obtained with functions f 1,..., f k and registers. Its configurations will be a state together with a valuation of each register Q [X D] An output function F : Finite word input this is a function from Q to T (X, f1,..., f k ). The image of w is the value of the term F(ˆδ(w)) in the case of infinite word input, this is a function from 2 Q to X. The image of w is the limit of the value of register F(ˆδ(w)) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := Y α Z := α Z α F(q) = X Y a b # a # a b X ε ε baab# baab# baab#aa# baab#aa# baab#aa# Y a ab ε a ε a ab Z aa baab ε aa ε aa baab Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

A restriction on the update function start q α X = X α X F = X This leads to an exponential output Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31

A restriction on the update function start q α X = X α X F = X This leads to an exponential output We want to forbid this behaviour: Copylessness: each register appear at most once on the r.h.s. Restricted copy: copies allowed but recombining is not possible Bounded copy: in the end the content of any register is never copies more than a bounded number of times Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31

A restriction on the update function start q α X = X α X F = X This leads to an exponential output We want to forbid this behaviour: Copylessness: each register appear at most once on the r.h.s. Restricted copy: copies allowed but recombining is not possible Bounded copy: in the end the content of any register is never copies more than a bounded number of times Streaming transducers have to satisfy this syntactic restriction Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31

Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 13 / 31

A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees graphs Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31

A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees Büchi Rabin graphs Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31

A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees graphs Büchi Rabin [AČ11] [Alur and Černý, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31

Existing proof, through a two way transducer Case of transformations from finite strings to finite strings [Alur and Černý, 2011] [Engelfriet and Hoogeboom, 2001] MSO Transformation Two-Way transducer w/ look-ahead [Alur and Černý, 2011] [Chytil and Jákl, 1977] Streaming Transducer Two-Way Transducer [Alur and Černý, 2011] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 15 / 31

A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees graphs Büchi Rabin [AČ11] [AFT12] [Alur and Černý, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs [Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 16 / 31

Existing proof, of a through way transducer Case of transformations from infinite strings to infinite strings[alur et al., 2012] [Engelfriet and Hoogeboom, 2001][Alur et al., 2012] MSO Transformation Two-Way transducer w/ look-ahead Functional NSST w/ look-ahead [Alur and Černý, 2011] Streaming Transducer Streaming Transducer w/ bounded copy [Miyano and Hayashi, 1984] Functional NSST [Alur et al., 2012] [Alur et al., 2012] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 17 / 31

A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words Büchi [AČ11] [AFT12] [Ad A12] finite trees infinite trees Rabin [Ad A12] [Ad A12] graphs [Alur and Černý, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs [Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings [Alur and D Antoni, 2012] (ICALP) Streaming Tree Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31

A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words Büchi [AČ11] [AFT12] [Ad A12]?? finite trees infinite trees Rabin [Ad A12]?? [Ad A12]???? graphs?????? [Alur and Černý, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs [Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings [Alur and D Antoni, 2012] (ICALP) Streaming Tree Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31

A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words Büchi [AČ11] [AFT12] [Ad A12] [ADT13]?? finite trees infinite trees Rabin [Ad A12]?? [Ad A12]???? graphs?????? [Alur and Černý, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs [Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings [Alur and D Antoni, 2012] (ICALP) Streaming Tree Transducers [Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31

A direct proof MSO Transformation [Alur, DG and Trivedi 13] [Alur and Černý, 2011] [Alur et al., 2012] Streaming Transducer w/ restricted copy Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 19 / 31

Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite By induction over formulas with r FV and quantifier depth at most k: true when k = 0 if true for some k, notice that an MSO formula with qd k + 1 and r FV is a boolean combination of formulas of the form X.ϕ where ϕ has qd k and r + 1 FV. Thus a finitely generated (by induction) boolean algebra Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite We define an equivalence relation over words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index We denote k-types these equivalence classes Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite We define an equivalence relation over words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index We denote k-types these equivalence classes Remark: This equivalence relation is a monoïd congruence The k-type of u v is determined by the k-types of u and v Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite We define an equivalence relation over words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index We denote k-types these equivalence classes Remark: This equivalence relation is a monoïd congruence The k-type of u v is determined by the k-types of u and v Remark Formulas with quantifier depth k and 2 first-order free variables: w 1 w 2 w 3 ϕ(x, y) w : x y Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite We define an equivalence relation over words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index We denote k-types these equivalence classes Remark: This equivalence relation is a monoïd congruence The k-type of u v is determined by the k-types of u and v Remark Formulas with quantifier depth k and 2 first-order free variables: w 1 w 2 w 3 ϕ(x, y) w : x y The validity of ϕ only depends on w[x], w[y] and the k-types of w 1, w 2, w 3 Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Crossings w : x A crossing at position x is an edge which connects two nodes which are not on the same side w.r.t. x. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 21 / 31

Boundedly many crossings input output 1 y b y a x y a y b w : α α c 1 c 2. u v w w u v.. c Theorem At any given position there are at most 2C k-types crossings Otherwise in the image, two distinct nodes have an outgoing edge to the same node Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 22 / 31

Boundedly many crossings means boundedly many registers w : x One register for each triple k-type, letter, k-type would be enough Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 23 / 31

Boundedly many crossings means boundedly many registers w : x?????????? One register for each triple k-type, letter, k-type would be enough We will also need to handle all possible behaviours Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 23 / 31

Handling all possible behaviours with Regular Look-Ahead Regular look-ahead: guards on transitions (and updates) MSO queries over the suffix. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Handling all possible behaviours with Regular Look-Ahead Regular look-ahead: guards on transitions (and updates) MSO queries over the suffix. w : y x?????????? Is there in the image some subword that starts at a position y (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(y:x) is τ 2? Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Handling all possible behaviours with Regular Look-Ahead Regular look-ahead: guards on transitions (and updates) MSO queries over the suffix. w : y x?????????? Is there in the image some subword that starts at a position y (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(y:x) is τ 2? This is an MSO query with quantifier depth K = k + C + 3! Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Handling all possible behaviours with Regular Look-Ahead Regular look-ahead: guards on transitions (and updates) MSO queries over the suffix. w : y x?????????? Is there in the image some subword that starts at a position y (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(y:x) is τ 2? This is an MSO query with quantifier depth K = k + C + 3! Thus all the possible cases are handled by guessing the K-type of w(x: w ] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Handling all possible behaviours with Regular Look-Ahead Regular look-ahead: guards on transitions (and updates) MSO queries over the suffix. w : y x?????????? Is there in the image some subword that starts at a position y (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(y:x) is τ 2? This is an MSO query with quantifier depth K = k + C + 3! Thus all the possible cases are handled by guessing the K-type of w(x: w ] The set of registers will be k-types Σ k-types K-types The set of states will be the set of K-types (the state will state which is the K-type of the prefix read so far). Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Finite word case At the end of the input, we output the non-empty register corresponding to the regular-look ahead ε. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 25 / 31

Finite word case At the end of the input, we output the non-empty register corresponding to the regular-look ahead ε. The reduction does not go through a two-way model. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 25 / 31

Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often the regular look-ahead. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often the regular look-ahead. The image is defined as the limit of the content of some register, depending on the set of infinitely occuring states (Muller condition) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often the regular look-ahead. The image is defined as the limit of the content of some register, depending on the set of infinitely occuring states (Muller condition) With the Muller output condition, we can have some MSO property over the whole word. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often the regular look-ahead. The image is defined as the limit of the content of some register, depending on the set of infinitely occuring states (Muller condition) With the Muller output condition, we can have some MSO property over the whole word. We need to effectively find a factorization τ(τ ) ω of the input. This can be found in Shelah s alternative proof of Büchi Theorem, using a finite additive coloring (Ramsey s Theorem) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often the regular look-ahead. The image is defined as the limit of the content of some register, depending on the set of infinitely occuring states (Muller condition) With the Muller output condition, we can have some MSO property over the whole word. We need to effectively find a factorization τ(τ ) ω of the input. This can be found in Shelah s alternative proof of Büchi Theorem, using a finite additive coloring (Ramsey s Theorem) Thus we can output infinitely often some increasing prefixes of the image Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often the regular look-ahead. The image is defined as the limit of the content of some register, depending on the set of infinitely occuring states (Muller condition) With the Muller output condition, we can have some MSO property over the whole word. We need to effectively find a factorization τ(τ ) ω of the input. This can be found in Shelah s alternative proof of Büchi Theorem, using a finite additive coloring (Ramsey s Theorem) Thus we can output infinitely often some increasing prefixes of the image We converge toward the output Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 27 / 31

Functional equivalence is decidable Do two transformations have the same image on any input? Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31

Functional equivalence is decidable Do two transformations have the same image on any input? A hard problem: different logical ways to define the same transformation w : a 0 a 1 a 2... a n 1 a n o 1 : a 1 a 2... a n 1 a n o 2 : a 1 a 2 a 3... a n Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31

Functional equivalence is decidable Do two transformations have the same image on any input? A hard problem: different logical ways to define the same transformation w : a 0 a 1 a 2... a n 1 a n o 1 : a 1 a 2... a n 1 a n o 2 : a 1 a 2 a 3... a n Reduction to reachability in a counter system (no test, no decrement): Idea: finding a conflicting position (say a in first image, b in the second) Two counters tracking the number of letters before the conflicting postion in each image Set of states: (states of the transducer 4 registers of the transducer ) 2 0: the value of this register does not appear in the output 1: its value appears before the conflicting position 2: its value contains the conflicting position 3: its value is after the conflicting position Erase the letters in the transitions, increment corresponding to the registers updates Find a reachable configuration where the two counters are equal Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31

The typechecking problem Definition Given formulas ϕ, ψ do we have w. w ϕ = T (w) ψ We can perform this check by some automatic construction Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 29 / 31

Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 30 / 31

Conclusion Contributions Direct proof of equivalence between Courcelle transformations and Streaming Transducers Previously unexplored setting of ω-words to trees Syntactically ensuring convergence of the output Equivalence and type-checking problems are decidable Perspectives More expressive transformations (relaxing the restriction on copies) Less expressive transformations (First-order fragment) Extension to regular cost functions Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 31 / 31

Conclusion Contributions Direct proof of equivalence between Courcelle transformations and Streaming Transducers Previously unexplored setting of ω-words to trees Syntactically ensuring convergence of the output Equivalence and type-checking problems are decidable Perspectives More expressive transformations (relaxing the restriction on copies) Less expressive transformations (First-order fragment) Extension to regular cost functions Thank you for your attention! Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 31 / 31

Alur, R. and Černý, P. (2011). Streaming transducers for algorithmic verification of single-pass list-processing programs. In POPL, pages 599 610. Alur, R. and D Antoni, L. (2012). Streaming tree transducers. In ICALP (2), volume 7392 of Lecture Notes in Computer Science, pages 42 53. Springer. Alur, R., Durand-Gasselin, A., and Trivedi, A. (2013). From monadic second-order definable string transformations to transducers. In LICS. IEEE. Alur, R., Filiot, E., and Trivedi, A. (2012). Regular transformations of infinite strings. In LICS, pages 65 74. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 32 / 31

Büchi, J. R. (1960). Weak second-order Arithmetic and Finite Automata. Zeitschrift fur Mathematische Logik und Grundlagen der Mathematik, 6:66 92. Chytil, M. and Jákl, V. (1977). Serial composition of 2-way finite-state transducers and simple programs on strings. In ICALP, volume 52 of Lecture Notes in Computer Science, pages 135 147. Springer. Courcelle, B. (1994). Monadic second-order definable graph transductions: a survey. Theoretical Computer Science, 126(1):53 75. Engelfriet, J. and Hoogeboom, H. J. (2001). MSO definable string transductions and two-way finite-state transducers. ACM Trans. Comput. Logic, 2:216 254. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 33 / 31

Miyano, S. and Hayashi, T. (1984). Alternating finite automata on omega-words. Theor. Comput. Sci., 32:321 330. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 34 / 31