Equivalent Stream Reasoning Programs

Similar documents
Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

The Regulated and Riemann Integrals

Handout: Natural deduction for first order logic

Chapter 0. What is the Lebesgue integral about?

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Lecture 3 ( ) (translated and slightly adapted from lecture notes by Martin Klazar)

Duality # Second iteration for HW problem. Recall our LP example problem we have been working on, in equality form, is given below.

N 0 completions on partial matrices

Riemann Sums and Riemann Integrals

KNOWLEDGE-BASED AGENTS INFERENCE

Riemann Sums and Riemann Integrals

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

The First Fundamental Theorem of Calculus. If f(x) is continuous on [a, b] and F (x) is any antiderivative. f(x) dx = F (b) F (a).

5.7 Improper Integrals

Integral points on the rational curve

MAA 4212 Improper Integrals

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

UNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3

p-adic Egyptian Fractions

Math 1B, lecture 4: Error bounds for numerical methods

Jim Lambers MAT 169 Fall Semester Lecture 4 Notes

Review of Riemann Integral

7.2 The Definite Integral

Review of Calculus, cont d

Lecture 1. Functional series. Pointwise and uniform convergence.

1.9 C 2 inner variations

A REVIEW OF CALCULUS CONCEPTS FOR JDEP 384H. Thomas Shores Department of Mathematics University of Nebraska Spring 2007

1 Online Learning and Regret Minimization

Frobenius numbers of generalized Fibonacci semigroups

Improper Integrals, and Differential Equations

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

A Framework for Efficient Representative Summarization of RDF Graphs

W. We shall do so one by one, starting with I 1, and we shall do it greedily, trying

1 The Lagrange interpolation formula

Riemann is the Mann! (But Lebesgue may besgue to differ.)

Euler, Ioachimescu and the trapezium rule. G.J.O. Jameson (Math. Gazette 96 (2012), )

Recitation 3: More Applications of the Derivative

Week 10: Line Integrals

Riemann Integrals and the Fundamental Theorem of Calculus

The practical version

arxiv:math/ v2 [math.ho] 16 Dec 2003

New Expansion and Infinite Series

Theoretical foundations of Gaussian quadrature

We partition C into n small arcs by forming a partition of [a, b] by picking s i as follows: a = s 0 < s 1 < < s n = b.

Bernoulli Numbers Jeff Morton

Nondeterminism and Nodeterministic Automata

Classical Mechanics. From Molecular to Con/nuum Physics I WS 11/12 Emiliano Ippoli/ October, 2011

Coalgebra, Lecture 15: Equations for Deterministic Automata

Introduction to the Calculus of Variations

On Odd and Even Cycles in Normal Logic Programs

Introduction to Group Theory

ECO 317 Economics of Uncertainty Fall Term 2007 Notes for lectures 4. Stochastic Dominance

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

arxiv: v1 [math.ra] 1 Nov 2014

Chapter 4 Contravariance, Covariance, and Spacetime Diagrams

Math 360: A primitive integral and elementary functions

Math 8 Winter 2015 Applications of Integration

Physics 116C Solution of inhomogeneous ordinary differential equations using Green s functions

Here we study square linear systems and properties of their coefficient matrices as they relate to the solution set of the linear system.

Reinforcement Learning

Quadratic Forms. Quadratic Forms

Notes on length and conformal metrics

Advanced Calculus: MATH 410 Uniform Convergence of Functions Professor David Levermore 11 December 2015

Lecture 9: LTL and Büchi Automata

Global Session Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems

CALCULUS WITHOUT LIMITS

Math 61CM - Solutions to homework 9

f(x) dx, If one of these two conditions is not met, we call the integral improper. Our usual definition for the value for the definite integral

Dually quasi-de Morgan Stone semi-heyting algebras II. Regularity

Global Types for Dynamic Checking of Protocol Conformance of Multi-Agent Systems

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

New data structures to reduce data size and search time

20 MATHEMATICS POLYNOMIALS

The Henstock-Kurzweil integral

Applicable Analysis and Discrete Mathematics available online at

Parse trees, ambiguity, and Chomsky normal form

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

Heat flux and total heat

How do we solve these things, especially when they get complicated? How do we know when a system has a solution, and when is it unique?

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

CS 275 Automata and Formal Language Theory

Lecture 13 - Linking E, ϕ, and ρ

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

Bisimulation. R.J. van Glabbeek

1B40 Practical Skills

ODE: Existence and Uniqueness of a Solution

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

LECTURE. INTEGRATION AND ANTIDERIVATIVE.

Continuous Random Variables

MATH 144: Business Calculus Final Review

Numerical Integration

Lecture 2: Fields, Formally

NUMERICAL INTEGRATION. The inverse process to differentiation in calculus is integration. Mathematically, integration is represented by.

Zero-Sum Magic Graphs and Their Null Sets

Best Approximation in the 2-norm

Stuff You Need to Know From Calculus

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

4 7x =250; 5 3x =500; Read section 3.3, 3.4 Announcements: Bell Ringer: Use your calculator to solve

II. Integration and Cauchy s Theorem

A BRIEF INTRODUCTION TO UNIFORM CONVERGENCE. In the study of Fourier series, several questions arise naturally, such as: c n e int

Transcription:

Equivlent Strem Resoning Progrms Hrld Beck nd Minh Do-Trn nd Thoms Eiter Institute of Informtion Systems, Vienn University of Technology Fvoritenstrße 9-11, A-1040 Vienn, Austri {beck,do,eiter}@kr.tuwien.c.t Abstrct The emerging reserch field of strem resoning fces the chllenging trde-off between expressiveness of query progrms nd dt throughput. For optimizing progrms methods re needed to tell whether two progrms re equivlent. Towrds providing prcticl resoning techniques on strems, we consider LARS progrms, which is powerful extension of Answer Set Progrmming (ASP) for strem resoning tht supports windows on strems for discrding informtion. We define different notions of equivlence between such progrms nd give semntic chrcteriztions in terms of models. We show how prcticlly relevnt frgment cn be lterntively cptured using Here-nd-There models, yielding n extension of equilibrium semntics of ASP to this clss of progrms. Finlly, we chrcterize the computtionl complexity of deciding the considered equivlence reltions. Introduction Strem resoning is n emerging reserch field tht ims t providing logic-oriented techniques on top of strem processing. High throughput of dt is centrl chllenge for strem processing methods, which usully focus on low-level computtions such s filtering nd ggregtion. Centrl to modern strem processing technologies re window mechnisms tht limit the input to snpshots of recent dt. Window opertors cn be utilized either to define which dt is still relevnt, or s prcticl mens to cope with the volume of dt. Also declrtive methods nd logic-oriented lnguges for resoning over dt strems hve been considered [Do et l., 2011; Gebser et l., 2012], in prticulr, ones tht llow to express such windows [Brbieri et l., 2010b]. A recent expressive formlism is the logic-bsed LARS frmework [Beck et l., 2015b], which llows for generic window functions nd temporl opertors in formuls. On top of this, LARS provides rule-bsed semntics tht cn be seen s n extension of Answer Set Progrmming (ASP) for dt strems. This reserch hs been supported by the Austrin Science Fund (FWF) projects P24090, P26471, nd W1255-N23. Declrtive nd logic-oriented pproches to strem resoning typiclly im for more expressiveness, which mkes efficient evlution even hrder to chieve. One wy to mitigte this problem is to optimize queries or progrms by simplifying them using equivlence preserving trnsformtions. However, this requires support for checking when two progrms re equivlent in the first plce. Vrious notions of query or progrm equivlence hve been studied in the literture, e.g., in dtbse reserch nd for nswer set progrms [Lifschitz et l., 2001; Eiter nd Fink, 2003; Eiter et l., 2007b]. However, equivlence reltions between declrtive progrms for strem resoning hve not been considered so fr. Towrds optimiztion of such progrms, we re thus interested in techniques tht llow us to tell when two progrms produce the sme results. Chrcterizing equivlence between LARS progrms in purely logicl terms is chllenging due to non-structurl definition of the FLP-semntics [Fber et l., 2004] defined for them, which imposes some limittions. Yet nother difficulty rises from the generic definition of window opertors. We tckle this issue with the following contributions: We develop prcticlly relevnt notions of equivlence for LARS progrms tht extend well-known equivlence reltions for logic progrms nd introduce dt equivlence for strems. We define novel logic clled Bi-LARS to cpture the FLPbsed semntics of lrge frgment of LARS progrms, including the prcticl one introduced in [Beck et l., 2015] tht we cll plin LARS. We lift model-theoretic chrcteriztions of strong/uniform/reltivized uniform equivlence from ASP to the strem setting to chrcterize the defined equivlence reltions. We introduce the notion of monotone windows nd show how vrint of Bi-LARS leds to n extension of the logic of Here-nd-There for our setting. We thus get link to equilibrium logic [Lifschitz et l., 2001] for clss of progrms. Finlly, we investigte the complexity of checking the considered equivlence reltions. Under benign window opertors, the complexity is not worse thn for logic progrms; only in some cses the complexity does increse. To the best of our knowledge, no similr work on equivlence notions in strem resoning exists to dte. Our results

b, c 0 1 2 3 4 Figure 1: Time-bsed window of size 2 t t = 3 thus give n entry point towrds optimiztion of expressive rule-bsed progrms for resoning over dt strems. LARS We will grdully introduce the min concepts of LARS [Beck et l., 2015b], recent logic-bsed frmework for nlyzing nd expressing resoning over strems. Where pproprite, we give only informl descriptions. We ssume tht the reder is fmilir with ASP [Gelfond nd Lifschitz, 1991; Brewk et l., 2011]; for equivlence reltions between ASP progrms, we refer to [Lifschitz et l., 2001; Eiter et l., 2007b]. We consider propositionl (ground) LARS. Throughout, A denotes the set of toms, which is prtitioned into extensionl (input) toms A E nd intensionl (derived) toms A I. Definition 1 (Strem) A strem S = (T, υ) consists of timeline T, which is closed intervl T N of integers clled time points, nd n evlution function υ : N 2 A. Intuitively, strem S ssocites with ech time point set of toms. We cll S dt strem, if it contins only extensionl toms. To cope with the mount of dt, one usully considers only recent toms. Let S = (T, υ) nd S = (T, υ ) be two strems such tht S S, i.e., T T nd υ (t ) υ(t ) for ll t T. Then S is clled substrem or window of S. Definition 2 (Window function) Any (computble) function w tht returns, given strem S = (T, υ) nd time point t T, substrem S of S is clled window function. Importnt re time-bsed window functions, which select ll toms ppering in lst n time points, nd tuple-bsed window functions, which select fixed number of ltest tuples. Exmple 1 Figure 1 depicts strem S = ([0, 4], υ) where υ = {0 {}, 1 {}, 3 {b}, 4 {, c}}, nd the ppliction of the time-bsed window function w on S tht looks bck two time units from time point t = 3. This returns the substrem S = ([1, 3], {1 {}, 3 {b}}). Window opertors. Window functions cn be ccessed in formuls by window opertors. For every window function w, employing n expression w α hs the effect tht α is evluted on the substrem of the dt strem delivered by w. Definition 3 (Formuls) The set F of formuls is given s follows, where A is n tom, t N, w window function. α ::= α α α α α α α @ t α w α The precedence of opertors,, @ t nd w is s for ; e.g., w @ t b c = (( w ) (@ t b)) c. Definition 4 (Structure) A structure is ny tuple M = S, W, B where S is strem, W is set of window functions nd B A is the bckground dt of M. Definition 5 (LARS Entilment) Let M = S, W, B be structure, S = (T, υ) nd t T. The LARS-entilment reltion between (M, t) nd formuls is defined s follows. Let A be n tom, nd let α, β F be formuls. Then, M, t iff υ(t) or B, M, t α iff M, t α, M, t α β iff M, t α nd M, t β, M, t α β iff M, t α or M, t β, M, t α iff M, t α for some t T, M, t α iff M, t α for ll t T, M, t @ t α iff M, t α nd t T, M, t w α iff M, t α, where M = S, W, B such tht S = w(s, t). Throughout, we ssume tht A contins two specil toms / tht re true/flse in every structure. In the sequel, n stnds for time-bsed window opertor tht tkes the lst n time points nd ll dt there. Exmple 2 Let S = ([0, 3], {0 {}, 1 {}, 3 {b, x}}) be strem nd let ϕ = 2 y x be LARS formul. Consider the structure M = S, { 2 },. We hve tht M, 3 2 y. Indeed, since y / υ(3), it follows tht M, 3 y. Furthermore, M, 3 2 since M, 1, where M is obtined by replcing S with S = ([1, 3], {1 {}, 3 {b, x}}), i.e., the result of pplying the time-bsed window of size 2 on S t time point 3. Furthermore, M, 3 x s x υ(3); thus M, 3 ϕ holds. We now turn to LARS progrms tht build on formuls. LARS Progrms Syntx. LARS progrms [Beck et l., 2015b] re sets of rules α β 1,..., β m, not β m+1,..., not β n, (1) where α, β 1,..., β n F re formuls, nd α contins only intensionl toms; B(r) = {β i 1 i n} is the body of r. For instnce, rule x 2, not y mounts to ϕ of Ex. 2. Semntics. Let D = (T, v D ) be dt strem. We cll strem I = (T, υ) D n interprettion strem for D, if it coincides with D on A E, i.e., for every A E nd t T, υ(t) only if υ D (t); the structure M = I, W, B is then n interprettion for D. Throughout, we ssume W (implicit by the considered progrms) nd B re fixed, nd re thus lso omitted. For rule r of the form (1), we define β(r) = β 1 β m β m+1 β n. (2) Let t T. We sy M stisfies rule r t t, denoted by M, t = r, if M, t β(r) α. In this cse, M is model of r (for D) t t. The notions of stisfction nd models crry over to progrms s usul, i.e., M, t = P, if M, t = r for ll r P. Moreover, M is miniml model of P (for D t t) if there does not exist n M = I, W, B s.t. M, t = P where I = (T, υ ) I. Note tht smller models must hve the sme timeline. Definition 6 (Answer Strem) Let P be progrm, D = (T, υ) be dt strem nd t T. An interprettion strem I for D is n nswer strem of P for D t t, if M = I, W, B is miniml model of the (FLP)-reduct P M,t = {r P M, t = β(r)} ; AS(P, D, t) denotes the set of ll such nswer strems I.

Exmple 3 (cont d) Consider the strem D = ([0, 3], υ), where υ={0 {}, 1 {}, 3 {b}} nd progrm P, given by the following rules: x 2, not y nd y 2, not x. By tking W = { 2 } nd B =, we get t t = 3 two nswer strems I x nd I y which ugment D by dding x nd y to υ(3), respectively. For instnce, the reduct P M,3, where M = I x, W, B, contins only the first rule. We hve M, 3 = P M,3, since M, 3 2 y x. Towrds smller model, we cn not remove, s is extensionl (i.e., in the dt strem), nor x becuse this would invlidte the impliction. The rgument for I y is nlogous. Bi-Structurl LARS Evlution We now define n extended vrint of LARS semntics, where formuls (resp. progrms) re evluted on pir of strems (S L, S R ) t the sme time. We will lter consider substrem reltion S L S R on ccording models similr to the logic of Here-nd-There [Heyting, 1930] which ws extensively studied in reltion to equivlence notions for ASP. In the sequel, we use the following nottion. Given strems S L = (T, υ L ) nd S R = (T, υ R ), we cll S = (S L, S R ) bi-strem nd M = S, W, B bi-structure, where W re window functions nd B is bckground dt s in LARS. We cll S L the left-strem nd S R the right-strem. Moreover, L = S L, W, B nd R = S R, W, B denote the underlying LARS structures of M; the left-structure nd the rightstructure, respectively. Definition 7 (Bi-LARS Entilment) Let M = S, W, B be s bove nd let t T. The Bi-LARS-entilment reltion between (M, t, w) for worlds w {L, R} nd formuls is defined s follows (where α, β F re formuls): M, t, w iff υ w (t) or B, for A, M, t, w α β iff M, t, w α nd M, t, w β, M, t, w α iff M, t, w α for some t T, M, t, w α iff M, t, w α for ll t T, M, t, w @ t α iff M, t, w α nd t T, M, t, L α β iff M, t, L α or M, t, L β, nd M, t, R α β M, t, R α β iff M, t, R α or M, t, R β, M, t, L α iff L, t α nd R, t α M, t, R α iff R, t α M, t, L w α iff L, t w α nd R, t w α, M, t, R w α iff R, t w α. Moreover, we define M, t α iff M, t, L α. Similrly s for LARS, M, t / lwys/never holds. If M, t α holds, we sy tht M entils α t time t nd we then cll M bi-model of α t time t. Entilment nd the notion of model re extended to sets of formuls s usul. Observe tht for the connectives/opertors,,, @ t nd, Bi-LARS hs recursive definition, while the evlution for nd brnches into seprte evlution in the underlying LARS structures. This is required with the im to provide semntic chrcteriztions of equivlences for lrge clss of LARS progrms. However, we will lso lter exmine when recursive definition is possible. Note tht in generl, entilment in both LARS structures does not imply entilment in the bi-structure. For instnce, consider the bistrem S = (S L, S R ), where S L = ([0, 0], {0 {}}) nd S R = ([0, 0], {0 }), nd tke α = (( ) ). We hve L, 0 α nd R, 0 α, but M, 0 α. The following lemm, which is immedite from Def. 7, intuitively sttes tht evlution for the right-strem is independent of the left-strem. Lemm 1 M, t, R α iff R, t α. We cll bi-strem (S L, S R ) totl, if S L = S R. Restricting the study to totl interprettions, Bi-LARS-stisfction clerly collpses to LARS-stisfction. Proposition 1 Let M = S, W, B be structure, where S = (T, υ) nd M = S, W, B, where S = (S, S), t T nd α be formul. Then, M, t α iff M, t α. Bi-LARS Semntics for LARS progrms. Entilment in Bi-LARS is extended from formuls to progrms nlogously s for LARS. Let D = (T, υ) be dt strem, t T nd let P be progrm. We sy bi-structure M stisfies rule r of form (1) t t, denoted by M, t = r, if M, t β(r) α. In this cse, M is (bi-)model of r (for D t t). Similrly s for LARS, M, t = P, if M, t = r for ll r P. We then cll M (bi-)model of P (for D t t). Plin LARS nd LARS bi. In [Beck et l., 2015], prcticl frgment of LARS ws introduced. We cll this frgment plin LARS, which restricts the rule hed to be of form or @ t, where is n tom, nd body formuls to be extended toms, i.e., expressions of the grmmr @ t @ t. (3) While plin LARS serves s guiding frgment, we will obtin our results for the following brod clss of LARS progrms. Definition 8 (F bi, LARS bi ) By F bi we denote the clss of LARS formuls without, where only occurs in the scope of or. Moreover, LARS bi is the clss of LARS progrms where ll formuls α, β i in rules (1) re in F bi. In the sequel, progrms re tcitly ssumed to be in LARS bi. Note tht the FLP-semntics of nswer strems (Def. 6) is defined non-recursively. Still, we cn cpture it by brnching in Bi-LARS evlution of nd into seprte LARS evlutions for left nd right, due to the following centrl property. Proposition 2 Let M = S, W, B be such tht S L S R nd let α F bi. Then, M, t α iff S L, t α nd S R, t α. The proof is by induction on the structure of formuls. The reltion S L S R nturlly rises with minimlity checking of models, where intuitively S R is model M of progrm P t time t nd S L is cndidte model of the reduct P M,t. It estblishes semntic connection between left nd right, which cn be exploited to conclude tht M, t α implies S L, t α; for rbitrry formuls, this fils. E.g., consider S L = ([0, 0], {0 }), S R = ([0, 0], {0 {}}), nd α = b; then M, 0 α but L, 0 α. Similrly, excluding ϕ is necessry to ensure tht the only-if direction of Proposition 2 holds. The following result now cptures the essence of the reduct-bsed semntics: the left-structure must stisfy ech rule whose body is true in the model given by the rightstructure. The proof is bsed on [Lifschitz et l., 2001].

Theorem 1 For ny M= S, W, B s.t. S L S R, time t nd progrm P, we hve M, t = P iff R, t = P nd L, t = P R,t. We re now going to chrcterize nswer strems similrly s in [Lifschitz et l., 2001] nd [Turner, 2001], by cpturing the minimlity condition in terms of bi-equilibrium models. Definition 9 (bi-equilibrium Model) Let M = I, W, B be structure. We sy M = (I, I), W, B is bi-equilibrium model of progrm P for dt strem D t time t, if (i) M, t = P, nd (ii) M, t = P, for ech M = (I, I), W, B such tht D I I nd I = (T, υ ). We obtin the next theorem from Def. 6, Prop. 1 nd Thm. 1. Theorem 2 Let M = I, W, B be structure s.t. I is n interprettion strem for D t t. Then, I AS(P, D, t) iff M = (I, I), W, B is bi-equilibrium model. This llows us to chrcterize progrm equivlences which include non-trivil window opertors, s will be shown next. Equivlence We now introduce equivlence notions for strem resoning in our setting. Given timeline T, we sy set A of @-toms, i.e., extended toms of form @ t, hve time references in T, if {t @ t A} T. This notion crries over nturlly for progrms P, i.e., if {t @ t occurs in P } T. Definition 10 (Equivlence Notions) Let T be timeline, D = (T, υ) be dt strem, nd let t T be time point. We sy two LARS progrms P nd Q re (i) (ordinry) equivlent (for D t t), denoted by P Q, if AS(P, D, t) = AS(Q, D, t); (ii) strongly equivlent (for D t t), denoted by P s Q, if AS(P R, D, t) = AS(Q R, D, t) for ll LARS progrms R with time references in T ; (iii) uniform equivlent (for D t t), denoted by P u Q, if AS(P F, D, t) = AS(Q F, D, t) for sets F of @- toms with time references in T ; (iv) dt equivlent (for D t t), denoted by P d Q, if AS(P, D S, t) = AS(Q, D S, t) for ll dt strems S with timeline T. Intuitively, (i)-(iii) cn be seen s extensions of corresponding notions in ASP [Lifschitz et l., 2001; Eiter et l., 2007b] to the LARS setting. In prticulr, these notions emerge if the progrms P nd Q re ordinry logic progrms (without windows nd temporl opertors) nd we consider void dt strem D = ([0, 0], υ) t time point 0. On the other hnd, dt equivlence is well-known in the dtbse re nd plys n importnt role in strem resoning, s the possibility to drop dt is crucil to gin performnce. The ddition of ll rules resp. fcts ccounts for the nonmonotonic nture of nswer strems, s replcing ordinry equivlent progrms P nd Q in the context of other rules R might chnge nswer strems. We now chrcterize strong nd uniform equivlence by mens of bi-models. To this end, from now we tcitly restrict to bi-structures M = S, W, B such tht S L S R. By bi(p ), we denote the set of ll respective bi-models of progrm P (where D nd t re implicit). b b, c 0 1 2 3 4 0 1 2 3 4 Figure 2: Tuple-bsed windows of size 3 t t = 4. Theorem 3 (Strong Equivlence) Let D = (T, υ) be dt strem, t T, nd let P nd Q be LARS bi progrms. Then, P s Q (for D t t) iff bi(p ) = bi(q) (for D t t). Furthermore, we lso chrcterize uniform equivlence in terms of bi-entilment. Let M LR = (S L, S R ), W, B nd M RR = (S R, S R ), W, B. Theorem 4 (Uniform Equivlence) P u Q iff (i) for ech M RR, M RR bi(p ) iff M RR bi(q), nd (ii) for ech M LR, where S L S R, M LR bi(p ) (resp. M LR bi(q)) iff M bi(q) (resp. M bi(p )) for some M = (S, S R ), W, B s.t. S L S S R. The proofs of Theorems 3 nd 4 re bstrcted from those for nswer set progrms (cf. [Lifschitz et l., 2001], resp. [Eiter nd Fink, 2003]) nd exploit the following key properties: (1) the reduct of the union of two progrms is the union of their reducts (2) the reduct of set of toms F is F itself, (3) n tom evlutes to true iff it is in the interprettion strem, nd (4) structure entils the union of two progrms iff it entils ech progrm seprtely. In similr wy, lso reltivised uniform equivlence [Woltrn, 2004], denoted by P A u Q, cn be chrcterized, i.e., the condition tht AS(P F, D, t) = AS(Q F, D, t) for ll fcts F A, where A is set of @-toms. Notbly, dt equivlence mounts to specil cse of reltivized uniform equivlence: Consider for D = (T, υ) the set A = {@ t A E nd t T }. Then, P d Q iff P A u Q. Recll tht plin LARS llows only intensionl toms nd @-toms with intensionl toms in rule heds. However, this is not the cse for ll LARS bi progrms, which lso llow window opertors in rule heds. LARS Here-&-There nd Monotone Windows In Definition 7, the semntics of the window opertor ws defined in Bi-LARS by stright brnching into seprte evlution of the left nd the right strem. Consider the following lterntive semntics. Definition 11 (Recursive ) We define the following lterntive semntics for Bi-LARS. Let w {L, R}. M, t, w w α iff M, t, w α, where M = (S L, S R ), W, B nd S w = w(s w, t). This recursive vrint my in generl brek the connection between left nd right, i.e., the reltion S L S R. Exmple 4 Consider strems S L = ([0, 4], υ L ) nd S R = ([0, 4], υ R ) s depicted in Figure 2, where S L S R. Applying tuple-bsed window opertor with size 3 t t = 4 returns S L = ([1, 4], {1 {}, 3 {b}, 4 {}}) s substrem of S L, nd S R = ([3, 4], {3 {b}, 4 {, c}} for S R. We observe tht S L S R, i.e. the substrem reltion breks.

In Exmple 4, the window is nonmonotonic in the sense tht by incresing the input strem, toms my dispper from the output. When excluding such nonmonotonic windows, the recursive version for semntics my be eqully used. Definition 12 We cll window function w monotone, if for every strems S 1 = (T 1, υ 1 ) nd S 2 = (T 2, υ 2 ) it holds tht S 1 S 2 implies w(s 1, t) w(s 2, t) for ll t T 1, i.e., w preserves substrems. If T 1 = T 2, this extends to timelines, i.e., w(s i, t) = (T i, υ i ) implies T 1 = T 2 for ll t T 1. Likewise, we cll window opertor w monotone if the underlying window function w is monotone. E.g., time-bsed window opertors just filter dt nd thus hve this property. Proposition 3 For plin LARS with monotone windows, the window semntics of Def. 7 nd Def. 11 coincide. Using Def. 11 for vrint of Bi-LARS on monotone windows cn be seen s n extension of Here-nd-There [Heyting, 1930] underlying Equilibrium Logic [Perce, 2006]. Definition 13 (HT-entilment) HT-entilment is defined s vrint of Bi-LARS entilment (Def. 7), using insted Def. 11 for the semntics nd α := α for negtion. Bsed on HT-entilment, we obtin conservtive extension of Perce s Equilibrium Logic for LARS with monotone windows, which trets nested implictions intuitionisticlly, nd thus different from FLP-bsed semntics. Under limited nesting of negtion, the two semntics ctully coincide; e.g., for the following clss of formuls/progrms: Definition 14 (F HT, LARS HT ) By F HT we denote the clss of LARS formuls where (i) ech is monotone, (ii) ech subformul α β expresses negtion (i.e., α, s β = ), nd (iii) no negtion occurs within the scope of or nother negtion. By LARS HT we denote the clss of LARS progrms where ll formuls α, β i in rules (1) re in F HT. Note tht nested negtion must be excluded, s e.g. the rule hs the equilibrium models (, ) nd ({}, {}). Only the first one mounts to n FLP-nswer set. With n inductive rgument, one cn show tht the centrl property of Prop. 2 crries over to formuls in F HT under HT-entilment. This llows one to estblish the chrcteriztion in Theorem 1 for this setting. Thus, for LARS HT progrms, FLP-bsed nswers strems nd HT-equilibrium models coincide, nd the equivlence notions cn eqully be chrcterized by HT-entilment. Theorem 5 (LARS Here-nd-There) Theorems 1-4 lso hold for LARS HT progrms under HT-entilment. Note tht LARS HT includes plin LARS progrms with monotone windows. Computtionl Complexity As regrds the complexity of equivlence checking, different scenrios emerge. We focus here on deciding P e Q for n equivlence notion e, where the dt strem D, the progrms P, Q nd (query) time point t re given. More generl is to request equivlence t multiple or ech time point t over D, nd/or to consider evolutions of the dt strem D. For smll (polynomil) horizon round t, i.e., n intervl [t 0, t 1 ] such tht t 0 t t 1 nd t 1 t 0 is polynomilly bounded, this essentilly reduces to polynomilly mny such questions. This is in line with the view tht strem resoning my lose informtion, i.e., query results over the full history nd the reduced dt my be different. Setup. We dopt the ssumptions in [Beck et l., 2015b], in prticulr tht relevnt toms re confined to A, the bckground B nd the window functions W re fixed nd cn be polynomilly evluted. Then, both model checking nd stisfibility testing for rbitrry LARS formuls is PSPACEcomplete [Beck et l., 2015b], s nswer strem checking nd deciding nswer strem existence. However, we note: Lemm 2 (cf. [Beck et l., 2015b]) For LARS formuls α without nested windows, deciding M, t α is polynomil nd deciding stisfibility of α wrt. timeline T nd time point t is NP-complete. The sme holds for window nesting depth bounded by constnt k. In prctice, bounded nesting of windows will pply; thus we dopt this ssumption. As n esy consequence, we get: Corollry 1 Given bi-structure M, time point t, nd (window-bounded) LARS formul α, deciding M, t α is fesible in polynomil time. Besides plin LARS, we study here the following frgment. Strtified LARS progrms extend the usul notion of strtified logic progrms by llowing constrints nd building the dependency grph s follows. Formuls of the form @ t nd α re the nodes, where A, t is time point, nd α occurs only in rule body s β i. Reltive to D nd t, toms re identified with @ t, nd edges re dded in the grph s usul, where lso n (negtion-style) edge from α to every @ t is dded such tht the vlue of α t t depends on the one of t t. As this depends on the semntics of the window opertor, for simple syntctic criterion we ssume here tht this is only the tom in α; e.g. time-bsed windows stisfy this property. Strtified LARS progrms re strem-strtified LARS progrms in [Beck et l., 2015] nd cn be evluted bottom up using n itertive fixed-point computtion to obtin n nswer strem (which exists if no constrint is violted). Complexity results. Our results re compctly summrized in Tble 1. Besides the progrm clsses, we distinguish between only monotonic nd possible nonmonotonic windows. As it ppers, the complexities of the vrious problems rnges from P to Π p 2. In most of the cses, the upper bound is n immedite or esy consequence of Lemm 2 nd the chrcteriztions of nswer strems nd equivlences from bove. In prticulr, deciding strong equivlence is lwys in conp, while deciding nswer strem existence resp. refuting uniform or dt equivlence cn be done in nondeterministic polynomil time using n NP orcle to verify guess for n nswer strem resp. counterexmple to equivlence. For strtified progrms, the fixed-point computtion of the unique nswer strem is fesible in polynomil time; this explins the P-entries. Fixed-point computtion is lso fesible on the reduct P M,t of plin LARS progrm with monotone windows to check minimlity of M, s here negtive literls

AS(P, D, t) / P o Q P e Q, e = s / u / d mon nonmon plin LARS NP / conp conp/ conp / conp Σ p 2 / Πp 2 conp/ Π p 2 / Πp 2 strtified P / P P / P conp / conp / conp conp / conp / conp Tble 1: Complexity of consistency nd equivlence checking for D t t (entries denote completeness results) cn be dropped in P M,t. This explins why nswer strem existence / ordinry equivlence is in NP/ conp. As for the lower bounds, deciding P u Q is reducible to deciding P d Q. Indeed, given ordinry logic progrms P nd Q on A, let A d be copy of A nd let P d = P R d nd Q d = Q R d, where R d = { d A}. Then, P nd Q re uniformly equivlent (wrt. A) iff P d nd Q d re dt equivlent wrt. A d. This cn be extended to LARS progrms (where window opertors possibly must be dpted), using rules @ t @ t d for the time points t. Thus, for the hrdness results, it is remins to consider uniform equivlence. Mny of the lower bounds re then inherited from the complexity of the respective notions for ordinry logic progrms [Eiter et l., 2007b]. In prticulr, plin LARS progrms subsume norml logic progrms, for which deciding nswer strem existence is NP-complete, while deciding uniform resp. strong equivlence is conp-complete (even for cyclic, i.e., recursion-free progrms [Eiter et l., 2007]). Wht remins re the Σ p 2-hrdness of nswer strem existence nd Π p 2-hrdness of ordinry equivlence nd uniform equivlence, respectively, for plin LARS progrms with nonmonotonic windows. These results re shown by reductions of evluting QBFs of the form X Y E(X, Y ), resp. X Y E(X, Y ). Actully, the proofs estblish them for plin progrms without negtion (i.e., for Horn progrms); they hinge on techniques in [Eiter nd Gottlob, 1995] nd [Eiter nd Fink, 2003] for the respective problems on ordinry disjunctive logic progrms, but must compenste the lck of negtion nd of disjunction. We cn emulte negtion using nonmonotonic windows by the following construction. Exmple 5 To emulte for n tom, we crete window opertor with n ssocited window function w (S, t) tht removes d from υ(t), if υ(t), where d is fresh tom, nd otherwise leves S unchnged. If d is fct in progrm P nd thus true in every model M of P t t, we hve M, t @ t d iff M, t. Similrly we cn define window opertors Φ tht check whether model M stisfies t t polynomil-time property Φ; e.g. whether truth ssignment given in υ(t) stisfies Boolen formul. We use this to evlute E(X, Y ) using window toms. However, for spce resons, we must omit detils. Notbly, the property Φ my lso be deciding M, t ϕ where the window nesting in ϕ is bounded (cf. Lemm 2); the ltter cn be used to compile complex formuls inside window opertors wy, nd shows tht plin LARS with nonmonotonic windows is quite powerful. Relted Work nd Conclusion Lifschitz et l. [2001] introduced strong equivlence of logic progrms under ASP semntics nd showed tht it coincides with equivlence in Here-nd-There logic. Inspired by this, Eiter et l. [2007b] chrcterized uniform nd reltivized notions of equivlence in ASP in terms of HT-interprettions (H, T ). We generlize this to the LARS frmework with bistructures (S L, S R ) contining pirs of strems. As regrds optimiztion in strem resoning, to our knowledge not much foundtionl work exists. Typiclly, the interest is concentrted on deling with evolving dt, nd to develop incrementl evlution techniques, e.g., [Motik et l., 2015; Ren nd Pn, 2011; Gebser et l., 2011; Brbieri et l., 2010; Beck et l., 2015]. In the context of dt processing, [Arsu et l., 2006] studied query equivlence for the Continuous Query Lnguge (CQL), but t very elementry level. As in essence CQL cn be cptured by LARS progrms [Beck et l., 2015b], results on LARS equivlence my be fruitfully pplied in this context s well. Nturlly, strem resoning reltes to temporl resoning; in [Cblr nd Veg, 2007], nonmonotonic Liner Temporl Equilibrium Logic (TEL) ws presented s n extension of Perce s Equilibrium Logic [2006] to liner time logic (LTL), defining temporl stble models over infinite structures. Notbly, strong equivlence for TEL theories mounts to equivlence in the underlying Temporl Here-nd-There logic [Agudo et l., 2008; Cblr nd Diéguez, 2014]. However, TEL differs from LARS in severl respects. LARS ims primrily t finite (single-pth) structures, nd the notion of window, which requires to go beyond the HT setting, hs no counterprt in TEL. Furthermore, the temporl opertors in LARS re more gered to ccess of dt in windows in prctice. Also the complexity of TEL, extensively studied in [Bozzelli nd Perce, 2015], nd LARS is different: model checking for (unbounded) LARS formuls resp. progrms is PSPACE-complete, while for LTL underlying TEL it is polynomil in our finite pth setting (in fct, efficiently prllelizble [Kuhtz nd Finkbeiner, 2009]). Outlook. In future work, our studies cn be extended in severl directions. Aprt from other notions of equivlence, dditionl progrm clsses re of prcticl relevnce. In prticulr, by confining to widely used time-bsed nd tuple-bsed window opertors one might exploit more specific properties thn by the distinction of monotone vs. nonmonotone ones. Relted to this is identifying mximl (reltive to some criteri) frgments where Here-nd-There semntics coincides with Bi-LARS, which is tilored for FLP. Furthermore, one might introduce window opertors to the more expressive temporl equilibrium logic. Aprt from potentil extensions of Bi-LARS to cpture ccording semntics, combining nonmonotonic temporl resoning with fetures to drop dt is n intriguing issue. Moreover, besides semntic lso syntctic criteri for progrm equivlence re prcticlly importnt. In prticulr, finding norml forms in reltion to prominent window opertors will directly support the optimiztion of progrms for resoning over streming dt. Acknowledgments. We thnk Andres Humenberger for his ssistnce in the erly phse of this work.

References [Agudo et l., 2008] Felicidd Agudo, Pedro Cblr, Gilberto Pérez, nd Concepción Vidl. Strongly equivlent temporl logic progrms. In JELIA, 2008. [Arsu et l., 2006] Arvind Arsu, Shivnth Bbu, nd Jennifer Widom. The CQL continuous query lnguge: semntic foundtions nd query execution. VLDB J., 15(2):121 142, 2006. [Brbieri et l., 2010] Dvide Frncesco Brbieri, Dniele Brg, Stefno Ceri, Emnuele Dell Vlle, nd Michel Grossniklus. Incrementl resoning on strems nd rich bckground knowledge. In ESWC 2010, pges 1 15, 2010. [Brbieri et l., 2010b] Dvide Frncesco Brbieri, Dniele Brg, Stefno Ceri, Emnuele Dell Vlle, nd Michel Grossniklus. Querying RDF strems with C-SPARQL. SIGMOD Record, 39(1):20 26, 2010. [Beck et l., 2015] Hrld Beck, Minh Do-Trn, nd Thoms Eiter. Answer updte for rule-bsed strem resoning. In IJCAI, 2015. [Beck et l., 2015b] Hrld Beck, Minh Do-Trn, Thoms Eiter, nd Michel Fink. LARS: A logic-bsed frmework for nlyzing resoning over strems. In AAAI, 2015. [Bozzelli nd Perce, 2015] Lur Bozzelli nd Dvid Perce. On the complexity of temporl equilibrium logic. In 30th Annul ACM/IEEE Symposium on Logic in Computer Science, LICS 2015, Kyoto, Jpn, July 6-10, 2015, pges 645 656. IEEE, 2015. [Brewk et l., 2011] Gerd Brewk, Thoms Eiter, nd Miroslw Truszczyński. Answer set progrmming t glnce. Communictions of the ACM, 54(12):92 103, 2011. [Cblr nd Diéguez, 2014] Pedro Cblr nd Mrtín Diéguez. Strong equivlence of non-monotonic temporl theories. In KR, 2014. [Cblr nd Veg, 2007] Pedro Cblr nd Gilberto Pérez Veg. Temporl equilibrium logic: A first pproch. In Computer Aided Systems Theory - EUROCAST 2007, pges 241 248, 2007. [Do et l., 2011] Thng M. Do, Seng Wi Loke, nd Fei Liu. Answer set progrmming for strem resoning. In AI, pges 104 109, 2011. [Eiter nd Fink, 2003] Thoms Eiter nd Michel Fink. Uniform equivlence of logic progrms under the stble model semntics. In ICLP, 2003. [Eiter nd Gottlob, 1995] T. Eiter nd G. Gottlob. On the Computtionl Cost of Disjunctive Logic Progrmming: Propositionl Cse. Annls of Mthemtics nd Artificil Intelligence, 15(3/4):289 323, 1995. [Eiter et l., 2007] T. Eiter, M. Fink, H. Tompits, nd S. Woltrn. Complexity results for checking equivlence of strtified logic progrms. In IJCAI, 2007. [Eiter et l., 2007b] Thoms Eiter, Michel Fink, nd Stefn Woltrn. Semnticl chrcteriztions nd complexity of equivlences in nswer set progrmming. ACM Trnsctions on Computtionl Logic, 8(3), July 2007. [Fber et l., 2004] Wolfgng Fber, Nicol Leone, nd Gerld Pfeifer. Recursive ggregtes in disjunctive logic progrms: Semntics nd complexity. In JELIA, 2004. [Gebser et l., 2011] Mrtin Gebser, Orkunt Sbuncu, nd Torsten Schub. An incrementl nswer set progrmming bsed system for finite model computtion. AI Commun., 24(2):195 212, 2011. [Gebser et l., 2012] Mrtin Gebser, Torsten Grote, Rolnd Kminski, Philipp Obermeier, Orkunt Sbuncu, nd Torsten Schub. Strem resoning with nswer set progrmming. Preliminry report. In KR, 2012. [Gelfond nd Lifschitz, 1991] M. Gelfond nd V. Lifschitz. Clssicl negtion in logic progrms nd disjunctive dtbses. New Genertion Computing, 9:365 385, 1991. [Heyting, 1930] Arend Heyting. Die formlen Regeln der intuitionistischen Logik. In Sitzungsberichte der preußischen Akdemie der Wissenschften. phys.-mth. Klsse, pges 42 65, 57 71, 158 169, 1930. [Kuhtz nd Finkbeiner, 2009] Lrs Kuhtz nd Bernd Finkbeiner. LTL pth checking is efficiently prllelizble. In ICALP, 2009. [Lifschitz et l., 2001] Vldimir Lifschitz, Dvid Perce, nd Agustín Vlverde. Strongly equivlent logic progrms. ACM Trns. Comput. Log., 2(4):526 541, 2001. [Motik et l., 2015] Boris Motik, Yvor Nenov, Robert Piro, nd In Horrocks. Incrementl Updte of Dtlog Mterilistion: The Bckwrd/Forwrd Algorithm. In AAAI, 2015. [Perce, 2006] Dvid Perce. Equilibrium logic. Annls of Mthemtics nd Artificil Intelligence, 47(1-2):3 41, 2006. [Ren nd Pn, 2011] Yun Ren nd Jeff Z. Pn. Optimising ontology strem resoning with truth mintennce system. In CIKM, pges 831 836, 2011. [Turner, 2001] Hudson Turner. Strong equivlence for logic progrms nd defult theories (mde esy). In LPNMR, 2001. [Woltrn, 2004] Stefn Woltrn. Chrcteriztions for reltivized notions of equivlence in nswer set progrmming. In JELIA, 2004.