Hostname: page-component-89b8bd64d-r6c6k Total loading time: 0 Render date: 2026-05-07T00:26:08.844Z Has data issue: false hasContentIssue false

Direct Encoding of Declare Constraints in ASP

Published online by Cambridge University Press:  14 February 2025

FRANCESCO CHIARIELLO
Affiliation:
IRIT, ANITI, University of Toulouse, France, (e-mail: francesco.chiariello@irit.fr)
VALERIA FIONDA
Affiliation:
Università della Calabria, Rende, Italia, (e-mail: valeria.fionda@unical.it, antonio.ielo@unical.it, francesco.ricca@unical.it)
ANTONIO IELO
Affiliation:
Università della Calabria, Rende, Italia, (e-mail: valeria.fionda@unical.it, antonio.ielo@unical.it, francesco.ricca@unical.it)
FRANCESCO RICCA
Affiliation:
Università della Calabria, Rende, Italia, (e-mail: valeria.fionda@unical.it, antonio.ielo@unical.it, francesco.ricca@unical.it)
Rights & Permissions [Opens in a new window]

Abstract

Answer set programming (ASP), a well-known declarative logic programming paradigm, has recently found practical application in Process Mining. In particular, ASP has been used to model tasks involving declarative specifications of business processes. In this area, Declare stands out as the most widely adopted declarative process modeling language, offering a means to model processes through sets of constraints valid traces must satisfy, that can be expressed in linear temporal logic over finite traces (LTL$_{\text {f}}$). Existing ASP-based solutions encode Declare constraints by modeling the corresponding LTL$_{\text {f}}$ formula or its equivalent automaton which can be obtained using established techniques. In this paper, we introduce a novel encoding for Declare constraints that directly models their semantics as ASP rules, eliminating the need for intermediate representations. We assess the effectiveness of this novel approach on two Process Mining tasks by comparing it with alternative ASP encodings and a Python library for Declare.

Information

Type
Rapid Communication
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2025. Published by Cambridge University Press
Figure 0

Table 1. Some declare templates as $\text {LTL}_{\text {p}}$ formulae. We slightly edit the definitions for chainPrecedence($a,b$) and alternatePrecedence($a,b$), to align their semantics to the informal description commonly assumed in process mining applications. Changes w.r.t the original source are highlighted in red. The succession (resp. alternateSuccession, chainSuccession) template is defined as the conjunction of (alternate, chain) response and precedence templates

Figure 1

Fig. 1. Left: minimal automaton for the LTL$_{\text {f}}$ formula $\varphi = \textsf {G}(a \rightarrow \textsf {X}\textsf {F} b)$. Models (labeling the transitions) represent sets of symbols; right: minimal automaton for $\varphi$ interpreted as a LTL$_{\text {p}}$ formula, where $*$ denotes any $x \in \mathscr{A} \setminus \{a, b\}$. A comma on edges denotes multiple transitions.

Figure 2

Fig. 2. Subsumption hierarchy between declare relation and existence templates. The arrow $t_1 \rightarrow t_2$ denotes that $\pi \models t_1 \implies \pi \models t_2$, e.g. $t_1$ is more specific (subsumes) than $t_2$.

Figure 3

Fig. 3. ASP program to execute a finite state machine corresponding to a constraint, encoded as template/4 facts, on input strings encoded by trace/3 facts.

Figure 4

Fig. 4. Left: facts that encode the response template; right: a minimal finite state machine whose recognized language is equal to the set of models of response, under LTL$_{\text {p}}$ semantics.

Figure 5

Fig 5. ASP program to evaluate each sub-formula of the LTL$_{\text {p}}$ definition of a given template, encoded as template/2 facts, on input strings encoded by a syntax tree representation through the conjunction/3, negate/2, until/3, next/2 and atom/2 terms.

Figure 6

Fig. 6. Left: facts that encode the response template; right: syntax tree of the response template LTL$_{\text {p}}$ definition.

Figure 7

Table 2. Log statistics: $|\mathscr{A}|$ is the number of activities; average $|\pi |$ is the average trace length; $|\mathscr{L}|$ is the number of traces; $|\mathscr{C}^{\text {IV}}|$ is the number of declare constraints above 50% support

Figure 8

Table 3. Runtime in seconds for conformance checking on $\mathscr{C}^{\text {IV}}$

Figure 9

Table 4. Cumulative runtime in seconds for query checking tasks

Figure 10

Fig. 7. Conformance checking cactus.

Figure 11

Table 5. Max memory usage (MB) over all the conformance checking and query checking tasks, aggregated by log, for all the considered methods. Lowest value in boldface

Figure 12

Fig. 8. Query checking cactus plot.

Figure 13

Table 6. Metrics comparison for conformance checking of $\mathscr{C}^{\text {IV}}$ over the sepsis cases event log, with ASP encodings $\text {ASP}_{\mathscr{D}}$, $\text {ASP}_{\mathscr{S}}$, and $\text {ASP}_{\mathscr{A}}$. Execution times do not take into account XES input parsing and output parsing (as in Table 3, but are performed directly on facts representation of the input. Thus, reported times slightly differ from Table 3, although being executed on the same log

Figure 14

Table 7. Comparing metrics between different ASP encodings, with increasing trace lenghts. An entry is an ordered pair $(t, m)$ where $t$ is the runtime (seconds), $m$ the memory peak (MBs)

Figure 15

Fig. 9. Comparison of runtime (upper) and peak memory usage (lower) for the ASP direct encoding and D4Py, on synthetic logs used in Table 7.

Figure 16

Listing 1. Response template.

Figure 17

Listing 2. AlternateResponse template.

Figure 18

Listing 3. ChainResponse template.

Figure 19

Listing 4. Precedence template.

Figure 20

Listing 5. AlternatePrecedence template.

Figure 21

Listing 6. ChainPrecedence template.

Figure 22

Listing 7. Succession template. Same failure conditions as Response, Precedence.

Figure 23

Listing 8. AlternateSuccession template. Same failure conditions as AlternateResponse, AlternatePrecedence.

Figure 24

Listing 9. ChainSuccession template. Same failure conditions as ChainResponse, ChainPrecedence.

Figure 25

Listing 10. Choice template.

Figure 26

Listing 11. ExclusiveChoice template.

Figure 27

Listing 12. RespondedExistence template.

Figure 28

Listing 13. Coexistence template.