arXiv:2609.08961cs.LOSep 2026

Manuscript Offprint

arXiv:2609.08961

Fitting and Learning Basis-Restricted Propositional Formulas

Balder ten Cate

Abstract

For a finite set OO of Boolean functions, we consider the class of propositional formulas built using the functions in OO as connectives. We determine, for each possible choice of OO, the complexity of various fitting and learning problems. These include: finding a formula that fits a given labeled sample, finding a small one (an Occam algorithm), minimizing the number of misclassified examples when the sample is not realizable (empirical risk minimization), and several forms of PAC learning. Our results apply both to formulas (represented as trees) and to circuits. We also briefly discuss the status of the same questions for other kinds of propositional fragments.

1 Introduction

Fix a finite set OO of Boolean functions and let PLO\text{PL}_O be the class of propositional formulas that can be built using the functions in OO as connectives. Varying OO gives a family of concept classes, and a natural question is how the difficulty of the standard learning-theoretic tasks depends on the choice of OO. Several such classifications are either known or implied by known results, but they are scattered across the literature. We put them side by side, focusing on four problems.

  • Fitting. Given a labeled sample, decide whether some PLO\text{PL}_O-formula agrees with all of it, and if so produce one.

  • Occam algorithms. If the sample is realizable, find a fitting formula of near-minimal size.

  • Empirical risk minimization. When the sample need not be realizable, find a PLO\text{PL}_O-formula minimizing the number of mistakes.

  • PAC learning. Is PLO\text{PL}_O efficiently learnable in (variants of) the PAC model?

The four problems are not independent. Fitting is the special case of empirical risk minimization in which the sample is realizable, so an ERM algorithm is in particular a fitting algorithm. An Occam algorithm is a fitting algorithm that compresses, and compression yields a PAC learner, so hardness of PAC learning rules out Occam algorithms as well.

These questions can be studied also for CIRO\text{CIR}_O, that is, the family of circuits using functions from OO as gates. Note that PLO\text{PL}_O and CIRO\text{CIR}_O have the same expressive power, but may differ in succinctness. In addition, in Section 9 we discuss other fragments, such as monotone CNF and Horn CNF, that do not fall under the above basis-generated regime.

Our contributions are partly organizational: we give a uniform presentation and we provide written-out proofs for results that are only sketched in the literature. Our main novel contributions are an algorithm for constructing fitting formulas efficiently based on a refinement of the classic Baker–Pixley construction, and a trichotomy theorem for empirical risk minimization, building on known results for hypergraph vertex-cover problems. We also fill a small gap, showing that the PAC-learnability dichotomy in [16] holds not only for circuits but also for formulas.

The picture that arises is as follows.

Fitting and Occam algorithms. The basic fitting problem turns out to be uniformly easy:

Theorem 1.1 (Fitting). Let OO be a fixed finite basis. Then PLO\mathsf{PL}_O has a polynomial-time fitting algorithm: given a labeled sample it decides whether the sample is realizable, and if so returns a fitting PLO\mathsf{PL}_O-formula of polynomial size. The same holds for CIRO\mathsf{CIR}_O.

Here, by a labeled sample we mean a finite list of labeled examples (a,b)(\mathbf{a}, b) with a∈{0,1}n\mathbf{a} \in \{0,1\}^n and b∈{0,1}b \in \{0,1\}; a formula fits the sample if it takes the value bb at a\mathbf{a} for each of its examples, and the sample is realizable for PLO\mathsf{PL}_O if some PLO\mathsf{PL}_O-formula fits it. The tractability of testing existence was already observed in [40]. We give a proof in Section 3, which also shows how to construct fitting formulas efficiently, using a refinement of the Baker–Pixley theorem.

One may ask for a short fitting formula. An Occam algorithm for PLO\mathsf{PL}_O is a polynomial-time fitting algorithm that, on every realizable sample, returns a fitting formula of size at most p(sopt,n)⋅mβp(s_{\mathrm{opt}}, n) \cdot m^{\beta} for some fixed polynomial pp and some fixed β<1\beta < 1, where mm is the number of examples, nn is the number of Boolean variables, and sopts_{\mathrm{opt}} is the least size of a fitting PLO\mathsf{PL}_O-formula. An Occam algorithm compresses, as it returns something sublinear in mm. One may ask for more, namely an attribute-efficient Occam algorithm, whose size bound does not depend on nn: a fitting formula of size at most p(sopt)⋅mβp(s_{\mathrm{opt}}) \cdot m^{\beta}.

Theorem 1.2 (Occam algorithms, from [16]). Let OO be a finite basis of Boolean functions.

(a) If O⪯{∧,⊤,⊥}O \preceq \{\wedge, \top, \bot\}, O⪯{∨,⊤,⊥}O \preceq \{\vee, \top, \bot\} or O⪯{¬,⊤,⊥}O \preceq \{\neg, \top, \bot\}, then PLO\mathsf{PL}_O has an attribute-efficient Occam algorithm.

(b) If {⊕3}⪯O⪯{⊕,⊤,⊥}\{\oplus^3\} \preceq O \preceq \{\oplus, \top, \bot\}, then PLO\mathsf{PL}_O has an Occam algorithm, but we do not know whether it has an attribute-efficient one.

(c) Otherwise PLO\mathsf{PL}_O does not have an Occam algorithm, under the cryptographic assumptions of Section 6.

The same holds for CIRO\mathsf{CIR}_O.

The proof is given in Section 7; the negative part is a consequence of the classification of PAC learnability, Theorem 1.5 below, since an Occam algorithm yields a proper PAC learner [11].

Empirical risk minimization. The next problem drops the assumption that the sample is realizable and asks for a hypothesis that minimizes the empirical risk, that is, the fraction of misclassified examples. This is empirical risk minimization (ERM). Unlike the fitting problem, ERM is not always solvable in polynomial time. When it is hard, one may ask for an approximation algorithm. We say that an algorithm is a weak approximator for PLO\mathsf{PL}_O if there are δ,ε>0\delta, \varepsilon > 0 such that, on every sample whose optimal hypothesis has empirical risk ≤ε\leq \varepsilon, the algorithm produces a PLO\mathsf{PL}_O-hypothesis of empirical risk ≤1/2−δ\leq 1/2 - \delta. This is, in some sense, the lowest bar. Note that, if OO includes the truth constants ⊤\top and ⊥\bot, then there is always a trivial solution that achieves an error fraction ≤1/2\leq 1/2. Every kk-approximation algorithm for a constant factor kk is a weak approximator: it suffices to pick ε=1/(4k)\varepsilon = 1/(4k) and δ=1/4\delta = 1/4.

To state the classification, for r>j≥1r > j \geq 1 let thjr\mathrm{th}_{j}^{r} denote the rr-ary threshold operation “at least jj of rr”, that is,

thjr(x1,…,xr)=1⟺x1+⋯+xr≥j.\mathrm{th}_{j}^{r}(x_{1},\ldots,x_{r})=1\quad\Longleftrightarrow\quad x_{1}+\cdots+x_{r}\geq j.

Thus thjr\mathrm{th}_{j}^{r} and thr−j+1r\mathrm{th}_{r-j+1}^{r} are dual, and th23=maj\mathrm{th}_{2}^{3} = \mathrm{maj}. Furthermore, in what follows, O⪯O′O \preceq O' means that every function in OO is term-definable from O′O', and O≡O′O \equiv O' that the two are interdefinable.

Theorem 1.3 (Empirical risk minimization). Let OO be a finite basis of Boolean functions. The ERM problem for PLO\mathsf{PL}_O falls into one of the following three regimes.

(i) If

{∧}⪯O⪯{∧,⊤,⊥},{∨}⪯O⪯{∨,⊤,⊥},or{⊕3}⪯O⪯{⊕,⊤,⊥},\{\land\}\preceq O\preceq\{\land,\top,\bot\},\qquad\{\lor\}\preceq O\preceq\{\lor,\top,\bot\},\qquad{o r}\qquad\{\oplus^{3}\}\preceq O\preceq\{\oplus,\top,\bot\},

then, unless P = NP, there is no polynomial-time weak approximator for PL_O, whatever its constants δ,ε>0\delta, \varepsilon > 0. In particular ERM for PL_O is NP-hard and has no polynomial-time constant-factor approximation.

(ii) If, for some k≥2k \geq 2,

{th2k+1}⪯O⪯{→,th2k+1}or{thkk+1}⪯O⪯{x∧¬y,thkk+1},\{\mathrm{t h}_{2}^{k+1}\}\preceq O\preceq\{\rightarrow,\mathrm{t h}_{2}^{k+1}\}\qquad{o r}\qquad\{\mathrm{t h}_{k}^{k+1}\}\preceq O\preceq\{x\land\neg y,\mathrm{t h}_{k}^{k+1}\},

then ERM for PLO\mathrm{PL}_{O} is NP-hard; it admits a polynomial-time kk-approximation; and, under the Unique Games Conjecture, it admits no polynomial-time (k−ε)(k-\varepsilon)-approximation for any ε>0\varepsilon>0. The factor kk is therefore optimal under that conjecture.

(iii) In all other cases, ERM for PLO\mathrm{PL}_{O} is solvable in polynomial time.

The same holds for CIO\mathrm{CI}_{O}.

The proof is given in Section 4. Note that, in light of Theorem 1.1, ERM may be equivalently viewed as the problem, given a labeled sample, of finding a relabeling that is realizable and disagrees on as few examples as possible.

Learning from random examples. We now turn to learning, beginning with the combinatorial parameter that governs how many examples are needed.

Proposition 1.4 (VC dimension). Let OO be a finite basis of Boolean functions and let n≥1n \geq 1. If O⪯{∧,⊤,⊥}O \preceq \{\land, \top, \bot\}, O⪯{∨,⊤,⊥}O \preceq \{\lor, \top, \bot\} or O⪯{⊕,⊤,⊥}O \preceq \{\oplus, \top, \bot\}, then the VC dimension of PLO\mathrm{PL}_O in nn variables is at most n+1n + 1. Otherwise it is 2Ω(n)2^{\Omega(n)}.

We now consider two notions of learnability. Both are representation-sensitive: the learner is told a bound ss on the size of a representation of the target, and may use a number of examples polynomial in 1/ε1/\varepsilon, 1/δ1/\delta, nn and ss. By a proper PAC learner for PLO\mathrm{PL}_O we mean an algorithm that, given ε,δ>0\varepsilon, \delta > 0, the bound ss, and sufficiently many examples drawn from an arbitrary distribution and labeled by a target in PLO\mathrm{PL}_O of size at most ss, outputs in polynomial time a hypothesis from the class whose error is at most ε\varepsilon with probability at least 1−δ1 - \delta. A PAC predictor need not output a hypothesis: after seeing the examples it is given one further point and must predict its label, with error bounded away from 1/21/2 by an inverse polynomial, and it may in addition ask membership queries, that is, ask for the value of the target at points of its own choosing. PAC prediction is easier than producing a hypothesis, and membership queries only help, so hardness of PAC prediction with queries is the stronger statement.1^1 Both notions, and the cryptographic assumptions, are given precisely in Section 6.

Theorem 1.5 (PAC learning and PAC prediction [16]). Let O be a finite basis. The following are equivalent.

(a) O⪯{∧,⊤,⊥}O \preceq \{\land, \top, \bot\}, O⪯{∨,⊤,⊥}O \preceq \{\lor, \top, \bot\} or O⪯{⊕,⊤,⊥}O \preceq \{\oplus, \top, \bot\};

(b) PLO\mathrm{PL}_{O} is polynomially properly PAC learnable;

(c) PLO\mathrm{PL}_{O} is polynomially PAC predictable with membership queries.

1^{1}This relies on the fact that, in the concept classes we consider here, the label of a given example for a given concept can be computed in polynomial time.

The implications (a)⇒(b)⇒(c)(a) \Rightarrow (b) \Rightarrow (c) are unconditional; the remaining implication (c)⇒(a)(c) \Rightarrow (a) holds under cryptographic assumptions described in Section 6. The same equivalence holds with CIRO\mathrm{CIR}_{O} in place of PLO\mathrm{PL}_{O}.

Dalmau [16] states the above result for formulas and for circuits but the proof establishes it only for circuits. We supply the missing step in Section 6. Other models of learning are considered in [16] as well, namely exact learnability from membership and equivalence queries. We omit them here, but note that our proof shows that the corresponding results of [16] also hold for formulas, and not just for circuits.

A finer question is whether, in the positive cases, the number of examples can be made attribute-efficient [39]: polynomial in ss, 1/ε1/\varepsilon, 1/δ1/\delta and log⁡n\log n rather than in nn (note that log⁡n\log n is the information theoretic content in bits of a single propositional variable). For the conjunctive and disjunctive bases this holds, as follows from Theorem 1.2 above. For the affine bases the target is a parity of at most ss variables, and whether such parities can be learned attribute-efficiently in polynomial time is a well-known open problem [36, 13].

The above results also yield a complete picture for agnostic learning [31], where we don’t assume that the labels are given by a target in the class: here, the examples are drawn from an arbitrary distribution DD on {0,1}n×{0,1}\{0,1\}^n \times \{0,1\}, and the learner must output a hypothesis whose error under DD exceeds the least error optD\mathrm{opt}_D of any nn-ary PLO\mathrm{PL}_O-formula by at most ε\varepsilon. Note that, since there is no target, the bound for the running time and sample size is in nn, 1/ε1/\varepsilon and 1/δ1/\delta. The learner is proper if the hypothesis is a PLO\mathrm{PL}_O-formula, and it is a weak agnostic learner if it is required to work only when optD≤ε\mathrm{opt}_D \leq \varepsilon, and then only to reach error ≤1/2−δ\leq 1/2 - \delta, for some fixed ε,δ>0\varepsilon, \delta > 0. Every weak agnostic learner yields a randomized weak approximator for ERM, by running it on the uniform distribution over a given sample. Conversely, when the VC dimension of PLO\mathrm{PL}_O is polynomial in nn, every polynomial-time ERM algorithm yields a proper agnostic learner, by uniform convergence; and polynomial VC dimension is in fact necessary for weak agnostic learning, even improper [47]. It follows from Theorem 1.3 and Proposition 1.4 that PLO\mathrm{PL}_O is properly agnostically learnable in polynomial time when O⪯{¬,⊤,⊥}O \preceq \{\neg, \top, \bot\}; that in the three intervals of regime (i) of Theorem 1.3 it is not properly weak agnostically learnable in polynomial time, unless NP=RP\mathrm{NP} = \mathrm{RP}; and that for every other basis it is not weak agnostically learnable at all, properly or not, for VC dimension reasons (cf. Proposition 1.4).

Finally, a further variant of the PAC model deserves discussion. Under random classification noise each label shown to the learner is flipped independently with a fixed probability η<1/2\eta < 1/2 [6]. The usual route to learning algorithms that are tolerant to such noise is Kearns's statistical query model, in which the learner sees no examples at all but may ask for the probability, under the example distribution, of any polynomial-time predicate of an example and its label, and receives it to within a tolerance of its choosing. A class learnable from polynomially many such queries of inverse-polynomial tolerance is PAC learnable under random classification noise of any rate η<1/2\eta < 1/2 [28]. Both notions are made precise in Section 8.

Theorem 1.6 (Statistical queries, from [28, 9]). Let OO be a finite basis. Under the cryptographic assumptions of Section 6, PLO\mathrm{PL}_O is efficiently learnable from statistical queries if and only if O⪯{∧,⊤,⊥}O \preceq \{\wedge, \top, \bot\}, O⪯{∨,⊤,⊥}O \preceq \{\vee, \top, \bot\} or O⪯{¬,⊤,⊥}O \preceq \{\neg, \top, \bot\}. The same holds for CIRO\mathrm{CIR}_O.

For random classification noise itself the picture is incomplete. Specifically, for the affine cases {⊕3}⪯O⪯{⊕,⊤,⊥}\{\oplus^3\} \preceq O \preceq \{\oplus, \top, \bot\} the question is open — it is known as the learning parity with noise problem [10].

Figure 1 collects these classifications. It depicts Post’s lattice. Its elements are all Boolean clones, which we can think of as the equivalence classes of the pre-order ⪯\preceq. They are colored to reflect the status of the clones in question with respect to the classifications above.

In this paper we focus on problems where a formula is to be derived from examples. For the converse direction, where a formula is given and a meaningful sample is to be generated for it — for instance one that characterizes the formula up to equivalence within the fragment — dichotomy results over Post's lattice exist as well, cf. [8].

The above results apply to fragments that are generated by sets of connectives, and that are for that reason closed under substitution. This excludes fragments such as Horn CNF, obtained by restricting the shape of clauses rather than the supply of connectives. Section 9 recalls Boolean constraint languages as the standard way of defining such fragments and records what becomes of the questions above when fragments are defined this way.

References (35)