A Homological Theory of Functions Greg Yang Harvard University [email protected] 7 April 7, 2017 1 0 2 Abstract r p In computational complexity, a complexity class is given by a set of problems or functions, A and a basic challenge is to show separations of complexity classes A (cid:54)= B especially when A 6 is known to be a subset of B. In this paper we introduce a homological theory of functions that can be used to establish complexity separations, while also providing other interesting ] consequences. We propose to associate a topological space S to each class of functions A, such C A that, to separate complexity classes A ⊆ B(cid:48), it suffices to observe a change in “the number of A holes”, i.e. homology, inS asasubclassB⊆B(cid:48) isaddedtoA. Inotherwords, ifthehomologies A . h of S and S are different, then A (cid:54)= B(cid:48). We develop the underlying theory of functions A A∪B t based on combinatorial and homological commutative algebra and Stanley-Reisner theory, and a m recover Minsky and Papert’s result [12] that parity cannot be computed by nonmaximal degree polynomial threshold functions. In the process, we derive a “maximal principle” for polynomial [ threshold functions that is used to extend this result further to arbitrary symmetric functions. 3 A surprising coincidence is demonstrated, where the maximal dimension of “holes” in S upper A v bounds the VC dimension of A, with equality for common computational cases such as the class 2 of polynomial threshold functions or the class of linear functionals in F , or common algebraic 0 2 3 cases such as when the Stanley-Reisner ring of SA is Cohen-Macaulay. As another interesting 2 application of our theory, we prove a result that a priori has nothing to do with complexity 0 separation: it characterizes when a vector subspace intersects the positive cone, in terms of . 1 homological conditions. By analogy to Farkas’ result doing the same with linear conditions, we 0 call our theorem the Homological Farkas Lemma. 7 1 : 1 Introduction v i X 1.1 Intuition r a Let A ⊆ B(cid:48) be classes of functions. To show that B(cid:48) (cid:54)= A, it suffices to find some B ⊆ B(cid:48) such that A∪B (cid:54)= A. In other words, we want to add something to A and watch it change. Let’s take a step back Consider a more general setting, where A and B are “nice” subspaces of a larger topological space C. We can produce a certificate of A∪B (cid:54)= A by observing a difference in the number of “holes” of A∪B and A. Figure 1 shows two examples of such certificates. 1 1.1 Intuition B A A B (a) AandB arebothcontractible(donothaveholes), (b) A has a hole in its center, but B covers it, so that but their union A∪B has a hole. A∪B is now contractible. Figure 1: Certifying A∪B (cid:54)= A by noting that the numbers of 1-dimensional holes are different between A∪B and A. Sometimes, however, there could be no difference between the number of holes in A∪B and A. For example, if B in Figure 1a is slightly larger, then A∪B no longer has a hole in the center (see Figure 2). But if we take a slice of A∪B, we observe a change in the number of connected components (zeroth dimensional holes) from A to A∪B. L L∩A L∩(A∪B) A B Figure 2: A∪B and A are both contractible, but if we look at a section L of A∪B, we see that L∩A has 2 connected components, but L∩(A∪B) has only 1. From this intuition, one might daydream of attacking complexity separation problems this way: 1. For each class A, associate a unique topological space (specifically, a simplicial complex) S . A 2. Compute the number of holes in S and S of each dimension, and correspondingly for each A A∪B section by an affine subspace. 3. Attempt to find a difference between these quantities (a “homological” certificate). It turns out this daydream is not so dreamy after all! This work is devoted to developing such a homological theory of functions for complexity sepa- ration, which incidentally turns out to have intricate connection to other areas of computer science and combinatorics. Our main results can be summarized as follows: 1) Through our homologi- cal framework, we recover Marvin Minsky and Seymour Papert’s classical result that polynomial threshold functions do not compute parity unless degree is maximal [12], and in fact we discover multiple proofs, each “coresponding to a different hole”; the consideration of lower dimension holes yields a maximal principle for polynomial threshold functions that is used to extend Minsky and Papert’s result to arbitrary symmetric functions [3]. 2) We show that an algebraic/homological 2 1 INTRODUCTION quantity arising in our framework, the homological dimension dim A of a class A, upper bounds the h VCdimensiondim AofA. Informally,thistranslatestothefollowingremarkablestatement: “The VC highest dimension of any holes in S or its sections upper bounds the number of samples needed A to learn an unknown function from A, up to multiplicative constants.” We furthermore show that equality holds in many common cases in computation (for classes like polynomial thresholds, F 2 linear functionals, etc) or in algebra (when the Stanley-Reisner ring of S is Cohen-Macaulay). 3) A We formulate the Homological Farkas Lemma, which characterizes by homological conditions when a linear subspace intersects the interior of the positive cone, and obtain a proof for free from our homological theory of functions. While the innards of our theory relies on homological algebra and algebraic topology, we give an extended introduction in the remainder of this section to the flavor of our ideas in what follows, assuming only comfort with combinatorics, knowledge of basic topology, and a geometric intuition for “holes.” A brief note about notation: [n] denotes the set {0,...,n−1}, and [n → m] denotes the set of functions from domain [n] to codomain [m]. The notation f :⊆ A → B specifies a partial function from domain A to codomain B. † represents the partial function with empty domain. 1.2 An Embarassingly Simple Example Let linfun ∼= (Fd)∗ be the class of linear functionals of a d-dimensional vector space V over F . If d 2 2 d ≥ 2, then linfun does not compute the indicator function I of the singleton set {1 := 11···1}. d 1 This is obviously true, but let’s try to reason via a “homological way.” This will provide intuition for the general technique and set the stage for similar analysis in more complex settings. Let g : 0 → 0,1 → 1. Observe that for every partial linear functional h ⊃ g strictly extending g, I intersects h nontrivially. (Because I is zero outside of g, and every such h must send at least 1 1 one element to zero outside of g). I claim this completes the proof. Why? Combinatorially, this is because if I were a linear functional, then for any 2-dimensional sub- 1 space W of V containing {0,1}, the partial function h :⊆ V → F ,domh = W, 2 (cid:40) g(u) if u ∈ domg h(u) = 1−I (u) if u ∈ domh\domg 1 is a linear functional, and by construction, does not intersect I on W \{0,1}. 1 Homologically, we are really showing the following The space associated to linfun , in its section by an affine subspace corre- d sponding to g, “has a hole” that is “filled up” when I is added to linfun . 1 d “Wait, what? I’m confused. I don’t see anything in the proof resembling a hole?” 1.3 The Canonical Suboplex OK. No problem. Let’s see where the holes come from. 3 1.3 The Canonical Suboplex (cid:20)0(cid:21) [10] (cid:20)1(cid:21) (cid:20)0(cid:21)(cid:55)→0 (cid:20)0(cid:21)(cid:55)→1 (cid:20)0(cid:21)(cid:55)→0 (cid:20)0(cid:21)(cid:55)→1 1 (cid:55)→0 1 (cid:55)→1 1 1 1 1 (cid:20)1(cid:21) (cid:55)→1 (cid:20)1(cid:21) (cid:20)1(cid:21) (cid:20)1(cid:21) (cid:20)1(cid:21) 0 (cid:55)→0 (cid:55)→0 (cid:55)→1 (cid:55)→1 0 0 0 0 [00] [01] (cid:20)1(cid:21) (cid:55)→0 0 (cid:20)11(cid:21)(cid:55)→0 [00] (cid:20)11(cid:21)(cid:55)→1 [01] (cid:20)11(cid:21)(cid:55)→1 [10] (cid:20)11(cid:21)(cid:55)→0 [11] (cid:20)11(cid:21)(cid:55)→0 [11] (cid:20)01(cid:21)(cid:55)→1 (a) Step 1 and Step 2 for linfun(cid:48). Step 1: Each simplex is (b) Step 3 for linfun(cid:48). The 2 2 labeledwithafunctionf ∈linfun(cid:48),representedasarowvector. simplices F are glued together 2 f Step2: Eachvertexofeachsimplexislabeledbyaninput/output accordingtotheirlabels. Forex- pair, here presented in the form of a column vector to a scalar. ample,F andF areglued [0 0] [0 1] Thecollectionofinput/outputpairsinasimplexF recoversthe together by their vertices with f graphoff. EachfaceofF hasaninducedpartialfunctionlabel, the common label [1 0]T (cid:55)→ 0, f given by the collection of input/output pairs on its vertices (not and not anywhere else because explicitly shown). no other faces share a common label. Figure 3 Let’s first define the construction of the simplicial complex S associated to any function class C C, called the canonical suboplex. In parallel, we give the explicit construction in the case of C = linfun(cid:48) := linfun (cid:23) {0 (cid:55)→ 0}. This is the same class as linfun , except we delete 0 from d 2 2 the domain of every function. It gives rise to essentially the same complex as linfun , and we will 2 recover Slinfun explicitly at the end. 2 Pick a domain, say [n] = {0,...,n−1}. Let C ⊆ [n → 2] be a class of boolean functions on [n]. We construct a simplicial complex S as follows: C 1. To each f ∈ C we associate an (n−1)-dimensional simplex F ∼= (cid:52)n−1, which will be a facet f of S . C 2. Each of the n vertices of F is labeled by an input/output pair i (cid:55)→ f(i) for some i ∈ [n], and f each face G of F is labeled by a partial function f ⊆ f, whose graph is specified by the labels f of the vertices of G. See Figure 3a for the construction in Step 1 and Step 2 for linfun(cid:48). 2 3. For each pair f,g ∈ C, F is glued together with F along the subsimplex G (in both facets) f g with partial function label f ∩g. See Figure 3b for the construction for linfun(cid:48). 2 This is the simplicial complex associated to the class C, called the canonical suboplex S of C C. Notice that in the case of linfun(cid:48)d, the structure of “holes” is not trivial at all: Slinfun(cid:48) has 3 d holes in dimension 1 but no holes in any other dimension. An easy way to visualize this it to pick one of the triangular holes; If you put your hands around the edge, pull the hole wide, and flatten the entire complex onto a flat plane, then you get Figure 4a. It is easy to construct the canonical suboplex of linfund from that of linfun(cid:48)d: Slinfund is just a cone over S , where the cone vertex has the label [0 0]T (cid:55)→ 0 (Figure 4b). This is because linfun(cid:48) every function in ldinfun shares this input/output pair. Note that a cone over any base has no d hole in any dimension, because any hole can be contracted to a point in the vertex of the cone. This is a fact we will use very soon. Let’s give another important example, the class of all functions. If C = [n → 2], then one can see that S is isomorphic to the 1-norm unit sphere (also known as orthoplex) Sn−1 := {(cid:107)x(cid:107) = C 1 1 4 1 INTRODUCTION (a) The shape obtained by stretching Slinfun(cid:48) (b) The canonical suboplex of linfund is just along one of its triangular holes and then flattend a cone over that of linfun(cid:48). Here we show the d everything onto a flat plane. This deformation case d=2. preserves all homological information, and from thispictureweseeeasilythatSlinfun(cid:48) has3holes, d each of dimension 1. Figure 4 0(cid:55)→1 a(cid:55)→b 2(cid:55)→1 SC(cid:23)(a(cid:55)→b) 1(cid:55)→0 1(cid:55)→1 SC 2(cid:55)→0 0(cid:55)→0 (a) The canonical suboplex of (b) SC(cid:23)(a(cid:55)→b) is an affine section (c) we may recover Slinfun(cid:48) as a d [3→2]. of S . linearcutthroughthe“torso”of C Slinfun . d Figure 5 1 : x ∈ Rn} (Figure 5a). For general C, S can be realized as a subcomplex of Sn−1. Indeed, for C 1 C = linfun(cid:48) ⊆ [3 → 2], it is easily seen that S is a subcomplex of the boundary of an octahedron, 2 C which is isomorphic to S2. 1 Let C ⊆ [n → 2], and let f :⊆ [n] → [2] be a partial function. Define the filtered class C (cid:23) f to be {g\f : g ∈ C,g ⊇ f} ⊆ [[n]\domf → [2]] Unwinding the definition: C (cid:23) f is obtained by taking all functions of C that extend f and ignoring the inputs falling in the domain of f. The canonical suboplex SC(cid:23)f can be shown to be isomorphic to an affine section of SC, when the latter is embedded as part of the L unit sphere Sn−1. Figure 5b shows an example when f has 1 1 a singleton domain. Indeed, recall linfun(cid:48) is defined as linfun (cid:23) {0 (cid:55)→ 0}, and we may recover d d Slinfun(cid:48) as a linear cut through the “torso” of Slinfun (Figure 5c). d d “OK. I see the holes. But how does this have anything to do with our proof of I (cid:54)∈ linfun ?” 1 d 5 1.4 Nerve Lemma Figure 6: A continuous deformation of Slinfun(cid:48) into a complete graph with 4 vertices (where we ignore the 2 sharp bends of the “outer” edges). Hold on tight! We are almost there. First let me introduce a “duality principle” in algebraic topology called the Nerve Lemma. Readers familiar with it can skip ahead to the next section. 1.4 Nerve Lemma Notethatthecanonicalsuboplexoflinfun(cid:48) canbecontinuouslydeformedasshowninFigure6into 2 a 1-dimensional complex (a graph), so that all of the holes are still preserved. Such a deformation produces a complex • whose vertices correspond exactly to the facets of the original complex, and • whose edges correspond exactly to intersections of pairs of facets, all the while preserving the holes of the original complex, and producing no new ones. Such an intuition of deformation is vastly generalized by the Nerve Lemma: Lemma 1.1 (Nerve Lemma (Informal)). Let U = {U } be a “nice” cover (to be explained below) i i of a topological space X. The nerve N of U is defined as the simplicial complex with vertices U (cid:84) {V : U ∈ U}, and with simplices {V } for each index set S such that {U : i ∈ S} is nonempty. i i i i∈S i Then, for each dimension d, the set of d-dimensional holes in X is bijective with the set of d-dimensional holes in N . U What kind of covers are nice? Open covers in general spaces, or sub- complex covers in simplicial (or CW) complexes, are considered “nice”, if in addition they satisfy the following requirements (acyclicity). P • Each set of the cover must have no holes. • Each nontrivial intersection of a collection of sets must have no holes. Figure 7: The open star StP of vertex P TheexamplewesawinFigure7isanapplicationoftheNerveLemmaforthe coverbyfacets. Anotherexampleisthestarcover: ForvertexV inacomplex, the open star StV of V is defined as the union of all open simplices whose closure meets V (see Figure 7 for an example). If the cover U consists of the open stars of every vertex in a simplicial complex X, then N is isomorphic U to X as complexes. OK! We are finally ready to make the connection to complexity! 6 1 INTRODUCTION (cid:20)1(cid:21) (cid:20)1(cid:21) 1 (cid:55)→1 1 (cid:55)→1 I1 (a) The canonical suboplex of linfun (cid:23) (b) When we add I to linfun to obtain D := 2 1 d {[0 0]T (cid:55)→ 0,[1 1]T (cid:55)→ 1} is isomorphic to the linfund∪{I1},SD(cid:23)g nowdoesnothaveanyhole! affine section as shown, and it has two discon- nectedcomponents,andthus“asinglezerothdi- mensional hole.” Figure 8 1.5 The Connection It turns out that S = S (a complex of dimension 2d−2) has holes in dimension linfun(cid:48) linfun (cid:23)(0(cid:55)→0) d d d−1. The proof is omitted here but will be given in Section 2.3.6. This can be clearly seen in our example when d = 2 (Figure 4a), which has 3 holes in dimension d−1 = 1. Furthermore, for every partial linear functional h (a linear functional defined on a linear subspace), Slinfun (cid:23)h also has d holes, in dimension d−1−dim(domh). Figure 8a show an example for d = 2 and h = [1 1]T (cid:55)→ 1. But when we add I1 to linfund to obtain D := linfund ∪{I1}, SD(cid:23)g now does not have any hole! Figure 8b clearly demonstrates the case d = 2. For general d, note that S has a “nice” linfun(cid:48) d cover by the open stars C := {StV : V has label u (cid:55)→ r for some u ∈ Fd\{0} and r ∈ F }. 2 2 When we added I1 to form D, the collection C(cid:48) := C ∪(cid:52)I1 obtained by adding the simplex of I1 to C is a “nice” cover of S . Thus the nerve N has the same holes as S , by the Nerve Lemma. D C(cid:48) D But observe that N is a cone! ...which is what our “combinatorial proof” of I (cid:54)∈ linfun really C(cid:48) 1 d showed. More precisely, a collection of stars S := {StV : V ∈ V} has nontrivial intersection iff there is a partial linear functional extend- ing the labels of each V ∈ V. We showed I intersects every partial 1 linear functional strictly extending g : 0 (cid:55)→ 0,1 (cid:55)→ 1. Therefore, a collectionofstarsS inC(cid:48) intersectsnontriviallyiff(cid:84)(S∪{(cid:52)I }) (cid:54)= ∅. I1 1 In other words, in the nerve of C(cid:48), (cid:52)I forms the vertex of a 1 cone over all other StV ∈ C. In our example of linfun , this is 2 demonstrated in Figure 9. Thus, to summarize, • N , being a cone, has no holes. • By C(cid:48) thhoeleNs,ewrveekLneomwmDa(cid:54)=, SlDi(cid:23)ngfhuansd,nio.eh.oIl1es(cid:54)∈elitihnefru.n•d,SainscdeeSsilriendfu.nd(cid:23)g has Flaiygeudreon9:DT=helninerfvuenNC∪(cid:48) {oIve}r-. 2 1 While this introduction took some length to explain the logic of Note that N is a cone over its C(cid:48) our approach, much of this is automated in the theory we develop base of 2 points. in this paper, which leverages existing works on Stanley-Reisner theory and cellular resolutions. *** 7 1.6 Dimension theory In our proof, we roughly did the following • (Local) Examined the intersection of I with fragments of functions in linfun . 1 d • (Global) Pieced together the fragments with nontrivial intersections with I to draw conclu- 1 sions about the “holes” I creates or destroys. 1 This is the local-global philosophy of this homological approach to complexity, inherited from algebraictopology. Thisismarkedlydifferentfromconventionalwisdomincomputerscience,which seeks to show that a function, such as f = 3sat, has some property that no function in a class, say C = P, has. In that method, there is no global step that argues that some global property of C changes after adding f into it. Usingourhomologicaltechnique,weshow,inSection3,aproofofMinskyandPapert’sclassical result that the class polythrk of polynomial thresholds of degree k in d variables does not contain d the parity function parity unless k = d (Theorem 3.40). Homologically, there are many reasons. d By considering high dimensions, we deduce that S has a hole in dimension (cid:80)k (cid:0)d(cid:1) that polythrk i=0 i is filled in by parity . By considering low dimensionsd, we obtain a maximal principle for d polynomial threshold functions from which we obtain not only Minsky and Papert’s result but also extensions to arbitrary symmetric functions. This maximal principle Theorem 3.51 says Theorem 1.2 (Maximal Principle for Polynomial Threshold). Let C := polythrk, and let f : d {−1,1}d → {−1,1} be a function. We want to know whether f ∈ C. Suppose there exists a function g ∈ C (a “local maximum” for approximating g) such that • for each h ∈ C that differs from g on exactly one input u, we have g(u) = f(u) = ¬h(u). If g (cid:54)= f, then f (cid:54)∈ C. (In other words, if f ∈ C, then the “local maximum” g must be a “global maximum”). Notice that the maximal principle very much follows the local-global philosophy. The “local maximum” condition is saying that when one looks at the intersection with f of g and its “neigh- bors” (local), these intersections together form a hole that f creates when added to C (global). The homological intuition, in more precise terms, is that a local maximum g (cid:54)= f ∈ C implies that the filtered class C (cid:23) (f ∩g) consists of a single point with label g, so that when f is added to C, a zero-dimensional hole is created. We also obtain an interesting characterization of when a function can be weakly represented by a degree bounded polynomial threshold function. A real function ϕ : U → R on a finite set U is said to weakly represent a function f : U → {−1,1} if ϕ(u) > 0 ⇐⇒ f(u) = 1 and ϕ(u) < 0 ⇐⇒ f(u) = −1, but we don’t care what happens when ϕ(u) = 0. Our homological theoryoffunctionessentiallysaysthatf ∈ polythrk (“f isstronglyrepresentablebyapolynomial d of degree k”) iff S has the same number of holes as S in each dimension and polythrk∪{f}(cid:23)g polythrk(cid:23)g d d for each g. But, intriguingly, f is weakly representable by a polynomial of degree k iff S polythrk∪{f} d has the same number of holes as S in each dimension (Corollary 3.46) — in other words, polythrk d we only care about filtering by g = † but no other partial functions. 1.6 Dimension theory Let C ⊆ [n → 2]. The VC Dimension dim C of C is the size of the largest set U ⊆ [n] such that VC C (cid:22) U = {0,1}U. Consider the following setting of a learning problem: You have an oracle, called the sample oracle, such that every time you call upon it, it will emit a sample (u,h(u)) from an unknown 8 1 INTRODUCTION distribution P over u ∈ [n], for a fixed h ∈ C. This sample is independent of all previous and all future samples. Your task is to learn the identity of h with high probability, and with small error (weighted by P). A central result of statistical learning theory says roughly that Theorem 1.3 ([10]). In this learning setting, one only needs O(dim C) samples to learn h ∈ C VC with high probability and small error. It is perhaps surprising, then, that the following falls out of our homological approach. Theorem 1.4 (Colloquial version of Theorem 3.11). Let C ⊆ [n → 2]. Then dim C is upper VC bounded by one plus the highest dimension, over any partial function g, of any hole in SC(cid:23)g. This quantity is known as the homological dimension dim C of C. h In fact, equality holds for common classes in the theory of computation like linfun and d polythrk, and also when certain algebraic conditions hold. More precisely — for readers with d algebraic background — Theorem 1.5 (Colloquial version of Corollary 3.34). dim C = dim C if the Stanley-Reisner ring VC h of S is Cohen-Macaulay. C These results suggest that our homological theory captures something essential about compu- tation, that it’s not a coincidence that we can use “holes” to prove complexity separation. 1.7 Homological Farkas Farkas’ Lemma is a simple result from linear algebra, but it is an integral tool for proving weak and strong dualities in linear programming, matroid theory, and game theory, among many other things. Lemma 1.6 (Farkas’ Lemma). Let L ⊆ Rn be a linear subspace not contained in any coordinate hyperplanes, and let P = {x ∈ Rn : x > 0} be the positive cone. Then either • L intersects P, or • L is contained in the kernel of a nonzero linear functional whose coefficients are all nonneg- ative. but not both. Farkas’ Lemma is a characterization of when a linear subspace intersects the positive cone in terms of linear conditions. An alternate view important in computer science is that Farkas’ Lemma provides a linear certificate for when this intersection does not occur. Analogously, our Homolog- ical Farkas’ Lemma will characterize such an intersection in terms of homological conditions, and simultaneously provide a homological certificate for when this intersection does not occur. Before stating the Homological Farkas’ Lemma, we first introduce some terminology. For g : [n] → {1,−1}, let P ⊆ Rn denote the open cone whose points have signs given by g g. Consider the intersection (cid:52) of P with the unit sphere Sn−1 and its interior (cid:52)˚ . (cid:52)˚ is g g g g homeomorphic to an open simplex. For g (cid:54)= ¬1, define Λ(g) to be the union of the facets F of (cid:52) g such that (cid:52)˚g and (cid:52)˚1 sit on opposite sides of the affine hull of F. Intuitively, Λ(g) is the part of ∂(cid:52) that can be seen from an observer in (cid:52)˚ (illustrated by Figure 10a). g 1 The following homological version of Farkas’ Lemma naturally follows from our homological technique of analyzing the complexity of threshold functions. 9 1.7 Homological Farkas Λ(g) Λ(g) (cid:52)g (cid:52)¬1 (cid:52)g (cid:52)1 (cid:52)¬1 (cid:52)1 (a) An example of a Λ(g). Intu- (b) An illustration of Homological Farkas’ Lemma. The hor- itively, Λ(g) is the part of ∂(cid:52) izontal dash-dotted plane intersects the interior of (cid:52) , but its g 1 that can be seen from an ob- intersection with any of the Λ(f),f (cid:54)= 1,¬1 has no holes. The server in (cid:52) . vertical dash-dotted plane misses the interior of (cid:52) , and we see 1 1 that its intersection with Λ(g) as shown has two disconnected components. Figure 10 Theorem 1.7 (Homological Farkas’ Lemma Theorem 3.43). Let L ⊆ Rn be a linear subspace. Then either • L intersects the positive cone P = P , or 1 • L∩Λ(g) for some g (cid:54)= 1,¬1 is nonempty and has holes. but not both. Figure 10b illustrates an example application of this result. One direction of the Homological Farkas’ Lemma has the following intuition. As mentioned before, Λ(g) is essentially the part of ∂(cid:52) visible to an observer Tom in (cid:52)˚ . Since the simplex is g 1 convex, the image Tom sees is also convex. Suppose Tom sits right on L (or imagine L to be a subspace of Tom’s visual field). If L indeed intersects (cid:52)˚ , then for L∩Λ(g) he sees some affine 1 space intersecting a convex body, and hence a convex body in itself. Since Tom sees everything (i.e. his vision is homeomorphic with the actual points), L∩Λ(g) has no holes, just as Tom observes. In other words, if Tom is inside (cid:52)˚ , then he cannot tell Λ(g) is nonconvex by his vision alone, 1 for any g. Conversely, the Homological Farkas’ Lemma says that if Tom is outside of (cid:52)˚ and if he 1 looks away from (cid:52)˚ , he will always see a nonconvex shape in some Λ(g). 1 AsacorollarytoTheorem1.7,wecanalsocharacterizewhenalinearsubspaceintersectsaregion inalinearhyperplanearrangement(Corollary3.55),andwhenanaffinesubspaceintersectsaregion in an affine hyperplane arrangement (Corollary 3.56), both in terms of homological conditions. A particular simple consequence, when the affine subspace either intersects the interior or does not intersect the closure at all, is illustrated in Figure 11. The rest of this paper is organized as follows. Section 2 builds the theory underlying our complexity separation technique. Section 2.1 explains some of the conventions we adopt in this workandmoreimportantlyreviewsbasicfactsfromcombinatorialcommutativealgebraandcollects important lemmas for later use. Section 2.2 defines the central objects of study in our theory, the Stanley-Reisner ideal and the canonical ideal of each function class. The section ends by giving a characterization of when an ideal is the Stanley-Reisner ideal of a class. Section 2.3 discusses how to extract homological data of a class from its ideals via cellular resolutions. We construct cellular 10