{'fraction_non_alphanumeric': 0.04121717583779047, 'fraction_numerical': 0.012026712597830357, 'mean_word_length': 4.322290125442264, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Learning Possibilistic Logic Theories from Default Rules

We introduce a setting for learning possibilistic logic theories from defaults of the form"if alpha then typically beta". We first analyse this problem from the point of view of machine learning theory, determining the VC dimension of possibilistic stratifications as well as the complexity of the associated learning problems, after which we present a heuristic learning algorithm that can easily scale to thousands of defaults. An important property of our approach is that it is inherently able to handle noisy and conflicting sets of defaults. Among others, this allows us to learn possibilistic logic theories from crowdsourced data and to approximate propositional Markov logic networks using heuristic MAP solvers. We present experimental results that demonstrate the effectiveness of this approach.


Introduction
Structured information plays an increasingly important role in applications such as information extraction [Dong et al., 2014], question answering [Kalyanpur et al., 2012] and robotics [Beetz et al., 2011]. With the notable exceptions of CYC and WordNet, most of the knowledge bases that are used in such applications have at least partially been obtained using some form of crowdsourcing (e.g. Freebase, Wikidata, ConceptNet). To date, such knowledge bases are mostly limited to facts (e.g. Obama is the current president of the US) and simple taxonomic relationships (e.g. every president is a human). One of the main barriers to crowdsourcing more complex domain theories is that most users are not trained in logic. This is exacerbated by the fact that often (commonsense) domain knowledge is easiest to formalize as defaults (e.g. birds typically fly), and, even for non-monotonic reasoning (NMR) experts, it can be challenging to formulate sets of default rules without introducing inconsistencies (w.r.t. a given NMR semantics) or unintended consequences.
In this paper, we propose a method for learning consistent domain theories from crowdsourced examples of defaults and non-defaults. Since these examples are provided by different users, who may only have an intuitive understanding of the semantics of defaults, together they will typically be inconsistent. The problem we consider is to construct a set of defaults which is consistent w.r.t. the System P semantics [Kraus et al., 1990], and which entails as many of the given defaults and as few of the non-defaults as possible. Taking advantage of the relation between System P and possibilistic logic [Benferhat et al., 1997], we treat this as a learning problem, in which we need to select and stratify a set of propositional formulas.
The contributions of this paper are as follows. First, we show that the problem of deciding whether a possibilistic logic theory exists that perfectly covers all positive and negative examples is Σ P 2 -complete. Second, we formally study the problem of learning from defaults in a standard learning theory setting and we determine the corresponding VCdimension, which allows us to derive theoretical bounds on how much training data we need, on average, to obtain a system that can classify defaults as being valid or invalid with a given accuracy level. Third, we introduce a heuristic algorithm for learning possibilistic logic theories from defaults and non-defaults. To the best of our knowledge, our method is the first that can learn a consistent logical theory from a set of noisy defaults. We evaluate the performance of this algorithm in two crowdsourcing experiments. In addition, we show how it can be used for approximating maximum a posteriori (MAP) inference in propositional Markov logic networks [Richardson and Domingos, 2006;Dupin de Saint-Cyr et al., 1994].

Related work
Reasoning with defaults of the form "if α then typically β", denoted as α |∼ β, has been widely studied [Kraus et al., 1990;Pearl, 1990;Lehmann and Magidor, 1992;Geffner and Pearl, 1992;Goldszmidt et al., 1993;Benferhat et al., 1997]. A central problem in this context is to determine what other defaults can be derived from a given input set. Note, however, that the existing approaches for reasoning about default rules all require some form of consistency (e.g. the input set cannot contain both a |∼ b and a |∼ ¬b). As a result, these approaches cannot directly be used for reasoning about noisy crowdsourced defaults.
To the best of our knowledge, this is the first paper that considers a machine learning setting where the input consists of default rules. Several authors have proposed ap-proaches for constructing possibility distributions from data; see [Dubois and Prade, 2015] for a recent survey. However, such methods are generally not practical for constructing possibilistic logic theories. The possibilistic counterpart of the Z-ranking constructs a possibilistic logic theory from a set of defaults, but it requires that these defaults are consistent and cannot handle non-defaults [Benferhat et al., 1997], although an extension of the Z-ranking that can cope with non-defaults was proposed in [Booth and Paris, 1998]. Some authors have also looked at the problem of learning sets of defaults from data [Benferhat et al., 2003;Kern-Isberner et al., 2008], but the performance of these methods has not been experimentally tested. In [Serrurier and Prade, 2007], a possibilistic inductive logic programming (ILP) system is proposed, which uses a variant of possibilistic logic for learning rules with exceptions. However, as is common for ILP systems, this method only considers classification problems, and cannot readily be applied to learn general possibilistic logic theories. Finally note that the setting of learning from default rules as introduced in this paper can be seen as a non-monotonic counterpart of an ILP setting called learning from entailment [De Raedt, 1997].

Possibilistic logic
A stratification of a propositional theory T is an ordered partition of T . We will use the notation Strat(T ) to denote the set of all such ordered partitions and Strat (k) (T ) to denote the set of all ordered partitions into at most k subsets of T . A theory in possibilistic logic [Dubois et al., 1994] is a set of formulas of the form (α, λ), with α a propositional formula and λ ∈]0, 1] a certainty weight. These certainty weights are interpreted in a purely ordinal fashion, hence a possibilistic logic theory is essentially a stratification of a propositional theory. The strict λ-cut Θ λ of a possibilistic logic theory Θ is defined as Θ λ = {α | (α, µ) ∈ Θ, µ > λ}. The inconsistency level inc(Θ) of Θ is the lowest certainty level λ in [0, 1] for which the classical theory Θ λ is consistent. An inconsistency-tolerant inference relation ⊢ poss for possibilistic logic can then be defined as follows: We will write (Θ, α) ⊢ poss β as an abbreviation for Θ ∪ {(α, 1)} ⊢ poss β. It can be shown that Θ ⊢ poss (α, λ) can be decided by making O(log 2 k) calls to a SAT solver, with k the number of certaintly levels in Θ [Lang, 2001].

Learning Theory
We now cover some basic notions from statistical learning theory [Vapnik, 1995]. We restrict ourselves to binary classification problems, where the two labels are 1 and −1. Let X be a set of examples. A hypothesis is a function h : X → {−1, 1}. A hypothesis h is said to cover an example e ∈ X if h(e) = 1. Consider a set S ⊆ X × {−1, 1} of n labeled examples that have been iid sampled from a distribution p. A hypothesis h's sample error rate is err S (h, S) = 1 n (x,c)∈S 1(h(x) = c) where 1(α) = 1 if α ≡ true and 1(α) = 0 otherwise. A hypothesis h's expected error w.r.t. the probability distribution p is given by err p (h) = E (X,C)∼p [1(h(X) = C)]. Statistical learning theory provides tools for bounding the probability P (sup h∈H |err p (h) − err S (h, S)| ≥ ǫ), where S is known to be sampled iid from p but p itself is unknown. These bounds link h's training set error to its (probable) performance on other examples drawn from the same distribution, and therefore permits theoretically controlling overfitting. The most important bounds of this type depend on the Vapnik-Chervonenkis (VC) dimension [Vapnik, 1995]. Definition 1 (Vapnik-Chervonenkis (VC) dimension). A hypothesis set H is said to shatter a set of examples Y if for every subset Z ⊆ Y there is a hypothesis h ∈ H such that h(e) = 1 for every e ∈ Z and h(e) = −1 for every e ∈ Y \Z. The VC dimension of H is the cardinality of the largest set that is shattered by H. Upper bounds based on the VC dimension are increasing functions of the VC dimension and decreasing functions of the number of examples in the training sample S. Ideally, the goal is to minimize expected error, but this cannot be evaluated since p is unknown. Structural risk minimization [Vapnik, 1995] helps with this if the hypothesis set can be organized into a hierarchy of nested hypothesis classes of increasing VC dimension. It suggests selecting hypotheses that minimize a risk composed of the training set error and a complexity term, e.g. if two hypotheses have the same training set error, the one originating from the class with lower VC dimension should be preferred.

Learning from Default Rules
In this section, we formally describe a new learning setting for possibilistic logic called learning from default rules. We assume a finite alphabet Σ is given. An example is a default rule over Σ and a hypothesis is a possibilistic logic theory over Σ. A hypothesis h predicts the class of an example e = α |∼ β by checking if h covers e, in the following sense.
Given: A multi-set S which is an iid sample from a set of default rules over a given finite alphabet Σ. Do: Learn a possiblistic logic theory that covers all positive examples and none of the negative examples in S. The above definition assumes that S is perfectly separable, i.e. it is possible to perfectly distinguish positive examples from negative examples. In practice, we often relax this requirement, and instead aim to find a theory that minimizes the training set error. Similar to learning in graphical models, this learning task can be decomposed into parameter learning and structure learning. In our context, the goal of parameter learning is to convert a set of propositional formulas into a possibilistic logic theory, while the goal of structure learning is to decide what that set of propositional formulas should be.

Parameter Learning
Parameter learning assumes that the formulas of the possibilistic logic theory are fixed, and only the certainty weights need to be assigned. As the exact numerical values of the certainty weights are irrelevant, we will treat parameter learning as the process of finding the most suitable stratification of a given set of formulas, e.g. the one which minimizes training error or structural risk (cf. Section 4.2).
Note that the Z-ranking of S + also corresponds to a stratification of T , as T contains exactly the clause representations of the positive examples. However using the Zranking leads to a different stratification, which is: Because arbitrary stratifications can be chosen, there is substantial freedom to ensure that negative examples are not covered. This is true even when the set of considered formulas is restricted to the clause representations of the positive examples, as seen in Example 3. Unfortunately, the problem of finding an optimal stratification is computationally hard. Theorem 1. Deciding whether a separating stratification exists for given T , S + and S − is a Σ P 2 -complete problem.
Proof. The proof of the membership result is trivial. We show the hardness result by reduction from the Σ P 2 -complete problem of deciding the satisfiability of quantified Boolean formulas of the form ∃X∀Y : and only if there exists a separating stratification for T , S + and S − . (⇒) Let θ be an assignment of variables in X such that ∀Y : Φ(Xθ, Y ) is true. Then we can construct the separating stratification as ∪{¬x : x ∈ X and xθ = 0}, {¬x : x ∈ X and xθ = 1} ∪ {x ∈ X : xθ = 0}).
Since Φ(X, Y ) will always be true in any model consistent with the highest level of the stratification, because of the way we chose x and ¬x for this level, so will aux. (⇐) Let T * be a stratification of T which entails the default rule |∼ aux. We can assume w.l.o.g. that T * has only two levels. Since T * is a separating stratification, we must have T * ⊢ poss aux. Therefore the highest level L * of T * must be a consistent theory and Φ(X, Y ) must be true in all of its models. Let X ′ = {x ∈ X : x ∈ L * or ¬x ∈ L * } and X ′′ = X \ X ′ . We can construct an assignment θ to variables in X ′ by setting xθ = 1 for x ∈ L * and xθ = 0 for ¬x ∈ L * . It follows from the construction that ∀X ′′ ∀Y : Φ(Xθ, Y ) must be true.
As this result reveals, in practice we will need to rely on heuristic methods for parameter learning. In Section 4.3 we will propose such a heuristic method, which will moreover also include structure learning.

VC Dimension of Possibilistic Logic Theories
We explore the VC dimension of the set of possible stratifications of a propositional theory, as this will allow us to provide probabilistic bounds on the generalization ability of a learned possibilistic logic theory. Let us write Strat(T ) for the set of all stratifications of a propositional theory T , and let Strat (k) (T ) be the set of all stratifications with at most k levels. The following proposition provides an upper bound for the VC dimension and can be proved by bounding the cardinality of Strat (k) (T ). Proposition 1. Let T be a set of n propositional formulas. Then V C(Strat (k) (T )) ≤ n log 2 k.
In the next theorem, we establish a lower bound on the VC dimension of stratifications with at most k levels which shows that the above upper bound is asymptotically tight.
Theorem 2. For every k, n, k ≤ n, there is a propositional theory T consisting of n formulas such that V C(Strat (k) (T )) ≥ 1 4 n(log 2 k − 1).
To prove Theorem 2, we need the following lemmas; some straightforward proofs are omitted due to space constraints. Lemma 1. If S is a totally ordered set, let kth(S, i) denote the i-th highest element of S. Let X = {x 1 , . . . , x n } be a set of cardinality n = 2 m where m ∈ N \ {0}. Let . . , x n/2 }, n/2) < kth({x n/2+1 , . . . , x n }, n/2)} be a set of 1 2 n log 2 n inequalities. Then for any C ′ ⊆ C there is a permutation of X satisfying all constraints from C ′ and no constraints from C \ C ′ .
i.e. D contains one default rule for every inequality from C. It follows from Lemma 1 and Lemma 2 that the set D can be shattered by stratifications of the propositional theory T . The cardinality of D is 1 2 n log 2 n. Therefore the VC dimension of stratifications of T is at least 1 2 n log 2 n.
Proof of Theorem 2. We show that if k and n are powers of two then 1 2 n log 2 k is a lower bound of the VC dimension. The general case of the theorem then follows straightforwardly. Let T = n k i=1 {x (i−1)·k+1 , . . . , x i·k } and let D i be a set of default rules of cardinality 1 2 k log 2 k shattered by Strat({x (i−1)·k+1 , . . . , x i·k }). It follows from Lemma 3 that such a set D i always exists. Let D = n k i=1 D i . Then D has cardinality 1 2 n log 2 k and is shattered by Strat (k) (T ). To see that the latter holds, note that the sets of formulas Strat({x (i−1)·k+1 , . . . , x i·k }) are disjoint. Therefore, if we want to find a stratification from Strat ( Combining the derived lower bounds and upper bounds on the VC dimension together with the structural risk minimization principle, we find that given two stratifications with the same training set error rate, we should prefer the one with the fewest levels. Furthermore, when structure learning is used, it is desirable for learned theories to be compact. A natural learning problem then consists in selecting a small subset of T , where T corresponds to the set of formulas considered by the structure learner, and identifying a stratification only for that subset. The results in this section can readily be extended to provide bounds on the VC dimension of this problem. Let T be a propositional theory of cardinality n and let m < n be a positive integer. The VC dimension of the set of hypotheses involving at most m formulas from T and having at most k levels is bounded by m(log 2 n + log 2 k). This can simply be obtained by upper-bounding the number of the different stratifications with at most k levels and m formulas selected from a set of cardinality n, by n m · k m .

Heuristic Learning Algorithm
In this section, we propose a practical heuristic algorithm for learning a possibilistic logic theory from a set S of positive and negative examples of default rules. Our method combines greedy structure learning with greedy weight learning. We assume that every default or non-default α |∼ β in S is such that ¬α and β correspond to clauses.
The algorithm starts by initializing the "working" stratification T * to be an empty list. Then it repeats the following revision procedure for a user-defined number of iterations n, or until a timeout is reached. First, it generates a set of candidate propositional clauses C as follows: • It samples a set of defaults α |∼ β from the examples that are misclassified by T * .
• For each default α |∼ β which has been sampled, it samples a subclause ¬α ′ of ¬α and a subclause β ′ of β. If α |∼ β is a positive example then ¬α ′ ∨ β ′ is added to C; if it is a negative example, then ¬α ′ ∨ β ′′ is added instead, where β ′′ is obtained from β ′ by negating each of the literals.
The algorithm then tries to add each formula in C to an existing level of T * or to a newly inserted level. It picks the clause c whose addition leads to the highest accuracy and adds it to T * . The other clauses from C are discarded. In case of ties, the clause which leads to the stratification with the fewest levels is selected, in accordance with the structural risk minimization principle and our derived VC dimension. If there are multiple such clauses, then it selects the shortest among them. Subsequently, the algorithm tries to greedily minimize the newly added clause c, by repeatedly removing literals as long as this does not lead to an increase in the training set error. Next, the algorithm tries to revise T * by greedily removing clauses whose deletion does not increase the training set error. Finally, as the last step of each iteration, the weights of all clauses are optimized by greedily reinserting each clause in the theory.

Experiments
We evaluate our heuristic learning algorithm 1 in two different applications: learning domain theories from crowdsourced default rules and approximating MAP inference in propositional Markov logic networks. As we are not aware of any existing methods that can learn a consistent logical theory from a set of noisy defaults, there are no baseline methods to which our method can directly be compared. However, if we fix a target literal l, we can train standard classifiers to predict for each propositional context α whether the default α |∼ l holds. This can only be done consistently with "parallel" rules, where the literals in the consequent do not appear in antecedents. We will thus compare our method to three traditional classifiers on two crowdsourced datasets of parallel rules: random forests [Breiman, 2001], C4.5 decision trees [Quinlan, 1993], and the rule learner RIPPER [Cohen, 1995]. Random forests achieve state-of-the-art accuracy 2 but its models are difficult to interpret. Decision trees are often less accurate but more interpretable than random forests. Finally, rule learners have the most interpretable models, but often at the expense of lower accuracy. In the second experiment, approximating MAP inference, we do not restrict ourselves to parallel rules. In this case, only our method can guarantee that the predicted defaults will be consistent.

Methodology
Our learning algorithm is implemented in Java and uses the SAT4j library [Berre and Parrain, 2010]. The implementation contains a number of optimizations which make it possible to handle datasets of thousands of default rules, including caching, parallelization, detection of relevant possibilistic subtheories for deciding entailment queries and unit propagation in the possibilistic logic theories. We use the Weka [Hall et al., 2009] implementations for the three baselines. When using our heuristic learning algorithm, we run it for a maximum time of 10 hours for the crowdsourcing experiments reported in Section 5.2 and for one hour for the experiments reported in Section 5.3. For C4.5 and RIPPER, we use the default settings. For random forests, we used the default settings and set the number of trees to 100.

Learning from Crowdsourced Examples
We used CrowdFlower, an online crowdsourcing platform, to collect expert rules about two domains. In the first experiment, we created 3706 scenarios for a team on offense in American football by varying the field position, down and distance, time left, and score difference. Then we presented six choices for a play call (punt, field goal, run, pass, kneel down, do not know/it depends) and asked the user to select the most appropriate one. All scenarios were presented to 5 annotators. A manual inspection of a subset of the rules revealed that they are of reasonably high quality. In a second experiment, users were presented with 2388 scenarios based on Texas hold'em poker situations, where users were asked whether in a given situation they would typically fold, call or raise, with a fourth option again being "do not know/it depends". Each scenario was again presented to 5 annotators. Given the highly subjective nature of poker strategy, it was not possible to enforce the usual quality control mechanism on CrowdFlower in this case, and the quality of the collected rules was accordingly found to be more variable.
In both cases, the positive examples are the rules obtained via crowdsourcing, while negative examples are created by taking positive examples and randomly selecting a different consequent. To create training and testing sets, we divided the data based on annotator ID so that all rules labeled by a given annotated appear only in the training set or only in the testing set, to prevent leakage of information. We added a set of hard rules to the possibilistic logic theories to enforce that only one choice should be selected for a game situation. The baseline methods were presented with the same information, in the sense that the problem was presented as a multi-class classification problem, i.e. given a game situation, the different algorithms were used to predict the most typical action (with one additional option being that none of the actions is typical). The results are summarized in Table 1. In the poker experiment, our approach obtained slightly higher accuracy than random forest and RIPPER but performed slightly worse than C4.5. However, a manual inspection showed that a meaningful theory about poker strategy was learned. For example, at the lowest level, the possibilistic logic theory contains the rule "call", which makes sense given the nature of the presented scenarios. At a higher level, it contains more specific rules such as "if you have three of a kind then raise". At the level above, it contains exceptions to these more specific rules such as "If you have three of a kind, there are three hearts on the board and your opponent raised on the river then call".
In the American football experiment, our approach obtained lower accuracy than the competing algorithms. The best accuracy was achieved by C4.5. Again, we also manually inspected the learned possibilistic logic theory and found that it captures some general intuitions and known strategy about the game. For example, the most general rule is "pass" which is the most common play type. Another example is that second most general level has several rules that say on fourth down and long you should punt. More specific levels that allow for cases when you should not punt, such as when you are in field goal range.
Despite not achieving the same accuracy as C4.5 in this experiment, it nonetheless seems that our method is useful for building up domain theories by crowdsourcing opinions. The learned domain theories are easy to interpret (e.g., the size of the poker theory, as a sum of rule lengths, is more than 10 times smaller than the number of nodes in the learned tree) and capture relevant strategies for both games. The models obtained by classifiers such as C4.5, on the other hand, are often difficult to interpret. Moreover, traditional classifiers such as C4.5 can only be applied to parallel rules, and will typically lead to inconsistent logical theories in more complex domains. In contrast, our method can cope with arbitrary default rules as input, making it much more broadly applicable for learning domain theories.

Approximating MAP Inference
Markov logic networks can be seen as weighted logical theories. The weights assigned to formulas are intuitively seen as penalties; they are used to induce a probability distribution over the set of possible world. Here we are interested in maximum a posteriori (MAP) inference. Specifically, we consider the following entailment relation from [Dupin de Saint-Cyr et al., 1994]: (M, α) ⊢ MAP β iff ∀ω ∈ max(M, α) : ω |= β where M is an MLN, α and β are propositional formulas and max(M, α) is the set of most probable models of α, w.r.t. the probability distribution induced by M. Note that MAP inference only depends on an ordering of possible worlds. It was shown in [Kuželka et al., 2015] that for every propositional MLN M there exists a possibilistic logic theory Θ such that (M, α) ⊢ MAP β iff (Θ, α) ⊢ poss β. Such a translation can be useful in practice, as possibilistic logic theories tend to be much easier to interpret, given that the weights associated with different formulas in an MLN can interact in non-trivial ways. Unfortunately, in general Θ is exponentially larger than M. Moreover, the translation from [Kuželka et al., 2015] requires an exact MAP solver, whereas most such solvers are approximate.
Therefore, rather than trying to capture MAP inference exactly, here we propose to learn a possibilistic logic theory from a set of examples of valid and invalid MAP entailments (M, α) ⊢ MAP β. Since our learning algorithm can handle non-separable data, we can use approximate MAP solvers for generating these examples, which leads to further gains in scalability. As is common, the evidence α consists of conjunctions of up to k literals, and the conclusion β consists of an individual literal. To create examples, we randomly generate a large number of evidence formulas α, each time considering a large number of possible βs. If β is MAP-entailed by α, we add α |∼ β to the set of positive examples; otherwise we add it to the set of negative examples. Notice that defaults in these experiments are not restricted to be just "parallel" rules.
We considered propositional MLNs learned from NLTCS, MSNBC, Plants and DNA data using the method from [Lowd and Davis, 2014]. These are standard datasets, and have 16, 17, 69 and 180 Boolean random variables, respectively. We used the existing train/tune/test division of the data. For each dataset, we generated 1000 training examples and 1000 testing examples of default rules as described above, and considered evidence formulas α of up 5 literals. We learn the possibilistic logic theory on the training examples, and report results on the held-out testing examples. To use the classical learners, we represent the antecedent using two Boolean attributes for each variable in the domain: the first indicates the variable's positive presence in the antecedent while the second indicates its negative presence. We represent the consequent in the same way. The label of an example is positive if it appears in the default theory and negative otherwise. While this allows us to predict whether a default a |∼ b should be true, the set of defaults predicted by the classical methods will in general not be consistent.
The last four rows of Table 1 show the test set accuracy for each approach on each domain. Overall, the learned possibilistic logic theories have similar performance to the decision tree and random forest models, and outperform RIPPER. This is quite remarkable, as the possibilistic logic theories are much more interpretable (containing approximately 50% fewer literals than the decision trees), which usually means that we have to accept a lower accuracy. Moreover, while the other methods can also be used for predicting MAP entailment, only our method results in a consistent logical theory, which could e.g. easily be combined with expert knowledge.

Conclusions
The aim of this paper was to study the problem of reasoning with default rules from a machine learning perspective. We have formally introduced the problem of learning from defaults and have analyzed its theoretical properties. Among others, we have shown that the complexity of the main decision problem is Σ P 2 complete, and we have established asymptotically tight bounds on the VC-dimension. At the practical level, we have proposed practical heuristic learning algorithm, which can scale to datasets with thousands of rules. We have presented experimental results that show the application potential of the proposed learning algorithm, considering two different application settings: learning domain theories by crowdsourcing expert opinions and approximating propositional MLNs. We believe that the methods proposed in this paper will open the door to a wider range of applications of default reasoning, where we see defaults as a convenient interface between experts and learned domain models. which cover some of the negative examples. We can also discard stratifications for which we know that no refinement of the top level will cover all of the positive examples. These two conditions are checked on line 11 of Algorithm 1.
The upper bound on the number of SAT queries can be achieved simply by caching the results of queries. Finally, the total runtime bound can be achieved by using dynamic programming and memoization (i.e. by caching the results of the procedure stratify-impl), and using the fact that SAT problems with n variables can be solved in time O(2 n ). Notice that stratify-impl will be called with at most 2 T different sets of input arguments. This is because the second argument is actually always uniquely determined by the first argument T ′ , given the conditions on T ′ in the for statement on line 11: it is the set of positive examples α |∼ β such that T ′ ∪ {α} is inconsistent. So, stratify-impl will be run at most 2 |T | times and the for statement on line 11 will always go through at most 2 |T | different sets T ′ , while the cost of each iteration will only be proportional to the number of examples, if the SAT queries are assumed to be pre-computed and cached. This gives us a worst-case bound on the runtime of the algorithm of O((4 |T | + 2 |T |+|vars(T )| ) · (|S + | + |S − |)).
The implementation available online contains also an optimized version of the exact algorithm.Note that due to its high complexity the algorithm described in this section does not scale to problems involving large numbers of default rules. For practical problems, it is therefore preferable to use the heuristic algorithm described in Section 4.3.

C Learned Models
In this section we briefly describe two examples of theories, one learned in the crowd-sourced poker domain (see Section 5.2) and the other learned in MAP-inference approximation experiments for the NLTCS domain (see Section 5.3).
The learned theory for the poker domain is shown in Table 2. Since default rules in the dataset from which this the-(¬a 12 ∨ a 14 , 0.9), (¬a 16 ∨ a 8 , 0.9), (a 8 ∨ a 15 ∨ ¬a 13 ∨ a 14 , 0.8), (¬a 3 ∨ a 8 , 0.8), (¬a 16 ∨ a 12 , 0.8), (¬a 2 ∨ a 1 , 0.8), (¬a 6 ∨ a 14 , 0.8), (¬a 15 ∨ a 1 , 0.8), (¬a 14 ∨ a 10 , 0.7), (¬a 9 , 0.7), (¬a 11 ∨ a 13 , 0.7), (¬a 1 ∨ a 10 , 0.6), (¬a 11 ∨ a 5 , 0.6), (¬a 7 , 0.5), (¬a 8 , 0.5), (¬a 14 , 0.5), (¬a 1 , 0.4), (¬a 4 , 0.3), (¬a 10 , 0.2), (¬a 5 , 0.1). ory was learned were all "parallel rules", most of the formulas in the theory are clausal representations of implications of the form "if situation α then action β"; an exception to this is one of the rules in the lowest level which has the form "not situation α", where α is in this case "The flop cards have just been dealt and you have a straight draw and a flush draw", and this rule basically serves to block the other rules in this level for evidence α ′ ⊇ α. The top level of the theory consists of hard integrity constraints. Table 3 shows a small theory which was learned in the NLTCS domain after 20 iterations of the algorithm (the complete learned theory available online is larger). Since in this domain the default rules were not restricted to be of the "parallel" form, also the structure of the rules in the theory is more complex.