The ghosts of forgotten things: A study on size after forgetting

Forgetting is removing variables from a logical formula while preserving the constraints on the other variables. In spite of being a form of reduction, it does not always decrease the size of the formula and may sometimes increase it. This article discusses the implications of such an increase and analyzes the computational properties of the phenomenon. Given a propositional Horn formula, a set of variables and a maximum allowed size, deciding whether forgetting the variables from the formula can be expressed in that size is $D^p$-hard in $\Sigma^p_2$. The same problem for unrestricted propositional formulae is $D^p_2$-hard in $\Sigma^p_3$.


Introduction
Several articles mention simplification as an advantage of forgetting, if not its motivation.Forgetting means deleting pieces of knowledge, and less is more.Less knowledge is easier to remember, easier to work with, easier to interpret.To cite a few: • "With an ever growing stream of information, bounded memory and short response time suggest that not all information can be kept and treated in the same way.[...] forgetting [...] helps us to deal with information overload and to put a focus of attention" [13].
• "For example, in query answering, if one can determine what is relevant with respect to a query, then forgetting the irrelevant part of a knowledge base may yield more efficient query-answering" [9].
• "Moreover, forgetting may be applicable in summarising a knowledge base by suppressing lesser details, or for reusing part of a knowledge base by removing an unneeded part of a larger knowledge base, or in clarifying relations between predicates" [8].
• "For performing reasoning tasks (planning, prediction, query answering, etc.) in an action domain, not all actions of that domain might be necessary.By instructing the reasoning system to forget about these unnecessary/irrelevant actions, without changing the causal relations among fluents, we might obtain solutions using less computational time/space" [15].• "There are often scenarios of interest where we want to model the fact that certain information is discarded.In practice, for example, an agent may simply not have enough memory capacity to remember everything he has learned" [16].
• "The most immediate application of forgetting is to model agents with limited resources (e.g., robots), or agents that need to deal with vast knowledge bases (e.g., cloud computing), or more ambitiously, dealing with the problem of lifelong learning.
In all such cases it is no longer reasonable to assume that all knowledge acquired over the operation of an agent can be retained indefinitely" [33].
• "For example, we have a knowledge base K and a query Q.It may be hard to determine if Q is true or false directly from K.However, if we discard or forget some part of K that is independent of Q, the querying task may become much easier" [41].
• "To some extent, all of these can be reduced to the problem of extracting relevant segments out of large ontologies for the purpose of effective management of ontologies so that the tractability for both humans and computers is enhanced.Such segments are not mere fragments of ontologies, but stand alone as ontologies in their own right.
The intuition here is similar to views in databases: an existing ontology is tailored to a smaller ontology so that an optimal ontology is produced for specific applications" [12].
These authors are right: if forgetting simplifies the body of knowledge then it is good for reducing the amount of information to store, for increasing the efficiency of querying it, for clarifying the relationships between facts, for obtaining solutions more easily, for retaining by agents of limited memory, for tailoring knowledge to a specific application.If forgetting simplifies the body of knowledge, all these motivations are valid. If.
What if not?What if forgetting does not simplify the body of knowledge?What if it complicates it?What if it enlarges it instead of making it smaller?
This looks impossible.Forgetting is removing.Removing information, but still removing.Removing something leaves less, not more.What remains is less than what before, not more.Forgetting about d, e, f and g in the formula depicted on the left of Figure 1 only leaves information about a, b and c.This is the prototypical scenario of forgetting, the first that comes to mind when thinking about removing information: some information goes away, the rest remains.The rest is a part of the original.Smaller.Simpler.Easier than that to store, to query, to interpret.But prototypical does not mean exclusive.
Forgetting x from the formula on the left of Figure 2 complicates it instead of simplifying it.Whenever a, b and c are the case so is x.And x implies n, m and l.Like the neck of an hourglass, x funnels the first three variables in the upper bulb to the last three in the lower.Without it, these links need to be spelled out one by one: a, b and c imply n; a, b and c imply m; a, b and c imply l.The variable x acts like a shorthand for the first three variables together.Removing it forces repeating them.
Forgetting x deletes x but not its connections with the other variables.The lines that go from a, b and c to n, l and m survive.Like a ghost, x is no longer there in its body, but in its spirit: its bonds.These remain, weaved where x was.
The formula resulting from forgetting is still quite short, but this is only because the example is designed to be simple for the sake of clarity.Cases with larger size increase due to forgetting are easy to find.Forgetting a single variable never increases size much, but forgetting many may increase size exponentially.
The size of the formula resulting from forgetting matters for all reasons cited by the authors above.To summarize, it is important for: 1. sheer memory needed; 2. the cost of reasoning; formulae that are difficult for modern solvers are typically large; while efficiency is not directly related to size, small formulae are usually easy to solve; 3. interpreting the information; the size of a formula tells something about how much the forgotten variables are related to the others.
These points are relevant to different research areas: for example, Delgrande and Wang [9] mention the second point regarding disjunctive logic programming; Erdem and Ferraris [15] do the same in the context of reasoning about actions.The third point is cited in the general survey on forgetting by Eiter and Kern-Isberner [13] and in the article that generalizes forgetting across different logics by Delgrande [8].
This witnesses that the problem of size after forgetting is relevant to different logics.Many of them generalize or can express propositional logic or Horn logic as a subcase.These are the two logics considered here, as greater common divisors of them.
The figures visualize forgetting as a cut between what is remembered and what is forgotten.This cut may divide parts that are easy to separate like in the first figure or parts that are not natural to separate like in the second figure.The first cut glides following the direction of the fabric of the knowledge base.The second is resisted by the connections it cuts.
The number of these connections does not tell the difference.How closely they hold together the parts across the cut does.Even if the links in the first example were c → d 1 , . . ., c → d 100 instead of c → d, the result would be the same.What matters is not how many links connect the parts across the cut, but how they do.
An increase of size gauges the complexity of these connections.The first example is easy to cut because its implications are easy to ignore: c may imply d, but if d is forgotten this implication is removed and nothing else changes.The second example is not so easy to cut: forgetting x does not just remove its implication from a, b and c; it shifts its burden to the remaining variables.
A size increase suggests that the forgotten variables are closely connected to the remaining ones.If forgetting is aimed at subdividing knowledge, it would be like the chapter on Spain next to that of Samoa and far away from France in an atlas.The natural division is by continents, not initials of the name.In general, the natural divisions are by topics, so that things closely connected stay close to each other.Forgetting about Samoa when describing Spain is easier than forgetting about France.Neglecting some obscure diplomatic relations is more natural than neglecting a bordering country.
Forgetting may be abstracting [28].Cold weather increases virus survival, which facilitates virus transmission, which causes flu.Forgetting about viruses: cold weather causes flu.But forgetting is not always natural as an abstraction.A low battery level, a bad UPS unit and a black-out cause a laptop not to start; which causes a report not to be completed, a movie not to be watched and a game not to be played.Forgetting about the laptop is a complication more than an abstraction: the three preconditions cause the first effect, they cause the second effect, and they cause the third effect.If x is the laptop not starting, this is the example in the second figure, where forgetting increases size.That cold weather causes cold is short, simple, a basic fact of life for most people.Brevity is the soul of abstraction.
In summary, a short formula is preferred for storage and computational reasons.The size of the formula after forgetting is important for epistemological reason, to evaluate how natural a partition or abstraction of knowledge is.Either way, the question is: how large is a formula after forgetting variables?
The question is not as obvious as it looks.Several formulae represent the same piece of knowledge.For example, a ∨ (¬a ∧ b) is the same as the shorter a ∨ b.The problem of formula size without forgetting eluded complexity researchers for twenty years: it was the prototypical problem for which the polynomial hierarchy was created in the seventies [36], but framing it exactly into one of these classes only succeeded at the end of the nineties [39].This is the problem of whether a formula is equivalent to another of a given size.
The problem studied in this article is whether forgetting some variables from a formula is equivalent to a formula of given size.
Forgetting is not complicated.A simple recipe for forgetting x from F is: replace x with true in F , replace x with false in F , disjoin the two resulting formulae [22].If F is in conjunctive normal form, another recipe is: replace all clauses containing x with the result of resolving them [42,8,34].The first solution may not maintain the syntactic form of the formula.None of them is guaranteed to produce a minimal one.
Forgetting no variable from a formula results in the formula itself.Insisting on forgetting something does not change complexity: every formula F is the result of forgetting x from F ∧ x if x is a variable not in F .The complexity of the size of F is a subcase of the size of forgetting x from F .It is however not an interesting subcase: the question is how much size decreases or increases due to forgetting.If F has size 100 before forgetting and 10 after, this looks like a decrease, but is not if F is equivalent to a formula of size 5 before forgetting and to none of size 9 or less afterwards.This is a size increase, not a decrease.
The main results of this article are the complexity characterization of this problem in the Horn and general propositional case: the problem is D p -hard and belongs to Σ p 2 when the formula is Horn; it is D p 2 -hard and in Σ p 3 for arbitrary CNF formulae.A detailed plan of the article follows.
After Section 2 introduces some basic concepts like resolution, Section 3 formally defines forgetting and gives some results about size.Thanks to equivalence, forgetting can be expressed in several ways: if F ′ expresses forgetting some variables from a formula, every formula F ′′ equivalent to F ′ does.Some equivalent formulations of forgetting are given, as well as some ways to compute forgetting.
Section 4 shows the complexity of the problem in the Horn restriction.It comes before the general case because of its slightly simpler proofs.The problem is D p -hard and belongs to Σ p 2 .
Section 5 shows that the problem is D p 2 -hard and belongs to Σ p 3 for arbitrary CNF formulae.In both cases, hardness is more difficult to prove than membership; on the other hand, it extends to logics that include propositional or Horn logics as subcases.For example, since modal logics extend propositional logics, the problem of size of forgetting is D p 2-hard.
A number of examples and counterexamples rely on calculating the resolution closure of a formula, its minimal equivalent formulae, the result of forgetting a variable from it and the minimal formulae equivalent to that.The program minimize.pydoes these operations on the formula it reads from another file, for example allvariables.pyor outresolve.py.It is currently available at https://github.com/paololiberatore/minimize.pytogether with the files that contain the formulae mentioned in this article.

Formulae
The formulae in this article are all propositional in conjunctive normal form (CNF): they are sets of clauses, a clause being the disjunction of some literals and a literal a propositional variable or its negation.This is not truly a restriction, as every formula can be turned into CNF without changing its semantics.A clause is sometimes identified with the set of literals it contains.For example, a subclause is a subset of a clause.
If l is a negative literal ¬x, its negation ¬l is defined as x.
The variables a formula A contains are denoted Var(A).

Definition 1
The size ||A|| of a formula A is the number of variable occurrences it contains.
This is not the same as the cardinality of Var(A) because a variable may occur multiple times in a formula.For example, A = {a, ¬a ∨ b, a ∨ ¬b} has size five because it contains five literal occurrences even if its variables are only two.The size is obtained by removing from the formula all propositional operators, commas and parentheses and counting the number of symbols left.
Other definitions are possible but are not considered in this article.An alternative measure of size is the total number of symbols a formula contains (including conjunctions, disjunctions, negations and parenthesis).Another is the number of clauses (regardless of their length).
The definition of size implies the definition of minimality: a formula is minimal if it is equivalent to no formula smaller than it.Given a formula, a minimal equivalent formula is a possibly different but equivalent formula that is minimal.As an example, A = {a, ¬a ∨ b, a ∨ ¬b} has size five since it contains five literal occurrences; yet, it is equivalent to B = {a, b}, which only contains two literal occurrences.No formula equivalent to A or B is smaller than that: B is minimal.Minimizing a formula means obtaining a minimal equivalent formula.This problem has long been studied [21,5].

Definition 2 The clauses of a formula A that contain a literal l are denoted by
This notation cannot cause confusion: when is between two sets, the symbol ∩ denotes their intersection; when is between a set and a literal, it denotes the clauses of the set that contain the literal.This is like seeing A∩l as the shortening of A∩clauses(l), where clauses(l) is the set of all possible clauses that contain the literal l.

Resolution
Resolution is a syntactic derivation mechanism that produces a new clause that is a consequence of two clauses: The result is implicitely removed repetitions.Sometimes ⊢ R is used in place of ⊢ to emphasize the use of resolution as the syntactic derivation rule.This is unnecessary in this article since no other derivation rule is ever mentioned.
Unless noted otherwise, tautologic clauses are excluded.Writing c 1 ∨ a, c 2 ∨ ¬a ⊢ c 1 ∨ c 2 implicitly assumes that none of the three clauses is a tautology unless explicitly stated.Two clauses that would resolve in a tautology are considered not to resolve, which is not a limitation [27].Tautologic clauses are forbidden in formulae, which is not a limitation either since tautologies are always satisfied.This assumption has normally little importance, but is crucial to superredundancy, a concept defined in the next section.
In what follows tautologies are excluded from formulae and from resolution derivations.As a result, resolving two clauses always generates a clause different from them.
A resolution proof F ⊢ G is a binary forest where the roots are the clauses of G, the leaves the clauses of F and every parent is the result of resolving its two children.

Definition 3
The resolution closure of a formula F is the set ResCn(F ) = {c | F ⊢ c} of all clauses that result from applying resolution zero or more times from F .
The clauses of F are derivable by zero-step resolutions from F .Therefore, F ⊢ c and c ∈ ResCn(F ) hold for every c ∈ F .
The resolution closure is similar to the deductive closure but not identical.For example, a ∨ b ∨ c is in the deductive closure of F = {a ∨ b} but not in the resolution closure.It is a consequence of F but is not obtained by resolving clauses of F .
All clauses in the resolution closure ResCn(F ) are in the deductive closure but not the other way around.The closures differ because resolution does not expand clauses: a ∨ b ∨ c is not a resolution consequence of a ∨ b.Adding expansion kills the difference [23,35].
That resolution does not include expansion may suggest that it cannot generate any nonminimal clause.That would be too good to be true, since a clause would be minimal just because it is obtained by resolution.In fact, it is not the case.Expansion is only one of the reasons clauses may not be minimal, as seen in the formula {a∨b∨c, a∨b∨e, ¬e∨c ∨d}: the second and third clauses resolve to a ∨ c ∨ b ∨ d, which is however not minimal: it contains the first clause of the formula, a ∨ b ∨ c.
What is the case is that resolution generates all prime implicates [23,35], the minimally entailed clauses.The relation between ResCn(F ) and the deductive closure of F tells that if a clause is entailed, a subset of it is generated by resolution; since the only entailed subclause of a prime implicate is itself, it is the only one resolution may generate.Removing all clauses that contain others from ResCn(F ) results in the set of the prime implicates of F .
While ResCn(F ) contains all clauses generated by an arbitrary number of resolutions, some properties used in the following require the clauses obtained by a single resolution step.This set contains only the clauses that results from resolving a single clause of A with a single clause of B. Exactly one resolution of one clause with one clause.Not zero, not multiple ones.A clause of A is not by itself in resolve(A, B) unless it is also the resolvent of another clause of A with a clause of B.
A clause of a formula is superredundant if it is redundant in the resolution closure of the formula [25]: ResCn(F )\{c} |= c.The following properties of superredundancy and superirredundancy are used in this article.

Lemma 1 ([25]) If a formula contains only superirredundant clauses, it is minimal.
Lemma 2 ( [25]) If no two clauses of F resolve, then a clause of F is superredundant if and only if F contains a clause that is a strict subset of it.

Forgetting
Forgetting is defined semantically: no specific formula is given as the unique result of forgetting variables from another.Several equivalent formulae may express forgetting the same variables from the same formula.The definition sets a constraint over B rather than uniquely defining a specific formula.Every formula B fits it as long as it is built over the right variables and has the right consequences.
Syntax is irrelevant to this definition.As it should: every B ′ that is syntactically different but equivalent to B carries the same information.There is no reason to confer A[true/x] ∨ A[false/x] a special status among all formulae holding the same information.Every formula equivalent to it, every formula that entails the same formulae is an equally valid result of forgetting.
The definition captures this parity among formulae by not defining forgetting as a single specific formula and then delegating the definition of its alternatives to equivalence.If B expresses forgetting some variables from A and B ′ is equivalent to B and contains the same variables, then B ′ also expresses forgetting the same variables from A. This is because equivalence implies equality of consequences.
The following Section 3.1 discusses the main focus of the analysis of this article: the size of a formula when variables are forgotten from it; it is followed by the equivalent ways of defining forgetting in Section 3.2; the subsequent Section 3.3 shows how to actually compute forgetting in general and in two specific cases; finally, Section 3.4 proves that in some cases, certain literals are always in the result of forgetting, which is important when computing the size after forgetting.

Size of forgetting
Many formulae B express forgetting the same variables X from a formula A. Some may be large and some may be small.Producing an artificially large formula is straightforward: if {a ∨ b, b ∨ c} expresses forgetting, also {a ∨ b, b ∨ c, ¬a ∨ a, a ∨ b ∨ ¬c} does: adding tautologies and consequences does not change the semantics of a formula.The question is not whether a large expression of forgetting exists.
The question is whether a small expression of forgetting exists.In this context, "small" means "of polynomial size".Technically: given a formula A and a set of variables X, does any formula of size polynomial in that of A express forgetting X from A?
Forgetting each variable x from the CNF formula A is expressed by A[true/x]∨A[false/x], which can be converted back into a CNF of quadratic size.Forgetting many variables this way produces an exponentially large formula.Yet, this formula may be equivalent to a short one.This is not the case for all formulae.That would have unlikely consequences on the complexity hierarchy [22].Yet, it is the case for some formulae.It depends on the formula.For example, forgetting variables from negation-free CNF formulae amounts to removing the clauses that contain these variables.The question is whether expressing forgetting can be done in small space for a specific formula.This will be proved D p -hard and in Σ p 2 for Horn formulae, and D p 2 -hard and in Σ p 3 for unrestricted CNF formulae.The existing literature provides mechanisms for forgetting variables from a formula and results about the minimal size of expressing forgetting for all formulae.They leave open the question in between: the minimal size of expressing forgetting for a formula.An example result of the first kind is: "Salient features of the solution provided include linear time complexity, and linear size of the output of (iterated) forgetting" [1]: given a formula, the size of forgetting is linear.An example result of the second kind is: "the size of the result of forgetting may be exponentially large in the size of the input program" [8]: forgetting may produce exponentially large formulae when considering all possible input formulae.It may, not must.For some formulae, forgetting may not increase size.The only hardness result about this problem has been published by Zhou [46]; it is discussed in a following section.Other authors reported worst-case results [15,14], and some the opposite, as certain forgetting mechanisms of certain logics can be expressed in polynomial size [19].
Forgetting propositional variables is also called variable elimination, especially in the context of automated reasoning [11]: it is a way to simplify a formula before processing.As such, it has stricter efficiency requirements than general forgetting.For example, the NiVER preprocessor "resolves away a variable only if there will be no increase in space" [37].A quadratic increase would be too much, given the aim of reducing the overall runtime of automated reasoning.
Forgetting is often identified by its dual concept of uniform interpolation, especially in first-order, modal and description logics [4].While forgetting is always expressible in exponential space in propositional logics, uniform interpolants in other logics may be larger, if they exist at all.For example, their size is at least triple-exponential in certain description logics, provided that they exist [31].Analogous to the question of checking their size is checking their existence [2].

Equivalent conditions
Forgetting could be based on consistency rather than inference.Or it could be based on models.It would still be the same, at least in propositional logic because of the way inference, consistency and models are related.For example, since mutual consistency is the exact opposite of inference, forget is equivalently defined in terms of equisatisfiability.

How to forget
Three properties related to computing forgetting are proved: it can be performed one variable at time, it can be performed by resolution, and it may be performed on the independent parts of the formula, if any.
The first property is an almost direct consequence of the definition.
Lemma 6 [8] If B expresses forgetting the variables Y from A and C expresses forgetting the variables

Forgetting is expressed by
While this formula can be turned into CNF, directly combining clauses is more convenient when working on CNFs.
Forgetting can be performed by resolution, as proved by Delgrande and Wassermann [10] in the Horn case and extended to the general case by Wang [42] and Delgrande [8].The function resolve(A, B) provided by Definition 4 gives the clauses obtained by resolving each clause of A with each clause of B, if they resolve.The notation A∩l introduced in Definition 2 gives the clauses of A that contain the literal l.
Forgetting a single variable is not a limitation because Lemma 6 tells that forgetting a set of variables can be performed one variable at time: forgetting x first and Y \{x} then is the same as forgetting Y .
The problem is that forgetting this way may produce non-minimal formulae even from minimal ones.For example, A = {a ∨ b ∨ x, ¬x ∨ c, a ∨ c} is minimal, but resolving x out to forget it produces {a ∨ b ∨ c, a ∨ c}, which is not minimal since the first clause is entailed by the second.The proof that A is minimal is long and tedious, and is therefore omitted.The formulae in the outresolve.pyfile of minimize.pyshow similar examples where the formula obtained by resolving out a variable either contains a redundant literal or is irredundant although not minimal.
Since resolving Horn clauses produces Horn clauses, this theorem indirectly shows that forgetting variables from Horn formulae is expressed by a Horn formula [10].That formula may not be minimal, yet its minimal equivalent formulae cannot be non-Horn: as mentioned in Section 2.2, resolution derives all clauses of all minimal equivalent formulae.
When a formula comprises two independent parts with no shared variable, forgetting from the formula is the same as forgetting from the two parts separately.This property is used in the following hardness proofs that merge two polynomial-time reductions.
Lemma 7 [6,22] Let A and B be two formulae built over disjoint alphabets:

Necessary literals
Finding a minimal version of a formula is difficult [29,38,18].Finding a minimal formula expressing forgetting is further complicated by the addition of forgetting.Determining the exact complexity of this problem proved difficult; not so much for membership to classes in the polynomial hierarchy but for hardness.Fortunately, proving hardness does not require finding the minimal size of arbitrary formulae, just for the formulae that are targets of the reduction.NP-hardness is for example proved by translating a formula (to be checked for satisfiability) to another formula and a set of variables (where the variables have to be forgotten from the formula).Such a reduction does not generate all possible formulae.Only for the ones generated by the reduction, the minimal size after forgetting is necessary.This is good news, because reductions do not generate all possible formulae.Rather the opposite: they usually produce formulae of a very specific form.Still better, a reduction can be altered to simplify computing the minimal size of the formulae it produces.If the minimal size is difficult to assess for the formulae produced by a reduction, the reduction itself can be changed to simplify them.
The reductions used in this article rely on two tricks to allow for simple proofs.The first is that some clauses of the formulae they generate are in all minimal-size equivalent formulae; this part of the minimal size is therefore always the same.The second is that the rest of the minimal size depends on the presence or absence of certain literals in all formulae expressing forgetting; where these literals occur if present does not matter, only whether they are present or not.
The first trick is based on superredundancy [25], defined in Section 2.
The second requires proving that a literal is contained in all formulae that express forgetting.This is preliminarily proved when no forgetting is involved.When the next lemmas say "A contains l" they mean: A contains a clause that contains the literal l.
Since consistency with S and with S\{l} ∪ {¬l} are unaffected by syntactic changes, they are the same for all formulae equivalent to A. In other words, if the conditions of the lemma hold for A they also hold for every formula equivalent to A.
This property carries over to formulae expressing forgetting by constraining S to only contain variables not to be forgotten.

Lemma 9 If S ∪ {l} is a set of literals over the variables Y such that S ∪ A is consistent, but S\{l} ∪ {¬l} ∪ A is not, every CNF formula that expresses forgetting all variables except
Y from A contains a clause that contains l.
How is this lemma used?To prove that reductions from a problem to the problem of minimal size of forgetting work.Not all reductions can be proved correct this way.The ones used in this article are built to allow that.They generate a formula that contains a certain literal l that may or may not meet the condition of the lemma.Depending on this, l may or may not be necessary after forgetting.This is a +0 or a +1 in the size of the minimal formulae expressing forgetting.If the other literals occurrences are k, the minimal size is k + 0 or k + 1 depending on whether the conditions of Lemma 9 are met.
In order for this to work, the +0/ + 1 separation is not enough.Equally important to the k + 0 vs. k + 1 size is that the other addend k stays the same.This is the number of the other literal occurrences.The formulae produced by the reduction may or may not contain a literal l, but this is useless if the rest of the formula changes.For example, if k changes from 10 to 9 the total size is either 10 + 0 or 9 + 1, which are the same.Lemma 9 concerns the presence of l in a formula, but this tells its overall size only when the rest of the formula has a fixed form.This is ensured by superirredundancy [25], defined in Section 2.

Size after forgetting, Horn case
How much forgetting variables increases or decreases size?Given a formula A and a set of variables Y , how much space forgetting Y from A takes? Technically, how large is a formula expressing forgetting Y from A? A complexity analysis of a decision problem requires turning it into a yes/no question.Given k, A and Y , does a formula B of size bounded by k express forgetting?
This is a decision problem: each of its instances comprises a number k, a formula A and a set of variables Y ; the solution is yes or no.Yet, it may not always capture the question of interest.For example, A may be a formula of size 100 that can be reduced to size 20 by forgetting the variables Y .This looks like a good result: the resulting formula takes much less space to be stored, checking what can be inferred from it is usually easier, and its literals are probably related in some simple way.Yet, all of this may be illusory: formula A has size 100, but only because it is extremely redundant; it could be reduced to size 10 just by rearrangements, without forgetting anything.That forgetting can be expressed in size 20 no longer looks good.It is not even a size decrease, it is a size doubling.
If forgetting was required independent on size, and checking size is a side question, the problem still makes sense: is forgetting A expressed by a formula of size 20?If forgetting is done for size reasons, or for reasons that depend on size, the problem is not this but rather "does forgetting reduce size?" or "how much forgetting increases or decreases size?"These questions depend on the original size of the formula.The answer is not "20".It is rather "forgetting increases size from 10 to 20".It is certainly not "forgetting decreases size from 100 to 20", since the formula can be shrunk more without forgetting.
The solution is to disallow formulae of size 100 that can be reduced to 10 without forgetting.If a formula has size 100, it really has size 100.It is not the inflated version of a formula of size 10.This way, if size can be reduced from 100 to 20 when forgetting, this reduction is only due to forgetting, not to the original formula being larger than necessary.
The following lemmas and theorems include this assumption that the formula is minimal in size.For example, the problem of checking the size after forgetting is proved hard for the complexity class D p 2 when the formula is minimal.It is also proved to be in the class Σ p 2 .The proof of the latter also holds when the formula is not minimal: it holds in both cases.
In other words, the problem belongs to Σ p 2 even if the formula is not minimal.Without the assumption of minimality, it is already known to be Σ p 2 -hard [46].This seems to better characterize complexity than D p 2 -hard, but there is a caveat.The Σ p 2 -hardness proof only holds allowing the troublesome formulae, the ones that can be reduced size without forgetting.Actually, it relies on them.It hinges on them.The reduction used in the Σ p 2hardness proof turns a formula F into a formula such that forgetting a certain variable from it produces F ∧ G, where G is a formula of size 4.This specific conjunction F ∧ G can be represented in space k if and only if F can be represented in space k − 4. Since the problem of whether a formula can be represented in a given space is Σ p 2 -hard, the proof is technically correct.Yet, it proves the problem hard only in a specific case where the size after forgetting is the same as the size before forgetting (plus 4).This is not the question whether forgetting increases or decreases the size of a formula, it is whether the formula itself can be reduced size.It is like saying "this sweater is very warm, I tried it at noon during my trip to Tahiti".No surprise it feels warm, it was already warm at noon in Tahiti.The question is whether it would be warm in Yakutsk as well.
Not assuming minimality is not a detail, is crucial to the Σ p 2 -hardness proof.The result of the reduction trivalizes for minimal formulae, as a minimal formula can always be represented in its size and not less.The assumption of minimality in the hardness proofs of the present article is a technical mean to ensure that the size after forgetting is due to forgetting, not to the original formula being representable in less space than it currently is.
Checking whether forgetting Y from A can be expressed in space k is easy to be proved in Σ p 2 if k is unary or polynomially bounded by the size of A: all it takes is checking all formulae of size k for their equisatisfiability with all sets of literals S over the remaining variables by Theorem 1. Hardness is not so easy to prove, and in fact leaves a gap to membership: it is only proved D p -hard in this article.
Not that D p -hardness is easy to prove.It requires two long lemmas, one for a coNPhardness reduction and one for an NP-hardness reduction.These reductions have a form that allows them to be merged into a single D p -hardness reduction.
A generic NP-hardness reduction is "if F is satisfiable then forgetting takes space less than or equal to k and greater otherwise".Such reductions cannot be merged.An additional property is required: forgetting can never be expressed in size less than k.If this is also a property of a coNP-hardness reduction where the size bound is l, the overall size is always k + l or greater, with k + l being only possible when the first formula is satisfiable and the second unsatisfiable.
This explains why the lemmas are formulated with "equal to k" in one case and "greater than k" in the other.Their other peculiarity, that the formula generated by the reduction is required to be minimal, is due to the reasons explained before.
Lemma 10 There exists a polynomial algorithm that turns a CNF formula F into a minimal-size Horn formula A, a subset X C ⊆ Var(A) and a number k such that forgetting all variables except X C from A is expressed by a Horn formula of size k if F is unsatisfiable and only by Horn formulae of size greater than or equal to k + 2 if F is satisfiable.
This lemma shows a polynomial reduction from propositional unsatisfiability to the problem of forget size in the Horn case.As for all polynomial reductions, it translates a formula F without knowing its satisfiability, which however affects the minimal size of expressing forgetting.
Being a polynomial reduction from propositional unsatisfiability, it proves the forgetting size problem coNP-hard.Yet, the lemma is not formulated this way.It instead predicates about the reduction itself.Only this way it could include the additional property that the minimal size is either k or at least k + 2. This allows merging it with another reduction to form a proof of D p -hardness.
The following lemma also shows the problem NP-hard: a formula F is satisfiable if and only if forgetting some variables from A can be expressed in a certain space.However, its statement refers to the reduction itself for the same reason of the previous lemma: it is necessary to the following proof of D p -hardness.
Lemma 11 There exists a polynomial algorithm that turns a CNF formula F into a minimal-size Horn formula A, a subset X C ⊆ Var(A) and a number k such that forgetting all variables except X C from A is expressed by a Horn formula of size k if F is satisfiable and only by Horn formulae of size greater than k otherwise.
Forgetting variables from the formulae A produced by the reduction can be done in polynomial time, just not minimally.In other words, if the reduction produces a formula A and a set of variables X C , forgetting X C from A can always be expressed by a possibly nonminimal formula B in polynomial time.The complete translation from F to B and k provides an alternative proof of NP-hardness of the minimality problem without forgetting [20]: given a Horn formula B, is there any formula of size k equivalent to it?
In the other way around, the existing proof of NP-hardness of the minimality problem without forgetting [20] could be used to show that the problem with forgetting is NP-hard.Yet, proving NP-hardness is not the final aim of this section.It is the D p -hardness when the formula is minimal.Minimality invalidates the existing proof.Lifting the NP-hardness reduction to D p -hardness requires forgetting never be expressible in size less than k, which the existing proof does not guarantee.
The problem of size after forgetting is the target of both a reduction from propositional satisfiability and from propositional unsatisfiability.This alone proves it both NP-hard and coNP-hard.These reductions have the additional property that forgetting variables from the formulae they generate cannot be expressed in size less than k.This allows merging them into a single D p -hardness proof.
Lemma 12 Checking whether forgetting some variables from a minimal-size Horn formula is expressed by a CNF or Horn formula bounded by a certain size is D p -hard.
Proving hardness takes most of this section, but still leaves a gap between the complexity lower bound it shows and the upper bound in the next theorem.The problem is D p -hard, which is just a bit above NP-hardness and coNP-hardness, but belongs to a class of the next level of the polynomial hierarchy: Σ p 2 .
Theorem 4 Checking whether forgetting some variables from a Horn formula is expressed by a CNF or Horn formula bounded by a certain size expressed in unary is D p -hard and in Σ p 2 , and remains hard even if the formula is restricted to be of minimal size.
The assumption that the size bound is represented in unary is technical.When formulated as a decision problem, the size of forgetting is the question whether forgetting certain variables X from a formula A is expressed by a formula of size k, but the actual problem is to find such a formula.If k is exponential in the size of A, a formula of size k may very well exist, but is unpractical to represent.Unless A is very small.The requirement that k is in unary forces the input of the problem to be as large as the expected output.If the available space is enough for storing a resulting formula of size k, it is also enough for storing an input string of length k, which k in unary is.In the other way around, representing k in unary witnesses the ability of storing a resulting formula of size k.The similar assumption "k is polynomial in the size of A" fails to include the case where A is very small but the space available for expressing forgetting is large.
The problem is D p -hard, and belongs to Σ p 2 .Theorem 4 leaves a gap between the lower bound of D p and the upper bound of Σ p 2 .According to what proved so far, the problem could be as easy as D p -complete or as hard as Σ p 2 -complete.Nothing in the results obtained so far favors either possibility.Actually, nothing indicates for certain that the problem is complete for either class; it could be complete for any class in between, like ∆ p 2 [log n] or ∆ p 2 .Anecdotal evidence hints that the problem is Σ p 2 -complete.The analogous problems without forgetting for unrestricted formulae kept a gap between NP and Σ p 2 for twenty years before being closed as Σ p 2 -complete [36,39].Proving membership was easy; proving hardness was not.This is a common pattern, not limited to formula minimization: in many cases, hardness is more difficult to prove than membership.Not always, but hardness proofs are often more complicated than membership proofs.The above lemmas are an example: several pages of proof for hardness, ten lines for membership.A proof of Σ p 2 -hardness may very well exist but is just difficult to find.As it was for the problem without forgetting.
All of this is anecdotal.Technically, the complexity of the problem could be anything in between D p and Σ p 2 .As a personal opinion, not based on the technical results, the author of this article would bet on the problem being Σ p 2 -complete.The missing proof of Σ p 2 -hardness could be an extension of that of Lemma 11, since both Σ p 2 and NP are based on an existential quantification.The extension of an already difficult proof would be further complicated by the addition of an inner universal quantification.
A way to partly close the issue is to further restrict the Horn case to make the problem to be ∆ p 2 -complete.The gap would close to its lower end for such a class of formulae.

Size after forgetting, general case
The complexity analysis for general CNF formulae mimics that of the Horn case.Two reductions prove the problem hard for the two basic classes of a level of the polynomial hierarchy.They are merged into a single proof that slightly increases the lower bound.A membership proof for a class of the next level ends the analysis.
The difference is that the level of the polynomial hierarchy is the second instead of the first.The two reductions prove the problem hard for ¶2 and Σ p 2 .They are merged into a D p 2 -hardness proof.Finally, the problem is located within Σ p 3 .As for the Horn case, the first lemma proves the problem ¶2-hard, but is formulated in terms of the reduction because the reduction is needed to raise the lower bound to D p 2 -hard.
Lemma 13 There exists a polynomial algorithm that turns a CNF formula F into a minimal-size CNF formula A, a subset X C ⊆ Var(A) and a number k such that forgetting all variables from A except X C is expressed by a CNF formula of size k if ∀X∃Y.F is valid and only by CNF formulae of size k + 2 or greater otherwise.
The second lemma is again about a reduction.Its statement implies that the problem is Σ p 2 -hard, but it predicates about the reduction rather than the hardness.This allows it to be merged with the first lemma into a proof of D p 2 -hardness.The existing proof of Σ p 2 -hardness of the problem without forgetting [39] also proves the problem with forgetting Σ p 2 -hard, but does not allow such a merging and does not hold in the restriction of minimal formulae.
Lemma 14 There exists a polynomial algorithm that turns a DNF formula and a number k such that forgetting all variables except X C from A is expressed by a CNF formula of size k if ∃X∀Y.F is valid, and only by larger CNF formulae otherwise.
As anticipated, the two reductions merge into one that proves the problem of forgetting size D p 2 -hard.
Lemma 15 Checking whether forgetting a given set of variables from a minimal-size CNF formula is expressed by a CNF formula bounded by a certain size is D p 2 -hard.
The next theorem adds a complexity class membership to the hardness of the problem of size of forgetting proved in the previous lemma.
Theorem 5 Checking whether forgetting some variables from a CNF formula is expressed by a CNF formula of a certain size expressed in unary is D p 2 -hard and in Σ p 3 , and remains hard even if the CNF formula is restricted to be of minimal size.
The technical assumption that the size bound is expressed in unary is the same as in Theorem 4; it is motivated after that theorem.

Conclusions
Forgetting variables from formulae may increase size, instead of decreasing it.This phenomenon is already recognized as a problem [9,3].Deciding whether it takes place or not for a specific formula and variables to forget is difficult.While checking inference is polynomial in the Horn case, checking whether forgetting is expressed by a formula of a certain maximal size is at least D p -hard, which implies it both NP-hard and coNP-hard; the same for the general case, where inference is coNP-hard but checking size after forgetting is at least D p 2 -hard.
The precise characterization of complexity is an open problem.For Horn formulae the problem is proved D p -hard and is in Σ p 2 , which leaves a large gap between the lower and the upper bound.The problem could be complete for D p .Or for Σ p 2 .Or for a class in between, like ∆ p 2 [log n] or ∆ p 2 .The same for the general case, where the problem is in Σ p 3 but only hard for D p 2 .The definition of the problem suggests that the actual complexity is the same as its upper bounds, Σ p 2 -complete and Σ p 3 -complete, but this is yet to be proved.Finding a subcase where the upper bound lowers to the hardness level would also be of interest.
While the problem is investigated in the general propositional case and in its Horn restriction, many other subcases of propositional logic are relevant.Forgetting is very easy on formulae in DNNF [7], as it amounts to simply removing literals.It is also easy for the Krom restriction [42] as resolving binary clauses always produces binary clauses, which are at most quadratically many.It may not on other tractable cases in Post's lattice [32].
Forgetting has variants and is defined for many logics other than propositional logic.The problem of size applies to all of them.What is its complexity?This article characterizes it for one version of forgetting in propositional logic.The other versions and the other logics are still open.Some results may apply to them as well.Logic programs embed Horn clauses; the hardness results for the Horn case may hold for them as well.More generally, how hard it is to check whether forgetting in logic programs is expressed within a certain size?How hard it is in first-order logic?In description logics?How hard it is when forgetting literals rather than variables?
The size after forgetting matters not only when forgetting variables, but also literals [22], possibly with varying variables [30].All variants inhibit the values of some variables to matter: forgetting variables makes their values irrelevant to the satisfaction of the formula; forgetting literals makes only the true or false value not to matter; varying variables allows some other variables to change.These variants generalize forgetting variables, inheriting the problem of size with the same complexity at least.
Forgetting applies to frameworks other than propositional logic.The problem of size applies to them as well.
Forgetting from logic programs [41,43,19] is usually backed by the need of solving conflicts rather than an explicit need of reducing size.Yet, an increase in size is recognized as a problem: "Whereas relying on such methods to produce a concrete program is important in the sense of being a proof that such a program exists, it suffers from several severe drawbacks when used in practice: In general, it produces programs with a very large number of rules" [3]; "It can also be observed that forgetting an atom results in at worst a quadratic blowup in the size of the program.[...] While this may seem comparatively modest, it implies that forgetting a set of atoms may result in an exponential blowup" [9].
Another common area of application of forgetting is first-order logic [26].Size after forgetting is related to bounded forgetting [47], which is forgetting with a constraint on the number of nested quantifiers.The difference is that the bound is an additional constraint rather than a limit to check.Bounded forgetting still involves a measure (the number of quantifiers), but forcing the result by that measure makes it close to bounding PSPACE problems [24].Enforcing size rather than checking it is another possible direction of expansion of the present article.
As are the other logics where forgetting is applied like description logics [12,44] and modal logics [45,40], where forgetting is often referred to as its dual concept of uniform interpolant, and also temporal logics [17], logics for reasoning about actions [15,33], and defeasible logics [1].The two latter entailments are respectively the same as the unsatisfiability of A ∧ ¬d i and B ∧ ¬d i .Since d i is a clause, ¬d i is a set of literals.The unsatisfiability of A ∪ ¬d i coincides with that of B ∪ ¬d i because ¬d i is a set of literals over Y , and the assumption is exactly the equisatisfiability of A ∪ S and B ∪ S for every set of literals over Y .

Theorem 2 A formula B over the variables Y expresses forgetting all variables except Y from A if and only if S ∪ A is equisatisfiable with S ∪ B for all sets of literals S over variables
Y that contain all variables in Y .Proof.If B expresses forgetting, then S ∪ A and S ∪ B are equisatisfiable for every set of literals S over Y , including the ones that contain all variables of Y .
In the other direction, if S is a set of literals over Y that does not contain all variables of Y , it can be expressed as S ≡ S 1 ∨ • • • ∨ S m where each S i is a set of literals that contains all variables of Y .The satisfiability of S ∪ A coincides with the satisfiability of some S i ∩ A, and the satisfiability of S ∪ B with that of S i ∪ B. By assumption S i ∪ A is equisatisfiable with S i ∪ B for every S i .
Lemma 8 If S is a set of literals such that S ∪ A is consistent, but S\{l} ∪ {¬l} ∪ A is not, the CNF formula A contains l.
Proof.Since S ∪ A is consistent, it has a model M.
The claim is that A contains a clause that contains l.This is proved by contradiction, assuming that no clause of A contains l.By construction S\{l} does not contain l either.As a result, A ′ = S\{l} ∪ A does not contain l.It is still satisfied by M because M satisfies its superset S ∪ A. Let M ′ be the model that sets l to false and all other variables the same as M. Let l 1 ∨ • • • ∨ l m be an arbitrary clause of A ′ .Since M satisfies A, it satisfies at least one of these literals l i .Since A does not contain l, this literal l i is either ¬l or a literal over a different variable.In the first case M ′ satisfies l i = ¬l because it sets l to false; in the second because it sets l i the same as M, which satisfies l i .This happens for all clauses of A ′ , proving that M ′ satisfies A ′ .
Since M ′ also satisfies ¬l because it sets l to false, it satisfies A ′ ∪{¬l} = S\{l}∪{¬l}∪A, contrary to its assumed unsatisfiability.

Lemma 9
If S ∪ {l} is a set of literals over the variables Y such that S ∪ A is consistent, but S\{l} ∪ {¬l} ∪ A is not, every CNF formula that expresses forgetting all variables except Y from A contains l.
Proof.Let B be a formula expressing forgetting all variables from A but Y .By Theorem 1, since S is a set of literals over Y , the consistency of S ∪ A equates that of S ∪ B. The same holds for S\{l} ∪ {¬l} since its variables are all in Y .
The lemma assumes the consistency of S ∪ A and the inconsistency of S\{l} ∪ {¬l} ∪ A. They imply the consistency of S ∪ B and the inconsistency of S\{l} ∪ {¬l} ∪ B. These two conditions imply that B contains l by Lemma 8.
Lemma 10 There exists a polynomial algorithm that turns a CNF formula F into a minimalsize Horn formula A, a subset X C ⊆ Var(A) and a number k such that forgetting all variables except X C from A is expressed by a Horn formula of size k if F is unsatisfiable and only by Horn formulae of size greater than or equal to k + 2 if F is satisfiable.
Proof.Let F = {f 1 , . . ., f m } be a CNF formula built over the alphabet X = {x 1 , . . ., x n }.The reduction employs the fresh variables E = {e 1 , . . ., e n }, T = {t 1 , . . ., t n }, C = {c 1 , . . ., c m } and {a, b}.The formula A, the set of variables X C and the number k are: Before formally proving the claim, how the reduction works is summarized.Some literals are still necessary after forgetting, and some of them are necessary only if F is satisfiable.The clauses ¬x i ∨¬e i make ¬x i and ¬e i necessary.The clause a∨¬b makes a and ¬b necessary.If F is always false, then for every value of the variables X ∪ E either some t i can be set to false (if x i = e i = false) or some c j can be set to false (because e i is the negation of x i , and at least a clause of F is false).This makes the clause ¬t 1 ∨• • •∨¬t n ∨¬c 1 ∨• • •∨¬c m ∨¬a∨b satisfied regardless of a and b.Instead, if the formula is satisfied by an evaluation of X and E is its opposite, then all c j and t i have to be true, turning This makes ¬a and b necessary as well.
The figure shows three models as an example.In the first model, the assignments x 1 = e 1 = false allow t 1 to take any value (denoted 0/1); regardless of the other variables (irrelevant values are marked −), without the need to also satisfy its subset ¬a ∨ b; this subclause can be false and still A is true.In the second model the values of x i and e i are opposite to each other for every i, but the clause f 2 ∈ F is false; c 1 can take any value, including false; this again allows A to be true even if ¬a ∨ b is false.In the third model, the variables x i and e i are all opposite to each other and all clauses of F true; all t i and c i are forced to be true, making ¬a ∨ b the only way to satisfy the clause When removing the intermediate variables t i and c i , all that matters is whether ¬a ∨ b was allowed to be false for some values of the removed variables or not.This is the case for the first two models but not the third, where ¬a and b are necessary.
Minimality.The minimality of A is proved applying Lemma 4 to remove some clauses so that the remaining ones do not resolve and Lemma 2 applies.Lemma 1 proves A minimal since it only contains superirredundant clauses.
Substituting the variables a, b with false removes ¬t 1 ∨• • •∨¬t n ∨¬c 1 ∨• • •∨¬c m ∨¬a∨b and a ∨ ¬b from A. The remaining clauses contain x i , e i only negative and t i , c j only positive.Therefore, these clauses do not resolve.Since they do not contain each other, Lemma 2 proves them superirredundant.They are also superirredundant in A by Lemma 4 since A does not contain any of their supersets.
The superirredundancy of the remaining two clauses is proved by substituting all x i , e i with false.This substitution removes the clauses ¬x i ∨ ¬e i , ¬x i ∨ t i , ¬e i ∨ t i , ¬x i ∨ c j and ¬e i ∨ c j because they all contain either ¬x i or ¬e i .The two remaining clauses are and a ∨ ¬b.They have opposite literals, but resolving them results in tautologies.As a result, F = ResCn(F ).Since none of the two entails the other, they are irredundant in ResCn(F ) and are therefore superirredundant.By Lemma 4, they are superirredundant in A as well since A does not contain a superset of them.
Formula F is unsatisfiable.Forgetting all variables except X C from A is expressed by Theorem 2 proves that B expresses forgetting if every set of literals S that contains exactly all variables X C = X ∪ E ∪ {a, b} is satisfiable with A if and only if it is satisfiable with B. Two cases are possible.{x i , e i } ⊆ S for some i ; the clause ¬x i ∨ ¬e i in both A and B is falsified by S; both A ∪ S and B ∪ S are unsatisfiable; {x i , e i } ⊆ S for no i ; since S contains either x i or ¬x i for each i and either e i or ¬e i for each i, either ¬x i ∈ S or ¬e i ∈ S; as a result, all clauses ¬x i ∨ ¬e i are satisfied in A ∪ S and B ∪ S, and can therefore be disregarded from this point on; the only remaining clause of B is a ∨ ¬b; if S contains ¬a and b, then B is not satisfied; but A contains the same clause a ∨ ¬b, so it is not satisfied either; if S contains both a and b or both ¬a and ¬b, then B is satisfied, and A is also satisfied by setting all variables t i and c j to true; therefore, the only sets S that may differ when added to A and B are those containing a and ¬b; these sets are consistent with B; they make the clause a ∨ ¬b of A redundant, and resolve with the clause Two subcases are considered: {¬x i , ¬e i } ⊆ S for some i the remaining clauses of A are satisfied by setting t i to false, all t z with z = i to true and all c j to true; in particular, the clause {¬x i , ¬e i } ⊆ S for no i ; at this point, also {x i , e i } ⊆ S for no i; as a result, S contains either {x i , ¬e i } or {¬x i , e i }, which means that it implies x i ≡ e i ; the clauses ¬e i ∨ c j are therefore equivalent to x i ∨ c j ; by assumption, at least a clause of F is false for every possible value of the variables X; let f j be such a clause for the only truth evaluation on X that satisfies S; by setting all variables t i and all c z with z = j to true and c j to false, this assignment satisfies all clauses; in particular, the clauses ¬x i ∨ c j and x i ∨ c j are satisfied even if c j is false because f j is false in S, which implies that all literals x i and ¬x i it contains are false; the clause All of this proves that B is the result of forgetting all variables except X C from A.
Minimal number of literals.Every CNF formula B that expresses forgetting all variables except X C = X ∪ E ∪ {a, b} from A contains at least k = 2 × n + 2 literal occurrences.This is proved by showing that B contains the literals ¬x i , ¬e i , a and ¬b.This is in turn proved by Lemma 9: for each of them l, a set S is shown consistent with A while S\{l} ∪ {¬l} is not.
For the literals ¬x i and a the set S contains all ¬x i , all e i , a and b.It is consistent with A because both are satisfied by the model that sets all x i to false and all e i , t i , c i , a and b to true.Replacing ¬x i with x i makes S inconsistent with ¬x i ∨ ¬e i .Replacing a with ¬a makes S inconsistent with a ∨ ¬b.
For the literals ¬e i and ¬b, the set S contains all x i , all ¬e i , ¬a and ¬b.It is consistent with A because both are satisfied by the model that assigns all x i , t i and c i to true and all e i , a and b to false.Replacing ¬e i with e i makes S inconsistent with ¬x i ∨ ¬e i .Replacing ¬b with b makes it inconsistent with a ∨ ¬b.
This proves that every formula obtained by forgetting all variables except X C from A contains all the k = 2 × n + 2 literals ¬x i , ¬e i , a and ¬b.
Formula F is satisfiable.If this is the case, every CNF formula B that expresses forgetting all variables except X C from A contains the literals ¬a and b.These two literals are in addition to the k literals of the previous point, raising the minimal number of literals to k + 2.
That B contains ¬a is proved by exhibiting a set of literals S that is consistent with A while S\{l} ∪ {¬l} is not where l = ¬a.This implies that B contains ¬a by Lemma 9. A similar set with l = b shows that B also contains b.
Let M be a model of F .The set of literals S contains x i or ¬x i depending on whether M satisfies x i ; it contains e i or ¬e i depending on whether M falsifies x i ; it also contains ¬a and ¬b.This set is consistent with A because they are both satisfied by the model that extends M by setting each e i opposite to x i , all t i and c i to true and a and b to false.In particular, the clause Replacing ¬a with a makes S no longer consistent with A. Let S ′ = S\{¬a} ∪ {¬¬a}.This set has the same literals over x i and e i of S. Since M satisfies F , for each of its clauses f j at least a literal in f j is true in M. If this literal is x i , then S ′ contains x i ; since x i is in f j , formula A contains the clause ¬x i ∨ c j ; therefore, S ′ ∪ A |= c j .If the literal of f j that is true in M is ¬x i , then S ′ contains e i ; since ¬x i is in f j , formula A contains ¬e i ∨ c j ; therefore, S ′ ∪ A |= c j .This proves that regardless of whether the literal of f j that is true in M is positive or negative, if F is consistent then S ′ ∪A implies c j .This is the case for every j since M satisfies all clauses of F .Since S ′ contains either x i or e i for every i and A contains both ¬x j ∨ t j and ¬e j ∨ t j for every j, S ′ ∪ A also implies all variables t j .Since S ′ = S\{¬a} ∪ {a} also contains a and ¬b, it is inconsistent with This proves that ¬a is in B.
The similar set S that contains a and b leads to the same point where all variables c j and t i are implied, making with {a, b} but not with {a, ¬b}.This proves that b is also in B.
Lemma 11 There exists a polynomial algorithm that turns a CNF formula F into a minimalsize Horn formula A, a subset X C ⊆ Var(A) and a number k such that forgetting all variables except X C from A is expressed by a Horn formula of size k if F is satisfiable and only by Horn formulae of size greater than k otherwise.
The formula A, the set of variables X C and the integer k are as follows.
Before formally proving that the reduction works, a short summary of why it works is given.The variables to forget are O ∪ P .A way to forget them is to turn A F into A R = {x i ∨ ¬q, e i ∨ ¬q | x i ∈ X}.The other clauses of A are superirredundant; therefore, all minimal equivalent formulae contain them.The bound k allows only one clause of A R for each i.Combined with the clauses of A T they entail t i ∨ ¬q.If F is satisfiable, they also combine with the clauses A C to imply all clauses c j ∨ ¬q.Resolving these clauses with A B produces all clauses x i ∨ ¬q and e i ∨ ¬q, including the ones not in the formula.This way, a formula that contains one clause of A R for each index i implies all of A R , but only if F is satisfiable.
The following figure shows how e 1 ∨ ¬q is derived from x 1 ∨ ¬q and e 2 ∨ ¬q, when the formula is The rest of the formula A does not depend on the specific clauses of F but only on the number of variables and clauses it contains.
For each index i, at least one among x i ∨ ¬q and e i ∨ ¬q is necessary for deriving ¬q ∨ t i , which is required for these derivations to work.Alternatively, ¬q ∨t i may be selected.Either way, for each index i at least a two-literal clause is necessary.
The claim is formally proved in four steps: first, a non-minimal way to forget all variables except X C is shown; second, its superirredundant clauses are identified; third, an equivalent formula of size k is built if F is satisfiable; fourth, the necessary clauses in every equivalent formula are identified; fifth, if F is unsatisfiable every equivalent formula is proved to have size greater than k.

Effect of forgetting.
Theorem 3 proves that forgetting all variables not in X C , which are O ∪ P , is expressed by resolving out these variables.Since o i occurs only in x i ∨ ¬o i and o i ∨ ¬q, the result is x i ∨ ¬q.The same holds for p i .The resulting clauses are denoted A R :

Superirredundancy.
The claim requires A to be minimal, which follows from all its clauses being superirredundant by Lemma 1.Most of them survive forgetting; the reduction is based on these being superirredundant.Instead of proving superirredundancy in two different but similar formulae, it is proved in their union.
In particular, the clauses Lemma 3 implies that they are also superirredundant in its subsets the formula before and after forgetting.
To be precise, the latter is just one among the formulae expressing forgetting.Yet, its superirredundant clauses are in all minimal CNF formulae equivalent to it.Therefore, all minimal CNF formulae expressing forgetting contain them.
Superirredundancy is proved via Lemma 4: a substitution simplifies A F ∪ A R ∪ A T ∪ A C ∪ A B enough to prove superirredundancy easily, for example because its clauses do not resolve and Lemma 2 applies.
• Replacing all variables x i , e i , t i and c j with true removes from all clauses of A F but o i ∨ ¬q and p i ∨ ¬q and all clauses of A B but r i ∨ ¬q and s i ∨ ¬q.The remaining clauses contain only the literals o i , p i , r i , s i and ¬q.Therefore, they do not resolve.Since none is contained in another, they are all superirredundant by Lemma 2. This proves the superirredundancy of all clauses o i ∨ ¬q, p i ∨ ¬q, r i ∨ ¬q and s i ∨ ¬q.
• Replacing all variables q, o i , p i , r i and s i with false removes from A F ∪A R ∪A T ∪A C ∪A B all clauses but A T ∪ A C .These clauses contain only the literals ¬x i , ¬e i , t i and c j .Therefore, they do not resolve.Since they are not contained in each other, Lemma 2 proves them superirredundant.
• Replacing all variables q, r i and s i with false and all variables t i and c i with true removes from clauses but x i ∨ ¬o i and e i ∨ ¬p i .They do not resolve because they do not share variables.Lemma 2 proves them superirredundant because they do not contain each other.
• Replacing all variables with false except for all variables t i and c j and the two variables x h and r h removes all clauses from ¬r h and all clauses ¬x h ∨ c j with x h ∈ f j .They only resolve in tautologies.Therefore, their resolution closure only contains them. Removing x h ∨ ¬r h from the resolution closure leaves only ¬x h ∨ t h and all clauses ¬x h ∨ c j with x h ∈ f j .They do not resolve since they do not contain opposite literals.Since it is not entailed by them.This proves it superirredundant.A similar replacement proves the superirredundancy of each These points prove that the clauses A F ∪ A T ∪ A C ∪ A B are superirredundant in the formula before forgetting and the clauses A T ∪ A C ∪ A B are superirredundant in the formula after forgetting.The only clauses that may be superredundant are A R in the formula after forgetting.
Formula F is satisfiable.
Let M be a model satisfying F .Forgetting all variables except X C is expressed by , where A ′ R comprises the clauses x i ∨ ¬q such that M |= x i and the clauses e i ∨ ¬q such that M |= ¬x i .This Horn formula has size k.It expresses forgetting because it is equivalent to A R ∪ A T ∪ A C ∪ A B .This is proved by showing that it entails every clause in A R .
Since M satisfies every clause f j ∈ F , it satisfies at least a literal of f j : for some x i , either x i ∈ f j and M |= x i or ¬x i ∈ f j and M |= ¬x i .By construction, R and ¬e i ∨ c j ∈ A C .In both cases, the two clauses resolve in c j ∨ ¬q.
Since M satisfies either x i or ¬x i , either The first clause resolves with ¬x i ∨ t i and the second with ¬e i ∨ t i .The result is t i ∨ ¬q in both cases.
Resolving all these clauses t i ∨¬q and c j ∨¬q with ¬t 1 ∨• • •∨¬t n ∨¬c 1 ∨• • •∨¬c m ∨x i ∨¬r i and then with r i ∨ ¬q, the result is x i ∨ ¬q.In the same way, resolving these clauses with ¬s i and s i ∨ ¬q produces e i ∨ ¬q.This proves that all clauses of A R are entailed.

Necessary clauses
All CNF formulae that are equivalent to A R ∪A T ∪A C ∪A B and have minimal size contain A T ∪ A C ∪ A B because these clauses are superirredundant.Therefore, these formulae are for some set of clauses A N .This set A N is now proved to contain either x h ∨ ¬q, x h ∨ ¬r h , e h ∨ ¬q, e h ∨ ¬s h or t h ∨ ¬q for each index h.Let M and M ′ be the following models.
The five clauses are falsified by M. Since the two of them x h ∨ ¬q and e h ∨ ¬q are in A R , this set is also falsified by M. As a result, M is not a model of This clause c contains either x h , e h or t h .This is proved by deriving a contradiction from the assumption that c does not contain any of these three literals.Since M |= c, the clause c contains only literals that are falsified by M.Not all of them: it does not contain x h , e h and t h by assumption.It does not contain ¬x h , ¬e h and ¬t h either because it would otherwise be satisfied by M. As a result, c is also falsified by M ′ , which is the same as M but for the values of x h , e h and t h .At the same time, From the fact that c contains either x h , e h or t h , that is a consequence of A R ∪A T ∪A C ∪A B , and that is in a minimal-size formula, it is now possible to prove that c contains either x h ∨¬q, x h ∨ ¬r h , e h ∨ ¬q, e h ∨ ¬s h or t h ∨ ¬q.
Since c is entailed by They contain either ¬q or ¬r h .These literals are only resolved out by clauses containing their negations q and r h .No clause contains q and the only clause that contains r h is r h ∨ ¬q, which contains ¬q.If a result of resolution contains x h , it also contains either ¬q or ¬r h .This applies to c because it is a result of resolution.
The same applies if c contains e h : it also contains either ¬q or ¬s i .The case of t h ∈ c is a bit different.The only two clauses of A R ∪ A T ∪ A C ∪ A B that contain t h are ¬x h ∨ t h and ¬e h ∨ t h .Since both are in A T and c ∈ A T , they are not c.The first clause ¬x h ∨ t h only resolves with but resolving with the latter generates a tautology.The result of resolving ¬x h ∨ t h with x i ∨ ¬q is t h ∨ ¬q; no clause contains q.Therefore, c can only be t h ∨ ¬q.The second clause ¬e h ∨ t h leads to the same conclusion.
In summary, c contains either x h ∨ ¬q, x h ∨ ¬r i , e h ∨ ¬q, e h ∨ ¬s i or t h ∨ ¬q.In all these cases it contains at least two literals.This is the case for every index h; therefore, A N contains at least n clauses of two literals.Every minimal CNF formula equivalent to This sum is exactly k.This proves that every minimal CNF formula expressing forgetting contains at least k literal occurrences.Worded differently, every CNF formula expressing forgetting has size at least k.
Formula F is unsatisfiable The claim is that no CNF formula of size k expresses forgetting if F is unsatisfiable.This is proved by deriving a contradiction from the assumption that such a formula exists.
It has been proved that every CNF formula expressing forgetting is equivalent to A R ∪ A T ∪ A C ∪ A B and that the minimal equivalent CNF formulae are A N ∪ A T ∪ A C ∪ A B for some set A N that contains clauses that include either x h ∨ ¬q, x h ∨ ¬r i , e h ∨ ¬q, e h ∨ ¬s i or t h ∨ ¬q for each index h.
If A N contains other clauses, or more than one clause for each h, or these clauses contain other literals, the size of A N ∪A T ∪A C ∪A B is larger than k = 2×n+||A T ||+||A C ||+||A B ||, contradicting the assumption.This proves that every formula of size k that is equivalent to where A N contains exactly one clause among x h ∨ ¬q, x h ∨ ¬r i , e h ∨ ¬q, e h ∨ ¬s i or t h ∨ ¬q for each index h.
The case to its previously proved superirredundancy.A similar argument proves e h ∨ ¬s h ∈ A N .
The conclusion is that every formula of size k that is equivalent to where A N contains exactly one clause among x h ∨ ¬q, e h ∨ ¬q, t h ∨ ¬q for each index h.
If F is unsatisfiable, all such formulae are proved to be satisfied by a model that falsifies A R ∪ A T ∪ A C ∪ A B , contrary to the assumed equivalence.
Let M be the model that assigns q = true and t i = true, and assigns x i = true and e i = false if x i ∨ ¬q ∈ A N and x i = false and e i = true if e i ∨ ¬q ∈ A N or t i ∨ ¬q ∈ A N .All clauses of A N and A T are satisfied by M.
This model M can be extended to satisfy all clauses of A C ∪ A B .Since F is unsatisfiable, M falsifies at least a clause f j ∈ F .Let M ′ be the model obtained by extending M with the assignments of c j to false, all other variables in C to true and all variables r i and s i to true.This extension satisfies all clauses of A B either because it sets c j to false or because it sets r i and s i to true.It also satisfies all clauses of A C that do not contain c j because it sets all variables of C but c j to true.The only clauses that remain to be proved satisfied are the clauses of A C that contain c j .They are ¬x i ∨ c j for all x i ∈ f j and ¬e i ∨ c j for all ¬x i ∈ f j .Since M ′ falsifies f j , it falsifies every x i ∈ f j ; therefore, it satisfies ¬x i ∨ c j .Since M ′ falsifies f j , it falsifies every ¬x i ∈ f j ; since by construction it assigns e i opposite to x i , it falsifies e i and therefore satisfies ¬e i ∨ c j .
This proves that then M ′ sets x 1 to true and e 1 to false; therefore, it does not satisfy e 1 ∨ ¬q ∈ A R .Otherwise, M ′ sets x 1 to false and e 1 to true; therefore, it does not satisfy This contradicts the assumption that The assumption that it has size k is therefore false.
Lemma 12 Checking whether forgetting some variables from a minimal-size Horn formula is expressed by a Horn formula bounded by a certain size is D p -hard.
Proof.For every CNF formula F , Lemma 10 ensures the existence of a minimal-size Horn formula A, a set of variables X A and an integer k such that forgetting all variables except X A from A is expressed by a Horn formula of size k if F is unsatisfiable and is only expressed by larger CNF formulae otherwise.
For every CNF formula G, Lemma 11 ensures the existence of a minimal-size Horn formula B, a set of variables X B and an integer l such that forgetting all variables except X B from B is expressed by a Horn formula of size l if G is satisfiable and is only expressed by larger CNF formulae otherwise.
The prototypical D p -hard problem is that of establishing whether a formula F is satisfiable and another G is unsatisfiable.If the alphabets of the two formulae G and F are not disjoint, they can be made so by renaming one of them to fresh variables because renaming does not affect satisfiability.The same applies to the formulae B and A respectively build from them according to Lemma 10 and Lemma 11 because renaming does not change the minimal size of forgetting either.Lemma 7 proves that A ∪ B can be minimally expressed by C ∪ D where C minimally expresses forgetting from A and D from B. The size of these two formulae are l and k if G is unsatisfiable and F satisfiable.If G is satisfiable, then D is larger than k while C is still large at least l; the minimal expression of forgetting A ∪ B is therefore strictly larger than k + l.The same happens if F is unsatisfiable.
This proves that the problem of checking the satisfiability of a formula and the unsatisfiability of another reduces to the problem of checking the size of the minimal expression of forgetting from Horn formulae.
Theorem 4 Checking whether forgetting some variables from a Horn formula is expressed by a Horn formula bounded by a certain size expressed in unary is D p -hard and in Σ p 2 , and remains hard even if the formula is restricted to be of minimal size.
Proof.The problem belongs to Σ p 2 because it can be expressed as the existence of a formula of the given size or less that expresses forgetting the given variables from the formula.In turn, expressing forgetting is by Theorem 2 the same as the equiconsistency with a set of literals containing all variables not to be forgotten.This condition can be expressed by the following metaformula where A is the formula, Y are the variables not to be forgotten and k the size bound.Lemma 13 There exists a polynomial algorithm that turns a CNF formula F into a minimalsize CNF formula A, a subset X C ⊆ Var(A) and a number k such that forgetting all variables from A except X C is expressed by a CNF formula of size k if ∀X∃Y.F is valid and only by CNF formulae of size k + 2 or greater otherwise.
The reduction is based on an extended alphabet with the additional fresh variables E = {e 1 , . . ., e n }, C = {c 1 , . . ., c m } and {a, b, q, r}.The formula A, the set of variables X C and the number k are: A short explanation of how the reduction works precedes its formal proof.The key is how a model over X ∪ {q} extends to a model of A, in particular its possible values of a and b.All models over X ∪ {q} that satisfy q can be extended to satisfy A: all clauses not containing q are satisfied by setting r = true and e i opposite to x i ; satisfaction is not affected by the values a and b.The remaining models set q = false.For these models, the truth of a clause f j makes f j ∨ c j ∨ q satisfied even if c j = false.In turn, c j = false satisfies ¬c j ∨ r even if r = false, which satisfies ¬r ∨ ¬a ∨ b ∨ q regardless of the values of a and b; the values of a and b only need to satisfy a ∨ ¬b ∨ q.Otherwise, the falsity of f j imposes c j = true to satisfy f j ∨ c j ∨ q, which makes ¬c j ∨ r require r = true, which turns ¬r ∨ ¬a ∨ b ∨ q into ¬a ∨ b ∨ q, making the literals ¬a and b necessary in addition to a and ¬b.
The proof comprises four steps: first, A is proved minimal as required by the claim of the lemma; second, k literals that are in every formula that expresses forgetting regardless of the validity of the QBF are identified; third, a formula of size k expressing forgetting when the QBF is valid is determined; fourth, every formula expressing forgetting contains at least two further literals if the QBF is invalid.

Minimality of A.
Follows from Lemma 1 since all clauses of A are superirredundant.This is in turn proved by showing substitutions that disallow all resolutions, which proves the superredundancy of the remaining clauses by Lemma 4 and Lemma 2.
The substitution that replaces with true the variables a, b, r, all e i and all c j with j = h for every given h such that f h ∈ F removes all clauses but f h ∨ c h ∨ q, which is therefore superirredundant.
The clauses ¬c j ∨ r are proved superirredundant by substituting q and all variables e i with true, which removes all other clauses.The clauses ¬c j ∨ r do not resolve because they do not contain opposite literals.
Two other clauses are proved superirredundant by the substitution that replaces all variables e i with true, all c j with false, and X ∪ Y with some values that satisfy F ; such values exist because F is by assumption satisfiable.This substitution removes all clauses but ¬r ∨ ¬a ∨ b ∨ q and a ∨ ¬b ∨ q, which only resolve in tautologies.
Finally, the clauses x h ∨ e h are proved superirredundant by replacing q and r with true, which removes all other clauses.Since the clauses x h ∨ e h only contain positive literals, they do not resolve.

Necessary literals.
Regardless of the validity of ∀X∃Y.F , the literals X ∪ E ∪ {a, ¬b, q} are necessary in every CNF formula that expresses forgetting all variables except X C from A. This is proved by Lemma 9, exhibiting a set of literals S such that S ∪ A is consistent, but S\{l} ∪ {¬l} ∪ A is not for every l ∈ X ∪ E ∪ {a, ¬b, q}.
The first set is S = {x i , ¬e i , a, b, ¬q}, which is consistent with A because of the model that satisfies S and assigns r and all variables c j to true.Changing x i to ¬x i violates the clause x i ∨ e i .Changing a to false violates a ∨ ¬b ∨ q.This proves that a and all variables x i are necessary by Lemma 9.
The second set is S = {¬x i , e i , ¬a, ¬b, ¬q}, which is consistent with A because of the model that satisfies S and assigns r and all variables c j to true.Changing e i to ¬e i violates x i ∨ e i , changing b to true violates a ∨ ¬b ∨ q.This proves that e i and ¬b are necessary by Lemma 9.
The third set is S = {x i , e i , ¬a, b, q}, which is consistent with A because of the model that satisfies S and assigns r and all variables c j to true.Changing q to false violates the clause a ∨ ¬b ∨ q, proving that q is necessary.
In summary, all literals in X ∪ E ∪ {a, ¬b, q} occur in every CNF formula expressing forgetting all variables except X C from A. These literals are 2 × n + 3.This is a part of the claim: no CNF formula expressing forgetting is smaller than 2 × n + 3.

Forgetting when ∀X∃Y.F is valid
If ∀X∃Y.F is valid, forgetting is expressed by which has the required size k = 2 × n + 3 and variables X C = X ∪ E ∪ {a, b, q}.Theorem 2 proves that this formula expresses forgetting: every set S of literals of X C that contains all variables of X C is consistent with B if and only if it is consistent with A. Since B only contains clauses of A, every set of literals S that is consistent with A is also consistent with B. The claim follows from proving the converse for every set of literals S over X C that mentions all variables of X C .
The assumption is that S∪B is consistent; the claim is that S∪A is consistent.Since S∪B is consistent, it has a model M. Let M X be its restriction to the variables X and M ′ Y to Y .By assumption, ∀X∃Y.F is valid.Therefore, M X ∪ M Y satisfies F for some truth evaluation M Y over Y .Since S is satisfied by M and does not mention any variable Y , it is also satisfied by

Forgetting when ∀X∃Y.F is invalid
All CNF formulae that express forgetting have been proved to mention X ∪E ∪{a, ¬b, q}.If ∀X∃Y.F is invalid, they all mention ¬a and b as well.This is proved by Lemma 9: a set of literals S over X C is shown to be consistent with A while S\{¬a} ∪ {a} is not.A similar set is shown for b.
Since ∀X∃Y.F is invalid, for some interpretation M X over X the interpretation M X ∪M Y falsifies F for every interpretation M Y over Y .The required set S is built from M X : it contains the literals over x i that are satisfied by M X and ¬a, ¬b and ¬q.The consistency of S ∪ A is shown by proving that M X ∪ M O can be extended to the other variables to satisfy A. This extension is where M Y is an arbitrary model over Y , M N assigns every e i opposite to x i in M X and M C is {c j = true | f j ∈ F } ∪ {r = true}.The clauses f j ∨ c j ∨ q are satisfied because c j is true, the clauses ¬c j ∨ r because r is true, the clause ¬r ∨ ¬a ∨ b ∨ q because a is false, a ∨ ¬b ∨ q because b is false, the clauses This is proved by contradiction: a model M ′ is assumed to satisfy S ′ ∪ A. Since M ′ satisfies S ′ , it assigns the variables x i the same as M X .Let M Y be the restriction of M ′ to the variables Y .By assumption, M X is a model over X that cannot be extended to Y to satisfy F .As a result, M X ∪ M Y |= F .Therefore, M ′ falsifies at least a clause f j ∈ F .Since M ′ satisfies f j ∨ c j ∨ q but falsifies both f j and q, it satisfies c j .It also satisfies r because it satisfies ¬c j ∨ r and falsifies c j .Since M ′ satisfies S ′ it satisfies a and falsifies b and q.The conclusion is that all literals of ¬r ∨ ¬a ∨ b ∨ q ∈ A are false, contrary to the assumption that M ′ satisfies A.
A similar set S with a and b in place of ¬a and ¬b proves that expressing forgetting also requires b.
Lemma 14 There exists a polynomial algorithm that turns a DNF formula F = f 1 ∨ • • • ∨ f m over variables X ∪ Y into a minimal-size CNF formula A, a subset X C ⊆ Var(A) and a number k such that forgetting all variables except X C from A is expressed by a CNF formula of size k if ∃X∀Y.F is valid, and only by larger CNF formulae otherwise.
and q.The formula A, the alphabet X C and the number k are as follows.
The reduction works because every minimal CNF formula that expresses forgetting contains at least one among x h ∨ q, e h ∨ q and t h ∨ q for each h, and all of A T ∪ A D ∪ A B .This proves the lower bound k.If the QBF is valid, for some evaluation over X the formula F is true regardless of Y .Choosing the clauses x h ∨ q, e h ∨ q or t h ∨ q that correspond to this model, some clause of A D implies q ∨ d j , which allows A B to entail all remaining clauses.If the QBF is not valid, no clause q ∨ d j is entailed.
The formal proof requires five steps: first, every formula expressing forgetting is equivalent to a certain formula A R ∪ A T ∪ A D ∪ A B ; second, A is a minimal CNF formula and the clauses of third, forgetting is expressed by a formula of size k if the QBF is valid; fourth, every minimal CNF formula expressing forgetting contains either x h ∨ q, e h ∨ q or t h ∨ q for each h; fifth, if the QBF is invalid then forgetting is only expressed by formulae larger than k.

Effect of forgetting.
The variables to forget are O ∪ P .Each is contained only in two clauses of A, with opposite signs.Resolving them produces the clauses in the following set A R .
Therefore, all formulae that express forgetting are equivalent to this formula.

{¬(f
This entailment and the previously proved The same holds for e i ∨ q by symmetry.Therefore,

Necessary clauses.
All formulae that express forgetting are equivalent to A R ∪ A T ∪ A D ∪ A B and therefore contain all its superirredundant clauses A T ∪ A D ∪ A B .As a result, they have the form A N ∪ A T ∪ A D ∪ A B for some set of clauses A N .It is now shown that all equivalent CNF formulae of minimal size contain a clause that include either x h ∨ q, x h ∨ ¬r h , e h ∨ q, e h ∨ ¬s h , or t h ∨ q for each h. Since If c contains neither x h , e h nor t h , it would still be falsified by the model that is the same as M except that it assigns x h , e h and t h to true.This model satisfies This proves that c contains either x h , e h or t h .
Since these three variables are negative in M and M |= c, they are positive in c.In other words, c contains either x h , e h or t h unnegated.
Since c is entailed by A R ∪ A T ∪ A D ∪ A B , but none of its proper subsets does, it follows from resolution: A R ∪ A T ∪ A D ∪ A B ⊢ c.
If c contains x h , it also contains either q or ¬r h .This is proved as follows.Since c is the root of a resolution tree and contains x h , this literal is also in one of the leaves of resolution.The only clauses of A R ∪ A T ∪ A D ∪ A B containing x h are x h ∨ q and all clauses ¬t 1 ∨ • • • ∨ ¬t n ∨ ¬d j ∨ x h ∨ ¬r h .The first does not resolve over q because the formula does not contain ¬q.The other clauses only resolve over r h with r h ∨ q, which introduces q, which again cannot be removed by resolution.Since c is obtained by resolution, if it contains x h it also contains either ¬r h or q.
By symmetry, if c contains e h it also contains either ¬s h or q.
The other case is that c contains t h .The only clauses of A R ∪ A T ∪ A D ∪ A B that contain t h are ¬x h ∨ t h and ¬e h ∨ t h .These clauses are satisfied by M while c is not, therefore c is not one of them.The first clause ¬x h ∨ t h only resolves over x h with x h ∨ q and all clauses ¬t 1 ∨ • • • ∨ ¬t n ∨ ¬d j ∨ x h ∨ ¬r h , but resolving with the latter only generates tautologies.Therefore, the first step of resolution is necessarily ¬x h ∨ t h , x h ∨ q ⊢ t h ∨ q.Since none of the involved clauses contains ¬q, every clause obtained from resolution that contains t h also contains q.This also includes c.The same holds by symmetry for ¬e h ∨ t h .This proves that every minimal-size CNF formula expressing forgetting contains a clause that includes either x h ∨ q, x h ∨ ¬r h , e h ∨ q, e h ∨ ¬s h , or t h ∨ q for each h.

Falsity of ∃X∀Y.F .
The falsity of ∃X∀Y.F contradicts the existence of a minimal-size CNF formula of size k expressing forgetting.The relevant results proved so far are: every CNF formula expressing forgetting has size k or more and is equivalent to A R ∪ A T ∪ A D ∪ A B ; the minimal-size such formulae are A N ∪ A T ∪ A D ∪ A B where A N contains, for each h, a clause that includes either x h ∨ q, x h ∨ ¬r h , e h ∨ q, e h ∨ ¬s h , or t h ∨ q.
A formula A N ∪ A T ∪ A D ∪ A B of size k expressing forgetting, if any, is minimal since no smaller formula expresses forgetting.Therefore, A N includes, for each h, a clause containing one of the five disjunctions.Since these are not in A T ∪ A D ∪ A B , the size of such formulae is k = 2 × n + ||A T ∪ A D ∪ A B || if every clause of A N is exactly one of the above disjunction for each h.If A N contains more than one clause for some h or the clause for some h contains more than two literals or A N contains other clauses, the formula is not minimal.
The case x h ∨ ¬r h ∈ A N can be excluded: it makes ¬t 1 ∨ • • • ∨ ¬t n ∨ ¬d j ∨ x h ∨ ¬r h ∈ A N redundant in A N ∪ A T ∪ A D ∪ A B , contradicting the minimality of this formula.The case e h ∨ ¬s h ∈ A N is excluded in the same way.
These exclusions leave A N to contain exactly one among x h ∨ q, e h ∨ q, and t h ∨ q for each h and nothing else.
The final step of the proof is that no such Nonequivalence is proved by exhibiting a model of the first formula that does not satisfy the second.
Let M X be the model over X that contains x i = true if x i ∨ q ∈ A N and x i = false otherwise.Let M N be the model that assigns every e i opposite to x i and M T = {t i = true | t i ∈ T }.By construction, M X ∪ M N ∪ M T ∪ {q = false} satisfies all clauses of A N .It also falsifies either x i ∨ q or e i ∨ q for each i because it assigns false to q and to either x i or e i .It therefore falsifies A R .
Since ∃X∀Y.F is invalid, every interpretation over X falsifies In summary, assuming that the QBF is not valid and that a CNF formula of size k expresses forgetting, it is proved that the formula does not express forgetting.This contradiction shows that no formula of size k expresses forgetting if the QBF is not valid.
Lemma 15 Checking whether forgetting a given set of variables from a minimal-size CNF formula is expressed by a CNF formula bounded by a certain size is D p 2 -hard.
Proof.For every ∀QBF Lemma 13 ensures the existence of a minimal-size CNF formula A, a set of variables X A and an integer k such that forgetting all variables except X A from A is expressed by a CNF formula of size k if the QBF is valid and is only expressed by larger CNF formulae otherwise.
For every ∃QBF Lemma 14 ensures the existence of a minimal-size CNF formula B, a set of variables X B and an integer l such that forgetting all variables except X B from B is expressed by a CNF formula of size l if the QBF is valid and is only expressed by larger CNF formulae otherwise.
A D p 2 -hard problem is that of establishing whether an ∃QBF and a ∀QBF are both valid.If their alphabets are not disjoint, they can be made so by renaming one of them to fresh variables since renaming does not affect validity.The same applies to the formulae B and A respectively build from them according to Lemma 13 and Lemma 14 because renaming does not change the minimal size of forgetting either.Lemma 7 proves that forgetting from A ∪ B is expressed by C ∪ D where C expresses forgetting from A and D from B. The minimal size of two such CNF formulae are respectively k and l.If the QBFs are both valid, they are exactly k and l large.Otherwise, they are strictly larger than either k or l.The sum is k + l if both QBFs are valid and is larger than k + l otherwise.
Theorem 5 Checking whether forgetting some variables from a CNF formula is expressed by a CNF formula of a certain size expressed in unary is D p 2 -hard and in Σ p 3 , and remains hard even if the CNF formula is restricted to be of minimal size.

Proof. Membership to Σ p
3 is proved first.The problem is the existence of a CNF formula of the given size or less that expresses forgetting the given variables from the formula.Theorem 2 reformulates forgetting in terms of equiconsistency with a set of literals containing all variables not to be forgotten.Forgetting withing a certain size is formalized by the following metaformula where A is the formula, Y the variables not to be forgotten and k the

Figure 1 :
Figure 1: An example of forgetting some variables.Arrows stands for propositional implications.

Figure 2 :
Figure 2: A formula that is complicated instead of simplified by forgetting

Definition 4
The resolution of two formulae is the set of clauses obtained by resolving each clause of the first formula with each clause of the second: resolve(A, B) = {c | c ′ , c ′′ ⊢ c where c ′ ∈ A and c ′′ ∈ B} If either of the two formulae comprises a single clause, the abbreviations resolve(A, c) = resolve(A, {c}), resolve(c, B) = resolve({c}, B) and resolve(c, c ′ ) = resolve({c}, {c ′ }) are used.

Definition 5 A
formula B expresses forgetting all variables from A except Y if and only if Var(B) ⊆ Y and B |= C is the same as A |= C for all formulae C such that Var(C) ⊆ Y .
expresses forgetting the variables Y from A and D expresses forgetting the variables Y from B if and only if C ∪ D expresses forgetting the variables Y from A ∪ B.

Lemma 5 A
formula B over the variables Y expresses forgetting all variables from A but Y if and only if A ∧ D is equisatisfiable with B ∧ D for all formulae D over variables Y .Proof.The definition of B expressing forgetting is that it is built over the variables Y and that A |= C is the same as B |= C for every formula C on the alphabet Y .The two entailments are respectively the same as the inconsistency of A ∧ ¬C and B ∧ ¬C.They coincide if and only if A ∧ D and B ∧ D are equisatisfiable, where D = ¬C.In the other way around, A ∧ D and B ∧ D are equisatisfiable if and only if A ∧ ¬C and B ∧ ¬C are, where C = ¬D.Theorem 1 A formula B over the variables Y expresses forgetting all variables except Y from A if and only if S ∪ A is equisatisfiable with S ∪ B for all sets of literals S over variables Y .Proof.The claim is proved in the two directions: first, B expressing forgetting implies the equisatisfiability; second, equisatisfiability implies that B expresses forgetting.The first direction is that if B expresses forgetting then S ∪A and S ∪B are equisatisfiable.The two satisfiability conditions are respectively equivalent to the entailments A |= ¬S and B |= ¬S.They coincide if A |= ¬S and B |= ¬S coincide.Since S is a set of literals over Y , the entailed formula ¬S contains only variables of Y .By definition of forgetting, A |= ¬S is the same as B |= ¬S.The converse direction is that if S ∪A and S ∪B are equisatisfiable for every set of literals over Y then B expresses forgetting all variables except Y from A. Forgetting is defined as A |= C being the same as B |= C for every formula C over Y .Like every other formula, C can be turned into an equivalent CNF D = {d 1 , . . ., d m } over the same alphabet.Because of equivalence, the two entailments to prove equal are respectively the same as A |= D and B |= D. Since D is a conjunction, it is entailed if and only if all its clauses are entailed.The two entailments are therefore respectively equivalent to A |= d i for every d i ∈ D and B |= d i for every d i ∈ D. They coincide if A |= d i is the same as B |= d i for every clause d i over Y .
∃B .||B|| ≤ k and ∀S .Var(S) ⊆ Y ⇒ (S ∪ A |= ⊥ ⇔ S ∪ B |= ⊥) Both B and S are bounded in size: the first by k, the second by the number of variables in Y .Since consistency is polynomial for Horn formulae, this is a ∃∀QBF, which proves membership to Σ p 2 .Hardness for D p is proved by Lemma 12.
¬b, ¬q} By construction, M X satisfies the first part of S. The model M O = {a = false, b = false, q = false} satisfies the second.Therefore, M X ∪ M O satisfies S.
. This clause is not satisfied by the following model.M = {x i = e i = t i = true | i = h} ∪ {x h = e h = t h = false} ∪ {d j = true | f j ∈ F } ∪ {r i = s i = true} ∪ {q = false}This model satisfies all clauses of A T ∪A D ∪A B .If A N also satisfied it, A N ∪A T ∪A D ∪A B would have a model that falsifies x h ∨ q, which it instead entails.As a result, A N contains a clause c that M falsifies.Since A N ∪ A T ∪ A D ∪ A B is a formula of minimal size, it entails no proper subset of c.By equivalence, the same applies to A R ∪ A T ∪ A D ∪ A B .

F
with an interpretation over Y .Let M Y be the interpretation over Y such thatM X ∪ M Y |= ¬F .Since F = f 1 ∨• • •∨f m , it holds M X ∪M Y |= ¬f j for every f j ∈ F .It follows M X ∪M Y ∪M N |= ¬f j [e i /¬x i ]since M N assigns every e i opposite to x i .Merging the results proved in the preceding two paragraphs,M X ∪ M T ∪ {q = false} ∪ M N ∪ M Y satisfies both A N and ¬f j [e i /¬x i ] for every f j ∈ F .This model can be extended to a model of A N ∪ A T ∪ A D ∪ A B by adding M O = {d j = false} ∪ {r i = true} ∪ {s i = true}.The clauses of A N are already proved satisfied.The clauses ¬x i ∨ t i ∈ A T are satisfied because M T contains t i = true.The clauses (¬f j [e i /¬x i ]) ∨ d j are satisfied because ¬f j [e i /¬x i ] is.The clauses of A B are satisfied because each contains either ¬d j , r i or s i , and these literals are true in M O .This proves that MX ∪ M T ∪ {q = false} ∪ M N ∪ M Y ∪ M O satisfies A N ∪ A T ∪ A D ∪ A B .It does not satisfy A R , which means that it falsifies A R ∪ A T ∪ A D ∪ A B .This proves that size bound.∃B .Var(B) ⊆ Y, ||B|| ≤ k and ∀S .Var(S) ⊆ Y ⇒ (∃M .M |= S∪A ⇔ ∃M ′ .M ′ |= S∪B) All four quantified entities are bounded in size: B by k, S and M ′ by the number of variables in Y and M by the number of variables in A. This is therefore a ∃∀∃QBF, which proves membership to Σ p 3 .Hardness to D p 2 is proved by Lemma 15 in the restriction where A is minimal.
it contains neither x nor ¬x and F does not contain c ∨ ¬x.The same holds for F [false/x] if F does not contain c ∨ x.
Lemma 5 A formula B over the variables Y expresses forgetting all variables from A but Y if and only if A ∧ D is equisatisfiable with B ∧ D for all formulae D over variables Y .Theorem 1 A formula B over the variables Y expresses forgetting all variables except Y from A if and only if S ∪ A is equisatisfiable with S ∪ B for all sets of literals S over variables Y .