Oriented Matroids and Combinatorial Neural Codes

A combinatorial neural code $\mathscr C\subseteq 2^{[n]}$ is convex if it arises as the intersection pattern of convex open subsets of $\mathbb R^d$. We relate the emerging theory of convex neural codes to the established theory of oriented matroids, both categorically and with respect to geometry and computational complexity. On the categorical side, we show that the map taking an acyclic oriented matroid to the code of positive parts of its topes is a faithful functor. We adapt the oriented matroid ideal introduced by Novik, Postnikov, and Sturmfels into a functor from the category of oriented matroids to the category of rings; then, we show that the resulting ring maps naturally to the neural ring of the matroid's neural code. For geometry and computational complexity, we show that a code has a realization with convex polytopes if and only if it lies below the code of a representable oriented matroid in the partial order of codes introduced by Jeffs. We show that previously published examples of non-convex codes do not lie below any oriented matroids, and we construct examples of non-convex codes lying below non-representable oriented matroids. By way of this construction, we can apply Mn\"{e}v-Sturmfels universality to show that deciding whether a combinatorial code is convex is NP-hard.


Introduction
A combinatorial neural code is a collection C of subsets of [n] := {1, . . ., n}.Such codes model neural activity, with each codeword σ ⊆ [n] in C representing a set of neurons which are simultaneously active.Our motivating example is the activity of hippocampal place cells, neurons in the brain which encode an animal's physical location [29].Each neuron i is active when the animal is in a corresponding subset U i of the animal's environment X ⊆ R d , called the i-th place field.If neural activity is viewed as a function X → {0, 1} n , then the set U i is the support of the i-th component of this function, the "preferred location" of that neuron.Neurons acting as indicators for a preferred set of stimuli appear across many sensory modalities, so we will use the slightly broader term receptive field to de-emphasize the spatial navigation aspect.
In this simplified model, neurons fire together if and only if their receptive fields overlap, and thus the code represents the intersection pattern of the receptive fields.This information can reveal significant topological and geometric information in experimental data, such as the topology of an animal's environment [8] or the intrinsic geometry of more abstract stimulus spaces [13,36].Receptive fields are often observed to be convex, and therefore we are interested in characterizing convex neural codes: codes that arise as the intersection patterns of convex open subsets of some Euclidean space.For example, Figure 1 illustrates three convex receptive fields and the associated convex code.
Beyond experimental motivation, requiring receptive fields to be convex yields rich theoretical results.In particular, the nerve lemma can be used to deduce topological properties of simplicial complexes associated to convex codes [5,6].Another useful tool developed to study neural codes is the neural ring [9], the coordinate ring of the code as an algebraic variety in F n 2 .This was used to detect obstructions to convexity in [7].However, there are many examples of non-convex codes which cannot be captured by these obstructions [18,23].While other classes of neural codes have been completely characterized (e.g.codes described by connected receptive fields [27], or convex codes on five or fewer neurons [14]), convex codes have evaded full description.
As the literature on combinatorial neural codes proliferated, we observed various similarities with the well-studied realm of oriented matroid theory.For instance, the class of stable hyperplane codes introduced in [17] are defined by a collection of half-spaces intersecting a convex set, which are precisely the sets of topes of a realizable COM (conditional oriented matroid) as studied in [1].The neural ideal, defined in [9] and further developed in [7,10,15], seems to align with the oriented matroid ideal defined in [28], particularly after the neural ideal is polarized [15].Finally, morphisms of codes, as defined in [19], seem analogous to strong maps of oriented matroids, as formulated in [16].In this paper, we draw parallels between the notions of convexity for neural codes and representability for oriented matroids, and formalize these connections on a functorial level.
First, we establish strong connections between representable oriented matroids and convex neural codes by considering the map L + : OM → Code which takes an oriented matroid to the positive parts of its covectors.Representable oriented matroids are precisely those which can be obtained from real hyperplane arrangements, as in Figure 2 of neural codes form a partially ordered set denoted P Code , introduced in [19].Roughly, C ≤ D if there is a way to construct a realization for C using a realization of D, in which case we say C is a minor of D. We extend a result of [19] and use it to prove that all codes lying below codes of representable oriented matroids have realizations with interiors of convex polytopes, which we call open polytope convex.Further, the converse also holds: A code is open polytope convex if and only if it is a minor of L + M for some representable oriented matroid M.
Since every code which has a convex realization in the plane has a realization with convex polygons [4], this result gives a full characterization of planar convex codes in terms of representable oriented matroids.In higher dimensions, it is not yet known whether every convex code has a realization with convex polytopes.If this does hold, then Theorem 2 would give a full characterization of convex codes in terms of representable oriented matroids.Without this result, we can still categorize non-convex codes: if a code is not convex, then either it does not lie below any oriented matroid in P Code , or it lies below non-representable matroids only.There are many known examples of non-convex codes [5,6,18,19,23], and we show that many of these fall into the first category: they are non-convex because they are not below any oriented matroids in P Code .For instance, codes with topological local obstructions do not lie below oriented matroids.Furthermore, sunflower codes [18], a well known family of non-convex codes with no local obstructions also do not lie below oriented matroids.
Theorem 2. The non-convex codes with no local obstructions constructed via sunflowers do not lie below codes of oriented matroids in P Code .
We are also able to generate an infinite family of non-convex codes of the second kind, those which lie below non-representable matroids only.In order to obtain this family, we establish a relationship between representability and convexity.We do this for the special case of uniform oriented matroids of rank 3, which correspond to non-degenerate pseudoline arrangements in the plane.Theorem 3. Let M be a uniform, rank 3 oriented matroid.Then we can construct a code which is convex if and only if M is representable.
Using this result, we are able to compare two fundamental decision problems: (1) is a given oriented matroid representable, and (2) is a given neural code realizable by convex sets.We demonstrate that deciding convexity for arbitrary neural codes is at least as hard as deciding representability of an oriented matroid.The latter problem is known to be NP-hard and ∃R-hard, leading to the following theorem: Theorem 4. The convex code decision problem is NP-hard and ∃R-hard.
Finally, we relate algebraic and categorical structures for matroids and codes.Acyclic oriented matroids form a category OM whose morphisms are given by strong maps, as defined in [16].Neural codes form a category Code introduced in [19], with morphisms defined using trunks of codes.We show that the map W + : OM → Code which takes an acyclic oriented matroid to the positive parts of its topes is a faithful functor.Furthermore, we adapt the oriented matroid ideal introduced in [28] to non-affine oriented matroids, producing the oriented matroid dual ideal O(M) and the oriented matroid ring k[x 1 , . . ., x n , y 1 , . . ., y n ]/O(M) .We show that the map S taking an oriented matroid to its oriented matroid ring is a functor, and use this to define the category OMRing.Using results from [15], we define the depolarization map D : OMRing → NRing, and show that this map is functorial.Finally, we show that these maps play nicely with the functor R : Code → NRing from [19].
Theorem 5.The maps S, D, and W + are functorial.In particular, the map W + is a faithful, but not full functor from OM → Code.Moreover, the square below commutes, that is,

OM OMRing
Code NRing The paper is organized as follows: In Section 2, we establish notation and background material that will be necessary for later sections.In Section 3, we relate minors of codes to realizability by intersection-closed families of sets, and use this to establish Theorem 2. In Section 4, we discuss classes of non-convex codes and their relationships to oriented matroids.In Section 5, we detail the functors among the categories of acyclic oriented matroids, combinatorial neural codes, and rings.Finally, in Section 6, we present open questions related to each area discussed in the paper.

Background
We provide the essential background information on oriented matroids in Section 2.1 and combinatorial codes in Section 2.2.In Section 2.3, we define the maps W + and L + which take oriented matroids to combinatorial codes.This section is by no means comprehensive, and we will occasionally make reference to theorems not fully stated in the text.Our primary reference for oriented matroids is [2], which collects and synthesizes decades of research on the subject.For combinatorial codes, there is no single comprehensive reference; for those unfamiliar with the subject, [9] and [19] are good introductions to the neural ring and morphisms of codes, respectively.
A set X ⊆ ±E is a signed set if its positive and negative parts are disjoint.If e ∈ E and X is a signed subset of ±E, define X e by X e = + if e ∈ X, X e = − if −e ∈ X, and X e = 0 otherwise; in this way, we can consider signed subsets equivalently as subsets of ±E or as vectors in {+, 0, −} E .The composition of sign vectors X and Y is defined component-wise by The separator of X and Y is the unsigned set sep(X, Y ) := {e | X e = −Y e = 0}.Now, we are ready to define oriented matroids, which we do via the covector axioms.
Definition 2.1.Let E be a finite set, and L ⊆ 2 ±E a collection of signed subsets satisfying the following covector axioms: Then, the pair M = (E, L) is called an oriented matroid, and L its set of covectors.
Maximal covectors (with respect to inclusion) are called topes.An oriented matroid is acyclic if it has a positive tope, i.e. a tope with empty negative part.
Example 2.2.A central hyperplane arrangement H in R d produces an oriented matroid.Let 1 , . . ., n be linear forms on R d , and H 1 , . . ., H n their zero sets (i.e.hyperplanes).We can assign each point x ∈ R d to a signed set X ⊆ ±[n] by The family of signed sets which arise in this way satisfies the covector axioms, and therefore defines an oriented matroid.Notice that each covector corresponds to a cell of the hyperplane arrangement, and that topes correspond to top-dimensional cells.We will refer to this oriented matroid M(H) = ([n], L(H)) as the oriented matroid of H.
An oriented matroid M is representable if M = M(H) for some hyperplane arrangement H. Figure 2(a) illustrates an example in R 2 .The rank of a representable oriented matroid is the minimum possible dimension of the hyperplane arrangement H with M = M(H).Not every oriented matroid is representable.However, we are able to take this hyperplane picture as paradigmatic.The topological representation theorem guarantees that every oriented matroid has a representation by a pseudosphere arrangement [12].For details, see [2,Chapter 5].
We can also use oriented matroid theory to describe affine hyperplane arrangements.An affine oriented matroid consists of a pair (M, g) where M is an oriented matroid and g is a distinguished element of its ground set.The affine space of (M, g) is the set {X ∈ L(M) | X g = +}.We can embed an affine hyperplane arrangement in R d as a central hyperplane arrangement in R d+1 .We replace each affine hyperplane w and add an additional hyperplane x d+1 = 0. Restricting to the x d+1 = 1 plane recovers the original hyperplane arrangement.Each chamber of the affine arrangement corresponds to an element of the affine space of (M(H), g), where g corresponds to the hyperplane x d+1 = 0.Because we can translate between affine and central realizations, the matroid M is representable with a central hyperplane arrangement if and only if (M, g) is representable by an affine hyperplane arrangement for any ground set element g.
There are many equivalent axiomatizations of oriented matroids.The two formulations we use most often throughout this work are the covector axioms (V1)-(V4), stated above, and the circuit axioms (C1)-(C4), which we state here.Definition 2.3.Let E be a finite set, and C ⊆ 2 ±E a collection of signed subsets satisfying the following circuit axioms: Then the pair M = (E, C) is an oriented matroid, and C is its set of circuits.
In some contexts, we admit the sets {e, ē} as improper circuits.We will call a circuit a proper circuit when we wish to emphasize that it is a signed set, i.e. its positive and negative parts are disjoint.
For an oriented matroid arising from a hyperplane arrangement, circuits are the signs of the coefficients in the minimal linear dependencies among the normal vectors to the hyperplanes.As a result, the rank of an oriented matroid can be defined via its circuits -the rank of an oriented matroid is the one less than the cardinality of its largest circuit.An oriented matroid is uniform of rank r if all of its circuits have the same cardinality of r + 1. Uniform oriented matroids correspond to generic hyperplane arrangements.
An element e ∈ E is a loop of M if {e} ∈ C(M).An oriented matroid is loopless if no element is a loop.
Proper circuits are related to covectors as follows: Two signed sets X and Y are called orthogonal if either X ∩ Y = ∅ or if there exist e, f ∈ X ∩ Y such that X e X f = −Y e Y f .A signed set is called a vector of M if and only if it is orthogonal to every covector.Equivalently, a signed set is a vector of M if and only if it is orthogonal to every tope.The circuits are the minimal vectors of M. The vectors of an oriented matroid define a dual oriented matroid, hence the vector and covector axioms are identical.Minimal covectors are know as cocircuits.They also satisfy the circuit axioms.
For a given oriented matroid M, each one of the set of covectors L(M), the set of topes W(M), the set of vectors V(M), and the set of circuits C(M) is sufficient to recover all of the others.

Combinatorial codes.
A combinatorial code C is a collection of subsets of a finite set V , i.e.C ⊆ 2 V .Typically, we take V = [n].
Given an arbitrary set X and collection U = {U 1 , . . ., U n } with each U i ⊆ X, the code of the cover U (relative to X) is code(U, X) sets and an open convex set X ⊆ R d , such that C = code(U, X), for some d.We will refer to open convex codes simply as convex codes.
Example 2.4.Let U i denote the open half-space on the positive side of hyperplane H i in Figure 2(a), i.e.
Then, code(U, R n ) is the combinatorial code with codewords as labeled in Figure 2(b).
Morphisms of combinatorial codes were defined in [19] in terms of trunks.For σ ⊆ [n], the trunk of σ in C is the set of codewords which contain σ, [m] by f (σ) := {i | σ ∈ T i }, and any code morphism f : C → D can be obtained in this way [19,Proposition 2.12].The class of codes, together with these morphisms, forms the category Code.
A subset σ ⊆ [n] can be encoded as a point c ∈ F n 2 by setting c i = 1 for i ∈ σ and c i = 0 for i / ∈ σ.Hence, a code C ⊆ 2 [n] can equivalently be thought of as a variety C ⊆ F n 2 .The vanishing ideal of a code C is the ideal and the neural ring of C is the quotient ring R C = F 2 [x 1 , . . ., x n ]/I C .The vanishing ideal I C is a pseudo-monomial ideal, meaning it is generated by products of the form i∈σ x i j∈τ (1− x j ), called pseudo-monomials.As with circuits, we distinguish between proper pseudomonomials, with σ and τ disjoint, and improper pseudo-monomials, which are divisible by some x i (1 − x i ).We will briefly discuss the vanishing ideal and neural ring in Section 5.1, but many more details can be found in [9].For clarity, we will denote pseudo-monomials and monomials with superscripts, i.e.
and x σ y τ := i∈σ x i j∈τ y j .

2.3.
Codes from oriented matroids.Consider an oriented matroid M on ground set E. We can consider the positive parts of covectors (respectively, topes) as a code on E, which we denote L + M (respectively W + M) to emphasize the change in categories: In Sections 3 and 4 we will show how L + relates representability of oriented matroids with convexity of codes.In Section 5, we will examine the functorial properties of W + ; culminating in a proof of Theorem 5.
If M is the matroid of a hyperplane arrangement the code L + M matches the code of the cover given by positive sides of the hyperplanes (as in Figure 2).This extends to any topological representation of M by a pseudosphere arrangement (as introduced in [12]).
Observation 2.5.If M is any oriented matroid and {S e } e∈E is an oriented pseudosphere arrangement topologically realizing M, then In particular, if M is a representable oriented matroid and {H e } e∈E is an oriented hyperplane arrangement realizing M, then The map L + is better behaved geometrically than W + .In particular, Observation 2.5 fails for W + .For instance, in the hyperplane arrangement pictured in Figure 2, ∅ is a codeword in the code of the cover given by the positive open half-spaces, but is not the positive part of any tope.
Remark 2.6.If M is an acyclic oriented matroid, then the the signed set −E is a tope.Thus, if S ⊆ E is the positive part of some covector X ∈ L(M), then S is also the positive part of the tope X • −E ∈ W(M).Thus, on acyclic oriented matroids, W + and L + coincide.

Intersection-closed families and morphisms
In [19], Jeffs shows that the image of a convex code under a code morphism, as well as any trunk of a convex code, is itself a convex code.From this observation, he defines the poset of isomorphism classes of codes P Code in which convex codes form a down-set: if D ≤ C in P Code and C is convex, then so is D. In this section, we generalize this statement to intersection-closed families, of which open convex subsets of R d is one example.A family F of subsets of a topological space is called intersection-closed if it is closed under finite intersections and contains the empty set.We say that a neural code C is F-realizable if C = code(U, X) for some U ⊆ F and X ∈ F. For instance, a neural code is convex if and only if it is F-realizable for the set F of convex open subsets of some R d .Then, using this result, we prove Theorem 2.
We recall the relevant definitions.Two codes C and D are isomorphic if there is a bijective code morphism f : C → D whose inverse is also a code morphism.If there is a sequence of codes C = C 0 , C 1 , . . ., C k = D such that each successive code is either the image of a morphism from or a trunk of the preceding code, we say D is a minor of C [20].Codes are then quasi-ordered by setting D ≤ C if D is a minor of C .The poset of isomorphism classes of codes induced by this order is denoted P Code .Proposition 3.1.For any intersection closed family F, if C is F-realizable and D ≤ C , then D is F-realizable.
Proof.We first check the case D = f (C ).This closely follows the proof of Theorem 1.4 in [19], since the only property of convex sets this proof uses is that the family of open convex subsets of R d is closed under finite intersection.We repeat the details here.Let C ⊆ 2 [n] , D ⊆ 2 [m] , and T 1 , . . ., T m be the trunks in C that define the morphism f : C → D. Let {U 1 , . . ., U n } ⊆ F be an F-realization of C .
If T j is nonempty, let σ j be the intersection of all elements of T j , which is the unique largest subset of [n] such that T j = Tk C (σ j ).Then, for j ∈ [m], define Since F is closed under finite intersection and contains the empty set, V j ∈ F for all j ∈ [m].Thus, it suffices to show that the code E that they realize is D. To see this, note that we can associate each point p ∈ X to a codeword in Then let p ∈ X be arbitrary, and let c and e be the associated codewords in C and E respectively.By the definition of the V j , we have that c ∈ T j if and only if j ∈ e, which is equivalent to e = f (c).Since p was arbitrary and every codeword arises at some point, we conclude that Then D = code(V, Y ).To check this, as above, we can associate each point p ∈ Y to a codeword by each of these codewords will contain σ, and we will obtain every codeword of C containing σ in this way.Our first application of Proposition 3.1 is to good cover codes.A code C is a good cover code if there exist open sets U 1 , . . ., U n realizing C which form a good cover, i.e. all intersections i∈σ U i are either empty or contractible.Good cover codes are precisely the codes with no local obstructions, as proved by [5,Theorem 3.13].Codes with local obstructions formed the first known class of non-convex codes [6].Recall the link of a face σ in a simplicial complex ∆ is the subcomplex For a code C , ∆(C ) is the simplicial complex of C , obtained by taking the closure of C under taking subsets.A neural code C has a local obstruction if there is some σ ∈ ∆(C ) \ C such that link σ (∆(C )) is not contractible.
We show that codes with no local obstructions form a down-set in P Code .The only requirement to be an open set in some good cover is contractibility, and the family of contractible sets is not intersection-closed.Instead, we consider the sets U 1 , . . ., U n in one particular good cover and their intersections as our intersection-closed family.
Corollary 3.2.The set of codes with no local obstructions is a down-set in P Code .
Proof.Let C be a code with no local obstructions.By [5,Theorem 3.13], C is a good cover code.Fix a good cover U = {U 1 , . . ., U n } realizing C .Let F U denote the family of sets obtained by arbitrary intersections of sets in U, together with the empty set.This family still forms a good cover.Any code D ≤ C is F U -realizable by Proposition 3.1; it is therefore a good cover code and thus has no local obstructions.
Armed with these results, we look at the codes of oriented matroids and those lying below them.In particular, we examine the intersection-closed family of interiors of convex polytopes in R n .We say that a code C is polytope convex if there exists a collection of interiors of convex polytopes P = {P 1 , . . ., P n } and a bounding convex polytope X such that C = code(P, X).Note that polytope convex codes are open convex.Proposition 3.1 implies that the image of any polytope code under a surjective morphism is also a polytope code.Thus, since the codes of representable oriented matroids correspond to codes of hyperplane arrangements, all codes which lie below a representable oriented matroid are polytope codes.We prove the converse, showing that every polytope code is itself the image of the code of an oriented matroid under some surjective morphism.This demonstrates that polytope codes are a down-set generated by the set of representable oriented matroid codes.
We begin by noting that codes below oriented matroids have no local obstructions.This result appears in different language in [11].We flesh this out.Proposition 3.3.Let M be an oriented matroid.If C ≤ L + M in P Code , C is a good cover code, and thus has no local obstructions.
Proof.Edelman, Reiner, and Welker define a simplicial complex ∆ acyclic (M) which is identical to ∆(L + M) [11].Proposition 11 and Lemma 13 of [11] and is therefore a good cover code.By Corollary 3.2, good cover codes form a down-set in P Code , so if C ≤ L + M in P Code , then C has no local obstructions.Theorem 2. A code C is polytope convex if and only if there exists a representable oriented matroid M such that C ≤ L + (M).
Proof.(⇒) A polytope is an intersection of half-spaces, so this follows from Observation 2.5 and Proposition 3.1.
(⇐) Let C be a polytope convex code with (V, X) a realization of C with convex polytopes V i and bounding convex set X. Without loss of generality, we can choose X to be a convex polytope.Then each V i is the intersection of a collection of open half spaces U i1 , . . ., U ik i , and X is the intersection of open half spaces X 1 , . . ., X k .Now, let H = code({U 11 , . . ., U 1k 1 , . . ., U nkn , X 1 , . . ., X k }, R d ).Let H be the trunk of the neurons associated to X 1 , . . ., X k .Now, we define a surjective morphism f : H → C as follows.Choose trunks T 1 , . . ., T n of H by T i = Tk H ({i1, . . ., ik i }).Let f be the morphism defined by the trunks T 1 , . . ., T n .We now show that its image is C .
To do this, construct the realization of f (H ) given in the proof of Proposition 3.1.This construction gives the realization In dimension two, every convex code admits a realization with convex polytopes [4].Thus, in dimension two, we can strengthen Theorem 2 as follows: Corollary 3.4.A code C including the empty codeword is open convex with minimal embedding dimension two if and only if there exists a representable affine oriented matroid (M, g) of rank three such that C ≤ Tk L + (M) (g).
Proof.First suppose C is a planar convex code.By intersecting each of the convex sets with the same sufficiently large ball, we obtain a realization of C by bounded convex sets.Then by Theorem 1 of [4], C has a realization with interiors of convex polygons in R 2 .These convex polygons are intersections of half-spaces.Let (M, g) be the affine oriented matroid of the corresponding affine, oriented hyperplane arrangement.Notice that M is representable and rank three, since it arises from the centralization of a hyperplane arrangement in R 2 .The covectors in the affine space of (M, g) each contain g in their positive part.Then by the argument used in the proof of Theorem 2, C ≤ Tk L + (M) (g).Now suppose that C ≤ Tk L + (M) (g), where (M, g) is a representable affine oriented matroid of rank two.Then by Theorem 2, C has a realization with intersections of half spaces in R 2 , and is thus convex with minimal embedding dimension two.

Non-convex codes
In dimensions three or higher, it is unknown whether every convex code has a realization with convex polytopes.However, the contrapositive to Theorem 2 still helps us characterize non-convex codes.If C is not convex, one of two possibilities hold: either C does not lie below any oriented matroid, or C lies below only non-representable oriented matroids in P Code .In this section, we prove that codes with local obstructions as well as "sunflower codes" do not lie below any oriented matroids.We also construct a new class of non-convex codes which lie below non-representable oriented matroids.appeared in [23].In [19], Jeffs uses this code to construct a smaller non-convex code C 2 ≤ C with no local obstructions, C 2 = {∅, 1236, 13, 135, 23, 234, 4, 456, 5, 6}.This code is minimally non-convex, in the sense that any code C < C 2 in P Code is convex.The proofs that C and C 2 are not convex depend on the n = 3 case of the following theorem: Jeffs uses this theorem to construct an infinite family {C n } n≥2 of minimally non-convex codes with no local obstructions generalizing C 2 ; we refer to these as "sunflower codes."In the rest of this subsection, we define the code C n for n ≥ 2 and give a proof that for all n ≥ 2, the code C n does not lie below any oriented matroid, representable or otherwise.• ∅; We will refer to the regions indexed by P as petals, and the regions indexed by S as simplices.Proof.Fix n ≥ 2. Suppose to the contrary that there is an oriented matroid M such that C n ≤ L + M. For ease of notation, let M denote the code L + M. Since ∅ ∈ C n , we can assume without loss of generality that C n = f (M ) for some code morphism f .Denote the ground set of M by E. The map f must be defined by trunks Tk M (π 1 ), . . ., Tk M (π n+1 ), Tk M (σ 1 ), . . ., Tk M (σ n+1 ), with π i , σ i ⊆ E corresponding to p i and s i respectively.
Claim 1: There is a tope T of M such that Roughly speaking, we are producing a codeword in the intersection of the last petal and all simplices, which also lies in the convex hull of the other petals.
Define a morphism g : M → 2 [n+1] by the trunks ) is either a hollow (n − 1)-simplex or a solid (n − 1)simplex.Since we have defined D as the image of an oriented matroid code, it cannot have local obstructions.The codeword {n + 1} is not in D; if it were, then f (g −1 ({n + 1})) would contain a codeword of C including s n+1 without any other s i .No such codeword exists in C .Thus link {n+1} (∆(D)) must be contractible and so must be a solid (n − 1)-simplex; therefore, Based on the trunks defining g, we know that ).By definition of f , we must also have S ⊆ c for any codeword c ∈ f (g −1 ([n + 1])); however, the only codeword of C n which contains S is S ∪ {p n+1 }.Thus, there is a codeword of M containing n+1 i=1 σ i ∪ n j=1 π j ∪ π n+1 .This implies that M has a covector X such that n+1 i=1 σ i ∪ n j=1 π j ∪ π n+1 ⊆ X + .To produce a tope satisfying the condition, take T = X • W for any tope W of M.
Claim 2: π n+1 ∪ n j=1 π j ⊆ T + implies n+1 j=1 π j ⊆ T + for any tope T of M. The intuition here is that the last petal must intersect the convex hull of the other petals only in the common intersection of all petals.
Let U be a tope with n+1 j=1 π j ⊆ U + .Such a tope must exist, since P ∈ C n .Suppose for the sake of contradiction that there exists a tope V such that Consider a shortest path from U to V in the tope graph of M. Each edge of the tope graph is naturally labeled by the ground set element e by which the two incident topes differ.By the T -convexity of intersections of half-spaces in the tope graph, each tope along this path has π n+1 ∪ n j=1 π j in its positive part, so no edge is labeled with an element of n j=1 π j .Thus at some point along the path from U to V , we must cross an edge (T, W ) labeled by a ground set element e ∈ n+1 j=1 π j \ n+1 j=1 π j .Choose the first such edge (T, W ) labeled with ground set element e.By our choice of e, there exist k, . Any path from a tope U with n+1 j=1 π j ⊆ U + to a tope V with n+1 j=1 π j ⊆ V + must cross an edge in n+1 j=1 π j .Analogously, a path from a point in the atom P = {p 1 , p 2 , . . ., p n } to the atom {p n+1 } must cross the boundaries of p 1 , p 2 , . . ., p n all at one time.and e / ∈ π .This means π k ⊆ W + , whereas π ⊆ W + .Then {p , p n+1 } ⊆ f (W + ), but f (W + ) = P .However, the only codeword of C n containing {p , p n+1 } is P , so we have reached a contradiction.Therefore, no such tope V may exist.
By Claim 1, M must have a tope T which has By showing that the family of codes {C n } n≥2 do not lie below oriented matroids, we have given an alternate proof that these codes do not have realizations with interiors of convex polytopes.This proof is significantly different in structure than the original proof that these codes are not convex using Theorem 4.1, which is in turn proved by induction on dimension.In contrast, our proof makes no reference to rank or dimension, and does not use induction.While the codes {C n } n≥2 are not open convex, they do have realizations with closed convex sets, which can even be chosen to be (non-full dimensional) closed convex polytopes.Notice that Theorem 2 establishes that if C has a realization with interiors of convex polytopes, then C ≤ L + M.However, the fact that a code has a realization with closed convex polytopes does not guarantee this.Further, in showing that these codes do not lie below any oriented matroids at all, we have established that, even while these codes are good cover codes, their obstructions to convexity are somehow still topological in nature.

Representability and convexity.
Having exhibited that many well-known non-convex codes do not lie below any oriented matroids at all, we now exhibit a family of non-convex codes which lie below non-representable oriented matroids.For each uniform, rank 3 affine oriented matroid (M, g), we construct a code C (M, g) which is convex if and only if M is representable (recall a uniform oriented matroid is one in which all circuits have the same cardinality).Moreover, this code is always the image of an oriented matroid under a code morphism.
Consider a uniform, affine oriented matroid (M, g) of rank 3. A pseudoline is a simple curve L in R 2 , unbounded in both directions, which partitions the plane into unbounded pieces R 2 = L + L L − .By the topological representation theorem ([2, Section 1.3], [12]), (M, g) can be represented by a uniform arrangement of piecewise linear pseudolines, that is, a family P = {L i } i∈[n] of pseudolines such that each pair intersects exactly once and no more than two meet at any point.The sign vectors of this arrangement are the covectors of (M, g).An example is illustrated in Figure 6(a).
Note that the oriented matroid of a pseudoline arrangement is completely determined by the order in which each line meets all of the other lines.We can record this information as follows: Let L 1 , . . ., L n be a pseudoline arrangement.For each pseudoline, fix one end of the pseudoline as the "head".Let π i (j) denote the index k such that L j is the k-th pseudoline we encounter as we follow L i from the head to the tail.
We use this order to define a code C (M, g).We then use the concept of order-forcing introduced in [21] to prove that the code C (M, g) is convex if and only if M is representable.Order-forcing depends on feasible walks in the codeword containment graph.
A sequence of codewords σ 1 , ..., σ k is order-forced if every feasible σ 1 , σ k walk contains that sequence as a subsequence.
Order forcing constrains the realizations of a code by forcing certain sequences of codewords to correspond to straight-line paths in all convex realizations.In any realization of a code, the atom corresponding to codeword σ is the region A σ = i∈σ U i \ j / ∈σ U j .Theorem 4.4 ([21], Theorem 1.1).Let σ 1 , σ 2 , . . ., σ k be an order-forced sequence of codewords in a code C ⊆ 2 [n] .Let U = {U 1 , . . ., U n } be a (closed or open) convex realization of C , and let x ∈ A σ 1 and y ∈ A σ k .Then the line segment xy must pass through the atoms of σ 1 , σ 2 , . . ., σ k , in this order.Now, we construct the code C (M, g) so that a sequence of codewords along each pseudoline is order-forced.Definition 4.5.Let (M, g) be a uniform, affine oriented matroid of rank 3 with pseudoline arrangement L 1 , . . ., L n .Without loss of generality, assume we have labeled pseudolines L 1 , . . ., L n , with their heads in clockwise order around the outside of the plane.An example is illustrated in Figure 6 (a).Order-forcing along each pseudoline Pairwise intersections of pseudolines plus order-forcing c j,π j (i) c j,π j (i)+1 : (i = 1, . . ., n, j = 1, . . ., n − 1.) We include an example of a good cover realization of this code in Figure 6(b).Proposition 4.6.For any uniform, rank 3 affine oriented matroid (M, g), there exists a rank 3 oriented matroid M such that C (M, g) ≤ L + M.
Proof.We describe the pseudoline arrangement associated to M. Fix a piecewise-linear pseudoline arrangement L 1 , . . ., L n representing (M, g) consistent with the labeling in C (M, g).Let B r be a line which meets L 1 , L 2 , . . ., L n in the clockwise order consistent with the labeling.Let B be a line which meets B r and then L n , L n−1 , . . ., L 1 in the opposite of this clockwise order.Orient B r and B such that B + r and B + are the half-spaces containing all bounded cells of the pseudoline arrangement.Orient each L i such that B r ∩ B lies in L − i .Now, for each i ∈ [n], we define a pseudoline L i which acts as a translation of L i into its positive half-space.That is, we let L i be a pseudoline which intersects B , B r , and each L j , j = i in the same order as L i , and such that for each other pseudoline L, the intersections of L i and L i are adjacent along L. Further, we ensure that L i , L i do not intersect.Orient L i so that L i ⊆ L + i .Define B , B r and orient them analogously.This pseduoline arrangement is illustrated in Figure 6(c).
Finally, we produce an oriented matroid M from this pseudoline arrangement by fixing a ground set element h such that the set of covectors of the pseudoline arrangement is the affine space of ( M, h).We claim the oriented matroid of this arrangement, M, lies above C (M, g).The morphism f such that f (Tk L + M (h)) = C (M, g) is defined by the the trunks {T a i } i=1,...,n ∪ {T br , T b } ∪ {T c i,j } i=1,...,n,j=1,...,n ∪ {T d s,j } s=r, ,j=1,...,n .
corresponding to the neurons of C (M, g).We let i, i (for each i ∈ [n]), r, r , , and be the ground set elements corresponding to L i , L i , B r , B r , B , and B respectively.These trunks are defined as follows: T a i := Tk({i, i , r, }) for i = 1, . . ., n T br := Tk({r, r , , n }) In order to define T c i,j , we introduce some notation.Let That is, right(i, j) is whichever of j, j the pseudoline L i meets first as we follow it from its intersection with B r to its intersection with B , and left(i, j) is whichever it hits second.Now, we define T c i,j := Tk({i, i , right(i, π i (j − 1)), left(i, π i (j))}) for i = 1, . . ., n, j = 2, . . ., n − 1.
Finally, we verify that the map f (σ) = {s | σ ∈ T s } has image C (M, g).Each T s specifies the open set U s given by the intersection of the open half-spaces indexed by s.By construction, the {U s } give rise to a good cover realization of C (M, g).
Theorem 4. Let M = (E, L) be a uniform, rank 3 oriented matroid.Then for g ∈ E, the code C (M, g) is convex if and only if M is representable.
Proof.First, we show that if M is representable, C (M, g) is convex.Note that by Proposition 4.6, we have that C (M, g) ≤ L + M. Also note that by construction, if M is representable, then so is M. Therefore, by Theorem 2, if M is representable, C (M, g) is convex.
Next, we show that if C (M, g) is convex, then M is representable.Note that the following sequences are order-forced in C (M, g).
(1) The only feasible path from We claim if C (M, g) is convex, then it has a realization in the plane.Suppose that C (M, g) is convex, and fix a realization U in R d .Choose points p 1 , p 2 , p 3 in the atoms A brb d r,1 d ,1 , A brandr,n , and A b a 1 d ,n respectively.We will show that each atom in this realization has a nonempty intersection with conv(p 1 , p 2 , p 3 ).By order forcing (1), the line from p 1 to p 2 must pass through the atoms of all codewords containing b r in the listed order.Likewise, by order forcing (2), the line from p 1 to p 3 must pass through the atoms of all codewords containing b in the listed order.
In particular, we have shown that for each i, the atoms of σ = b r a i d r,i d r,(i+1) c i,1 and τ = b a i d ,(n+1−i) d ,(n+2−i) c i,1 have a nonempty intersection with conv(p 1 , p 2 , p 3 ).For each i, pick a point q i ∈ conv(p 1 , p 2 , p 3 ) ∩ A σ and a point r i ∈ conv(p 1 , p 2 , p 3 ) ∩ A τ .Applying order forcing (3) for each i, we have that the line from r i to q i passes through the atoms of all codewords containing a i , in the listed order.This accounts for every codeword of C (M, g).Thus, intersecting the open sets in U with the plane aff(p 1 , p 2 , p 3 ) produces a two-dimensional convex realization of C (M, g).Now, we obtain a straight line arrangement for (M, g) in this plane by extending the line segment from q i to r i to be a line.By uniformity of M and our choice of bounding lines, every pair of pseudolines intersects in B + ∩ B + r and so no new intersections are introduced.Notice that by order forcing (3), this line meets the sets U a 1 , . . ., U an in the order consistent with the pseudoline arrangement.Thus, if this code is convex, M is representable.Proposition 4 demonstrates that matroid representability and convex code realizability are intertwined.One consequence is that non-representable oriented matroids are a new source for constructing non-realizable codes: Corollary 4.7.There is an infinite family of non-convex codes which lie below oriented matroids in P Code .
Proof.There are infinitely many non-representable uniform oriented matroids of rank 3 [2, Proposition 8. Example 4.8.Let (M, g) be the uniform non-Pappus matroid from [32], whose pseudoline arrangement appears in Figure 7.This matroid is non-representable, since a realization of it would violate Pappus's hexagon theorem.Then C (M, g) is a non-convex code with no local obstructions.

4.3.
The convex code decision problem is NP-hard.We now turn to the computational aspects of convex codes.Using the relationship between convex codes and representable oriented matroids (Theorem 3), we demonstrate the convex code decision problem is NP-hard and ∃R-hard, though it remains open whether the convex code decision problem lies in either of these classes, or is even decidable.The complexity class ∃R, read as the .existential theory of the reals, is the class of decision problems of the form where P is a quantifier-free formula whose atomic formulas are polynomial equations, inequations, and inequalities in the x i .In other words, a problem in ∃R defines a semialgebraic set over the real numbers and asks whether or not it contains any points [3].Many well known problems in computational geometry lie in ∃R, including some problems very similar to determining whether a code is convex.For instance, determining whether a graph is the intersection graph of convex sets in the plane is ∃R complete [31].Theorem 3 implies the convex code decision problem is at least as difficult as deciding if an oriented matroid is representable.This decision problem is ∃R-complete [26,30,32,33]: given any decision problem in ∃R, there is a polynomial time algorithm to produce an oriented matroid (presented in terms of covectors) which is realizable if and only if the decision problem has a positive answer.Therefore the convex code decision problem is ∃R-hard.
Theorem 5. Any problem in ∃R can be reduced in polynomial time to the problem of determining whether a neural code is convex.
Proof.By the Mnëv-Sturmfels universality theorem (see [2,26,30,32,33]), determining whether a rank 3 uniform oriented matroid (presented in terms of covectors) is representable is complete for the existential theory of the reals.By Proposition 4, a rank 3 uniform oriented matroid M is representable if and only if C (M, g) is a convex neural code.Further, the number of neurons in C (M, g) is quadratic in the size of the ground set of M, and the number of codewords of C (M, g) is less than the number of covectors of M. Finally, we can construct C (M, g) from the covectors of M in polynomial time.Any problem in ∃R can be reduced in polynomial time to deciding representability of a uniform oriented matroid and thus convexity of the corresponding code.
Since any ∃R complete problem is also NP-hard, we have as a corollary that determining whether a code is convex is NP-hard.
Corollary 4.9.The problem of determining whether a code is convex is NP-hard, where the problem size is measured in the number of codewords.
Notice that because we can perform this reduction of a problem in ∃R to a neural code in polynomial time, this result holds even when we measure the problem size in terms of the number of codewords, which may be exponentially large in the number of neurons.Again, this NP hardness result is not surprising.For instance, it parallels the result that recognizing whether a simplicial complex is the nerve of convex sets in R d is NP-hard for d ≥ 2 [34].
5. Categories of codes, matroids, and rings 5.1.The Neural Ring.To set the stage for the functorial connections between combinatorial codes and oriented matroids, we begin with a brief discussion of the functor R : Code → NRing defined in [19], and its relation to the combinatorial relations of a code, introduced in [9].Recall that the neural ring of a code C is R C = F 2 [x 1 , . . ., x n ]/I C , where I C is the vanishing ideal of C as a variety in F n 2 .This is the ring of F 2 -valued functions on C with distinguished coordinate functions x 1 , . . ., x n , that is, x i (σ) = 1 iff i ∈ σ.The category NRing is the category of neural rings together with monomial maps, ring homomorphisms φ : R D → R C which map the coordinate functions of R D either to products of coordinate functions in R C or to 0. By restricting to this class of homomorphisms, the functor R which takes a code to its neural ring is a contravariant equivalence of categories [19,Theorem 1.6].For f : C → D a morphism of codes defined by trunks The pseudo-monomials in I C provide a dual description of C .They record the dependencies among the elements of [n], or, equivalently, among the sets U i in any realization of C .If C = code(U, X), then [9, Lemma 4.2] implies: Containment relationships as in the right hand side of (1) are called the combinatorial relations of C .As a generating set for I C , the minimal pseudo-monomials, i.e. the minimal combinatorial relations, are sufficient to recover the code C .The minimal proper pseudomonomials in I C are called the canonical form of C [9].The following lemma shows that the structure of a pseudo-monomial ideal encodes the weak elimination axiom (axiom (C4)) of oriented matroid circuits.Lemma 5.1.Let C = 2 [n] be a combinatorial code.Denoting pseudo-monomials x σ (1 − x) τ as sets σ∪ τ ⊆ ±[n], the minimal relations of C satisfy circuit axiom (C4) (weak elimination).
Thus, some minimal pseudo-monomial Note that, while the proper circuits of an oriented matroid satisfy axiom (C4), we must include improper pseudo-monomials of the form x i (1 − x i ) in order for the generators of I C to satisfy (C4).While elements of the canonical form are minimal combinatorial relations, they do not satisfy axiom (C3) (incomparability).Combinatorial relations on the same support need not be equal or opposite: for instance, the combinatorial relations of the code which are all supported on the set {1, 2, 3}.
The relationship between pseudo-monomials in I C and codewords in C is analogous to the relationship between circuits and topes.In light of Lemma 5.1, the oriented matroid analogue of R maps an oriented matroid M to an ideal generated by the circuits of M and then the depolarization map D is simply the algebraic analogue of W + .As we will see, most of the work involved in establishing these connections is in showing W + and S are functors.5.2.Oriented matroids to neural codes.We now show that the map W + is a contravariant functor from the category OM whose objects are acyclic oriented matroids and whose morphisms are strong maps, to the category Code whose objects are neural codes and whose objects are code morphisms.
We define strong maps in terms of convexity following [16].First, we include the requisite information on convexity for oriented matroids.
The convex closure of a set S ⊆ ±E is the intersection of all convex sets that contain S. Remark 5.3.This definition differs from [2, Exercise 3.9, p 152] in that it acts on subsets of ±E rather than E. The intuition behind this definition comes from vector arrangements.A signed-linear dependence on S ∪ {−x} gives a signed-linear representation of x in terms of S: just add x to both sides of the equation.This can be rescaled to a convex combination of elements in S; therefore, x should be in the convex closure.
We now define strong maps: Definition 5.4.Let M 1 , M 2 be a pair of oriented matroids on ground sets E 1 , E 2 and f : Extend f to a map f on the signed ground sets by f (−e) = −f (e), where • = −•.We say that f induces a strong map φ f : Remark 5.5.We briefly explain the loops in the definition of strong maps.We want the function on sets to be well-defined while still allowing some elements to "disappear," so we add {•} in the target to absorb the disappearing elements.Since strong maps between matroids on the same ground set have certain duality properties, we include {•} in the source as well.
The following lemma gives us an equivalent definition of convexity in terms of topes.We will make use of a corollary (Corollary 5.7) along the way to proving W + is a functor.Lemma 5.6.A subset S ⊆ ±E is convex if and only if for all x / ∈ S and A ⊆ S containing no signed circuits, there exists a tope X ∈ W(M) such that A ∪ {−x} ⊆ X.
Proof.Assume that for all x / ∈ S and A ⊆ S containing no signed circuits, there is a tope X with A ∪ {−x} ⊆ X. Suppose that S is not convex, by way of contradiction.Then there exists some x / ∈ S for which there is a circuit C with −x ∈ C ⊆ S ∪ {−x}.But, A = C \ {−x} is a subset of S containing no signed circuits (by axiom (C3)), and if any tope contained A ∪ {−x}, that would contradict tope-circuit orthogonality.
For the reverse implication, we prove the contrapositive using the four-painting axioms [2, Theorem 3.4.4(4P)].Suppose that there is some set A ⊆ S containing no signed circuits and an element x / ∈ S such that A ∪ {−x} is not contained in any tope.Paint the ground set to be black and white coincident with A ∪ {−x}, and to be red on the remaining elements.By the four-painting axioms, there must be a circuit supported on the elements of A ∪ {−x}; this proves that S is not convex.
Proof.Let X be a tope.By tope-circuit orthogonality, there is no circuit contained in X.Consider x / ∈ X.Since topes have full support, x / ∈ X implies −x ∈ X.This means that for any A ⊆ X, the set A ∪ {−x} ⊆ X, which is a tope.Therefore X is convex.Now we define the contravariant functor W + : OM → Code.We restate the map on objects and add the action on morphisms.Definition 5.8.Let M be an acyclic oriented matroid.Take W + M to be the code consisting of the positive parts of topes of M, In order to prove that W + is a functor, we must prove that W + φ is actually a well-defined function with the desired domain.At this point, acyclicity becomes necessary.
Example 5.9.Consider the matroid M 1 on ground set E = {1, 2, 3} defined by the columns of the matrix 1 −1 0 0 0 1 The topes of M 1 are {1 23, 1 23 , 123, 12 3}.Let M 2 be the rank-1 matroid on one element obtained by contracting the first two columns of M 1 .That is, M 2 is the oriented matroid on ground set [1] with topes { 1, 1}.The contraction is the strong map induced by the set map Passing to Code, we have W + M 2 = {∅, 1} and W + M 1 = {1, 13, 2, 23}.For the functor to work, we would need W + φ(1) = 3 to be the positive part of some tope, but there is no such tope.By demanding that the matroids are acyclic we avoid this problem.Acyclic oriented matroids are also loopless, so topes of acyclic oriented matroids have full support.Proposition 5.10.Let M 1 and M 2 be acyclic oriented matroids on E 1 and E 2 respectively, and Proof.Since both matroids are loopless, topes of each have full support on their ground sets.By Corollary 5.7, X ∪ {•} is convex, and since f is a strong map, we conclude that If not, then by nonconvexity of Z, there is x / ∈ Z, such that −x is in some circuit C contained in Z ∪ {−x}.Thus, x would be an element in the convex closure of Z but not in Z itself, rendering Z nonconvex.Because Z has full support, this means −x ∈ Z, implying C ⊆ Z.Because M 1 is acyclic, C must have at least one element x ∈ f −1 (X + ) + .But this implies that −x should be in the convex closure of f −1 (X ∪ {•}), contradicting convexity.
Finally, by Corollary 5.7, we note that a maximal signed convex set must be a tope, indicating that Z is a tope satisfying our constraints.Thus, Proposition 5.10 confirms that the map of codes has the desired domain, so it is well-defined as a map of sets.We need to confirm that this set map is also a morphism of codes (i.e. the preimage of a trunk is a trunk).
Proposition 5.11.For a strong map of acyclic oriented matroids φ f : M 1 → M 2 , the map of neural codes given by It is sufficient to check that the preimage of a simple trunk (i.e. the trunk of a singleton set) is a trunk.Thus, we compute (W Thus, the map W + φ f is a morphism of neural codes.
To finish off the proof that W + is a functor, we need only check that it respects the identity morphism and composition of morphisms.
Proposition 5.12.The identity strong map on a matroid id : M → M yields W + id : W + M → W + M the identity on the corresponding code.
Given two strong maps φ : Proof.Based on Proposition 5.10, the map of codes is well-defined.The composition of strong maps is defined by Thus W + respects composition of morphisms.Next, we check that thus W + respects the identity morphism.Therefore, W + is a functor.Proposition 5.13.The map W + is a faithful, but not full, contravariant functor from the category OM of acyclic oriented matroids with strong maps to the category Code of neural codes with code morphisms.
Since we have already proven that the map of categories W + is indeed a functor, we only need to prove that the functor is faithful but not full to complete the proof of Proposition 5.13. .For i = 1, 2, 3, 4, let the plane H i be the plane spanned by the line embedded in the plane z = 1 and the origin, and let the H 5 be the plane z = 0, oriented up.Notice that the canonical construction of a realization of D from the realization of C is not a hyperplane realization, even though D happens to be a hyperplane code.
Proof.For a given strong map φ : M 1 → M 2 , it is easy to read out the map on ground sets E 1 → E 2 from the values of W + φ.Because the set map uniquely determines the strong map, the functor is faithful -that is, it is injective on morphisms.
To show that not all morphisms of codes arise from strong maps of oriented matroids we produce the following example: Take the morphism f : C → D, where and the morphism is defined by trunks Tk C (135) and Tk C (245).See Figure 8 for realizations of these codes.By construction, f is a morphism of neural codes.Both codes are hyperplane codes, thus they arise from oriented matroids M 2 and M 1 .However, the map f does not arise from any strong map.To see this, notice that the proof of Proposition 5.11 actually proves that the preimage of a simple trunk is a simple trunk for any morphism arising from a strong map.However, by construction, f −1 (Tk D (1 )) = Tk C (135), which is not a simple trunk.This proves that the functor is not full.

5.3.
Oriented matroids to rings.We now describe the oriented matroid ring and show that the map taking an oriented matroid to its associated ring is a functor.The key ingredient for doing this is the oriented matroid ideal introduced in [28].As defined in that paper, the oriented matroid ideal is associated to affine oriented matroids; in other words, oriented matroids with a distinguished element.We alter their definition to avoid the need for a distinguished element, and show that the affine oriented matroid ideal can be constructed algebraically from the oriented matroid ideal.Finally, we define the oriented matroid ring as the quotient by the Alexander dual ideal.We define the functor S which takes an oriented matroid to its oriented matroid ring and describe its image, which we take as our category OMRing.
Fix a field k.We will consider polynomial rings over k with variables indexed by the ground set E of an oriented matroid; when the indexing set is apparent, we will denote these as k[x, y] or k[x].The affine oriented matroid ideal is defined in [28] (under the name "oriented matroid ideal") with an equivalent description from their Proposition 2.8 as follows: Definition 5.14.Let M = (E, L, g) be an affine oriented matroid with E = {1, . . ., n, g}.(Covectors) For every sign vector Z ∈ {0, +, −} E , associate a monomial y i where x g = y g = 1.
The affine oriented matroid ideal O g (M) is the ideal in k[x, y] generated by all monomials corresponding to covectors (Circuits) The minimal prime decomposition of the affine oriented matroid ideal is C , where P C is the ideal generated by variables x i , y j | i ∈ C + , j ∈ C − , j = g , and the intersection is over all circuits C such that g ∈ C − .We define the oriented matroid ideal in terms of generators, and show that it also has this dual description in terms of minimal primes.Remark 5.16.This definition can be extended in a straightforward way to matroids with loops, but "topes" would be replaced with "complements of covectors."Note that the minimal complements of covectors in loopless matroids are indeed the topes.Proposition 5.17.Let M = (E, L) be a loopless oriented matroid.The minimal prime decomposition of O(M) is given by O(M) = C P C , where P C is the ideal generated by variables x i , y j | i ∈ C + , j ∈ C − , and the intersection is over all (proper and improper) circuits C.
Proof.Note that O(M) is a monomial ideal, as is the intersection of the monomial ideals {P C } C .Therefore, it is sufficient to check that the sets of monomials in the two ideals are identical.
First, consider m Z = m xy (±[n] \ Z) for Z ∈ W(M).We will show that m Z ∈ P C for all C ∈ C(M).The affine oriented matroid ideal can be obtained from the oriented matroid ideal using the following construction.
Ideal quotients commute with intersection, so we can apply the quotient to each component.The first component becomes the ideal quotient of O(M \ g) by itself, which is the full ring.After specializing x g = 1, the second component is also the full ring.Turning to the third component, we need to prove that ( A monomial m is in the quotient if and only if for all A = ±[n] \ B where B ∈ L(M \ g), either y g | m • m xy (A) or there exists covector Z ∈ L(M) with Z g = − such that m One more step is needed to make the functor S work.The oriented matroid ideal O(M) is a square-free monomial ideal; we take its Alexander dual (see e.g.[25,Definition 1.35]) to obtain O(M) .This takes the oriented matroid ideal and swaps the role of topes and circuits; i.e. irreducible components now correspond to topes, and monomial generators to circuits.Let W be a tope and let p(W ) = x e | W e = + + y e | W e = − .Then, for acyclic We define the category OMRing to be the category whose objects are oriented matroid rings S M with distinguished generators x 1 , . . ., x n , y 1 , . . ., y n .The morphisms of OMRing are the strong monomial maps Sφ f , where φ f is a strong map of oriented matroids.5.4.Oriented matroid rings to neural rings and back.The final piece of the puzzle is describe the relationship between OMRing and the category of neural rings NRing.Note that neural rings are defined over F 2 , thus we take all rings in this section to be over F 2 .The vanishing ideal of a code is a pseudo-monomial ideal, meaning it has a pseudo-monomial generating set.Polarization of a pseudo-monomial ideal, introduced in [15], produces a true monomial ideal which encodes the same combinatorial information.As W + is not a full functor and R is an equivalence of categories, there is no reason to expect polarization to be a functor.Instead, we will use the operation of depolarization to define the functor D so that R • W + = D • S, i.e. the diagram below commutes.Observe that S/D ∼ = F 2 [x] under the map y i → 1 − x i .Under this same map, x σ y τ → x σ (1 − x) τ , so S /D is a pseudo-monomial ideal; since x i y i ∈ O(M) for all i ∈ [n], we have x i (1 − x i ) ∈ S /D for all i and therefore S /D is the vanishing ideal of a combinatorial code.
Next we check that if φ : S M 1 → S M 2 is a strong monomial map, then Dφ is a monomial map of neural rings.By definition, φ induces a monomial map , sending each x i to some x j or 0 as appropriate.So, we only need to check this is a well-defined ring homomorphism.This follows from properties of polarization: [15].Therefore, Thus, Dφ is a well-defined monomial map.
To complete the proof D is a functor, we need to show D respects the identity and composition of morphisms.These are immediate from the definitions: D id x i = x id(i) and Proposition 5.22.The diagram (3) commutes.
Proof.We will show that: (1) for any acyclic oriented matroid M, (2) for a strong map of acyclic oriented matroids f : (1) We prove the first part by showing that the ring of functions on W + M is precisely the ring (D • S)(M).We do this by showing that they are both quotients of F 2 [x] by the same ideal.For a tope W e. the image of p(W ) under the map y i → 1 − x i (recall Eq. ( 2)).Then we have x] vanishing at codeword W + .As the vanishing ideal of a finite variety, we have By construction, m(W ) = p(−W ).By symmetry (axiom (V2)), W is a tope if and only if −W is a tope.Therefore, the ideals are defined by the same intersection and therefore the corresponding quotients are identical.
(2) Now we prove that strong maps point to the same monomial map via D • S and R • W + .It is sufficient to check the action of each monomial map on generators of F 2 [x].
A strong map φ f is defined by a set map f : E 1 → E 2 satisfying S ⊆ E 2 convex implies f −1 (S) ⊆ E 1 convex.The strong monomial map Sφ f sends x i to 0 if f (i) = • and x f (i) otherwise; it acts similarly on y i .Applying D, the monomial map (D • S)(φ f ) still sends x i to 0 if f (i) = • and x f (i) otherwise.
Going around the diagram the other way, W + φ f sends a codeword σ ∈ W + M 2 to f −1 (σ) ∈ W + M 1 .The functor R sends a morphism of codes g : C 1 → C 2 to the ring homomorphism given by sending ν ∈ RC 2 to its precomposition with g, i.e. ν • g ∈ RC 1 .Starting with a strong map φ f , let us consider the action of RW + φ f on generators of RW + M 1 : Theorem 5 (proven by Propositions 5. 13, 5.19, 5.21 and 5.22) gives us a new lens to see the neural ideal.In essence, neural codes can be seen as a relaxation of oriented matroids.The neural ideal is a generalization of the oriented matroid ideal to the less constrained category of neural codes.Further, Propositions 5.21 and 5.22 demonstrates that the duality between a neural code and its combinatorial relations is analogous to the duality between topes and circuits.In particular, in the special case when a neural code arises from an oriented matroid, the codewords correspond to topes and the elements of the canonical form correspond to circuits.Lemma 5.1, which states that the elements of the canonical form partially follow the circuit axioms, strengthens this analogy.

Open questions
The preceding sections have presented our case for employing oriented matroid theory in the study of neural codes.However, we stand at the very beginning of exploring this connection.In this section, we outline some directions for future work.
6.1.Is the missing axiom of convex neural codes also lost forever?Oriented matroids capture much of combinatorial structure of hyperplane arrangements in a few axioms.Is it possible to give a similar characterization for convex neural codes, or at least for codes which lie below oriented matroids in P Code ?While general neural codes are not required to satisfy any axioms, the codes below oriented matroids may be more tractable to combinatorial description.Question 6.1.Can the class of neural codes below oriented matroids be characterized by a set of combinatorial axioms?
The functorial view we introduced in Section 5 may be helpful in finding this characterization.If this question is answered in the affirmative, then these codes can be thought of as "partial oriented matroids."Suppose that C ⊆ 2 [n] is a code and M is an oriented matroid on ground set [N ] such that C = f (L + M); then, we obtain constraints on the set of covectors of M. Each included codeword σ ∈ C implies existence of a preimage covector in M, and each excluded codeword τ / ∈ C implies a set of forbidden covectors which may not be in M. The oriented matroids satisfying these constraints can then be said to be "completions" of the partial oriented matroid.
Just as we wish to characterize codes lying below oriented matroids with a set of combinatorial axioms, we might also wish to characterize convex codes using a set of combinatorial axioms.However, this is likely not possible.In [24], Mayhew, Newman, and Whittle show that "the missing axiom of matroid theory is lost forever."Slightly more formally, they show that there is no sentence characterizing representability in the monadic second order language M S 0 , which is strong enough to state the standard matroid axioms.Roughly, this means that there is no "combinatorial" characterization of representability, or no characterization of representability in the language of the other matroid axioms.
Because we have found strong connections between representability and convexity, it is natural to ask whether a similar statement can be proven for convex codes.Question 6.2.Is there a natural language in which we can state "combinatorial" properties of neural codes, in analogy with the M S 0 for matroids?If so, is it possible to characterize convexity in this language?6.2.Computational questions.While we have shown that the convex code decision problem is ∃R-hard, we have not actually shown that the convex code decision problem lies in ∃R, or is even algorithmically decidable.A similar problem, that of determining whether a code has a good cover realization, is undecidable by [5,Theorem 4.5].Here, the distinction between codes with good cover realizations and convex realizations may be significant.For instance, while there is an algorithm to decide whether, for any given d, a simplicial complex is the nerve of convex open subsets of R d , for each d ≥ 5, it is algorithmically undecidable whether a simplicial complex is the nerve of a good cover in R d [35].
We outline a possible path towards resolving [5, Question 4.5], which asks whether there is an algorithm which decides whether a code is convex.Our approach hinges on Theorem 2: a code is polytope convex if and only if it lies below a representable oriented matroid.A first step towards solving the convex code decision problem is answering the following open question: Question 6.3.Can every convex code be realized with convex polytopes?
In dimension two, this question has an affirmative answer, as a result, the class of planar convex codes is decidable [4].If this holds in all dimensions, then our Theorem 2 becomes strengthened to the following: Conjecture.A code C is convex if and only if C ≤ L + M for M a representable oriented matroid.
If this conjecture holds, then we can replace the problem of determining whether a code is convex with the problem of determining whether a code lies below a representable matroid.We only need to consider the set of minor-minimal matroids lying above the code, and check these matroids for representability.Question 6.4.Given a code C , is the set of minor-minimal matroids above C finite?If so, is there an efficient algorithm to enumerate them?One way to find oriented matroids above a code C is to travel step-by-step up the poset P Code .While there is a straightforward algorithm to enumerate the O(n) codes which are covered by a code C ⊆ 2 [n] in P Code [18], we do not know of a straightforward way to characterize the codes which cover C .If we can characterize these codes as well, we may be able to find a way to "climb up" towards an oriented matroid.Alternatively, we can use the "partial oriented matroid" perspective described above to obtain a set of constraints that must be obeyed by any oriented matroid above this code.Then we can look for a matroid satisfying these constraints.
Both of these approaches depend on the minimal size of the ground set of oriented matroids that lie above C in P Code .Let C below an oriented matroid Note that if H(n) is a computable function of n, and Question 6.3 is answered in the affirmative, then the convex code decision problem is decidable.6.3.Other questions in geometric combinatorics.Many classic theorems about convex sets, such as Helly's theorem, Radon's theorem, and Caratheodory's theorem, have oriented matroid analogues.In some way, we can view our Theorem 2 as an oriented matroid version of Jeffs' sunflower theorem [18,Theorem 1.1].The fact that the non-convex codes constructed from the sunflower theorem do not lie below oriented matroids shows us that there is some fact about oriented matroids underlying the sunflower theorem.Question 6.6.Is there a natural oriented matroid version of Jeffs' sunflower theorem?Proposition 3.3 stated that if M is an oriented matroid, the code L + M has no local obstructions.That is, for any σ ∈ ∆(L + M) \ L + M, link σ (∆(L + M)) is contractible.This result can also be found in [11], where is is phrased as a result about the simplicial complex ∆ acyclic (M).Something stronger holds for representable oriented matroids: by [5, Theorem 5.10], if M is a representable oriented matroid, and σ ∈ ∆(L + M)\L + M, then link σ (L + M) must be collapsible.Expanding upon this work, [22] gives stronger conditions that the link of a missing codeword in a convex code must satisfy.
If not, then the non-collapsibility of link σ (∆(L + M)) gives a new "signature" of nonrepresentability.
6.4.Functorial questions.The maps W + and L + established analogies between structures of oriented matroids and neural codes.Topes and covectors are translated into the codewords, and signed circuits are mapped to the combinatorial relations.This leads us to the following natural question: Question 6.8.Do W + and L + map other matroid features to meaningful structures associated to neural codes?In particular, do the chirotope, rank function, and convex closure function have a natural interpretation when mapped to general neural codes?This paper focused on the category of oriented matroids, since they have a well-established notion of morphisms (strong maps) and since they are extensively studied.However, there is also a notion of "affine strong maps" defined in [16] that may serve to turn affine oriented matroids into a category.This might also admit a natural functor to neural codes.Additionally, the recently defined objects COM's (which stands for both conditional oriented matroids and complexes of oriented matroids) [1] are a natural place to try to extend strong maps next.Question 6.9.Can affine oriented matroids with affine strong maps be embedded in Code?Can strong maps be defined for COM's in such a way that the resulting category can be embedded in Code?
While strong maps are more frequently used as morphisms of oriented matroids, weak maps are the next best option.Question 6.10.Can the category of oriented matroids with morphisms given by weak maps be embedded in Code?

Figure 2 .
Figure 2. (a) The covectors of an oriented matroid arising from a central hyperplane arrangement.(b) The combinatorial code of the cover given by the positive open half-spaces.

Figure 3 .
Figure 3. Example of construction from proof of Proposition 3.1

Definition 4 . 3 .
Let C ⊆ 2[n] be a neural code.The codeword containment graph of C is the graph G C whose vertices are codewords of C , with edges {σ, τ } when either σ τ or τ

a 1 ,
. . ., a n : Strips corresponding to each pseudoline of M. b , b r : Strips corresponding to two new "boundary" pseudolines whose positive quadrant includes all pseudoline intersections.c i,j for all i, j ∈ [n]: n neurons along each a i to apply order-forcing.d s,i for all s ∈ { , r}, i ∈ [n]: n neurons along b r and b to apply order-forcing.The codewords of C (M, g) are as follows: b b r d ,1 d r,1 : Intersection of the two boundary strips.b s d s,j : Order-forcing along each boundary strip (s = , r, j = 1, . . ., n.) b r a i d r,i d r,i+1 c i,1 : Intersection of each pseudoline with right boundary strip, with order-forcing neurons.(i = 1, . . ., n − 1) b r a n d r,n c n,1 : Intersection of final pseudoline with right boundary strip (one less order-forcing neuron is required.)b a n+1−i d ,i d ,i+1 c n+1−i,n : Intersection of each pseudoline with left boundary strip plus order-forcing neurons.(i = 1, . . ., n − 1.) b a 1 d ,n c 1,n : Intersection of first pseudoline with left boundary strip.a i c i,j :

Figure 6 .
Figure 6.(a) A pseudoline arrangement for the oriented matroid M. (b) A good-cover realization of the code C (M, g).Left, representative open sets are shown.Right, select codewords are labeled.(c) A pseudoline arrangement for M.

Figure 7 .
Figure 7.The pseudoline arrangement for the uniform non-Pappus matroid.The pairs of lines 23, 45, 78, 79, and 89 are taken to intersect outside of the figure..

2 ∅Figure 8 .
Figure 8. Partial realization of code C (left) and a realization of code D (right).To construct the complete realization of C , embed this figure in the plane z = 1 in R 3. For i = 1, 2, 3, 4, let the plane H i be the plane spanned by the line embedded in the plane z = 1 and the origin, and let the H 5 be the plane z = 0, oriented up.Notice that the canonical construction of a realization of D from the realization of C is not a hyperplane realization, even though D happens to be a hyperplane code.

Definition 5 . 15 .
Let M be a loopless oriented matroid.Let the oriented matroid ideal O(M) denote the ideal generated as m xy (Z) : Z tope of M , where m xy (Z) = i:Z i =+ x i i:Z i =− y i .
For each element b ∈ E, exactly one of b or −b is in every tope Z, so m Z ∈ x b , y b ; this covers improper circuits of the form {b, b}.For every proper circuit C, both sep(Z, C) and sep(Z, −C) are non-empty by tope-circuit orthogonality.In this case, there existsi ∈ C (resp, −i ∈ C) such that i / ∈ Z (−i / ∈ Z); this means that x i | m Z for i ∈ C which implies m Z ∈ P C .Since m Z ∈ P Cfor all types of circuits, it is also in the intersection.In the reverse direction, we show that for any monomial m in C P C , there is a tope Z such that m xy (±[n] \ Z) | m.For all elements j ∈ E, either x j | m or y j | m; so there exist disjoint sets I, J such that [n] = I ∪ J andm I,J = i∈I x i j∈J y j | m.We claim that Z = I ∪ J is a tope of M. It is enough to show that every circuit C ∈ C(M) is orthogonal to Z.The fact that m I,J ∈ P C and m I,J ∈ P −C means that both sep(Z, C) and sep(Z, −C) are nonempty, implying orthogonality.

Proposition 5 . 18 .
The affine oriented matroid ideal O g (M) can be obtained via the following ideal quotient and specializationO g (M) = [O(M) : O(M \ g)] xg=1 yg=0 ⊆ k[x 1 , . . ., x n , y 1 , . . ., y n ].Proof.By Definition 5.14,O(M) = C∈C(M) | m • m xy (A).Suppose m • m xy (A) ∈ y g .Then y g | m since m xy (A) is defined on the deletion by g; this implies that m ∈ y g .Suppose instead that m • m xy (A) ∈ O g (M).This implies that there is a covector Z of M with Z g = − such that m (g) xy (Z) | m•m xy (A).By [2, Prop 3.8.2(b)],this implies that the support of m is a covector of the matroid.Since y g m xy (A), the support of m must include y g , implying that its support is a covector B of M with B g = −.This implies m ∈ O g (M).We conclude that ( y g + O g (M)) : O(M \ g) = y g + O g (M).Specializing y g = 0 leaves us with O g (M).

Definition 5 . 20 .
Let S M be an oriented matroid ring.Define DS M to be the ring S

Proposition 5 . 21 .
The map D is a functor OMRing to NRing.Proof.We first show D maps an oriented matroid ring to a neural ring.Denote S = F 2 [x, y] and D = x i + y i − 1 | i ∈ [n] ⊆ S. Let D denote the ideal with the same generators as D, but considered as an ideal of S M , i.e.DS M = S M / D, and let S = O(M) + D ⊆ S. We apply standard isomorphism theorems to conclude DS M = S M / D ∼ = S/S ∼ = (S/D)/(S /D).

minC
≤L + (M)|E(M)|be the smallest N such that any code C on n neurons which lies below an oriented matroid lies below an oriented matroid with ground set of size at most N .Similarly, letH(n) = max C ⊆2 [n]smallest N such that any code C on n neurons below a representable oriented matroid lies below a representable oriented matroid with ground set of size at most N .Clearly, M (n) ≤ H(n), since any representable matroid is a matroid.Question 6.5.Describe the growth of M (n) and H(n) as functions of n.Are they equal?