On Modal Logic Formulae Minimization Giovanni Pagliarini1 , Andrea Paradiso1 , Guido Sciavicco1 and Ionel Eduard Stan2 1 University of Ferrara, Italy 2 Free University of Bozen-Bolzano, Italy Abstract From the intricate circuits of digital devices to the abstract realms of logical theory, formula minimization remains a cornerstone challenge with various implications. This paper explores the adaptation of formula minimization techniques to modal logic ๐’ฆ, driven by the challenges of processing increasingly complex data structures. Our investigation begins by analyzing the inherent computational complexity of minimizing modal formulae, a critical step towards developing effective solutions. We, then, introduce a heuristic algorithm for the purpose. We prove its correctness, addressing the unique demands of modal logic. The implications of this work extend beyond theoretical interest, and include practical insights for the post-hoc treatment of symbolic models in modal logic ๐’ฆ, as well as temporal, spatial, and other non-classical logics in advanced computational contexts. Keywords Modal logic, Formula minimization, Heuristic algorithm 1. Introduction The expressiveness of two-valued Boolean algebra capable of describing switching circuit operations, highlighted by Shannon in 1938 [1], allowed the arising of a new field called logic synthesis. The great interest in circuits development, particularly in their Boolean form, highlighted a natural duality between Boolean circuits and Boolean formulae; Boolean formulae can be considered a particular representation of Boolean circuits. The need for ever smaller circuits and formula representations led to the study of techniques whose goal was to reduce the dimension of a given circuit, preserving its semantic behavior. To solve this problem, different algorithms were theorized, the most famous of which is the Quineโ€“McCluskey algorithm [2], considered a milestone in the field of logic optimization. The challenge of reducing a Boolean circuit to its minimal equivalent can be adeptly transformed into a logical problem using propositional logic. Specifically, given a Boolean formula ๐œ™ and a metric for its size (e.g., the number of tokens in the formula), the goal is to discover a formula ๐œ™โ€ฒ that is both equivalent to ๐œ™ and minimal in terms of size. This problem has been extensively examined when the formulae are represented in disjunctive normal form (DNF) or conjunctive normal form (CNF), and we refer to it as the Propositional Minimal Equivalent Formula (PMEF) problem, addressing it in both its search and decision formats. The decision variant, in particular, is framed as follows: given a propositional formula ๐œ™ and an integer ๐‘˜, is there an equivalent formula ๐œ“, whose size does not exceed ๐‘˜? Regardless of whether the formula is presented in CNF, DNF, or another generic form, the complexity of PMEF is determined as ฮฃ๐‘2 -complete, as documented by [3]. This classification places it in the second level of the polynomial hierarchy [4], distinct from the satisfiability problem (PSAT ), which well-knowingly ฮฃ๐‘1 -complete, that is, NP-complete. Diverse strategies have been developed to address the PMEF problem, which can be categorized into exact and heuristic algorithms. Exact methods inevitably grapple with the problemโ€™s inherent exponential time complexity yet consistently deliver globally minimal solutions. In contrast, heuristic techniques strive to bypass the limitation of the required computational effort by offering solutions that are good, though not necessarily optimal and represent local optima. Historically, exact algorithms CILC 2024: 39th Italian Conference on Computational Logic, June 26-28, 2024, Rome, Italy $ giovanni.pagliarini@unife.it (G. Pagliarini); andrea.paradiso@edu.unife.it (A. Paradiso); guido.sciavicco@unife.it (G. Sciavicco); ioneleduardstan@unibz.it (I. E. Stan)  0000-0002-8403-3250 (G. Pagliarini); 0000-0002-3614-2487 (A. Paradiso); 0000-0002-9221-879X (G. Sciavicco); 0000-0001-9260-102X (I. E. Stan) ยฉ 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR ceur-ws.org Workshop ISSN 1613-0073 Proceedings have evolved from the foundational Quine-McCluskey algorithm. Notable implementations include ESPRESSO [5], which operates in both exact and heuristic capacities, and SCHERZO [6], a state-of- the-art solution. Prominent examples of heuristic algorithms are MINI [7], BOOM [8], and ESPRESSO, again, which can function in both modalities. Moreover, recent advancements include a new algorithm proposed in [9], which minimizes propositional formulae without translating into normal forms (CNF or DNF). Beyond its foundational application in circuit minimization, propositional minimization finds rele- vance in several domains. Notably, in the emerging field of eXplainable AI (XAI), this technique aids in the post-hoc analysis of models, particularly in symbolic learning, where models are interpreted as sets of propositional formulae. Such minimization processes are crucial, especially as outlined in [10], where the role of prime implicants, a concept linked to formulae minimization, underscores their significance in refining explanations within AI systems. While minimization has traditionally centered on propositional logic, similar inquiries can be ex- tended to more expressive logical frameworks. For instance, first-order logic has been explored in this context [11]. Our focus here is on modal logic, which augments propositional logicโ€™s expressive power without venturing into first-order complexities (refer to [12] for an overview). Modal logic is pivotal, particularly as a foundational framework for more complex languages, including temporal [13, 14, 15], spatial [16], and various description logics [17]. By examining the basic unary modal logic ๐’ฆ, significant insights can be gained, as evidenced by recent advances in symbolic learning beyond propositional logic [18, 19, 20, 21], which are already apparent at this fundamental level [22]. Similarly to the proposi- tional case, machine learned modal logic modelsโ€”conceptualized as sets of modal formulaeโ€”can benefit significantly from efficient minimization algorithms, especially since modal logic lacks a standardized normal form, differentiating it markedly from propositional and first-order logics. In this work, we introduce the Modal Minimal Equivalent Formula (MMEF) problem, defined as the search for the smallest modal formula equivalent to a given one. Its decision version asks whether a modal formula ๐œ“ exists, equivalent to ๐œ™ and not exceeding a specified size ๐‘˜. We establish that MMEF is PSPACE-complete, aligning its complexity with modal logic ๐’ฆ satisfiability testing (MSAT ). This classification leads to a naรฏve but optimal exact algorithm that systematically explores all potential smaller formulae within the original signature and verifies each for equivalence. The primary goal of this paper is to propose an innovative heuristic algorithm for MMEF that leverages insights from its propositional counterparts and to validate its correctness. As we will demonstrate, this heuristic is uniquely adaptable and suitable for any extension of basic modal logic, regardless of the complexity or variety of modal operators employed. This work is organized as follows. In Section 2 we briefly recall the basic modal logic, its syntax, and its semantics. In Section 3 we define and study MMEF. Then, in Section 4 we describe our heuristic solution, before concluding. 2. Modal Logic The syntax of well-formed formulae in the basic modal language ๐’ฆ [12], denoted later by ๐œ™, ๐œ“, . . . (the Greek letters ๐›ผ, ๐›ฝ, . . ., instead, will be used to denote numeric parameters), is based on a set of propositional letters ๐’ซ = {๐‘, ๐‘ž, . . . }. Formulae are built with the following grammar: ๐œ™ ::= โŠค | โŠฅ | ๐‘ | ยฌ๐œ™ | ๐œ™ โˆง ๐œ™ | ๐œ™ โˆจ ๐œ™ | โ™ข๐œ™ | โ–ก๐œ™, where the missing classic Boolean operators can be obtained as shortcuts. The symbols โ™ข and โ–ก are called modalities, and, informally, they are treated as existential and universal operator, respectively. A formula in which no modality occurs is said to be purely propositional, or Boolean. Given two formulae ๐œ™, ๐œ“, we use ๐œ™ = ๐œ“ to denote the fact that they are syntactically identical, and |๐œ™| to denote the size of ๐œ™. Several different, but substantially equivalent, size measures of formula can be defined; the most common one is the number of tokens, that is, its length. In the following, we shall assume that |๐œ™| denotes precisely the length, but all our results immediately apply to the other possibilites. The subset of ๐’ซ that is used in a formula ๐œ™, plus the symbols โŠค and โŠฅ, is called signature of ๐œ™, and denoted by ๐‘ ๐‘–๐‘”(๐œ™); given a signature ๐’ฎ โІ ๐’ซ โˆช {โŠค, โŠฅ}, we denote by ฮฆ(๐’ฎ) the set of all well-formed modal formula that can be built on it. Finally, we denote by ๐‘ ๐‘ข๐‘(๐œ™) the set of all sub-formulae of a formula ๐œ™; a formula ๐œ“ โˆˆ ๐‘ ๐‘ข๐‘(๐œ™) such that its outermost connective is a modal operator, that is, a modal sub-formula, is said to be a maximally modal sub-formula if every sub-formula ๐œ‰ โˆˆ ๐‘ ๐‘ข๐‘(๐œ™) such that ๐œ“ โˆˆ ๐‘ ๐‘ข๐‘(๐œ‰) has, as outermost connective, a Boolean one, and the subset of ๐‘ ๐‘ข๐‘(๐œ™) of all and only maximally modal sub-formulae of a given formula ๐œ™ is denoted by msub(๐œ™). In the so-called Kripke semantics, we interpret a formula on a Kripke interpretation ๐พ = (๐‘Š, ๐‘…, ๐‘‰ ), where the pair (๐‘Š, ๐‘…), in which ๐‘Š is a non-empty, finite set of worlds and ๐‘… โІ ๐‘Š ร— ๐‘Š is the accessibility relation, is called Kripke frame, and ๐‘‰ is a valuation function that assigns to each world the set of propositional letters that are true on it, that is ๐‘‰ : ๐‘Š โ†’ 2๐’ซ . In general, we denote Kripke interpretations with the symbols ๐พ, ๐พ1 , . . .. Given an interpretation ๐พ and a world ๐‘ค, we say that ๐พ, ๐‘ค satisfies a formula ๐œ™, denoted by ๐พ, ๐‘ค |= ๐œ™, if and only if ๐พ, ๐‘ค |= ๐‘ iff ๐‘ โˆˆ ๐‘‰ (๐‘ค), ๐พ, ๐‘ค |= ยฌ๐œ™ iff ๐พ, ๐‘ค ฬธ|= ๐œ™, ๐พ, ๐‘ค |= ๐œ™ โˆง ๐œ“ iff ๐พ, ๐‘ค |= ๐œ™ and ๐พ, ๐‘ค |= ๐œ“, ๐พ, ๐‘ค |= ๐œ™ โˆจ ๐œ“ iff ๐พ, ๐‘ค |= ๐œ™ or ๐พ, ๐‘ค |= ๐œ“, ๐พ, ๐‘ค |= โ™ข๐œ™ iff โˆƒ๐‘ฃ s.t. ๐‘ค๐‘…๐‘ฃ and ๐พ, ๐‘ฃ |= ๐œ™, ๐พ, ๐‘ค |= โ–ก๐œ™ iff โˆ€๐‘ฃ s.t. ๐‘ค๐‘…๐‘ฃ it is the case that ๐พ, ๐‘ฃ |= ๐œ™. Moreover, we have ๐พ, ๐‘ค |= โŠค, ๐พ, ๐‘ค ฬธ|= โŠฅ. Given a modal formula ๐œ™, we say that it is satisfiable if and only if there exists a Kripke interpretation ๐พ and a world ๐‘ค such that ๐พ, ๐‘ค |= ๐œ™; in this case, ๐พ is said to be a model of ๐œ™ (however, we often use the term model to refer to machine learning models). In the following, we use the notation ๐œ™ โ‰ก ๐œ“ to denote the fact that ๐œ™ and ๐œ“ are equivalent, that is, for every interpretation ๐พ and world ๐‘ค, it is the case that ๐พ, ๐‘ค |= ๐œ™ if and only if ๐พ, ๐‘ค |= ๐œ“. Moreover, it is well-known that every modal logic formula can be presented in negated normal form (NNF), that is, in such a way that the symbol ยฌ only occurs in front of propositional letters, and that converting a formula into an equivalent one in NNF does not increase its length by more than a constant factor; in the following, we assume that every formula is in NNF, and we use NNF() to denote an algorithm that turns a given formula in its negated normal form equivalent. A propositional letters or the negation of a propositional letter is known as a literal; here, we denote literals by ๐œ†, ๐œ†1 , . . .. Finally, given two formulae ๐œ™, ๐œ‰, and given a formula ๐œ“ โˆˆ ๐‘ ๐‘ข๐‘(๐œ™), by ๐œ™[๐œ“/๐œ‰] we denote the formula ๐œ™ after having syntactically replaced every occurrence of the sub-formula ๐œ“ in ๐œ™ with ๐œ‰. Observe that modal logic generalizes propositional logic, and the valuation function associates a propositional interpretation to each world. Later in this paper, we shall use ๐‘€, ๐‘€1 , . . . to denote propositional interpretations. The satisfiability problem for modal logic (MSAT ), that is, the problem of establishing if, given a modal formula, there exists a Kripke interpretation and a world that satisfy it, is known to be PSPACE- complete [23]; this is in sharp contrast with the same problem at the propositional level (PSAT ), which is NP-complete. There exist tens of available systems for satisfiability checking of modal formulae. These are generally separated into tableau-based systems (e.g., [24, 25]), which can be considered extensions of classical propositional tableaux, DPLL-based methods, that is, methods based on the progressive substitution of modal sub-formulae with fresh propositional letters, so that standard propositional satisfiability checkers can be then used (e.g., [26]), translational approaches, based on the idea of translating a modal formula into its first-order counterpart, so that standard first-order satisfiability checkers can be then used (e.g., [27]), and automata-based techniques (e.g., [28]); an excellent survey on this topic can be found in [29]. In the following, we shall use PSAT() (resp., MSAT()) to denote an algorithm that solves an instance of the satisfiability problem for propositional (resp., modal) logic. Modal logic is paradigmatic for several varieties of more-than-propositional logics. Indeed, most classic temporal [13, 14, 15], spatial [16], and description [17] logics are specializations of modal logics with more than one accessibility relations (possibly with higher arities) and associated modalities, subject to constraints on the admitted Kripke interpretations, that range from very simple and intuitive ones (e.g., transitivity, antisymmetry) to very complex ones (e.g., when worlds are assumed to be intervals and modalities are assumed to mimic relations between intervals). 3. Exact Minimization of Modal Formulae At the propositional level, the problem of minimizing a given formula has been presented in several forms. In its decision version it is usually defined as the problem, given a formula ๐œ™ and an integer ๐‘˜, of establishing whether a formula ๐œ“, smaller than or of the same size of ๐œ™, and equivalent to ๐œ™, exists. Typically, propositional formulae are assumed to be in disjunctive normal form (DNF) or conjunctive normal form (CNF), but the problem can be defined for generic formulae as well; as a matter of fact, this problem is studied in [9]. Regardless of the form of the input formula, this problem, called here the Propositional Minimal Equivalent Formula (PMEF) problem, is known to be ฮฃ๐‘2 -complete [3]. In the following, we shall use PMEF() to denote both an algorithm that solves an instance (๐œ™, ๐‘˜) of the decision version of this problem and an algorithm that solves an instance ๐œ™ of its search counterpart. Whenever convenient, we shall use EXACT-PMEF() (resp., HEURISTIC-PMEF()) to denote an exact (resp., heuristic) algorithm for solving a particular instance. Generalizing the minimization problem to modal formulae is very natural. However, modal formulae do not have an accepted disjunctive/conjunctive normal form in the same way that propositional ones do; normal forms for modal formulae have been studied in [30], but the available proposals lack the naturalness and simplicity that are characteristic of normal forms. Definition 1. Given a modal formula ๐œ™ and an integer ๐‘˜, the Modal Minimal Equivalent Formula (MMEF) problem consists in deciding whether there exists a formula ๐œ“ such that ๐œ“ โ‰ก ๐œ™ and its size is at most ๐‘˜. In the following, we shall use the same symbol to denote both the decision and the search version of this problem. Similarly to the propositional case, in its search version this problem too can be solved exactly and heuristically, and we shall use EXACT-MMEF() (resp., HEURISTIC-MMEF()) to denote a generic exact (resp., heuristic) algorithm for it. Lemma 1. MMEF is PSPACE-hard. Proof: We aim to establish the PSPACE-hardness of MMEF through a Turing reduction from MSAT. Consider an instance ๐œ™ of MSAT. Notably, ๐œ™ is unsatisfiable if and only if it is equivalent to the formula โŠฅ. Let us define ๐œ“ = ๐œ™ โˆง ๐‘ โˆง ๐‘ž, where ๐‘ and ๐‘ž are propositional letters not included in ๐‘ ๐‘–๐‘”(๐œ™), the signature of ๐œ™; we convert the instance ๐œ™ for MSAT into the instance (๐œ“, 1) for MMEF. Firstly, assume ๐œ™ is satisfiable. Under this condition, any formula ๐œ‰ equivalent to ๐œ™ and minimal in size cannot be shorter than a single syntactic token (i.e., ๐œ‰ must be equivalent to โŠค or to a single propositional letter), and, in particular, cannot be ๐‘ nor ๐‘ž. Consequently, any minimal size formula ๐œ equivalent to ๐œ“ must, at least, include the conjunction ๐‘ โˆง ๐‘ž. Therefore, querying MMEF(๐œ“, 1) under these conditions would return false. Conversely, if ๐œ™ is unsatisfiable, it is equivalent to โŠฅ, and so is ๐œ“. In this scenario, MMEF(๐œ“, 1) would return true, indicating that a minimal formula equivalent to ๐œ“ and smaller than or equal to size 1 exists. This construction shows that MSAT โ‰ค๐‘‡ MMEF. Given that MSAT is known to be PSPACE-hard, it follows that MMEF is also PSPACE-hard. โ–ก As a side observation, it is easy to see that the above argument could be generalized to prove that the minimization problem in any non-trivial logic is at least as hard as its satisfiability problem. Algorithm 1: Exact Modal Minimal Equivalent Formula 1 function EXACT-MMEF(๐œ™): 2 forall ๐‘˜ โ‰ค |๐œ™| do 3 forall ๐œ“ โˆˆ ฮฆ(๐‘ ๐‘–๐‘”(๐œ™)) of length ๐‘˜ do 4 if EQUIVALENT (๐œ™, ๐œ“) then 5 return ๐œ“ 6 end 7 end 8 end 9 return ๐œ™ 10 end 11 function EQUIVALENT (๐œ™, ๐œ“): 12 return not MSAT ((๐œ™ โˆง ยฌ๐œ“) โˆจ (๐œ“ โˆง ยฌ๐œ™)) 13 end As it turns out, MMEF is also in PSPACE. This can be proved by providing a sound and complete PSPACE algorithm for the search version of MMEF, that is, EXACT-MMEF(), shown in Alg. 1. Observe, in particular, line 2 and 3 of EXACT-MMEF(): our systematic, ordered exploration of the search space for ๐œ“ โˆˆ ฮฆ(๐‘ ๐‘–๐‘”(๐œ™)) guarantees that this step does not require more than polynomial space, as it can be implemented without memorizing smaller formulae. Lemma 2. EXACT-MMEF() is terminating, sound and complete. Specifically, if ๐œ“ = EXACT-MMEF(๐œ™), then: (i) ๐œ“ โ‰ก ๐œ™ and (ii) for every formula modal formula ๐œ‰, if |๐œ‰| < |๐œ“|, then ๐œ‰ ฬธโ‰ก ๐œ™. Proof: It is immediate to observe that, for a given ๐œ™, the execution EXACT-MMEF(๐œ™) always termi- nates. Suppose ๐œ“ = EXACT-MMEF(๐œ™). This implies that the query MSAT((๐œ“ โˆง ยฌ๐œ™) โˆจ (๐œ™ โˆง ยฌ๐œ“)) returns false, indicating that (๐œ“ โˆง ยฌ๐œ™) โˆจ (๐œ™ โˆง ยฌ๐œ“) is unsatisfiable. Consequently, the equivalence ๐œ“ โ†” ๐œ™ holds, verifying that ๐œ“ โ‰ก ๐œ™ and establishing (๐‘–). For (๐‘–๐‘–), assume by contradiction that there exists a modal formula ๐œ‰ such that |๐œ‰| < |๐œ“| and ๐œ‰ โ‰ก ๐œ™. Given that |๐œ‰| < |๐œ“|, ๐œ‰ would have been tested for equivalence with ๐œ™ before ๐œ“. But since ๐œ‰ โ‰ก ๐œ™, then MSAT((๐œ‰ โˆง ยฌ๐œ™) โˆจ (๐œ™ โˆง ยฌ๐œ‰)) would have returned false, so EXACT-MMEF(๐œ™) would have returned ๐œ‰, which is in contradiction with our assumption that EXACT-MMEF(๐œ™) has returned ๐œ“. Therefore no such ๐œ‰ can exist, concluding the proof. โ–ก Lemma 3. MMEF is in PSPACE. Proof: Consider the operation of EXACT-MMEF(). The algorithm functions within polynomial space bounds, as it tests each formula sequentially and discards each partial result; the space requirement for each test is also polynomial. To solve a decision instance (๐œ™, ๐‘˜) for MMEF, EXACT-MMEF() is executed on ๐œ™. Subsequently, the size of the resulting formula is compared to the integer ๐‘˜. Since EXACT-MMEF() operates within polynomial space and the size comparison also requires only a constant amount of additional space, MMEF is PSPACE. โ–ก Theorem 1. MMEF is PSPACE-complete. It is worth observing that our approach for EXACT-MMEF() is substantially equivalent to the naรฏve approach for EXACT-PMEF() as shown in [9], used by the authors as baseline. Algorithm 2: Heuristic Modal Minimal Equivalent Formula 1 function HEURISTIC-MMEF(๐œ™, ๐›ผ, ๐›ฝ, ๐›พ): 2 return HMMEF(๐œ™, ๐›ผ, ๐›ฝ, ๐›พ, |๐œ™|, ๐‘ ๐‘–๐‘”(๐œ™)) 3 end 4 function HMMEF(๐œ™, ๐›ผ, ๐›ฝ, ๐›พ, Max , ๐’ฎ): 5 if |๐œ™| โ‰ค ๐›ผ then 6 return EXACT-MMEF(๐œ™) 7 else 8 if ๐œ™ = ๐œ™1 โŠš ๐œ™2 then 9 (๐œ“, ๐ป) โ† PROPOREPLACE(๐œ™, ๐›พ, โˆ…, Max , ๐’ฎ) 10 if |๐œ“| โ‰ค ๐›ฝ then 11 ๐œ“ โ€ฒ โ† EXACT-PMEF(๐œ“, ๐›พ) 12 else 13 ๐œ“ โ€ฒ โ† HEURISTIC-PMEF(๐œ“, ๐›พ) 14 end 15 (๐œ™, ๐ป) โ† PROPOREPLACE(NNF (๐œ“ โ€ฒ ), ๐›พ, ๐ป โˆ’1 , 0, ๐’ฎ) 16 end 17 if ๐œ™ = ๐œ™1 โŠš ๐œ™2 then 18 return HMMEF(๐œ™1 , ๐›ผ, ๐›ฝ, ๐›พ, Max , ๐’ฎ) โŠš HMMEF(๐œ™2 , ๐›ผ, ๐›ฝ, ๐›พ, Max , ๐’ฎ) 19 else if ๐œ™ = โ™ข ๐œ™1 then 20 return โ™ข HMMEF(๐œ™1 , ๐›ผ, ๐›ฝ, ๐›พ, Max , ๐’ฎ) 21 end 22 end 23 end 4. Heuristic Minimization of Modal Formulae The naรฏve PSPACE approach to formula minimization, as discussed, exhibits considerable inefficiency. This inefficiency stems primarily from three sources: unavoidable redundant exploration of formulae equivalent to those already tested, inherently exponential time required for each test, and exponentially wide search space. While the first issue could be partially mitigated by incorporating sorting techniques to organize formulae, and the second one by employing very efficient implementations of MSAT solvers, the number of potential candidates remains the most relevant bottleneck of this approach. To develop a more practical solution, we consider a heuristic approach that does not ensure a global optimum but offers more operational feasibility. Drawing inspiration from [26], this approach exploits efficient solutions to the PMEF problem. By progressively applying consistent substitutions, we aim to minimize the initial formula at least from a propositional standpoint. It is important to note that propositional minimization generally surpasses mere satisfiability checking in complexity, and most current methods require the formula to be in a specific normal form. However, as demonstrated in [9], it is feasible to minimize propositional formulae without converting them to normal form. Alternatively, one could temporarily transform propositional sub-formulae into CNF or DNF for exact or heuristic minimization, and subsequently assessing whether the resultant formula is indeed smaller than the original. Throughout this process, we transition from exact to heuristic minimization methods based on practical considerations. To ensure consistency in substitutions, an external hash table keyed by the formulae themselves is utilized. This structure also aids in identifying semantically opposite sub- formulae, a task that can be executed through exact or heuristic methods. For modal sub-formulae that are sufficiently short, exact minimization remains feasible. In summary, our recursive, heuristic approach hinges on three key parameters: ๐›ผ, the maximum length of a modal sub-formula below which exact minimization is employed (as opposed to continuing recursion in search of smaller alternatives); ๐›ฝ, the cutoff length for employing exact over heuristic minimization for propositional sub-formulae; and ๐›พ, the threshold under which exact substitutions are preferred to heuristic substitutions. HEURISTIC-MMEF(), outlined in Algorithm 2, serves as a simple driver for the recursive HMMEF() function. The parameters ๐›ผ, ๐›ฝ, and ๐›พ are natural numbers that modulate the optimizations within the algorithm. Initially, HMMEF() checks if the input formula ๐œ™ is small enough (|๐œ™| โ‰ค ๐›ผ); if so, EXACT- MMEF() is invoked directly. If |๐œ™| exceeds ๐›ผ, HHMEF() evaluates the structure of ๐œ™. For formulae where the outermost connective is modal (i.e., ๐œ™ = โ™ข ๐œ“ with โ™ข โˆˆ {โ™ข, โ–ก}), HHMEF() recursively calls itself on its argument (i.e., ๐œ“). If, on the other hand, the outermost connective is Boolean (i.e., ๐œ™ = ๐œ“1 โŠš ๐œ“2 ), the process resorts to Boolean minimization. PROPOREPLACE() utilizes a hash table ๐ป, keyed by modal formulae, to manage substitutions. For a given formula ๐œ™ and any sub-formula ๐œ“ โˆˆ ๐‘ ๐‘ข๐‘(๐œ™), ๐ป[๐œ“] stores the literal ๐œ† replacing ๐œ“ in ๐œ™ after substitution. The goal of PROPOREPLACE() is to recursively substitute sub-formulae in ๐œ™ with fresh literals or their negations to render the formula purely propositional. Each execution begins with an empty ๐ป. In the simplest case where ๐œ™ is already a literal, no substitution is necessary. If the outermost operator is modal and ๐œ™ is sufficiently short (|๐œ™| โ‰ค ๐›พ), PROPOREPLACE() explores all smaller potential equivalent formulae within ๐œ™โ€™s signature. If a formula ๐œ“ is found to be semantically equivalent to ๐œ™ (or ยฌ๐œ™), PROPOREPLACE() checks if a literal ๐œ† has already been assigned to it and returns that literal (or its negation). If no such ๐œ“ is found (including the case where ๐œ“ is ๐œ™ itself), indicating that ๐œ™ has not been substituted previously, a fresh literal is assigned, updating ๐ป with both ๐œ™ and ยฌ๐œ™. This substitution is deemed exact. Conversely, if ๐œ™ is too lengthy, PROPOREPLACE() repeats these steps but limits its scope to checking if ๐ป already contains ๐œ™ or its negated form in NNF. If absent, a new fresh literal is assigned, noting that this substitution may not be optimal as it might replace two equivalent sub-formulae with different literals. When the outermost operator of ๐œ™ is Boolean, PROPOREPLACE() recursively calls itself on the inner sub-formulae, performs the replacements, and reconstructs the formula. Here, ๐ป may remain unchanged but could be updated during the recursive calls. Because HEURISTIC-MMEF() is not an exact algorithm, we can only prove its soundness; to this end, we first need to prove the soundness of PROPOREPLACE(). In the following, we assume that HEURISTIC-MMEF() is called on some formula ๐œ™ with 1 โ‰ค ๐›ผ, ๐›ฝ, ๐›พ โ‰ค |๐œ™|, that Max is the length of the formula onto which HEURISTIC-MMEF() is called, and that ๐’ฎ its signature. Lemma 4. If (๐œ“, ๐ป) = PROPOREPLACE(๐œ™, ๐›พ, โˆ…, Max, ๐’ฎ) and msub(๐œ™) = {๐œ“1 , . . . , ๐œ“๐‘› }, then: (i) ๐œ“ is Boolean, (ii) ๐œ“ = ๐œ™[๐œ“1 /๐ป[๐œ“1 ], . . . , ๐œ“๐‘› /๐ป[๐œ“๐‘› ]], and (iii) if ๐ป[๐œ“๐‘– ] = ๐ป[๐œ“๐‘— ] (resp., ๐ป[๐œ“๐‘– ] = ยฌ๐ป[๐œ“๐‘— ]) for some ๐‘– ฬธ= ๐‘—, then ๐œ“๐‘– โ‰ก ๐œ“๐‘— (resp., ๐œ“๐‘– โ‰ก ยฌ๐œ“๐‘— ). Proof: We proceed by double induction on the structural complexity of ๐œ™ and the recursive depth of the call to prove a stronger property. If (๐œ“, ๐ป โ€ฒ ) = PROPOREPLACE(๐œ™, ๐›พ, ๐ป, Max, ๐’ฎ), then: (i) ๐œ“ = ๐œ™[๐œ‰1 /๐ป โ€ฒ [๐œ‰1 ], . . . , ๐œ‰๐‘› /๐ป โ€ฒ [๐œ‰๐‘› ]] for all maximal modal sub-formulae ๐œ‰1 , . . . , ๐œ‰๐‘› of ๐œ™, unless ๐œ™ is a literal, (ii) if ๐œ“ is a literal not in ๐’ฎ, then ๐ป โ€ฒ [๐œ“] exists, (iii) for any pair of formulae ๐œ‰ โ€ฒ , ๐œ‰ โ€ฒโ€ฒ , ๐ป โ€ฒ [๐œ‰ โ€ฒ ] = ๐ป โ€ฒ [๐œ‰ โ€ฒโ€ฒ ] (resp., ๐ป โ€ฒ [๐œ‰ โ€ฒ ] โ‰ก ยฌ๐ป โ€ฒ [๐œ‰ โ€ฒโ€ฒ ]) implies ๐œ‰ โ€ฒ โ‰ก ๐œ‰ โ€ฒโ€ฒ (resp., ๐œ‰ โ€ฒ โ‰ก ยฌ๐œ‰ โ€ฒโ€ฒ ), and (iv) for any formula ๐œ‰, ๐ป[๐œ‰] maps to a literal that is either หœ๐‘ก or ยฌ๐‘กหœ, where หœ๐‘ก โˆˆ / ๐’ฎ. Assume that ๐œ™ is a literal, that is, ๐œ™ = ๐‘ or ๐œ™ = ยฌ๐‘; by construction, it must be the case that ๐‘ โˆˆ ๐’ฎ. Then, PROPOREPLACE() returns (๐œ“, ๐ป โ€ฒ ) = (๐œ™, ๐ป). If this is the first call to PROPOREPLACE(), then both ๐ป and ๐ป โ€ฒ are empty, and if it is not, then ๐ป remains unchanged from the previous call; in both cases, (๐‘–) โ€“ (๐‘–๐‘ฃ) trivially hold. This solves the base case along both dimensions, that is, the call number and the complexity of the input formula; all other cases are inductive. If the outermost connective of ๐œ™ is a modal operator, we examine cases based on the size of ๐œ™ relative to ๐›พ. For ๐œ™ with size less than or equal to ๐›พ, all smaller NNF formulae within the signature ๐‘ ๐‘–๐‘”(๐œ™) are considered. If a formula ๐œ‰ is such that ๐œ‰ โ‰ก ๐œ™ (resp., ๐œ‰ โ‰ก ยฌ๐œ™) exists with preassigned ๐ป[๐œ‰], we return (๐ป[๐œ‰], ๐ป) (resp., (๐ป[ยฌ๐œ‰], ๐ป)). Then, (๐‘–) and (๐‘–๐‘–) are satisfied trivially, and (๐‘–๐‘–๐‘–) and (๐‘–๐‘ฃ) hold by inductive hypothesis. If no such ๐œ‰ is found, หœ๐‘ก is introduced, and we return (๐‘กหœ, ๐ป โ€ฒ ) setting ๐ป โ€ฒ [๐œ™/๐‘กหœ, NNF (ยฌ๐œ™)/ยฌ๐‘กหœ]. Once more, (๐‘–) and (๐‘–๐‘–) hold trivially; (๐‘–๐‘–๐‘–) and (๐‘–๐‘ฃ), instead, come by Algorithm 3: Propositional Replace 1 function PROPOREPLACE(๐œ™, ๐›พ, ๐ป, Max , ๐’ฎ): 2 if ๐œ™ = ๐‘ or ๐œ™ = ยฌ๐‘ then 3 if ๐‘ โˆˆ ๐’ฎ then 4 return (๐œ™, ๐ป) 5 else 6 return (๐ป[๐œ™], ๐ป) 7 end 8 else if ๐œ™ = โ™ข ๐œ™1 then 9 if |๐œ™| โ‰ค ๐›พ then 10 forall ๐‘˜ โ‰ค Max do 11 forall ๐œ“ โˆˆ ฮฆ(๐‘ ๐‘–๐‘”(๐œ™)) such that ๐œ“ is in NNF and |๐œ“| = ๐‘˜ do 12 if EQUIVALENT(๐œ“, ๐œ™) and ๐ป[๐œ“] exists then 13 return (๐ป[๐œ“], ๐ป) 14 end 15 end 16 end 17 หœ๐‘ก โ† NEWLETTER() 18 ๐ป[๐œ™] โ† หœ๐‘ก 19 ๐ป[NNF (ยฌ๐œ™)] โ† ยฌ๐‘กหœ 20 return (๐ป[๐œ™], ๐ป) 21 else 22 if ๐ป[๐œ™] exists then 23 return (๐ป[๐œ™], ๐ป) 24 else 25 หœ๐‘ก โ† NEWLETTER() 26 ๐ป[๐œ™] โ† หœ๐‘ก 27 ๐ป[NNF (ยฌ๐œ™)] โ† ยฌ๐‘กหœ 28 return (๐ป[๐œ™], ๐ป) 29 end 30 end 31 else if ๐œ™ = ๐œ™1 โŠš ๐œ™2 then 32 (๐œ™โ€ฒ1 , ๐ป1 ) โ† PROPOREPLACE (๐œ™1 , ๐›พ, ๐ป, Max , ๐’ฎ) 33 (๐œ™โ€ฒ2 , ๐ป2 ) โ† PROPOREPLACE (๐œ™2 , ๐›พ, ๐ป1 , Max , ๐’ฎ) 34 return (๐œ™โ€ฒ1 โŠš ๐œ™โ€ฒ2 , ๐ป2 ) 35 end 36 end construction, because หœ๐‘ก is fresh. If |๐œ™| > ๐›พ, then we proceed exactly in the same way, but limiting our search to ๐œ‰ = ๐œ™ and ๐œ‰ = NNF (ยฌ๐œ™), leading to exactly the same conclusions. Lastly, if ๐œ™ = ๐œ™1 โŠš ๐œ™2 , where โŠš โˆˆ {โˆง, โˆจ}, recursive calls process sub-formulae ๐œ™1 and ๐œ™2 . After the call on ๐œ™1 and ๐ป, PROPOREPLACE() returns the pair (๐œ™โ€ฒ1 , ๐ป1 ). After the second call, on ๐œ™2 and ๐ป1 , PROPOREPLACE() returns the pair (๐œ™โ€ฒ2 , ๐ป2 ). Then, the pair (๐œ“, ๐ป โ€ฒ ) = (๐œ™โ€ฒ1 โŠš ๐œ™โ€ฒ2 , ๐ป2 ) is returned. At this point, (๐‘–) holds because msub(๐œ™) = msub(๐œ™โ€ฒ1 ) โˆช msub(๐œ™โ€ฒ2 ), and (๐‘–๐‘–) holds trivially. Finally, (๐‘–๐‘–๐‘–) and (๐‘–๐‘ฃ) hold by construction, and by the inductive hypothesis for ๐ป1 and ๐ป2 . โ–ก Lemma 5. If it is the case that (๐œ“, ๐ป) = PROPOREPLACE(๐œ™, ๐›พ, โˆ…, Max, ๐’ฎ), ๐œ“ โ€ฒ = PMEF(๐œ“), and (๐œ“ โ€ฒโ€ฒ , ๐ป) = PROPOREPLACE(๐œ“ โ€ฒ , ๐›พ, ๐ป โˆ’1 , Max, ๐’ฎ), then ๐œ“ โ€ฒโ€ฒ โ‰ก ๐œ™. Proof: We aim to demonstrate that for any Kripke interpretation ๐พ = (๐‘Š, ๐‘…, ๐‘‰ ) and world ๐‘ค, if ๐พ, ๐‘ค |= ๐œ™, then ๐พ, ๐‘ค |= ๐œ“ โ€ฒโ€ฒ , and the other way around. Consider a Kripke interpretation ๐พ and a world ๐‘ค such that ๐พ, ๐‘ค |= ๐œ™. Define ๐พ โ€ฒ = (๐‘Š, ๐‘…, ๐‘‰ โ€ฒ ) where ๐‘‰ โ€ฒ behaves as ๐‘‰ on every world and every propositional letter ๐‘ โˆˆ ๐‘ ๐‘–๐‘”(๐œ™), while, for a generic world ๐‘ค and letter หœ๐‘ก โˆˆ / ๐‘ ๐‘–๐‘”(๐œ™) is defined as follows: and ๐พ, ๐‘ค |= ๐œ‰, or {๏ธ‚ โˆ’1 หœ๐‘ก โˆˆ ๐‘‰ โ€ฒ (๐‘ค) iff ๐ป [๐‘กหœ] = ๐œ‰ ๐ป โˆ’1 [๐‘กหœ] = ยฌ๐œ‰ and ๐พ, ๐‘ค ฬธ|= ๐œ‰ with ๐œ‰ โˆˆ msub(๐œ™). Observe, first, that ๐พ โ€ฒ is well-defined, thanks to Lemma 4, (๐‘–๐‘–๐‘–). Moreover, since ๐พ, ๐‘ค |= ๐œ™, by Lemma 4, (๐‘–๐‘–) and (๐‘–๐‘–๐‘–), we know that ๐พ โ€ฒ , ๐‘ค |= ๐œ“. Then, again by Lemma 4, (๐‘–), we know that ๐œ“ is a propositional formula, so that PMEF() can be applied to it; clearly, the resulting formula ๐œ“ โ€ฒ is equivalent to ๐œ“, so that ๐พ โ€ฒ , ๐‘ค |= ๐œ“ โ€ฒ . Now, we want to prove that ๐พ โ€ฒ , ๐‘ค |= ๐œ“ โ€ฒโ€ฒ , and we proceed by structural induction on ๐œ“ โ€ฒ . If ๐œ“ โ€ฒ = ๐‘ or ๐œ“ โ€ฒ = ยฌ๐‘ for ๐‘ โˆˆ ๐’ฎ, then ๐œ“ โ€ฒโ€ฒ = ๐œ“ โ€ฒ and the claim follows directly. If ๐œ“ โ€ฒ = หœ๐‘ก (or ยฌ๐‘กหœ), where / ๐’ฎ, then ๐œ“ โ€ฒโ€ฒ = ๐œ‰ for some ๐œ‰ โˆˆ msub(๐œ™) such that ๐ป[๐œ‰] = หœ๐‘ก (or ๐ป[๐œ‰] = ยฌ๐‘กหœ). Given that ๐พ โ€ฒ , ๐‘ค |= หœ๐‘ก หœ๐‘ก โˆˆ (or ๐พ โ€ฒ , ๐‘ค ฬธ|= หœ๐‘ก), by definition ๐พ โ€ฒ , ๐‘ค |= ๐œ‰ follows. Assume, now, ๐œ“ โ€ฒ = ๐œ1โ€ฒ โˆง๐œ2โ€ฒ . If ๐พ โ€ฒ , ๐‘ค |= ๐œ“ โ€ฒ , then both ๐พ โ€ฒ , ๐‘ค |= ๐œ1โ€ฒ and ๐พ โ€ฒ , ๐‘ค |= ๐œ2โ€ฒ . Since ๐œ“ โ€ฒโ€ฒ = ๐œ1โ€ฒโ€ฒ โˆง๐œ2โ€ฒโ€ฒ where ๐œ1โ€ฒโ€ฒ , ๐œ2โ€ฒโ€ฒ are the results from a call to PROPOREPLACE() on ๐œ1โ€ฒ , ๐œ2โ€ฒ , by the induction hypothesis ๐พ โ€ฒ , ๐‘ค |= ๐œ1โ€ฒโ€ฒ and ๐พ โ€ฒ , ๐‘ค |= ๐œ2โ€ฒโ€ฒ , hence ๐พ โ€ฒ , ๐‘ค |= ๐œ“ โ€ฒโ€ฒ . The disjunction case ๐œ“ โ€ฒ = ๐œ1โ€ฒ โˆจ ๐œ2โ€ฒ is analogous. Finally, because ๐พ โ€ฒ , ๐‘ค |= ๐œ“ โ€ฒโ€ฒ and ๐‘ ๐‘–๐‘”(๐œ“ โ€ฒโ€ฒ ) = ๐‘ ๐‘–๐‘”(๐œ™), it follows that ๐พ, ๐‘ค |= ๐œ“ โ€ฒโ€ฒ as well, thereby concluding that ๐พ, ๐‘ค |= ๐œ™. The converse, that ๐พ, ๐‘ค |= ๐œ“ โ€ฒโ€ฒ implies ๐พ, ๐‘ค |= ๐œ™, follows by a similar argument. โ–ก Lemma 6. If ๐œ“ = HHMEF(๐œ™, ๐›ผ, ๐›ฝ, ๐›พ, Max, ๐’ฎ), then ๐œ“ โ‰ก ๐œ™ and |๐œ“| โ‰ค |๐œ™|. Proof: We use induction on the complexity of ๐œ™ to establish that if ๐œ“ results from any invocation of HHMEF(๐œ™, ๐›ผ, ๐›ฝ, ๐›พ, Max, ๐’ฎ), then ๐œ“ โ‰ก ๐œ™. Additionally, we aim to show that |๐œ“| โ‰ค |๐œ™|. Consider the case when |๐œ™| โ‰ค ๐›ผ. In this scenario, ๐œ“ is derived from the exact minimization of ๐œ™. Exact minimization ensures that ๐œ“ is equivalent to ๐œ™ and its size is less than or equal to that of ๐œ™, directly fulfilling the lemmaโ€™s conditions. Now, let us examine the situation where |๐œ™| > ๐›ผ. If ๐œ™ takes the form ๐œ™1 โŠš ๐œ™2 , then after one substitution with PROPOREPLACE(), one propositional minimization, and one back substitution, again, with PROPOREPLACE(), we obtain ๐œ“ โ€ฒ . Then Lemma 5 applies, and ๐œ“ โ€ฒ โ‰ก ๐œ™; thanks to the minimization step, |๐œ“ โ€ฒ | โ‰ค |๐œ™|. At this point, three possibilities arise. If ๐œ“ โ€ฒ is a literal, then ๐œ“ = ๐œ“ โ€ฒ , and the lemma is satisfied. If ๐œ“ โ€ฒ = ๐œ“1โ€ฒ โŠš ๐œ“2โ€ฒ , then, in general, ๐œ“ โ€ฒ may be different from ๐œ™; yet, HMMEF() is called recursively on ๐œ“1โ€ฒ and ๐œ“2โ€ฒ , returning ๐œ“1 and ๐œ“2 , respectively. By inductive hypothesis, ๐œ“1 โ‰ก ๐œ“1โ€ฒ (resp., ๐œ“2 โ‰ก ๐œ“2โ€ฒ ) and |๐œ“1 | โ‰ค |๐œ“1โ€ฒ (resp., |๐œ“2 | โ‰ค |๐œ“2โ€ฒ ). But then, as we wanted, ๐œ“ โ‰ก ๐œ™ and |๐œ“| โ‰ค |๐œ™|. Finally, if ๐œ“ โ€ฒ = โ™ข ๐œ“1โ€ฒ , then again, in general, ๐œ“ โ€ฒ may be different from ๐œ™; yet, HMMEF() is called recursively on ๐œ“1โ€ฒ , returning ๐œ“1 and, by inductive hypothesis, ๐œ“1 โ‰ก ๐œ“1โ€ฒ and |๐œ“1 | โ‰ค |๐œ“1โ€ฒ . Therefore, ๐œ“ โ‰ก ๐œ™ and |๐œ“| โ‰ค |๐œ™|. โ–ก Theorem 2. HEURISTIC-MMEF() is sound, that is, if ๐œ“ = HEURISTIC-MMEF(๐œ™, ๐›ผ, ๐›ฝ, ๐›พ), then ๐œ“ โ‰ก ๐œ™ and |๐œ“| โ‰ค |๐œ™|. It is quite trivial to see that HEURISTIC-MMEF() works in polynomial space; however, it is worth dis- cussing its temporal complexity. Let ๐’žHEURISTIC-MMEF (๐‘›, ๐›ผ, ๐›ฝ, ๐›พ) denote the cost of executing HEURISTIC- MMEF() on a formula of length ๐‘›, with parameters ๐›ผ, ๐›ฝ, and ๐›พ, can be now estimated. A straight- forward computation of its growth rate might not yield insightful results due to its heavy depen- dence on several factors: the cost ๐’žEXACT-MMEF from each of the multiple runs of EXACT-MMEF(), ๐’žEXACT-PMEF from each of the various executions of EXACT-PMEF(), ๐’žHEURISTIC-PMEF from the calls to HEURISTIC-PMEF(), and ๐’žPSAT from the applications of PSAT(). Nevertheless, it is possible to see that ๐’žHEURISTIC-MMEF (๐‘›, ๐›ผ, ๐›ฝ, ๐›พ) = ๐’ช(๐’žEXACT-MMEF (๐‘›)), that is, that the heuristic approach is expected not to perform worse than the exact method. We establish this by setting ๐›ผ at some given fixed value, while ๐›ฝ and ๐›พ are configured to their worst- case scenarios. Intuitively, as ๐›ผ increases, HEURISTIC-MMEF()โ€™s behavior more closely approximates that of EXACT-MMEF(). When ๐›ฝ and ๐›พ are maximized, EXACT-PMEF() is utilized more frequently as opposed to HEURISTIC-PMEF(), which inherently increases computational costs. Additionally, this configuration leads to a higher frequency of PSAT() calls, further influencing the overall computational expense. Theorem 3. HEURISTIC-MMEF() is at least as efficient as EXACT-MMEF(), that is, ๐’žHEURISTIC-MMEF (๐‘›, ๐›ผ, ๐›ฝ, ๐›พ) = ๐’ช(๐’žEXACT-MMEF (๐‘›)). Proof: We start by noting that the worst case for HEURISTIC-MMEF() occurs when we set ๐›ฝ = ๐›พ = ๐‘›. Here, we analyze its computational complexity under these parameters, denoted as ๐’žHEURISTIC-MMEF (), and show that it is bounded by ๐’ช(๐’žEXACT-MMEF (๐‘›)). Consider a modal formula of length ๐‘›. In the most challenging scenario for HEURISTIC-MMEF(), EXACT-MMEF() is invoked frequently on sub-formulae of length ๐›ผ. This scenario typically arises when ๐‘› symbols are distributed across the maximum number of sub-formulae, each comprising ๐›ผ symbols; at most, such sub-formulae can be ๐›ผ๐‘› . Each application of EXACT-MMEF() on these ๐›ผ-long sub-formulae entails a cost of ๐’ช(๐’žEXACT-MMEF (๐›ผ)). Moreover, again in the worst case, we can bound the cost due to the remaining operations as follows. Each sub-formula goes through three steps: a call to PROPOREPLACE() to perform a substitution, a call to EXACT-PMEF() (since ๐›ฝ = ๐‘›), and a call to PROPOREPLACE() to perform the back substitution. While the last operation only adds ๐’ช(๐‘›) to the total cost, the first one consists of the entire exploration of the sub-formula (๐’ช(๐‘›)) plus an examination of each of ๐’ช(2๐‘› ) potentially equivalent formulae (since ๐›พ = ๐‘›) and a call to PSAT() (๐’žPSAT (๐‘›)). Summing up the costs, we derive: ๐‘› ๐’žHEURISTIC-MMEF (๐‘›, ๐›ผ, ๐›ฝ, ๐›พ) = ๐‘‚( ๐’žEXACT-MMEF (๐›ผ) + ๐‘›(๐‘›2๐‘› ๐’žPSAT (๐‘›) + ๐’žPMEF (๐‘›) + ๐‘›)). ๐›ผ Since ๐›ผ is a constant, and since each call to EXACT-MMEF(๐œ™), where |๐œ™| = ๐‘›, requires ๐’ช(2๐‘› ) calls to MSAT(), that is, it entails a cost of ๐’ช(2๐‘› ๐’žMSAT (๐‘›)), we have that: ๐’žHEURISTIC-MMEF (๐‘›, ๐›ผ, ๐›ฝ, ๐›พ) = ๐‘‚ (๐‘›(๐‘›2๐‘› ๐’žPSAT (๐‘›) + ๐’žPMEF (๐‘›) + ๐‘›)) = ๐’ช(2๐‘› ๐’žMSAT (๐‘›)), the latter being precisely ๐’ช(๐’žEXACT-MMEF (๐‘›)), and hence we have the claim. โ–ก We conclude by showing an example of execution of HEURISTIC-MMEF() on the formula: ๐œ™ = (โ–ก(๐‘ โ†’ (๐‘Ÿ โˆง ๐‘Ÿ))) โˆง ((๐‘ž โˆง (๐‘Ÿ โˆง ๐‘ž))) โˆง (((โ–ก๐‘ž โˆง โ™ขโŠค) โ†’ โ™ข๐‘ž) โˆง โ–ก(๐‘ โ†’ (๐‘Ÿ โˆง ๐‘Ÿ))), shown in Fig. 1. Upon calling HEURISTIC-MMEF(๐œ™, 8, 0, 0), after the first substitution step, we obtain a propositional formulas as in Fig. 1a, middle, with a corresponding hash table as in Fig. 1a, right; observe that, in the figure, we do not show the negations of formulae in ๐ป, which are nonetheless present. Step 1 of the execution consists of substituting all maximally modal sub-formulae of ๐œ™ with fresh propositional letter; since |๐œ™| = 28, no exact modal minimization is performed at this point. In Step 2, shown in Fig. 1b, a heuristic propositional minimization is performed because ๐›ฝ = 0, which results in the elimination of one redundant occurrence of หœ๐‘ก1 (in this case, however, an exact propositional minimization would not have had a different result). Even after Step 3, that is, the reverse substitution of the maximally modal formulae found in Step 1, shown in Fig. 1c, the hash table ๐ป remains the same. At this point, HEURISTIC-MMEF() is called, recursively, on the sub-formula rooted at โˆง1 , with no changes, on the sub-formula at โ–ก2 , which is minimized exactly, on the sub-formula rooted at โˆง4 , with no result, and on the sub-formula rooted at โ†’5 , again, for an exact minimization; this process is shown in Fig. 1d. Observe that calling HEURISTIC-MMEF() on ๐œ™ with a lower ๐›ผ would lead to the result in Fig. 1d, left, which is still smaller than the original one, but not as small as the result of the call with ๐›ผ = 8. 5. Conclusions Formula minimization is a well-known problem in the case of Boolean logic, with several applications not only in field of circuit design but also in the area of explainable artificial intelligence. In this paper we defined the same problem for the harder case of modal logic, motivated not only by the naturalness of the question but also by the fact that modal logic is now being applied to learning from non-tabular data, leading to the need of simplifying potentially very long modal formulas in order to ensure their intepretability. We proved that the decision problem that corresponds to minimization in the modal case is PSPACE- complete, and we proposed a heuristic algorithm, namely HEURISTIC-MMEF(), for it; we proved the soundness of our proposal, and we discussed its theoretical complexity. ๐ป โˆง โˆง key value โˆง โˆง โˆง โˆง โ–ก(๐‘ โ†’ (๐‘Ÿ โˆง ๐‘Ÿ)) ๐‘กหœ1 โ–ก โˆง โ†’ โ–ก (1) =โ‡’ ๐‘กหœ1 โˆง โ†’ ๐‘กหœ1 โ–ก๐‘ž ๐‘กหœ2 โ†’ ๐‘ž โˆง โˆง โ™ข โ†’ ๐‘ž โˆง โˆง ๐‘กหœ4 โ™ขโŠค ๐‘กหœ3 ๐‘ โˆง ๐‘Ÿ ๐‘ž โ–ก โ™ข๐‘ž ๐‘ โˆง ๐‘Ÿ ๐‘ž ๐‘กหœ2 ๐‘กหœ3 โ™ข๐‘ž ๐‘กหœ4 ๐‘Ÿ ๐‘Ÿ ๐‘ž โŠค ๐‘Ÿ ๐‘Ÿ (a) In Step 1, since |๐œ™| > ๐›ผ a call to PROPREPLACE() is made and every maximally modal subformula, starting from the root, is substituted with a fresh propositional letter. ๐ป โˆง key value โˆง โˆง โˆง โ–ก(๐‘ โ†’ (๐‘Ÿ โˆง ๐‘Ÿ)) ๐‘กหœ1 (2) โˆง โ†’ ๐‘กหœ1 โˆง โ†’ ๐‘กหœ1 =โ‡’ โ–ก๐‘ž ๐‘กหœ2 ๐‘กหœ1 โˆง โˆง ๐‘กหœ4 ๐‘ž โˆง โˆง ๐‘กหœ4 โ™ขโŠค ๐‘กหœ3 ๐‘ž ๐‘Ÿ ๐‘กหœ2 ๐‘กหœ3 ๐‘Ÿ ๐‘ž ๐‘กหœ2 ๐‘กหœ3 โ™ข๐‘ž ๐‘กหœ4 (b) In Step 2, since |๐œ™| > ๐›ฝ, a call to HEURISTIC-PMEF() is made resulting in the elimination of ๐‘ก1 from the rightmost conjunct. ๐ป โˆง key value โˆง โˆง โ†’ โ–ก(๐‘ โ†’ (๐‘Ÿ โˆง ๐‘Ÿ)) ๐‘กหœ1 โˆง โ†’ (3) โ–ก โˆง โˆง โ™ข =โ‡’ โ–ก๐‘ž ๐‘กหœ2 ๐‘กหœ1 โˆง โˆง ๐‘กหœ4 โ†’ ๐‘ž ๐‘Ÿ โ–ก โ™ข ๐‘ž ๐‘ž โ™ขโŠค ๐‘กหœ3 ๐‘Ÿ ๐‘กหœ2 ๐‘กหœ3 ๐‘ โˆง ๐‘ž โŠค โ™ข๐‘ž ๐‘กหœ4 ๐‘Ÿ ๐‘Ÿ (c) In Step (3) a call to PROPREPLACE() operates the back substitution. โˆง โˆง โˆง1 โ†’5 ๐ปโˆง4 โˆง โŠค โ–ก2 โˆง4 โˆง โ™ข (4-11) key value =โ‡’ โ–ก โˆง โ†’ ๐‘ž ๐‘Ÿ โ–ก โ™ข ๐‘ž โ–ก(๐‘ โ†’ (๐‘Ÿ โˆง ๐‘Ÿ)) ๐‘กหœ1 โ†’ ๐‘ž ๐‘Ÿ ๐‘ โˆง3 ๐‘ž โŠค ๐‘ ๐‘Ÿ ๐‘Ÿ ๐‘Ÿ (d) From Step 4 to Step 11 several recursive calls are performed. In particular, from Step 4 to Step 7 the formula rooted at โˆง1 is minimized, but no changes occur. Step (8) corresponds to a call to EXACT-MMEF() on the formula rooted at โ–ก2 (since its length is less than ๐›ผ), resulting into the elimination of the redundant conjunction ๐‘Ÿ โˆง ๐‘Ÿ. In Step 9 and 10 a recursive call on the formula rooted at โˆง4 is performed, with no result. Finally, in Step (11) the procedure calls itself on the formula rooted at โ†’5 ; since the length of this formula is less than ๐›ผ, again, this call corresponds to an execution of EXACT-MMEF(), leading to the final formula. The hash table shown at this point is precisely the one built within the recursive call on the formula rooted at โˆง1 . Nodes in formula syntax trees are numbered following the recursive call at which they are considered; similarly, ๐ป4 indicates the hash table at the fourth recursive call, that is, the last one in which a modification occurs. Figure 1: Example of execution of HEURISTIC-MMEF(). The natural continuation of this work is to implement HEURISTIC-MMEF() and to perform a com- prehensive test to assess its practical usefulness. Moreover, as it is customary with heuristic solutions, some different choices may lead to different behaviours in terms of practical efficiency; we plan to explore several natural combinations and potential improvements of our proposals towards an optimal solution. Finally, it would be interesting to establish to what extent the properties of specific modal logics may improve the behaviour of HEURISTIC-MMEF() in specific cases, such as temporal or spatial logics. This work is part of a long-term open-source project for symbolic learning and reasoning with modal, temporal, and spatial logic, written in Julia language [31]. Acknowledgments This research has been partially funded by the FIRD project Modal Geometric Symbolic Learning (Uni- versity of Ferrara), and the Gruppo Nazionale Calcolo Scientifico-Istituto Nazionale di Alta Matematica (GNCS-INdAM) project Symbolic and Numerical Analysis of Cyber-Physical Systems (GNCS-INdAM). Giovanni Pagliarini, Guido Sciavicco, and Ionel Eduard Stan are GNCS-INdAM members. References [1] C. E. Shannon, A symbolic analysis of relay and switching circuits, Transactions of the American Institute of Electrical Engineers (1938). [2] W. V. Quine, The problem of simplifying truth functions, The American Mathematical Monthly (1952). [3] C. Umans, The minimum equivalent dnf problem and shortest implicants, Journal of Computer and System Sciences (2001). [4] A. R. Meyer, L. J. Stockmeyer, The equivalence problem for regular expressions with squaring requires exponential space, in: Proc. of the 13th Annual Symposium on Switching and Automata Theory, 1972, pp. 125โ€“129. [5] R. Rudell, A. Sangiovanni-Vincentelli, Multiple-valued minimization for pla optimization, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems 6 (1987) 727โ€“750. [6] O. Coudert, Doing two-level logic minimization 100 times faster, in: Proc. of the 6th Annual ACM-SIAM Symposium on Discrete Algorithms, 1995, pp. 112โ€“121. [7] S. Hong, R. Cain, D. Ostapko, Mini: A heuristic approach for logic minimization, IBM Journal of Research and Development 18 (1974) 443 โ€“ 458. [8] J. Hlavicka, P. Fiser, BOOM - A heuristic boolean minimizer, Computing and Informatics 22 (2003) 19โ€“51. [9] E. Calรฒ, J. Levy, General boolean formula minimization with QBF solvers, in: Proc. of the 25th International Conference of the Catalan Association for Artificial Intelligence, volume 375 of Frontiers in Artificial Intelligence and Applications, IOS Press, 2023, pp. 347โ€“358. [10] J. Marques-Silva, Logic-based explainability in machine learning, in: Proc. of the 18th International Summer School 2022 on Reasoning Web. Causality, Explanations and Declarative Knowledge, volume 13759 of Lecture Notes in Computer Science, Springer, 2022, pp. 24โ€“104. [11] T. Lampert, Minimizing disjunctive normal forms of pure first-order logic, Logic Journal of the IGPL 25 (2017) 325โ€“347. [12] P. Blackburn, M. de Rijke, Y. Venema, Modal Logic, volume 53 of Cambridge Tracts in Theoretical Computer Science, Cambridge University Press, 2001. [13] M. Ben-Ari, Z. Manna, A. Pnueli, The temporal logic of branching time, in: Proc. of the 8th Annual ACM Symposium on Principles of Programming Languages, ACM Press, 1981, pp. 164โ€“176. [14] J. Halpern, Y. Shoham, A propositional modal logic of time intervals, J. ACM 38 (1991) 935โ€“962. [15] A. Pnueli, The temporal logic of programs, in: Proc. of the 18th Annual Symposium on Foundations of Computer Science, IEEE Computer Society, 1977, pp. 46โ€“57. [16] M. Aiello, J. van Benthem, A modal walk through space, Journal of Applied Non Classical Logics 12 (2002) 319โ€“364. [17] L. Sikos, Description Logics in Multimedia Reasoning, Springer, 2017. [18] G. Bechini, E. Losi, L. Manservigi, G. Pagliarini, G. Sciavicco, I. E. Stan, M. Venturini, Statistical rule extraction for gas turbine trip prediction, Journal of Engineering for Gas Turbines and Power 145 (2023) GTPโ€“22โ€“1408. [19] F. Manzella, G. Pagliarini, G. Sciavicco, I. Stan, The voice of COVID-19: breath and cough recording classification with temporal decision trees and random forests, Artificial Intelligence in Medicine 137 (2023) 102486. [20] G. Pagliarini, G. Sciavicco, Interpretable land cover classification with modal decision trees, European Journal of Remote Sensing 56 (2023) 2262738. [21] S. Mazzacane, M. Coccagna, F. Manzella, G. Pagliarini, V. Sironi, A. Gatti, E. Caselli, G. Sciavicco, Towards an objective theory of subjective liking: A first step in understanding the sense of beauty, PLOS ONE (2023) 1โ€“20. [22] D. Della Monica, G. Pagliarini, G. Sciavicco, I. Stan, Decision trees with a modal flavor, in: Proc. of the 21st International Conference of the Italian Association for Artificial Intelligence, volume 13796 of Lecture Notes in Computer Science, Springer, 2022, pp. 47โ€“59. [23] R. E. Ladner, The computational complexity of provability in systems of modal propositional logic, SIAM Journal on Computing (1977). [24] M. Fitting, Tableau methods of proof for modal logics, Notre Dame Journal of Formal Logic 13 (1972) 237โ€“247. [25] M. F, Single step tableaux for modal logics, Journal of Automatic Reasoning 24 (2000) 319โ€“364. [26] F. Giunchiglia, R. Sebastiani, Building decision procedures for modal logics from propositional decision procedures: The case study of modal k(m), Information and Computation 162 (2000) 158โ€“178. [27] C. Areces, R. Gennari, J. Heguiabehere, M. de Rijke, Tree-based heuristics in modal theorem proving, in: Proc. of the 14th European Conference on Artificial Intelligence (ECAI), IOS Press, 2000, pp. 199โ€“203. [28] G. Pan, U. Sattler, M. Vardi, Bdd-based decision procedures for the modal logic K, Journal of Applied Non Classical Logics 16 (2006) 169โ€“208. [29] R. Sebastiani, A. Tacchella, SAT techniques for modal and description logics, in: Handbook of Satisfiability - Second Edition, volume 336 of Frontiers in Artificial Intelligence and Applications, IOS Press, 2021, pp. 1223โ€“1266. [30] M. Bienvenu, Prime implicates and prime implicants: From propositional to modal logic, J. Artif. Intell. Res. (JAIR) (2009). [31] F. Manzella, G. Pagliarini, A. Paparella, G. Sciavicco, I. Stan, Sole.jl โ€“ Symbolic Learning in Julia, https://github.com/aclai-lab/Sole.jl, 2024.