1 Introduction
Given a formula F in Classical Propositional Logic (CL), each row in a formula’s truth table describes a conjunction of literals C. Reading the truth table as a disjunctive normal form, it immediately follows that
$C \rightarrow F$
is a tautology. As an example, let us consider the CL formula |F = (A v B) & (B v C) & (C v A)|. Then its truth table (with 1 for True and 0 for False) is the one on the left. Let us select any row, say [1,0,1] and interpret it as |G = A & B & C|. Then the truth table of the resulting tautology G -> F is shown on the right.
Thus, it is easy to extract from the truth-table of a formula F in CL assumptions that would make it a theorem in CL.
This model-theoretic approach extends also to intermediate logics Footnote 1 and in particular, it applies to the 5-valued truth-tables of the equilibrium logic (Pearce et al. Reference Pearce, de Guzmán and Valverde2000), underlying Answer Set Programming (ASP).
With no finite truth-tables, no inter-definability of logical connectives, no rule of excluded middle and only a concept of tautology and contradiction defined for Intuitionistic Propositional Logic (IL), we need to be a bit more creative when trying to find salient assumptions that would make the formula a theorem in IL. Such salient assumptions include conjunctions of literals, mimicking the truth tables of CL but it also makes sense to extend them to more expressive subsets of formulas. First, given a formula in IL, we will need a search process for finding assumptions that would make it a theorem. Next, we would like our assumptions to be minimal with respect to the partial order relation governing the logic (or its equivalent Heyting algebra), intuitionistic implication.
This brings us to Abductive Logic Programming (Eshghi and Kowalski Reference Eshghi and Kowalski1989; Denecker and Kakas Reference Denecker and Kakas2002), where facts designated as abducibles are filtered with integrity constraints to provide relevant assumptions needed for the success of a goal G w.r.t. a given program P. In the context of IL, our abductive reasoning will rely on finding minimal assumptions under which a formula becomes a theorem.
And finally, in the absence of a convenient automated semantic method like truth tables or SAT solvers in CL, we will need a theorem prover, ideally derived directly from the rules of a terminating sequent calculus, that interoperates smoothly with the search process synthesizing our assumptions.
These requirements make Prolog a natural meta-language for an actionable description of these concepts. We will materialize our approach as a literate Prolog program, from which, as a convenience to the reader, we will extract our code and make it available online as a Prolog file. Footnote 2
The rest of the paper is organized as follows. Section 2 overviews our Prolog-based theorem prover and the sequent calculus it is derived from. Section 3 introduces our protasis synthesizer and its uses for abductive reasoning. Section 4 generalizes our approach to the synthesis of minimal canonical assumptions. Section 5 discusses significance of our results, its possible extensions as well as some of its limitations. Section 6 overviews related work and Section 7 concludes the paper.
We assume the reader is fluent in Prolog, propositional intuitionistic and classical logic and familiar with abductive reasoning and key concepts behind sequent calculi and automated theorem proving.
2 Background: The intuitionistic propositional logic theorem prover
We will derive our Prolog prover from a set of compact and elegant sequent calculus rules formally describing provability in IL.
2.1 Roy Dyckhoff’s G4ip calculus
Motivated by problems related to loop avoidance in implementing Gentzen’s LJ calculus, Roy Dyckhoff designed and proved sound and complete a sequent calculus-based axiomatization of IL (Dyckhoff Reference Dyckhoff1992). He has proved that the calculus is terminating, by identifying a multiset ordering-based formula size definition that decreases after each step (Dyckhoff Reference Dyckhoff1992).
The sequents of the G4ip calculus follow:

Key to the termination proof in Dyckhoff (Reference Dyckhoff1992) is the rule
$L\!\rightarrow\!\rightarrow$
that breaks down nested implications into “smaller” ones, each containing fewer connectives. The rules work with the context
$\Gamma$
being a multiset, but it has been shown later (Dyckhoff Reference Dyckhoff2016) that
$\Gamma$
can be a set, with duplication in contexts eliminated.
Note that the same calculus has been discovered independently in the 1950s by Vorob’ev and in the 1980s-1990s by Hudelmaier (Reference Hudelmaier1988).
2.2 Implementing the theorem prover
In the tradition of “lean theorem provers”, we can build one directly from the G4ip calculus, in a goal oriented style, by reading the rules from conclusions to premises.
Thus, we start with a simple, almost literal translation of sequent rules to Prolog with values in the environment
$\Gamma$
denoted by the variable Vs. Besides implication (denoted ->), conjunction (denoted &) and disjunction (denoted v), we implement rules for inverse implication (denoted
), negation (denoted | |) and equivalence (denoted
). We also add rules for a top element (denoted true) and a bottom element (denoted false).
Correctness of our additions follows from the definitions of:
-
intuitionistic inverse implication:
$\varphi \leftarrow \psi ~\equiv~ \psi \rightarrow \varphi$
-
intuitionistic equivalence:
$\varphi \leftrightarrow \psi \equiv \varphi \rightarrow \psi ~ \verb~&~ ~ \psi \rightarrow \varphi$
-
intuitionistic negation:
$ \verb|~|\varphi ~\equiv~ \varphi \rightarrow \verb~false~$
. -
top element:
$\verb~true~ ~\equiv~ \verb~false~ \rightarrow \verb~false~ $
.
Note that the added connectives are meant to enhance the expressiveness of the logic. For instance, “
” allows expressing the fact that two formulas are equivalent and thus equiprovable, “head
body” mimics Prolog’s familiar Horn clause syntax “ head :- body” and finally the negation symbol makes formulas more compact and human-readable.
We define operators for all our connectives, except ->, that we will use with its standard right associativity.
A formula T is a theorem if it is provable from an empty set of assumptions:
We follow here Dyckhoff’s calculus but delegate details to helper predicates iprover_reduce/4 and iprover_impl/4.
iprover_reduce/4 is the first step in breaking down formulas in the premise into their components.

iprover_impl/4 details the case analysis of the handling of implication (and its instances) prescribed by rule
$L\!\rightarrow\!\rightarrow$
.

Example 1 After defining:
we observe success on proving a tautology and failing to prove a contradiction, but we refer to Tarau (Reference Tarau2019) for an extensive combinatorial testing of a variant of this prover as well as its testing against the ILTP benchmark Footnote 3 and several other provers.
2.3 Classical logic for free
Glivenko’s theorem states that a propositional formula F is a classical tautology if and only if
$\tilde ~~ \tilde ~ F$
is an intuitionistic tautology. This gives us a classical prover for free, that we will use as an alternative to iprove when defining several concepts parameterized by a prover.
Example 2 The two provers, as it is well known, will disagree on |p v p|
but agree on |p & p|:
3 Abductive reasoning mechanisms
We are now ready to introduce our search for assumptions that make a given formula an intuitionistic tautology.
3.1 Generating the abducibles
Defining some of the atoms occurring in a formula F as the only ones to be used in the search process brings us to declare them as abducibles (Eshghi and Kowalski Reference Eshghi and Kowalski1989), but we will also enable the option to make abducible all the atoms occurring in F. Thus, when the variable Abducibles is free, all atomic symbols will be considered abducibles.
The predicate atoms_of/2 finds the set of all the atoms occurring in a formula. It backtracks over all arguments, recursively and it collects atomic elements to a list, with setof/3 which also eliminates possible duplicates.
3.2 Protasis generation
If F is a formula, we can think of a premise C such that
$C \rightarrow F$
is a theorem
Footnote 4
as a counterfactual assumption making F conditionally true. We call such a formula C a protasis. Thus, given a formula and a set of assumptions (our abducibles), we will need to search among them for assumptions that would make the formula a theorem.
The predicate any_protasis/6 implements this idea, subject to a set of parameters:
-
Prover allows a choice of the underlying logic (e.g., intuitionistic or classical)
-
AggregatorOp fixes one of the connectives of the logic, from which the protasis is built Footnote 5
-
The yes/no flag WithNeg decides if negations of the abducibles can be part of the protasis
-
Abducibles is a set of atoms or a free variable, meaning that all atoms will be included
-
Assumption will be any protasis, that given the previously specified parameters, ensures that Assumption->Formula is a theorem in the logic specified by Prover.
The predicate mark_hypos/3 will mark with their negations the abducibles if we want to allow them to occur in the protasis positively or prefixed by their negations.
Our subset generator subset_of, used to iterate over all subsets of the abducibles, first enumerates templates of increasing length as we want smaller subsets to be tried first.
Then, for each template of length K, it fills it with a subset of length K of the N abducibles, one at a time, on backtracking.
The predicate join_with_op builds an expression from a sequence of abducible literals (atoms, possibly negated) with a given operator.
How we join the abducible literals with help of a given operator, is different for associative and commutative operators like & and v (the default 3-rd clause of join_with) and ->,
,
, that we treat as special cases.
Thus, once the head was picked with select/3, the order of the remaining literals is immaterial.
For non-associative
we will use all permutations of the abducibles.
Finally, as v and & are permutation invariant, we just call join_with_op.
Implication and reverse implications are handled in join_with, knowing that their components, except the head, are permutation invariant, with the following equivalences in mind:
and
Note that these hold both intuitionistically and classically, as it can be quickly verified with iprover and cprover.
3.3 The weakest protasis
The next step is defining a weakest protasis, keeping in mind that a partial order Footnote 6 among them is defined by the intuitionistic implication (->). First, we will collect with setof/3 all the candidate assumptions to ensure that the prover is called on each only once.
Next, we ensure that a weakest protasis is such that it does not imply any other protasis, thus that it is a minimal element w.r.t. our partial order. We rely for that on the predicate weakest_with/3:
The partial order relation is exposed as the predicate weaker_with/3 which ensures that a weakest protasis does not imply any other protasis, including ones that might imply it.
Note that the predicate weakest_protasis/6 depends on the same parameters as any_protasis, in particular on the Prover implementing a given provability relation.
Example 3 Peirce’s law is known to hold in CL and not hold in IL. In fact, it can turn IL into CL if added as an axiom. The predicate peirce/2 will try to synthesize an assumption that would make it hold.
When running it we get:
This reveals an interesting fact. It tells us that if |p v p| were assumed, Peirce’s law would hold in IL, as iprove would succeed. As it is well known, |p v p| would turn IL into CL and cprove tells us that indeed, Peirce’s law holds unconditionally in CL.
Example 4 We can also synthesize conditional assumptions when using implication or inverse implication as our aggregator connective. After defining:
we obtain:

showing that the implication d->c (equivalent of the Horn Clause c:-d) should hold for the formula to be a theorem. This illustrates a mechanism to synthesize Horn Clauses playing the role of conditional assumptions.
Another interesting case is that of a contradiction. After defining contra_test/1 as:
and running it with:
we can see that no assumption would make the contradiction a tautology, and this will also be the case for Prover=cprover. Note that to ensure this, we have enforced in the definition of any_protasis that such assumptions should themselves not be contradictions.
Example 5 In the case of the logic of here-and-there (Pearce Reference Pearce1997), derived from IL by adding the axiom
| f v (f->g) v g|
as shown in Lifschitz et al. (Reference Lifschitz, Pearce and Valverde2001), we will get with cprover the protasis true. This indicates, as expected, that it is already a theorem in CL and thus also a theorem in the logic of here-and-there.
On the other hand, the less obvious weakest protasis obtained for iprove indicates that the excluded middle rule would be needed for both f and g.
3.4 An example of intuitionistic abductive reasoning
With the logic of synthesizing meaningful minimal assumptions that make a formula a theorem clarified, we are now ready to revisit abductive reasoning along the lines of Eshghi and Kowalski (Reference Eshghi and Kowalski1989). The predicate explain_with/5 finds, given a Prover, the abductive inference problem parameterized by:
-
a formula Prog seen here as representing a knowledge base
-
a set of Abducibles occurring in Prog
-
a goal formula G such that Prog -> G should always hold
-
a formula IC playing the role of integrity constraints meant to filter out unwanted assumptions
Note also that any_protasis replaces weakest_protasis in this definition, given that minimality might want to be stated as part of the integrity constraints IC.
Example 6 To revisit a simple example of abductive explanation generation, we define:
Then, when running it, it will display, as expected:
4 Synthesis of minimal canonical assumptions
We will now generalize our abductive reasoning mechanism by lifting the constraint on the premise of our sequent from literals connected by a single operation to a canonical form that has been shown to be able to represent arbitrary IL formulas.
4.1 The Mints transformation
Grigori Mints has proven, in his seminal paper studying complexity classes for intuitionistic propositional logic (Mints Reference Mints1992), that any formula f is equiprovable to a formula of the form
$X_f \rightarrow g$
, where
$X_f$
is a conjunction of formulas of one of the forms:
With introduction of new variables (like with the Tseitin transform for SAT or ASP solvers), the transformation runs in linear space and time. Note that as a premise to a sequent can be seen as a conjunction implying its conclusion, the conjunction of the formulas described by Mints can be seen as serving the same purpose as the conjunctive normal form (CNF) in classical logic.
Thus, by generating this set of bounded size formulas as premises of a sequent, we can express equivalent formulas of unbounded size, otherwise subject to a much larger search space in the formula synthesis process.
We will now generate, using a given set of abducibles, premises built of these formulas, with their propositional variables selected from the set of abducibles.
Conceptually, while we will keep calling the propositional variables involved in our premise abducibles, we shall see them from now on simply as a set of independent variables on which the derivation of the sequent’s conclusion from its premise depends.
We define a generator for the set of Mints formulas with help of a DCG grammar Footnote 7 that collects its propositional variables from a list of abducibles.
We extend our DCG, subject to the same limitation on available abducibles, to generate a list of formulas meant to be part of the premise. We will later aggregate this list into a conjunction.
Next, we eliminate duplicates with Prolog’s sort/2.
We derive any_mints_premise/4 in a way similar to any_protasis/6, except that the arguments WithNeg and AggregatorOp become unnecessary and multiple occurrences of any abducible need to be supported. For brevity, we explain our steps as comments in the code.
Note that we have limited the length of the premise in the case of the Mints-formulas, arbitrarily, to the number of abducible atoms, that the selection of atoms has as an upper bound. For more flexibility, this can be lifted to be based on a length parameter passed to any_mints_premise.
4.2 Labeling the variables in the Mints formulas
We will describe here the implementation of part_as_equiv/2 that will be used to to generate variables bound to possibly repeated occurrences of each atom. Note that equalities of logic variables define equivalence classes that correspond to partitions of the set of variables. We implement this simply by selectively unifying them.
The predicate part_as_equiv/2 takes a list of distinct logic variables and generates partitions-as-equivalence-relations by unifying them “nondeterministically”. It also collects the unique variables defining the equivalence classes, as a list given by its second argument. It works reversibly, when unique values are given as its second argument and a bound list of free variables as its first.
To implement it, we split a set repeatedly in subset+complement pairs with help from the predicate complement_of/2.
Example 7 Here, we are interested in the reverse use of part_as_equiv, with the list of unique variables as input and a sequence of variables of fixed length but possibly repeated occurrences as output.
We derive weakest_mints_premise/4 in a way similar to weakest_protasis/6 except for passing only the relevant arguments to any_mints_premise/4.
Example 8 When using the axiom that conservatively extends IL to the logic of here-and-there Lifschitz et al. (Reference Lifschitz, Pearce and Valverde2001) we observe again that no premise is needed for cprover and that iprover suggests as premises either one of the disjuncts in the axiom, or, more interestingly, |g-> g|.
In fact, we observe:

suggesting that extending IL with:
|f v (f->g) v (g -> g)|
would result in an alternative axiomatization of the logic of here-and-there.
5 Discussion
We hope that the astute reader is aware at this point that the paper is an exploration of the theory behind some fundamental concepts relating abductive reasoning, program synthesis and theorem proving in a concise and easily replicable form, facilitated by the choice of Prolog as our meta-language, but with the possibility of a fairly routine transliteration to a traditional “formulas-on-paper” presentation in mind. As such, the paper can be seen as an executable specification of these concepts. While not neglecting minimal efforts for efficient execution, and some elegance in the coding style, our main priority was to ensure that the paper conveys its message as a fully self-contained literate program.
We have designed our abductive reasoning logic entirely in a proof-theoretical framework, in contrast to the usual model-theoretical semantics, arguably in the original spirit of intuitionistic logic.
Both our weakest protasis-based and weakest Mints formulas-based synthetic assumptions are attempts to recover in IL an analogue of the CNF available for a formula in CL. At the same time, finding the weakest assumptions shares the focus on minimal models encountered in various logic calculi. Our interest in finding weakest assumptions under which the formula becomes a theorem is driven by the transitivity of the partial order induced by ->, given that for a given formula f, becoming a theorem under the assumption w, ensures also that if (s->w), then (s->f) is also a theorem, where w denotes a weakest assumption and s denotes a (stronger) assumption that implies it.
We have restricted ourselves to propositional logic but we foresee extensions to stronger logics among which Monadic First Order Logic (known as decidable for CL and undecidable for IL), enhanced with Prolog’s constraint solving mechanisms is a promising option.
While we have forced a clear separation between our meta-language (Prolog) and object-language (IL), it would be quite easy to extend our theorem prover to reflect Prolog’s negation as failure in the object-language as an addition to IL. This would result in a logic with two flavors of negation, similar in the context of IL to the underlying equilibrium logic of ASP.
6 Related work
We refer to Denecker and Kakas (Reference Denecker and Kakas2002) as still the most lucid and comprehensive overview (also citing 124 papers) on abductive reasoning in Logic Programming and to Eshghi and Kowalski (Reference Eshghi and Kowalski1989) as one of the most influential initiators for the interest in the field, with connections explored in depth to negation as failure and non-monotonic reasoning. Some of our examples related to the logic of here-and-there and equilibrium logic (Pearce Reference Pearce1996; Pearce et al. Reference Pearce, de Guzmán and Valverde2000) originate in Lifschitz et al. (Reference Lifschitz, Pearce and Valverde2001), where intermediate logics relevant for the foundation of ASP systems are overviewed. For abductive reasoning in the context of several logics including non-monotonic ones, we mention Gabbay and Olivetti (Reference Gabbay and Olivetti2002) and Gabbay (Reference Gabbay2000).
By contrast, the novelty of our approach is the generalized view of abductive reasoning as an instance of program synthesis controlled by a theorem prover. Our theorem prover is derived directly from the G4ip sequent calculus Dyckhoff (Reference Dyckhoff1992); Dyckhoff (Reference Dyckhoff2016). In Tarau (Reference Tarau2019) details of this derivation process as well as a combinatorial testing framework used to insure correctness are given. The idea of using a theorem prover for the synthesis of modal formulas is also present in Tarau (Reference Tarau2020), having as an outcome an embedding of the epistemic logic IEL in IL and a derived theorem prover for that logic. In Tarau and de Paiva (Reference Tarau and de Paiva2020) a theorem prover, restricted to the implicational fragment of IL is used to derive a theorem prover for implicational linear logic, with help from the Curry-Howard correspondence and the use of linearity of the resulting lambda terms as a filtering mechanism. In this context, the distinct focus of the current paper is on a very general formula synthesis mechanism within IL itself, covering abductive reasoning and emulating in IL key semantic concepts available in CL and intermediate logics.
7 Conclusions
We have presented a fully executable specification of a generalized abductive reasoning framework, that can be relatively easily ported to any logic for which a decision mechanism exists (e.g., as provided by a theorem prover). In particular, this applies to several interesting intermediate logics among which the equilibrium-logic (relevant as a foundation of ASP systems) as well as modal logics and their instantiations as alethic, temporal, deontic or epistemic systems. Besides providing (in the form of the concept of weakest protasis) an analogue of the unavailable truth-table models for intuitionistic formulas, we have also generalized our abduced sequent premises to use minimal canonical formulas to which arbitrary IL formulas can be broken down, with the potential of synthesizing salient assumptions that would make a given formula a theorem. When the underlying logic is used to model a set of safety constraints that should always hold, this generalized abduction synthesis could reveal critical missing assumptions, not just as literals but also as a conjunction of interdependencies among them.