Enumerating Independent Linear Inferences

A linear inference is a valid inequality of Boolean algebra in which each variable occurs at most once on each side. In this work we leverage recently developed graphical representations of linear formulae to build an implementation that is capable of more efficiently searching for switch-medial-independent inferences. We use it to find four `minimal' 8-variable independent inferences and also prove that no smaller ones exist; in contrast, a previous approach based directly on formulae reached computational limits already at 7 variables. Two of these new inferences derive some previously found independent linear inferences. The other two (which are dual) exhibit structure seemingly beyond the scope of previous approaches we are aware of; in particular, their existence contradicts a conjecture of Das and Strassburger. We were also able to identify 10 minimal 9-variable linear inferences independent of all the aforementioned inferences, comprising 5 dual pairs, and present applications of our implementation to recent `graph logics'.


Introduction
A linear inference is a valid implication ϕ → ψ of Boolean logic, where ϕ and ψ are linear, i.e. each variable occurs at most once in each of ϕ and ψ.Such implications have played a crucial role in many areas of structural proof theory.For instance the inference switch, s : x ∧ (y ∨ z) → (x ∧ y) ∨ z governs the logical behaviour of the multiplicative connectives `and ⊗ of linear logic [Gir87], and similarly the inference medial, m : (w ∧ x) ∨ (y ∧ z) → (w ∨ y) ∧ (x ∨ z) together with the structural rules weakening and contraction, governs the logical behaviour of the additive connectives ⊕ and & [Str02,Str03].Both of these inferences are fundamental to deep inference proof theory, in particular allowing weakening and contraction to be reduced to atomic form [BT01,Brü03a], thereby admitting elegant 'geometric' proof normalisation procedures based on atomic flows [GG08,Gun09].One particular feature of these normalisation procedures is that they are robust under the addition of further linear inferences to the system, thanks to the atomisation of structural steps.
On the other hand the set of all linear inferences L plays an essential role in certain models of linear logic and related substructural logics.In particular, the multiplicative fragment of Blass' game semantics model of linear logic validates just the linear inferences (there called 'binary tautologies') [Bla92], and this coincides too with the multiplicative fragment of Japaridze's computability logic, cf., e.g., [Jap05].From a complexity theoretic point of view, the set L is sufficiently rich to encode all of Boolean logic: it is coNP-complete [Str12b,DS16].
It was recently shown by one of the authors, together with Straßburger, that, despite its significance, L admits no polynomial-time axiomatisation by linear inferences unless coNP = NP [DS15, DS16], resolving a long-standing open problem of Blass and Japaridze for their respective logics (see, e.g., [Jap17]).Note that the condition of polynomial-time computability naturally arises from proof theory [CR74,CR79], and is also required for the result to be meaningful: it prevents us just taking the entire set L as an axiomatisation.
From a Boolean algebra point of view, this result means that the class of linear Boolean inequalities has no feasible basis (unless coNP = NP).From a proof theoretic point of view this means that any propositional proof system (in the Cook-Reckhow sense [CR74,CR79], see also [Kra19]) must necessarily admit some 'structural' behaviour, even when restricted to proving only linear inferences (unless coNP = NP).
An immediate consequence of this result is that s and m above do not suffice to generate all linear inferences (unless coNP = NP), even modulo all valid linear equations (which are just associativity, commutativity, and unit laws, cf.[DS15,DS16]).In fact, this was known before the aforementioned result, due to the identification of an explicit 36 variable inference in [Str12b]. 1Already in that work the question was posed whether such an inference was minimal, and since then the identification of a minimal {s, m}-independent linear inference has been a recurring theme in the literature of this area.
It has been verified in [Das13] that a minimal {s, m}-independent linear inference must be 'non-trivial', as long as we admit all valid linear equations (again, these are just associativity, commutativity and unit laws).Intuitively, 'non-triviality' rules out pathological inferences such as x ∧ y → x ∨ y or x ∧ (y ∨ z) → x ∨ (y ∧ z).For these inferences the variable, say, y is, in a sense, redundant; it turns out that they may be derived in {s, m}, modulo linear equations, from a smaller non-trivial 'core'.We recall these arguments in Section 2.
Furthermore [Das13] identified a 10 variable linear inference that is not derivable by switch and medial (even under linear equations), which Straßburger conjectured was minimal [Str12a].Around the same time Šipraga attempted a computational approach, searching for independent linear inferences by brute force [ Š12].However, computational limits were reached already at 7 variables.In particular, every linear inference of up to 6 variables is already derivable by switch and medial, modulo linear equations; due to the aforementioned 10 variable inference, any minimal independent linear inference must have size 7,8,9, or 10.
Since 2013 there have been significant advances in the area, in particular through the proliferation of graph-theoretic tools.Indeed, the interplay between formulae and graphs was heavily exploited for the aforementioned result of [DS15,DS16].Since then, multiple works have emerged in the world of linear proof theory that treat these graphs as 'first class citizens', comprising a now active area of research [NS18, AHS20, AHS22, CDW20].
Contribution.In this work we revisit the question of minimal {s, m}-independent linear inferences by exploiting the aforementioned recent graph theoretic techniques.Such an approach vastly reduces the computational resources necessary and, in particular, we are able to provide a conclusive result: the smallest {s, m}-independent linear inference has size 8.In fact there are four minimal (w.r.t.derivability) such ones, unique up to associativity, commutativity, renaming of variables, given by, and the De Morgan dual of Eq. (1.3).Note that Eq. (1.2) did not appear in the preliminary version [DR21] as it was erroneously considered to be isomorphic to the first.We dedicate some discussion to each of these separately in Section 3.2, and include a manual verification of their soundness and {s, m}-independence in Appendix A, as a sanity check.
Our main contribution, as announced in the preliminary version of this paper [DR21], is an implementation that checks inference for {s, m}-derivability, which was able to confirm that all 7 variable linear inference are derivable from switch and medial.In fact we found (1.1) independently of the implementation presented in this paper. 2Ultimately, we improved the implementation to run on inferences of size 8 too, and our inference (1.1) was duly found, as well as (1.2), (1.3), and the dual of (1.3).One highlight of (1.3) is that it exhibits a peculiar structural property that refutes Conjecture 7.9 from [DS16], as we explain in Section 3.2.2.
In this extended version, we also show how our search algorithm can be generalised to enumerate minimal linear inferences independent of an arbitrary set S of linear inferences.This can be employed to devise a recursive algorithm basis(n) that computes all n-variable minimal linear inferences independent of all smaller ones.To this end, in Section 6 we define the notion of an n-minimal set, which is intuitively a minimal set of inferences that derives all n-variable inferences modulo all < n-variable inferences.We show these n-minimal sets are unique up to linear equations and renaming of variables, and finally prove correctness of our algorithm basis(n) by extending some theoretical results on constant-freeness for switch and medial to the general setting of arbitrary n-minimal sets.For instance the 9-variable minimal linear inferences given by basis(9) are those not derivable from switch, medial, and the four aforementioned 8-variable linear inferences, instead of the weaker condition of not being derivable from only switch and medial.Indeed, we were able to successfully run basis(9) to compute the 9-minimal linear inferences.We classify these in Section 7, identifying 10 such inferences in total, comprising 5 dual pairs.
Our implementation [Ric21] is split into a library and an executable, where the executable implements our search algorithm described in Section 5.2, and the library contains foundations for working with linear inferences using the graph theoretic techniques presented in Section 4. These are written in Rust and designed to be relatively fast while maintaining readability.
In addition to having the machinery needed for our original search, the library has also been extended for to work with arbitrary graphs, e.g. as presented in [CDW20], in particular being able to check other notions of inference for graphs and having tools for determining whether an inference is an instance of an arbitrary, user-supplied graph rewrite.Our intention is that this could form a reusable base for future investigations in the area, both for linear formulae and for the recent linear graph theoretic settings of [NS18, AHS20, AHS22, CDW20].
As well as the additions already mentioned, this extended version contains several further proofs, examples and general discussion compared with the preliminary version [DR21].

Preliminaries
In this section we present some preliminaries on linear inferences, triviality and minimality.The content of this section is based on Section 2 of the preliminary version, [DR21], with some additional proofs and narrative.
Throughout this paper we shall work with a countably infinite set of variables, written x, y, z etc.A linear formula on a (finite) set of variables V is defined recursively as follows:

•
and ⊥ are linear formulae on ∅, the empty set of variables (called units or constants).• x and ¬x are linear formulae on {x}, for each variable x.
We adopt the expected Boolean semantics of (linear) formulae.Namely we extend any map α from variables to {0, 1} (an 'assignment') to one on all (linear) formulae as follows: The formula ϕ satisfies an assignment α if α(ϕ) = 1.Formulae ϕ and ψ are logically equivalent if they satisfy the same assignments.
Remark 2.1 (On negation).Note that our restriction of negation to only propositional variables is made without loss of generality.Namely, we may recover ¬ϕ thanks to De Morgan's laws by setting: Note in particular that, if ϕ is a linear formula on V, then so is ¬ϕ.
A linear formula that does not contain or ⊥ is constant-free.A linear formula with no negated variables (i.e.formulae of form ¬x) is negation-free.Later in the paper, we will be able to restrict our search to inferences between constant-free negation-free formulae.
In what follows, we shall omit explicit consideration of variable sets, assuming that they are disjoint whenever required by the notation being used.
A binary relation ∼ on linear formulae is closed under contexts if we have for all ϕ, ψ, and χ: An equivalence relation (on linear formulae) that is closed under contexts is called a (linear) congruence.
Definition 2.2 (Linear equations).Let ∼ ac be the smallest congruence satisfying, ∼ u is the smallest congruence satisfying: ∼ acu is the smallest congruence containing both ∼ ac and ∼ u .
Remark 2.3 (Variable sets under congruence).Suppose ϕ and ϕ are linear formulae on V and V respectively.If ϕ ∼ ac ϕ then V = V .
Note also that ∼ u generates a unique normal form of linear formulae by maximally eliminating constants: Proposition 2.4 (Folklore).Every formula is ∼ u -equivalent to a unique constant-free formula, or is equivalent to ⊥ or .
Proof.Construe the equations of Eq. (2.1) as a rewrite system by orienting them left-to-right.This system reduces the size of formulae and so must terminate.By inspection, the normal form must contain no constant under the scope of a connective ∨ or ∧.
For uniqueness, it suffices to consider the critical pairs.In fact, the analysis is particularly simple since any critical pair is a ∨ or ∧ of constants that always reduces to the same constant: For the above pairs, we have indicated a reduction, say ∧ ϕ → ϕ or ϕ ∨ → , by ∧ or ∨ respectively.
Remark 2.5 (On logical equivalence).Clearly, if ϕ ∼ acu ψ then ϕ and ψ are logically equivalent.In fact, for linear formulae, we also have a converse: two linear formulae ϕ and ψ on the same variables are logically equivalent if and only if ϕ ∼ acu ψ [DS15, DS16].Furthermore, given two linear formulae ϕ and ψ that are constant-free, ⊥, or , then ϕ and ψ are logically equivalent if and only if they are ∼ ac -equivalent.These property follows from Proposition 2.4 above, the results of Section 2.2, and the graphical representation of linear formulae and their semantics in Section 4.

Linear inferences.
A linear inference is just a valid implication ϕ → ψ (i.e., α(ϕ) = 1 =⇒ α(ψ) = 1) where ϕ and ψ are linear formulae.The left-hand side (LHS) and right-hand side (RHS) of a linear inference, generally speaking, need not be linear formulae on the same variables.Nonetheless we shall occasionally refer to linear inferences "on V" or "on n variables", assuming that the LHS and RHS are both linear formulae on some fixed V with |V| = n.
There are two linear inferences we shall particularly focus on, due to their prevalence in structural proof theory.Switch is the following inference on 3 variables, and medial is the following inference on 4 variables: We may compose switch and medial (and more generally an arbitrary set of linear inferences) to form new linear inferences by construing them as term rewriting rules.More generally, we will consider rewriting derivations modulo the equivalence relations ∼ ac and ∼ acu we introduced earlier.In the latter case, as previously mentioned, the underlying set of variables may change during a derivation, though Proposition 2.4 will later allow us to work with some fixed set of variables throughout {s, m} derivations.Definition 2.6 (Rewriting).Let S be a set of linear inferences.We write → S for the term rewrite system generated by S. I.e., → S is the smallest relation containing each inference of S and closed under substitution and contexts.
We write S for the closure of → S modulo ac, i.e. ϕ S ψ if there are ϕ , ψ such that ϕ ∼ ac ϕ → S ψ ∼ ac ψ.In this case we may say that the inference ϕ → ψ is an instance (without units) of some inference in S. We write Su for the closure of → S modulo acu, i.e. ϕ Su ψ if there are ϕ , ψ such that ϕ ∼ acu ϕ → S ψ ∼ acu ψ.Similarly in this case we may simply say the inference is an instance (with units) of some inference in S.
We write * S , or * Su , for the smallest reflexive transitive relation containing S and ∼ ac , or Su and ∼ acu , respectively, and say that a linear inference ϕ → ψ is S-derivable (without units) (or S-derivable with units) if ϕ * S ψ (or ϕ * Xu ψ, respectively).
We shall typically write such sets S by just listing their linear inferences, e.g.we write * ms instead of * {m,s} and * msu instead of * {m,s}u , in order to lighten notation.Clearly, s and m are valid, so any derivation ϕ * msu ψ comprises a linear inference.
Example 2.7 (Weakening and duality).The following derives ⊥ * su χ for any χ: Using this, we may {s}-derive weakening, ϕ → ϕ ∨ χ, with units as follows: Notice that * su is closed under De Morgan duality: If ϕ * su χ and φ and χ are obtained from ϕ and χ, respectively, by flipping each ∨ to a ∧ and vice versa, then χ * su φ.This follows by direct inspection of s and each clause of ∼ acu ; indeed the same property holds for * s , * ms , and * msu by the same reasoning.As a result, we also have that coweakening, ϕ ∧ χ → ϕ, is {s}-derivable with units.
Example 2.8 ('Mix').Units can help us derive even constant-free linear inferences.For instance, mix: ϕ ∧ ψ → ϕ ∨ ψ can be derived as a composite of coweakening and weakening: The following is one of the main results of this paper: Theorem 2.9.Suppose ϕ is a linear formula over V 1 and ψ is a linear formula over V 2 and r : ϕ → ψ is a linear inference.Then if |V 1 ∩ V 2 | ≤ 7 we have that ϕ * msu ψ.Furthermore, there is a valid linear inference ϕ → ψ on 8 variables with ϕ * msu ψ, so 7 is maximal with the property above.
This theorem was the original objective of the preliminary version of this paper [DR21].Indeed, before this it was not known if the smallest linear inference independent of switch and medial used 7 or 8 variables.The rest of Section 2 and Sections 4 and 5 work towards a proof of this theorem.

Trivial inferences.
In order to state Theorem 2.9 above in its most general form, we have allowed linear formulae to include constants and negation, and linear inferences to be between formulae with different variable sets.However it turns out that we may proceed to prove Theorem 2.9, without loss of generality, by working with derivations of only constant-free, negation-free formulae on some fixed set of variables, as was already shown in [Das13].This is done by defining the notion of a trivial inference, whose {s, m}-derivability, with units, may be reduced to that of a smaller non-trivial inference.
Definition 2.10.An inference ϕ → ψ is trivial at a variable x if ϕ[ /x] → ψ[⊥/x] is again a valid inference.An inference is trivial if it is trivial at one of its variables.
Example 2.11.The mix inference from Example 2.8, x∧y → x∨y, is trivial at x and trivial at y. Note, however, that it is not trivial at x and y 'at the same time', in the sense that the simultaneous substition of ⊥ for x and y in the LHS and for x and y in the RHS does not result in a valid implication.In contrast, the linear inference w ∧ (x ∨ y) → w ∨ (x ∧ y) from [Das13] is, indeed, trivial at x and y 'at the same time'.
Neither switch nor medial are trivial.
Remark 2.12 (Global vs local triviality).Note that triviality is closed under composition by linear inferences: if ϕ → ψ is trivial at x and ψ → χ is valid, then ϕ → χ is trivial at x. Similarly for χ → ψ if χ → ϕ is valid.One pertinent feature is that the converse does not hold: there are 'globally' trivial derivations that are nowhere 'locally' trivial.For instance consider the following derivation (from [DS16, Remark 5.6]): The derived inference is just an instance of mix, from Example 2.8, on the redex w ∧ x, which is trivial.However, no local step is trivial.
To prove (the first half of) Theorem 2.9, in Section 5 we will actually prove the following apparent weakening of that statement: Theorem 2.13.Let n < 8. Let ϕ and ψ be constant-free negation-free linear formulae on n variables and suppose ϕ → ψ is a non-trivial linear inference.Then ϕ In fact this statement is no weaker at all, and we will now see how the consideration of triviality allows us to only deal with such special cases without loss of generality.We first show that is not necessary to consider linear inferences where the premise and conclusion have different variables.
Proposition 2.14.Let ϕ and ψ be linear formulae on V 1 and V 2 , respectively, and let r : ϕ → ψ be a linear inference.Then there is r : ϕ → ψ on V 1 ∩ V 2 such that r is {s, m, r }-derivable with units.
Proof.First note that by setting ϕ = in Example 2.8 we have for any ψ: and by setting ψ = ⊥ we have for all ϕ that: ⊥ ∼ acu ϕ ∧ ⊥ * msu ϕ ∨ ⊥ ∼ acu ϕ Now we can let ϕ be ϕ with every variable in V 1 \ V 2 (or its negation) replaced with , and ψ be ψ with every variable in V 2 \ V 1 (or its negation) replaced with ⊥.Then r : ϕ → ψ is clearly a linear inference (since r is valid w.r.t.all assignments) and only uses the variables V 1 ∩ V 2 .Furthermore we have the derivation: msu ψ where the first step applies the derivation of x * msu The key use of triviality is that if an inference is trivial, then there is a smaller non-trivial inference from which it can be derived.
Proposition 2.15 [Das13, Theorem 34].Let ϕ and ψ be linear formulae on V, and let r : ϕ → ψ be a trivial linear inference.Then there is a non-trivial linear inference r : ϕ → ψ on some V V such that r : ϕ → ψ is {s, m, r }-derivable with units.
Note in particular that, in both statements above, if r is {s, m}-derivable with units, then so is r.This is also the case for the next result.
Proof.First, note that both ϕ and ψ must be linear formulae on V, since ϕ → ψ is non-trivial.For the same reason, no variable can occur positively in ϕ and negatively in ψ or vice-versa, since ϕ → ψ is non-trivial, and so any negated variable may be safely replaced by its positive counterpart.From here, we simply set ϕ and ψ to be the constant-free formulae (uniquely) obtained from Proposition 2.4 by ∼ u .Non-triviality of r follows from that of r by logical equivalence.
Corollary 2.17.The statement of Theorem 2.13 implies (the first half of ) the statement of Theorem 2.9.
Proof.Let r be as in Theorem 2.9.Let r be the inference where the LHS and RHS have the same variable set obtained from Proposition 2.14, let r be the non-trivial linear inference obtained by Proposition 2.15 above, and finally let r be the non-trivial constant-free negation-free linear inference obtained by Proposition 2.16.By Theorem 2.13, r is {s, m}derivable and so, by Proposition 2.14, Proposition 2.15, and Proposition 2.16, r is also {s, m}-derivable with units.
It is clear that if an inference is derivable with switch and medial then it is also derivable with switch, medial, and units.The following proposition, while not necessary for the proof of Corollary 2.17, allows the the converse in some cases, and is the reason why our search algorithm in Section 5 will only check for {s, m}-derivability.
Proof.Suppose we have the following derivation of ϕ → ψ, a non-trivial constant-free negation-free linear inference: Using Proposition 2.4, we can reduce any formula ϕ to a ∼ u equivalent constant-free formula (or ⊥ or ), which we will denote ϕ .We can now reduce each ϕ i and ψ i to ϕ i or ψ i respectively.Now each ∼ acu can be replaced by a ∼ ac by Remark 2.5 as all the involved formulae are constant-free or ⊥ or .It remains to show that each rewrite is still valid.We prove by induction on the definition of → ms (namely as the closure of ms under contexts and substitution) that if ϕ → ms ψ then either ϕ ∼ ac ψ or ϕ ms ψ .• Suppose we have an instance of the form ϕ ∧ χ → ψ ∧ χ, with ϕ → ms ψ. - -If χ = then (ϕ ∧ χ) = ϕ and (ψ ∧ χ) = ψ , whence we conclude by the inductive hypothesis for ϕ → ms ψ. -Otherwise we have χ is not a constant, and so ϕ and ψ must also not be constants, or the inference would be trivial.Therefore, (ϕ ∧ χ) = ϕ ∧ χ and (ψ ∧ χ) = ψ ∧ χ .By the inductive hypothesis for ϕ → ψ we have ϕ ∼ ac ψ or ϕ ms ψ , whence we conclude by context closure of ∼ ac and ms .
• The other cases for closure under contexts follow similarly.
However any such r is either an instance of ∼ ac or s .(This can be checked by hand or using our computer implementation presented in Section 5).Now, returning to Eq. (2.4), we have by the above argument that each ϕ i ∼ ac ψ i or ϕ i ms ψ i .Since ms = ∼ ac • → ms • ∼ ac , we can locally merge any redundant ac steps to obtain that, indeed ϕ * ms ψ .

Minimality of inferences.
Let us take a moment to explain the various notions of 'inference minimality' that we shall mention in this work.
Size minimality refers simply to the number of variables the inference contains.E.g. when we say that the 8-variable inferences in the next section are size minimal (or 'smallest') non-{s, m}-derivable with units (or {s, m}-independent) linear inferences, we mean that there are no {s, m}-independent linear inferences with fewer variables.
A linear inference ϕ → ψ is logically minimal if there is no logically distinct interpolating linear formula.I.e. if ϕ → χ and χ → ψ are linear inferences, then χ is logically equivalent to ϕ or ψ (and so, by Remark 2.5, is ∼ acu -equivalent to ϕ or ψ).
Finally, a linear inference ϕ → ψ is {s, m}-minimal if there is no formula χ s.t.ϕ ms χ or χ ms ψ and χ → ψ or ϕ → χ, respectively, is a valid linear inference which is not a logical equivalence.
It is clear from the definitions that any logically minimal inference is also {s, m}-minimal, though the converse may not be true.The reason for considering {s, m}-minimality is that it is easier to systematically check by hand.In fact, the implementation we give later in Section 5 further verifies that our new 8-variable inferences are logically minimal.
Logical minimality also serves an important purpose for our proof of Theorem 2.13, as it allows the following reduction, greatly reducing the search space for our implementation, in fact to nearly 1% of its original size for 8 variable inferences: 3 Lemma 2.19.Suppose the statement of Theorem 2.13 holds whenever ϕ → ψ is logically minimal.Then the statement of Theorem 2.13 holds (even when ϕ → ψ is not logically minimal).
Proof.Suppose we have a non-trivial inference between constant-free negation-free linear inferences ϕ → ψ.Then ϕ → ψ can be refined into a chain of logically minimal linear All of these must be non-trivial, as triviality of any of them would imply triviality of ϕ → ψ, cf.Remark 2.12.Therefore if all such inferences are derivable from switch and medial (with units) then so is ϕ → ψ, by transitivity.

New 8-variable {s, m}-independent linear inferences
In this section we shall present the new 8-variable linear inferences of this work ((1.1), (1.2), and (1.3) from the introduction), and give self-contained arguments for their {s, m}independence and {s, m}-minimality, as a sort of sanity check for the implementation described in the next section.We shall also briefly discuss some of their structural properties, in reference to previous works in the area.Thanks to the results of the previous section, in particular Proposition 2.16 and Remark 2.12, we shall only consider non-trivial constant-free negation-free linear inferences with the same variables in the LHS and RHS.Furthermore, by Proposition 2.18 we shall only consider {s, m}-derivability (i.e.without units).
The content of this section is based on Section 3 of the preliminary version, [DR21], with the addition of the inference (1.2) and surrounding discussion that was previously overlooked.
3.1.Previous linear inferences.In [Str12b] Straßburger presented a 36-variable inference that is {s, m}-independent, by an encoding of the pigeonhole principle with 4 pigeons and 3 holes.He there referred to it as a 'balanced' tautology, but in our setting it is a linear inference that can be written as follows: In [Das13] Das noticed that a more succinct encoding of the pigeonhole principle could be carried out, with only 3 pigeons and 2 holes, resulting in a 10-variable {s, m}-independent linear inference.A variation of that, e.g. as used in [Das17], is the following: In fact this is not a {s, m}-minimal inference, but we write this one here for comparison to two of the new 8-variable inferences in the next subsection.It can be checked valid and non-trivial by simply checking all cases, or by use of a solver.We do not give an argument for {s, m}-independence here, but such an argument is similar to the one we give for an 8-variable inference Eq. (3.2) given in the next subsection.
Remark 3.1 (Deriving 3-2-pigeonhole using contraction).It is known that, when we add to {s, m} structural rules that allow us to 'duplicate' and 'erase' propositional variables then the resulting (non-linear) system can derive every linear inference.This is thanks to the completeness of the deep inference system SKS for propositional logic and its cut-elimination theorem (see, e.g., [Brü03b]).With respect to Eq. (3.1) above, we need only a single 'duplication' on z or z .For instance, here is the corresponding derivation for z, 3.2.The four minimal 8 variable {s, m}-independent linear inferences.Pre-empting Section 5.2, let us explicitly give the four minimal linear inferences found by our algorithm and justify their {s, m}-independence and {s, m}-minimality, as a sort of sanity check for our implementation later.As we will see, they turn out to be significant in their own right, which is why we take the time to consider them separately.
3.2.1.Refinements of the 3-2-pigeonhole-principle.First let us consider an 8 variable linear inference that may be used to derive Eq. (3.1) (identical to (1.1) from the introduction): Recalling the notion of 'duality' from Example 2.7, let us formally define the dual of a linear inference ϕ → χ to be the linear inference χ → φ, where φ and χ are obtained from ϕ and χ, respectively, by flipping all ∨s to ∧s and vice-versa.Considering linear inferences up to renaming of variables, we have: Indeed, the formula structure of the RHS is clearly the dual of that of the LHS, and the mapping from a variable in the LHS to the variable at the same position in the RHS is, in fact, an involution.I.e., u is mapped to itself; v is mapped to y which in turn is mapped to v; v is mapped to w which is in turn mapped to v ; x is mapped to y which in turn is mapped to x; and z is mapped to itself.Validity may be routinely checked by any solver, but we give a case analyis of assignments in Appendix A.1.
We may also establish {s, m}-independence and {s, m}-minimality by checking all applications of s or m to the LHS (note that we do not need to check the RHS, by Observation 3.2 above).This analysis is given explicitly in Appendix A.4.
We also found the following inference (identical to Eq. (1.2)): At first glance this looks very similar to (3.2), however it turns out that it is not isomorphic to it, and neither is derivable from the other.Like (3.2), it is also self dual.Validity of this inference is checked in Appendix A.2, and its {s, m}-minimality is checked in Appendix A.5 (similarly to the (3.2), by duality we only need to check applications of s and m from the LHS).

3.2.2.
Counterexamples to a conjecture of Das and Straßburger.Finally, our search algorithm found two completely new linear inferences, which were dual to eachother.One of them (identical to (1.3) from the introduction) is: with the other given by dualising the above inference.Again, validity is routine, but a case analysis is given in Appendix A.3.We may establish {s, m}-independence and {s, m}-minimality again by checking all possible rule applications.This analysis is given in Appendix A.6.This new inference exhibits a rather interesting property, which we shall frame in terms of the following notion, since it will be used in the next section: Definition 3.4.Let ϕ be a linear formula on a variable set V. For distinct x, y ∈ V, the least common connective (lcc) of x and y in ϕ is the connective ∨ or ∧ at the root of the smallest subformula of ϕ containing both x and y.
Note that, in the inference (3.4) above, the lcc of w and x changes from ∨ to ∧, but the lcc of y and y changes from ∧ to ∨.No such example of a minimal linear inference exhibiting both of these properties was known before; switch, medial and all of the linear inferences of this section either preserve ∨-lccs or preserve ∧-lccs.In fact, Das and Straßburger showed that any valid linear inference preserving ∧-lccs is already derivable by medial [DS16, Theorem 7.5].Furthermore they made the following conjecture: Conjecture 7.9 from [DS16], rephrased.Each logically minimal nontrivial linear inference preserves either ∧-lccs or ∨-lccs.
We shall see several further counterexamples over 9 variables later in Section 7, where we also discuss possible consequences and trends arising from all these new inferences.

A graph-theoretic presentation of linear inferences
In this section we consider graphical representations of formulas that render our search algorithm in Section 5 more efficient.The content of this section is based on Section 4 from the preliminary version, [DR21], with the addition of further examples, figures and narrative.
A significant cause of algorithmic complexity when searching for linear inferences is the multitude of formulae equivalent modulo associativity and commutativity (∼ ac ).For example, for 7 variables, there are 42577920 formulae (ignoring units), yet only 78416 equivalence classes.Under Remark 2.5 it would be ideal if we could deal with ∼ ac -equivalence classes directly, realising logical and syntactic notions on them in a natural way.This is precisely what is accomplished by the graph-theoretic notion of a relation web, cf.[Gug07, Str07, DS15, DS16].
Throughout this section we work only with constant-free negation-free linear formulae, cf.Theorem 2.13.Recall the notion of least common connective (lcc) from Definition 3.4.Definition 4.1.Let ϕ be a linear formula on a variable set V. The relation web (or simply web) of ϕ, written W(ϕ), is a simple undirected graph with: • The set of nodes of W(ϕ) is just V, i.e. the variables occurring in ϕ.
• For x, y ∈ V, there is an edge between x and y in W(ϕ) if the lcc of x and y in ϕ is ∧.
When we draw graphs, we will draw a solid red line x y if there is an edge between x and y, and a green dotted line x y otherwise.
Example 4.2.Let ϕ be the linear formula w ∧ (x ∧ (y ∨ z)).W(ϕ) is the following graph: w x y z Note that linear formulae equivalent up to associativity and commutativity have the same relation web, since ∼ ac does not affect the lccs.For instance, if ψ = (w ∧ x) ∧ (z ∨ y), then W(ψ) is still just the relation web above.In fact, we also have the converse: Proposition 4.3 (E.g., [DS16], Proposition 3.5).Given linear formulae ϕ and ψ, ϕ ∼ ac ψ if and only if W(ϕ) = W(ψ).

Thus relation webs are natural representations of equivalence classes of linear formulae modulo associativity and commutativity.
We can also realise our new 8-variable inferences from the previous section graphically: Example 4.4.The inferences (3.2), (3.3) and (3.4) may be construed as graph rewrites on their webs, as given in Fig. 1.The one for (3.4) is obtained from that of (3.4) by switching every edge to a non-edge and vice-versa, and exchanging the LHS and RHS.Note, for (3.4), that the edge between y and z changes from red to green, and several edges (e.g.x to y) change from green to red, exhibiting how this inference breaks Conjecture 7.9 from [DS16].
It is easy to see that the image of W is just the cographs.A cograph is either a single node, or has the form R S or R S for cographs R and S. Formally, R S has as nodes the disjoint union of the nodes of R and the nodes of S; edges within the R component are inherited from R and similarly for S; there is also an edge between every node in R and every node in S. R S is defined similarly, but without the last clause.A cograph decomposition of a cograph R is just a definition tree according to these construction rules (its 'cotree'), which we identify with a linear formula (whose web is R) in the natural way, setting ∧ for a node and ∨ for a node.By Proposition 4.3, the cograph decomposition of a cograph is unique up to associativity and commutativity of ∧ and ∨.
Cographs admit an elegant local characterisation by means of forbidden subgraphs: Definition 4.5.An induced subgraph of a graph G is one whose edges are just those of G restricted to some subset of the nodes.A graph G is P 4 -free if none of its induced subgraphs are isomorphic to the following graph, called P 4 : w x y z Further define a clique P of a graph G to be a subset of the nodes of G such that the induced subgraph on these nodes has all possible edges.Dually define a stable set to be a subset of the nodes whose induced subgraph contains no edges.A clique or stable set is maximal if any proper superset is no longer a clique or stable set respectively.
The following result is well-known since (at least) the '70s, and has appeared numerous times in the literature (see also [Gug07,Str07]): Proposition 4.6 (E.g.[CLB81]).A graph is a cograph if and only if it is P 4 -free.
Thus, relation webs are just the P 4 -free graphs whose nodes are variables.Note, in particular, that this characterisation gives us an easy way to check whether a graph is the web of some formula: just check every 4-tuple of nodes for a P 4 .In both these cases, the induced subgraph generated from {u, w, x, y} is P 4 .
What is more, we may also verify several semantic properties of linear inferences, such as validity and triviality, directly at the level of relation webs: Proposition 4.8 (Follows from Proposition 4.4 and Theorem 4.6 in [DS16]).Let ϕ and ψ be linear formulae on the same set of variables with webs R and S respectively.The following are equivalent: (1) ϕ → ψ is a valid linear inference.
(2) For every maximal clique P of R, there is some Q ⊆ P such that Q is a maximal clique of S.
(3) For every maximal stable set Q of S, there is some P ⊆ Q such that P is a maximal stable set of R.
Note that for inferences between arbitrary graphs (i.e.graphs that are not P 4 -free), conditions (2) and (3) above are not equivalent.In fact, (3) holds for R → S exactly when (2) holds for S → R, where R is the dual of R (inverting every edge).
Example 4.9 [DS16].Recall the definition of P 5 and C 5 from Example 4.7.It can be checked that P 5 → C 5 satisfies (2) but C 5 → P 5 does not (as {u, z} is a maximal clique of C 5 with no subset that is a maximal clique of P 5 ).Conversely C 5 → P 5 does satisfy (3) but P 5 → C 5 does not (for example {x, z} is a maximal stable set of C 5 but none of {x, z} is stable but not maximal in P 5 as {u, x, z} is stable).
Proposition 4.10 [DS16, Proposition 5.7].Let ϕ and ψ be linear formulae on the same variables with webs R and S respectively.The following are equivalent: (1) ϕ → ψ is a linear inference that is trivial at x.
(2) For every maximal clique P of R, there is some Q ⊆ P \ {x} such that Q is a maximal clique of S.
(3) For every maximal stable set Q of S there is some P ⊆ Q \ {x} such that P is a maximal stable set of R.
Note that the criterion for triviality is a strict strengthening of that for validity, as we would expect.Again note the duality between the second and third characterisations of triviality above.It is easy to see that the validity criterion of Proposition 4.8 holds for each of these rules.For s, the maximal cliques {x, y} and {x, z} in the LHS are mapped to {x, y} and {z} in the RHS respectively.For m, the maximal cliques {w, x} and {y, z} in the LHS are mapped to themselves in the RHS.Now consider the trivial inference x ∧ y → x ∨ y, construed as the graph rewrite rule: We can easily verify the criterion for triviality at x from Proposition 4.10 since the only maximal clique on the LHS, {x, y} has {y} ⊆ {x, y} \ {x} as a maximal clique on the RHS.
Example 4.12 (Supermix).A further interesting example is given by a class of inferences from [Das13] known as 'supermix'.These have the following form: Each of these inferences is trivial, as long as n > 0, and moreover they are trivial at each b i 'at the same time'.Note that, for n > 3, they are examples of inferences that that have more ∧ symbols in the RHS than the LHS, and for n > 4 more edges in the RHS than the LHS.For instance, considering n = 4, we can see that there are 4 edges in the LHS but 4 2 = 6 edges in the RHS.The only other inference so far that increases the number of edges is medial (which, nonetheless, reduces the number of ∧ symbols in a formula).It is not known whether any non-trivial linear inference has both of these properties.
Remark 4.13.With the results in this section, the notation for inferences between formulae can be equally used for relation webs.For example, for webs R and S, we write R ms S (or R → S is an instance of {s, m}) to mean that the inference between (any choice of) the underlying linear formulae is an instance of ms , and R * ms S to mean the there is a derivation from switch and medial between the underlying formulae.Since these relations are invariant under associativity and commutativity, they are independent of the particular cograph decomposition chosen.
Furthermore, to prove Theorem 2.13, it is sufficient to show that for all webs R and S with size less than 8, if R → S is valid and non-trivial then R * ms S.
It is in fact possible to check whether an inference is derivable from medial at the level of graphs: The second condition can, in fact, be replaced by simply requiring that R → S is valid [DS16, Theorem 7.5].A relation web characterisation for switch derivability can also be found in [Str07, Theorem 6.2], however we do not use it in our implementation.The medial characterisation was used in the original implementation that accompanied [DR21], though a more general method is used in the current implementation which allows checking whether an inference is an instance of any graph rewrite (see Section 5.1 for more details).

Implementation
As stated in previous sections, Theorem 2.13 is proved using a computational search.In this section we describe the algorithm used to search for S-independent inferences between P 4 -free graphs of size n, for some set S of linear inferences, as well as some of the optimisations we employ so that this search finishes in a reasonable time.Many of these optimisations may be of self-contained theoretical interest.To prove Theorem 2.13, we will take the set S = {s, m} and n = 7, but everything in this section generalises to an arbitrary set of linear inferences.
The implementation is written in Rust,5 which offers a combination of good performance (both in terms of speed and memory management) but also provides a variety of high level abstractions such as algebraic data types.Furthermore, it has built-in support for iterators, allowing the code to be written in a more functional style, and has a built-in testing framework, meaning that sanity checks can be built into the code base.The code [Ric21] is available at https://github.com/alexarice/lin_infand has been split into two parts: a library containing types for undirected linear graphs and formulae and some operations on them, and an executable which implements the search algorithm using this library as a base.
The content in this section is based on Section 5 of the preliminary version [DR21].In this version we have generalised the search algorithm to take an arbitrary set S of linear inferences as input, and we have further used this to devise a recursive algorithm basis computing minimal sets of independent linear inferences, whose correctness we justify in Section 6. 5.1.Library.The library portion of the implementation defines methods for working with relation webs, as well as the ability to convert formulae to relation webs and vice versa.The majority of the library consists of the LinGraph trait, which is an interface for types that can be treated as undirected graphs.This allows us to query the edges between variables as well as perform more involved operations such as checking whether a graph is P 4 -free.We may also ask whether a pair of relation webs forms a valid linear inference and check whether the inference is trivial using Propositions 4.8 and 4.10.
Storing graphs and relation webs.The library was designed with the intention of storing graphs as compactly as possible.Therefore there are implementations of LinGraph which pack the data (a series of bits for whether there exists an edge between each pair of nodes) into various integer types.The implementation is given for unsigned 8 bit, 16 bit, 32 bit (which can store up to 8 variable graphs), 64 bit, and 128 bit integers.Furthermore there is an implementation using vectors (variable length arrays) of Boolean values, which is less memory efficient but can store relation webs of arbitrary size.A further improvement could be to use an external library implementing bit arrays to make a memory efficient, yet infinitely scalable implementation.
Checking an inference between graphs.In order to implement linear inference checking, we use a data type representing maximal cliques of a relation web, which we represent as the trait MClique.It is possible to use Rust's inbuilt HashSet6 to do this but, as above, a more memory efficient solution is provided where we store the data in a single integer, with each bit determining whether a node is contained in the clique.For example a maximal clique on an 8 node graph can be encoded into a single byte.While checking for linear inferences and triviality, the main operation on maximal cliques is asking whether one is a subset of the other.This operation can be carried out very quickly using bitwise operations.Lastly we also need a way to generate the maximal cliques of a relation web.This is done using the Bron-Kerbosch algorithm [BK73], which is fast enough for our purposes (as we are only finding the maximal cliques of relatively small graphs).
As mentioned after Proposition 4.8, for arbitrary (non-P 4 -free graphs) the maximal clique condition and maximal stable set condition for checking an inference do not have to agree, and so we would like to have both options in our library.To avoid having to calculate stable sets as well as cliques, we instead simply calculate whether an inference R → S between graphs satisfies the stable set condition by checking whether S → R satisfies the clique condition.To this end, the library contains functions for dualising a graph.
Working with isomorphism.There is also code for working with isomorphisms of graphs, which is used in the search algorithm to shrink the search space further.This is implemented as a module where permutations and operations on these permutations are defined, as well as having the ability to apply a permutation to the nodes of a graph, to get a new but isomorphic graph.
Generating all P 4 -free graphs.The library also has a function that allows all P 4 -free graphs of a certain size to be generated.The naive algorithm for doing this which simply generates all graphs and checks each one for being P 4 -free is computationally infeasible for graphs with more than a few variables, as the number of graphs scales superexponentially with the number of variables (for instance there are 2 21 7-variable undirected graphs).Instead, we use a recursive algorithm that generates all P 4 -free graphs of size n by first generating the P 4 -free graphs of size n − 1 and then checking all possible extensions of these graphs to see if they are P 4 -free.Correctness of this procedure is due to the fact that induced subgraphs of a P 4 -free are themselves P 4 -free.In fact, a further optimisation is also added: when we check whether the extensions are P 4 -free, it is sufficient to only check if subsets of the nodes containing the added node are not isomorphic to P 4 , instead of checking every subset.
Checking if an inference is an instance of another.The library contains code for checking whether an inference r : R → R is an instance of another inference p : S → S .This is implemented as in [CDW20], and so allows us to also work with non-P 4 -free graphs.Let us first recall the definition of a module: Definition 5.1.Given a graph R on variables V, a subset M of V is a module if every element of M has the same neighbourhood outside of M , so if x, y ∈ M and z ∈ V \ M then there is an edge between x and z if and only if there is an edge between y and z.
For a formula ϕ, the modules of the graph W(ϕ) correspond exactly to the subformulae of ϕ.The check is done as follows: • For each subset M of the variable set, check if M is both a module of R and R .This is the generalisation of finding a suitable context for the rewrite to all graphs.Each such module M generates the induced subgraphs M ⊆ R and M ⊆ R .• If r is an instance of p, then for some M found we have there is a substitution of p which produces M → M .We check this by going through all partitions of M into |S| non-empty parts P x for every node x of S and seeing if this substitution produces M → M .This is done by checking if M has an edge between a ∈ P x and b ∈ P y (with x = y) precisely when then there is an edge between x and y in S, checking the similar condition for M , and finally checking that for each x, the induced subgraph of M and M generated from P x are the same.
When specialised to P 4 -free graphs, this procedure agrees with the usual notion of rewrite step.11:21 Sanity checks.Finally, the library also contains some automated tests used as sanity checks on the code, which may be used to check various implementations against each other.5.2.Search algorithm.The main part of the implementation is a search algorithm to find logically minimal non-trivial inferences of a specified size n between relation webs that are not derivable from a specified set of inferences S. The search algorithm functions in multiple phases.After each phase the results are serialised and saved to disk so that the algorithm can be restarted from this point.
Phase 1: generating P 4 -free graphs on n nodes.Suppose we are searching for S-independent linear inferences between webs on n variables.The first phase, as described in the previous section, is to gather all P 4 -free graphs with n nodes.
Phase 2: identifying isomorphism classes and canonical representatives.To describe the second phase we need to introduce some new notions.Without loss of generality, we will assume henceforth that the variable set is given by V = {0, . . ., n − 1}.
Definition 5.2.Note that the function ι : {(x, y) ∈ N × N | x < y} → N given by ι(x, y) = x + i<y i is a bijection.Define the numerical representation of a linear graph R, written N (R), to be the natural number whose ι(x, y) th least significant bit is 1 if and only if (x, y) ∈ R.This is the encoding used to store graph in integers as described in the Section 5.1.Definition 5.3.Given a bijection ρ : V → V, we write ρ(R) for the graph on V with edges (ρ(x), ρ(y)) for each edge (x, y) ∈ R. R and S are isomorphic if S = ρ(R), for some bijection ρ : V → V, in which case ρ is called an isomorphism from R to S.
As isomorphism is an equivalence relation, we can partition the set of P 4 -free graphs into isomorphism classes.It can readily be checked that N (from Definition 5.2) is injective and can therefore be used to induce a strict total ordering on graphs.Say that a relation web is least if it is the smallest element in its isomorphism class (with respect to this ordering induced from N ).
The second phase of the algorithm is to identify these least relation webs, as well as identify the isomorphism between every relation web and its isomorphic least relation web.It will become clear why this data is needed later on in the section.To obtain this, first the relation webs are sorted (by numerical representation) and then, taking each graph R in turn, applying every possible permutation to its nodes, and seeing if any result in a smaller web (with respect to N ).If none do then we record it as a least relation web (with the identity isomorphism).Otherwise suppose it is isomorphic to R with isomorphism ρ where N (R ) < N (R).As we are checking graphs in order, we must already know that R is isomorphic to least graph R with isomorphism π.Then we can record R as being isomorphic to R with isomorphism π • ρ.This allows us to use the following lemma.
Lemma 5.4.Take some set S of inferences and number n.Then to show that any valid non-trivial logically minimal inference R → S on n variables is derivable from S, that is R * S S, it is sufficient to only check those inferences where R is least.Hence to prove the statement of Theorem 2.13, it is sufficient to prove that for all valid non-trivial logically minimal inferences R → S on n < 8 variables where R is least, that R * ms S.
Proof.Suppose R → S is a valid non-trivial logically minimal inference on n variables.Then let ρ be an isomorphism from R to R which is least, and let S = ρ(S).Then we have that R → S is valid, non-trivial, minimal, and R is least, and so by assumption we have R * S S .By applying the isomorphism to the derivation we get R * S S as required.The second part of the lemma follows straight from the first, along with Remark 4.13 to restrict to non-trivial linear inferences and Lemma 2.19 to restrict to minimal inferences.
The above lemma allows us to search for independent linear inferences by only searching inferences from least webs to arbitrary webs.This increases the speed of the search greatly as it turns out there are relatively few isomorphism classes (and so least webs).For example, specialising to the case n = 7, there are 78416 P 4 -free graphs with 7 variables with only 180 of them being least (so that there are 180 isomorphism classes).Note that we may not similarly restrict the RHS of inferences to least webs.This means we need to know the maximal cliques of every P 4 -free graph to determine whether there are inferences between them.
Phase 3: generating all maximal cliques.In phase three we generate all the maximal cliques of the graphs found in phase one and store them so that they do not need to be recomputed every time we check a linear inference.Each maximal clique of a graph of size n can be stored using only n bits, so storing all this data is feasible.
Phase 4: generating 'least' linear inferences.With the maximal clique data, phase four of generating a list of all valid linear inferences (from a least web to an arbitrary web) can be easily done by iterating through all possible combinations and checking them using Proposition 4.8.
Phase 5: checking for non-triviality.Similarly phase five of checking which of these inferences are non-trivial is also simple using Proposition 4.10.This data is stored in a HashMap of sets for quick indexing.
Phase 6: restricting to logically minimal inferences.Phase six is now to restrict our inferences to only those that are logically minimal.Write Φ R be the set of webs distinct from R that R (non-trivially) implies.We calculate, for a least web R, the set M R of webs S with R → S a logically minimal linear inference using the identity: Note that to calculate this, we need to be able to generate Φ R for arbitrary (i.e.not necessarily least) webs.This is where the isomorphism data stored in phase two becomes useful, as if ρ is an isomorphism from R to R , with R least, we can use, to generate Φ R , where we already have Φ R .In the implementation, we generate each Φ R on the fly (from Φ R ), though we could have pre-generated all of these, which might provide further speedup for this phase.
Phase 7: checking for S derivability.The last phase is to check the remaining inferences, of which there are now few enough to feasibly do so.Logically minimal inferences have one further benefit: a logically minimal inference (and in fact any S-minimal inference) ϕ → ψ is derivable from S if and only if it is derivable from a single S step.
To check whether each remaining inference is derivable from S, we use the library function for determining whether a given inference is an instance of another.For the specific • 384 were an instance of Inference (3.4), • 104 were an instance of the dual of Inference (3.4), • and there were 184 remaining inferences.After quotienting by isomorphism, there were 10 remaining inferences, in 5 dual pairs.These inferences are given in Section 7, and a theoretical justification for this search is given in Section 6.
Other features of the implementation.The implementation executable has a couple of extra features.One of these is the ability to run the search algorithm recursively on n to get a set of minimal inferences basis(n).This works in the following way: We set basis(0) = ∅.To calculate basis(n + 1), we first recursively run the algorithm on n to get a set of inferences basis(n).We can then run the above phases on size n + 1 inferences checking against the set basis(n) of inferences.This will give us a set S of n + 1 variable inferences.We then return basis(n + 1) = basis(n) ∪ S. The use of this algorithm and it's name are explained in Section 6.
Further we also include a flag that toggles whether the search algorithm searches for only P 4 -free graphs, or if it searches for any graph.Turning off the checking for P 4 -free graphs changes phase 1 of the algorithm to include all graphs instead of just those that are P 4 -free, but the rest of the algorithm functions the same.We lastly also include a flag for using maximal stable set entailment (condition (3)), instead of the maximal clique entailment (condition (2)).Since both of these coincide for P 4 -free graphs, this only needs to be considered when the "P 4 " setting is turned off.
These extra features of the implementation are not needed for the proof of Theorem 2.13, but are used in the following sections.

Enumerating a 'basis' of linear inferences
Theorem 2.9 was concerned with minimal linear inferences independent of switch and medial, and so its proof requires the special case of S = {s, m} in the search algorithm of the previous section.This section is devoted to proving that the recursive algorithm basis(n) described at the end of the last section in fact computes a 'canonical' basis of linear inferences independent of all smaller ones.The content of this section is new and does not appear in the preliminary version [DR21].
6.1.Defining a 'basis' of linear inferences.First, we must make precise what the 'canonical' linear inferences of a certain size are.
Definition 6.1.Let L ≤n denote the set of all linear inferences on ≤ n variables, and write L <n = L ≤(n−1) .For n > 4, we call a set X of linear inferences n-minimal if it is a smallest set of linear inferences such that X ∪ L <n derives (with units) every r ∈ L n .
(4) Any non-trivial logically minimal r ∈ L ≤n that is not L <n -derivable (with units) is an instance of some r ∈ X, modulo acu.
Proof.For (1), suppose for contradiction that ϕ has variables V 1 and ψ has variables V 2 where V 1 = V 2 .However by Proposition 2.14, we then have that there is some r on V 1 ∩ V 2 , which must have fewer variables than r, and that r is derivable from r , switch and medial, meaning r is already L <n -derivable.For (2), note that by Proposition 2.15 any trivial n-variable linear inference is already L <n -derivable.
For (3), suppose X r : ϕ → ψ is not logically minimal.Let χ have n variables such that ϕ → χ → ψ are valid but χ is not equivalent to ϕ or ψ.Note in particular that ϕ, χ, ψ are satisfied by k, l, m assignments respectively, with k < l < m.By assumption X ∪ L <n must derive r 0 : ϕ → χ and r 1 : χ → ψ; we may assume that any such derivation does not use r: • if an instance of r has a constant substituted for one of the variable inputs, then it reduces to a L <n inference, modulo acu by Proposition 2.4.• otherwise an instance of r would have k assignments satisfying its LHS (which is too few in the case of r 1 ) and m assignments satisfying its RHS (which is too many in the case of r 0 ).Thus (X \ {r}) ∪ L <n derives r 0 and r 1 and hence it also derives r and by extension every r ∈ L ≤n , contradicting the minimality of X.
For (4) let L ≤n r : ϕ → ψ be logically minimal and non-trivial and not L <n -derivable.X ∪ L <n must derive r, since it derives all of L ≤n .However, any such derivation cannot have any formula not already logically equivalent to ϕ or ψ, by logical minimality.Thus all formulae are acu-equivalent to ϕ or ψ by Remark 2.5, and there must be a single step whose LHS and RHS are thus acu-equivalent to ϕ and ψ respectively.Note that the above lemma actually characterises n-minimal sets: a set X is n-minimal iff it contains just (a renaming, modulo ac, of) each non-trivial logically minimal r ∈ L ≤n that is not L <n -derivable.Corollary 6.4.For n > 4, n-minimal sets are unique up to acu and renaming of variables.
Due to Proposition 2.16, and since every element of an n-minimal set is non-trivial, by Proposition 6.3, we can always choose the elements of an n-minimal set to be constant-free and negation-free.This motivates the following definition.Definition 6.5.We define the sets M n for each n as follows: For n = 0, 1, 2 we have M n = ∅, then M 3 = {s}, and M 4 = {m}.For n > 4, we write M n for the (unique up to ac and renaming) constant-free negation-free n-minimal set, and we write M ≤n := m≤n M m .
By definition of n-minimality and completeness of {s, m} for L ≤4 we have: Fact 6.6.For n > 4, M ≤n is complete for L ≤n , i.e. any r ∈ L n is M ≤n -derivable with units.
In fact we can say more than this: M ≤n is the minimal set w.r.t.set inclusion (unique up to ac and renaming) such that, for every k, its restriction to ≤ k-variable inferences derives every r ∈ L ≤k .It also has the property that for every r ∈ M n , we cannot derive r in M ≤n \ {r}.This can be viewed as a 'local' version of independence that allows the unit-elimination results of the next subsection to go through.In this way we may say that it forms a 'basis' for L. Remark 6.7 (On independence).Note that our sets M ≤n are not fully independent.For instance s is an acu-instance of (3.2).In fact we believe that there cannot exist a minimal set (w.r.t.set inclusion) that is complete, i.e. derives all of L, as infinite descending sequences (w.r.t.set inclusion) may exist.Indeed the inferences QHQ n from [Str12b] seem to suggest this, since each QHQ n derives all QHQ <n .However these inferences are not logically minimal, and a comprehensive reduction of this family to a logically minimal one is beyond the scope of this work.6.2.Computing M n recursively without units.With a view to generalising our search algorithm, we would like to, for arbitrary n, identify M n , i.e. the 'minimal' n-variable inferences that are independent of L <n .However, in order to apply our implementation, based on graph theoretic representations that do not account for constants or negation, we need the following generalisation of Proposition 2.18.Theorem 6.8.For n ≥ 4, if M ≤n derives a constant-free negation-free nontrivial linear inference r, then it also derives r without units.
Proof.We structure the whole proof by induction on n.The base case is given by Proposition 2.18, and we follow a variation of the argument therein for the inductive step too.
Again, for any formula ϕ, write ϕ for the unique constant-free formula (or ⊥ or ) ∼ uequivalent to ϕ, cf.Proposition 2.4.Suppose ϕ → ψ is a nontrivial constant-free negation-free linear inference with an M ≤n -derivation (with units) of the form: Like in Proposition 2.18, we proceed by replacing each ϕ i and ψ i by ϕ i and ψ i respectively.
As before, we indeed have that ψ i ∼ ac ϕ i+1 , thanks to Remark 2.5.For the inferences ϕ i → ψ i , we shall show by induction on the definition of → M ≤n (namely as the closure of M ≤n under contexts and substitution) that, whenever ϕ → M ≤n ψ, we have ϕ * M ≤n ψ .(Note the difference here with Proposition 2.18 where we showed the stronger statement that ϕ ∼ ac ψ or ϕ ms ψ , instead of ϕ * ms ψ ).• In the case of context closure, the argument is the same as for Proposition 2.18, relying on context closure of * X in place of X .• Suppose ϕ → M ≤n ψ with ϕ = α(χ 0 , . . ., χ k ) and ψ = β(χ 0 , . . ., χ k ) where α(x 0 , . . ., x k ) → β(x 0 , . . ., x k ) (all variables displayed) is in M ≤n (and so k < n).
-Otherwise, ϕ → ψ is an instance of some inference r : γ → δ on < n variables, so that r ∈ L <n .Now we appeal to Fact 6.6 so that r is M <n -derivable with units and so applying the main inductive hypothesis we have that r is M <n -derivable without units.Finally, since derivations are closed under substitution, we have that ϕ → ψ is M <n derivable (without units), i.e. ϕ * M<n ψ as required.Now, returning to Eq. (6.1), we have by the above argument that each ϕ i * M ≤n ψ i , whence we conclude since * M ≤n is reflexive and transitive.
Putting together Proposition 6.3, Fact 6.6, and Theorem 6.8 above we finally have: Corollary 6.9.For all n, M n is precisely the set containing (a renaming, modulo ac, of ) each logically minimal constant-free negation-free non-trivial n-variable linear inference that is not an instance without units of some inference in M <n .
Proof.This is easily checked for n ≤ 4. For n > 4, we have from Proposition 6.3 and Fact 6.6 that M n consists of (a renaming, modulo ac, of) each logically minimal constant-free negationfree non-trivial n-variable linear inference that is not derivable by M <n with units.By Theorem 6.8, we have that it is sufficient to be not derivable from M <n without units, and since inferences of M n are logically minimal, this is the same as each inference of M n not being an instance of any inference in M <n .6.3.Enumerating M n using graphs.With the results of the previous section, we can now compute each M n using the techniques from Section 4 and Section 5. We start with some definitions: Definition 6.10.Recall that graphs have an ordering < derived from their numerical representation.Further recall that we call a graph least if it is the smallest element (with respect to this ordering) in its isomorphism class.Let an inference of graphs R → S be least if R is least and there is no isomorphism ρ such that ρ(R) = R and ρ(S) < S.
Inductively define W n to be the set containing each logically minimal non-trivial nvariable least linear inference between P 4 -free graphs which is not an instance of any inference in W <n (i.e., under substitutions of P 4 -free graphs for nodes).
We now claim the following: Lemma 6.11.M n contains just (a renaming of ) a cograph decomposition of each r ∈ W n .
Proof.The proof proceeds by induction on n by using the classification of Corollary 6.9.
First, all cograph decompositions of inferences in W n are logically minimal non-trivial n-variable inferences by definition, and must be constant-free and negation-free, as they are decompositions of graph-based inferences.Further they are not an instance (without units) of some inference in M <n as this would render them an instance of an inference in W <n by the inductive hypothesis.Since two formulae have the same web if and only if they are ∼ ac equivalent, a renaming of some cograph decomposition of each inference in W n is present in M n .
Conversely, suppose r : ϕ → ψ is a logically minimal constant-free negation-free nontrivial n-variable inference that is not an instance (without units) of some inference in M <n .Then there is some isomorphism ρ such that ρ(W(ϕ)) → ρ(W(ψ)) is a logically minimal non-trivial n-variable least linear inference.Further it is not an instance of W <n by inductive hypothesis and assumption, and so ρ(W(ϕ)) → ρ(W(ψ)) is in W n .Note that r is, by definition, just a renaming of some cograph decomposition of ρ(W(ϕ)) → ρ(W(ψ)).
We now find each W n by inductively finding W ≤n for each n.The base case is given that W ≤4 = {s, m}.For the inductive step we suppose we want to find W n and W ≤n for some n > 5, and assume that we already know W <n .We simply use the search algorithm specified in Section 5.2 with inputs n and using W <n as the set of rewrites to check against.This will find us a set of n-dimensional inferences between P 4 -free graphs which are logically minimal, valid, non-trivial, have a least graph as their premise, and are not derivable from Figure 2: 9-variable inferences which form M 9 with their duals.
W <n .From here, M n is calculated by simply taking cograph decompositions of the elements of W n .This is exactly the procedure basis, described at the end of Section 5.2, which is part of the executable portion of the implementation.
Theorem 6.12.The recursive algorithm basis(n) introduced in Section 5.2 computes the set M n .
It should further be remarked that running this recursive algorithm for n = 7 and n = 8 replicates the main results of the paper, as M <7 = M <8 = {s, m}, and so the recursive algorithm simply checks for switch medial derivability in these cases.

New 9-variable minimal linear inferences
Running basis(9) found 10 distinct 9-variable inferences which are logically minimal, nontrivial, and not derivable from switch, medial, and the four 8-variable inferences presented in Section 3.These are the 5 inferences in Figure 2, along with each of their duals, which form the set M 9 .None of the 9-variable inferences were self-dual.Running basis(10) seemed infeasible on a standard desktop.
In what follows we provide some analysis of these new 9-variable inferences, though a more detailed inspection of these (and, indeed, larger inferences) could form the subject of future work.The content of this section is new and does not appear in the preliminary version [DR21].7.0.General comments.Before turning to each inference individually, let us remark on some global patterns and statistics.• The LHS has 25 red edges (and 11 green edges), and the RHS has 12 red edges (and 24 green edges).• The inference flips 14 red edges to green, and 1 green edge to red (namely the edge (y, z )).
Let us point out that this inference is distinguished in that its RHS has the highest logical depth among all inferences in M ≤9 , exhibiting 4 alternations between ∨ and ∧.It would be interesting to see if inferences in M n become arbitrarily deep as n increases.• The LHS has 25 red edges (and 11 green edges), and the RHS has 11 red edges and 25 green edges.• The inference flips 15 red edges to green, and 1 green edge to red (namely the edge (y, z )).
This inference is similar to the last one, in that the two have identical LHSs, each flips only one green edge to red, and each generalises the same inferences from M ≤8 (only (3.3)).This inference is in a sense more 'symmetric' in that the number of red edges in the LHS equals the number of green edges in the RHS (and vice-versa).

Further remarks: applications to graph logics
In this section we describe some further potential applications of our theoretical results in the previous section to graph logics, and the generalised implementation available at [Ric21].
The content of this section is new and does not appear in the preliminary version [DR21].
8.1.Graph inferences.As mentioned earlier, our implementation is set up to be able to work with all graphs, and not just P 4 -free graphs, in particular, we can check if an inference is an instance of any arbitrary graph rewrite.Using this, we can perform our algorithm without the restriction to P 4 -free graphs to obtain sets G n of n-variable logically minimal non-trivial graph inferences which are not derivable (w.r.t.condition (2)) from the set of smaller graph instances.Note that although our software is able to check maximal stable set entailment (condition (3)) as well as maximal clique entailment (condition (2)), using the first would simply yield the dual of the results we list here.
There are still no non-trivial inferences for sizes 0, 1, and 2. For n = 3, we have G 3 = {s}.At n = 4 we get that M n = G n , as medial is no longer logically minimal, and in fact decomposes into the two following inferences: We list G 5 in Figure 3 which has 16 elements.We were further able to calculate G 6 which has 137 elements, and G 7 , which has 2013 elements, but we omit these here.
Let us point out, as a word of warning, that the sort of unit-elimination that we carry out for {s, m}-derivability in Section 2, and more generally for linear derivability in Section 6, has not been considered.The significance of our sets G n should be established by similar such results, but this is beyond the scope of this work.8.2.The graph logic GS.Acclavio, Horne and Straßburger introduce in [AHS20, AHS22] a graph logic motivated by the linear logic MLL.In particular they define an extension GS of MLL + mix to arbitrary graphs, that uniquely satisfy certain desiderata.Their logic has a primitive treatment of negation, inducing a form of graph entailment.Interestingly, GS entailment is incomparable with the conditions (2) and (3) on graphs considered in the previous subsection, even though the former's restriction to P 4 -free graphs is contained in the latter's.
It would be interesting to adapt our implementation to consider GS -entailment instead of the graph entailments of the previous subsection, in order to better understand theorems of GS itself, but this consideration is left for future work.

Conclusions
In this work we undertook a computational approach towards the classification of linear inferences.To this end we succeeded in exhausting the linear inferences up to 8 variables, showing that there are four (distinct) 8 variable linear inferences that are independent of switch and medial, using the algorithm basis presented in Section 5.One of these new inferences (and its dual) contradicts a Conjecture 7.9 from [DS16].Conversely, all linear inferences on 7 variables or fewer are already derivable using switch and medial.
We proposed in Section 6.3 a well-defined notion M ≤n of 'basis' for linear inferences with ≤ n variables.We showed that our algorithm basis(n) in fact correctly computes each M n .We were further able to run basis(n) for n = 9 and thus classified in Section 7 the logically minimal 9 variable linear inferences independent of all inferences on < 9 variables.Our preliminary analysis uncovered that all but 1 of these was a counterexample to the aforementioned conjecture, suggesting that inferences of this form may not be scarce when the number of variables is increased.We were not able to evaluate basis(10), but believe it is
Example 4.7.P 5 and C 5 are two examples of graphs which are not P 4 free.They are the following:

Example 4. 11 (
Validity of switch and medial, triviality of mix).The switch and medial inferences can be construed as the following graph rewrite rules on relation webs, respectively: Proposition 4.14 [Str07, Theorem 5].Let R → S represent a constant-free negation-free non-trivial linear inference.Then R → S is derivable from medial if and only if: • Whenever x y in R, also x y in S. • Whenever x y in R but x y in S there exists w and z such that w x y z is an induced subgraph of R and w x y z is an induced subgraph of S.

Figure 3 :
Figure 3: The set of G 5 of logically minimal nontrivial graph inferences not derivable by all smaller ones.