Towards rigorous understanding of neural networks via semantics-preserving transformations

In this paper, we present an algebraic approach to the precise and global verification and explanation of Rectifier Neural Networks, a subclass of Piece-wise Linear Neural Networks (PLNNs), i.e., networks that semantically represent piece-wise affine functions. Key to our approach is the symbolic execution of these networks that allows the construction of semantically equivalent Typed Affine Decision Structures (TADS). Due to their deterministic and sequential nature, TADS can, similarly to decision trees, be considered as white-box models and therefore as precise solutions to the model and outcome explanation problem. TADS are linear algebras, which allows one to elegantly compare Rectifier Networks for equivalence or similarity, both with precise diagnostic information in case of failure, and to characterize their classification potential by precisely characterizing the set of inputs that are specifically classified, or the set of inputs where two network-based classifiers differ. All phenomena are illustrated along a detailed discussion of a minimal, illustrative example: the continuous XOR function.


Introduction
Neural networks are perhaps today's most important machine learning models, with exciting results, e.g., in image recognition [SZ14], speech recognition [CSW + 18, BMR + 20] and even in highly complex games [VBC + 19, BBC + 19, SSS + 17].As the name suggests, neural networks are learned from data using efficient, but approximate training algorithms [Rud16, KB14].At their core, neural networks are (dataflow-oriented) computation graphs [GBC16].They consist of many computation units, called neurons, that are arranged in layers such that computations in each layer can be performed in parallel, with successive layers only depending on the preceding layer.Modern neural networks, in practice, possess up to multiple billions of parameters [BMR + 20] and leverage parallel hardware such as GPUs to perform computations of this scale [OJ04].This highly quantitative approach is responsible for exciting success stories, but also for their main weakness: Neural network behavior is often chaotic and hard to comprehend for a human.Perhaps most infamously, a neural network's prediction can change drastically under imperceptible changes to its input, so-called adversarial examples [MMS + 17, GSS14, SZS + 13].
The explainability of neural networks, which are computationally considered as black-boxes due to their highly parallel and non-linear nature, is therefore one of the current core challenges in AI research [DSB17].The fact that neural networks are increasingly used in safetycritical systems such as self-driving cars [BGC + 21] turns trustworthiness of machine learning into a must [DSB17].However, state-of-the-art explanation technology is more about reassuring intuition, e.g., to support cooperative work of humans with AI systems, such as in the field of medical diagnostics [TG20], than about precise explanation or guarantees [LPK21].Moreover, current approaches to Neural Network verification are still in their infancy in that they are not yet sufficiently tailored to the nature of Neural Networks to achieve the required scalability or to provide diagnostic information beyond individual witness traces in cases where the verification attempts fail (cf., [BLJ21, KBD + 17, WZX + 21] and Section 8 for a more detailed discussion).
In this paper, we present an algebraic approach to the verification and explanation of Rectifier Neural Networks (PLNN), a very popular subclass of neural networks that semantically represent piece-wise affine functions (PAF) [MPCB14].Key to our approach are Typed Affine Decision Structures (TADS) that concisely represent PAF in a white-box fashion that is as accessible to human understanding as decision trees.TADS can nicely be derived from PLNNs via symbolic execution [Cla76,Kin76], or, alternatively, compositionally along the PLNN's layering structure, and their algebraic structure allows for elegant solutions to verification and explanation tasks: -TADS can be used for PLNNs similarly as Algebraic Decision Diagrams (ADDs) have been used for Random Forests in [GS21] to elegantly provide model and outcome explanations as well as class characterizations.-Using the algebraic operations of TADS one can not only decide the equivalence problem, i.e., whether two PLNNs are semantically equivalent, but also whether they are -similar, i.e., never differ more than .In both cases, diagnostic information in terms of a corresponding 'difference' TADS is provided that precisely specifies where one of these properties is violated.-TADS comprise non-continuous piece-wise linear operations which cannot be represented by PLNNs.This is necessary to not only deal with regression tasks, where one aims at approximating continuous functions, but also with classification tasks with discrete output domains. 1 In the latter case, TADSbased class characterization allows one to precisely characterize the set of inputs that are classified as members of a given class, or the set of inputs where two (PLNN-based) classifiers differ.-Finally, TADS can also profitably be used for the verification of preconditions and postconditions, the illustration of which is beyond the scope of this paper, but will be discussed in [NSMB23] in the setting of digit recognition.
The paper illustrates the essential features of TADS using a minimal, illustrative example: the continuous XOR function.The simplicity of XOR is ideally suited to provide an intuitive entry into the presented theory.A more comprehensive example is presented in [NSMB23], where digit recognition based on the MNIST data base is considered.In this highly dimensional setting, specific scalability measures are required to apply our TADS technology.
After specifying the details of our running example in Section 2, Section 3 sketches Algebraic Decision Structures that later on will be instantiated with Affine Functions recalled in Section 4 to introduce the central notion of this paper, Typed Affine Decision Structures (TADS).Semantically, TADS represent piece-wise affine functions, which marks them as a fitting representation for Rectifier Networks that represent continuous piece-wise affine functions2 and that are discussed in Section 5. Our main contribution is the derivation of TADS, using both symbolic execution and compositionality along the layering structure of PLNN, as a complete and precise model explanation of PLNNs.We introduce TADS in Section 6 and state important algebraic properties that allow the manipulations mentioned beforehand.Subsequently, Section 7 illustrates the impact on verification and explanation of the algebraic properties of TADS that are also established in Section 6 along the running example.The paper closes after a discussion of related work in Section 8 with conclusions and direction to future work in Section 9.

Running Example -XOR
As a running example throughout this paper, we discuss the XOR function under the perspective of a regression task and a classification task, as specified below.We chose the XOR problem for illustration for two reasons: -The XOR problem concerns a two-dimensional function which can be visualized as a function plot.-While simple, the XOR problem has been a roadblock in early AI research because it cannot be solved by linear approaches [MP69].Therefore, it is a minimal problem that still requires a more powerful non-linear model such as a PLNN.For the following formalizations, let us fix some basic notation: The set of natural numbers (including zero) is denoted N and the set of real numbers R. Unions and intersections of sets are defined as usual.The cartesian product of two sets is defined as A sequence of cartesian products over the same set may be abbreviated as   ( ≥ 0), where and the Kleene star operator is defined as Moreover, intervals of R are of the form [, ] for ,  ∈ R with  ≤  and denote the set of all real values between  and .
As a regression task, the XOR problem is stated as follows: Definition 2.1 (XOR Regression).Find a piece-wise affine function  : [0, 1] 2 → [0, 1] that is continuous and satisfies: (0, 0) ≈ 0 ≈  (1, 1) and  (1, 0) ≈ 1 ≈  (0, 1) Thus, a learning algorithm is tasked with approximating a continuous version of an XOR gate, interpolating between the four edge points for which the XOR function is defined. 3 When posing the XOR problem as a classification task, the XOR function can be regarded as a function with discrete binary output 1 or 0 but with a continuous domain R 2 . 3The restriction to the interval [0, 1] is meant to ease the exposition.

Definition 2.2 (XOR Classification).
Find a piece-wise affine function  : [0, 1] 2 → {0, 1} such that: As the XOR-problem requires fixed values only at four points, there exist infinitely many solutions.This is typical for machine learning problems where only some few points are fixed and others are left for the machine learning model to freely interpolate.Different machine learning models have different principles that dictate this interpolation.For example, concerning PLNNs, the interpolation is (piece-wise) linear.
In line with the principle of Occam's razor [Sob15], humans4 would optimally solve the XOR-regression problem with a function as simple as: A visualisation of  * can be found in Figure 1.Similarly, a human would probably choose the following corresponding straightforward extension to the classification problem: An illustration of  * can be found in Figure 2. It is straightforward to check that these functions solve the XOR-regression and XOR-classification problems optimally in the sense that they match the traditional XOR function at all points where it is defined.
The continuous XOR problems will serve as running examples throughout this work: We will demonstrate different representations of piece-wise linear functions (such as  * ) and transformations between them along the development of our theory, and showcase differences between the manually constructed solutions to the regression and classification tasks and their learned counterparts in Section 7.

Algebraic Decision Structures
In order to prepare the algebraic treatment of decision structures, we focus on decision structures whose leafs are labeled with the elements of an algebra  = (A, ), so-called Algebraic Decision Structures (ADDs).This subsumes the classical case where leafs of decision structures are elements of a set, as these are simply algebras where  is empty.In this section we summarize the definitions and theorems of [GS21], which are required later in this paper. 5

Definition 3.1 (Algebraic Structures).
An algebraic structure, or algebra for short, is a pair (A, ) of a carrier set A and a set of operations .Operations op ∈  have a fixed arity and are closed under A.
In the following, the algebra is identified with its carrier set and both are written calligraphically.

Definition 3.2 (Algebraic Decision Tree).
An Algebraic Decision Tree (ADT) over the algebra  and the predicates P6 is inductively defined by the following BNF: ADTs are (directed) trees where for a node ( , , ) the root is given by  and the left and right children by  and , respectively.ADTs of the form  are leafs with no children and  denotes the empty tree.We can merge nodes in these ADTs, which leads to the more general Algebraic Decision Structures (ADS):

Definition 3.3 (Node Merging).
Let  be an ADT and  1 and  2 be two nodes in  such that  2 is not reachable from  1 .Then, the two-step transformation of  -re-route the incoming edges of  2 to  1 and -eliminate all unreachable nodes of .
Node merges aggregate subtrees in a manner that does not create directed cycles.Later, we will define semantics preserving merges.

Definition 3.4 (Algebraic Decision Structure).
A rooted directed acyclic graph (DAG) that results from an ADT by a series of node merges is called an Algebraic Decision Structure (ADS).Let S  denote the set of all such ADSs over an algebra .
We can define their semantics inductively.

Definition 3.5 (Decision Structure Semantics).
For a set Σ of valuations the semantic function for ADSs is inductively defined as ADS can be considered the universe in which we operate, typically using semantics-preserving transformations.In particular, we will frequently apply semantic reduction and infeasible path reduction as discussed in the next two subsections.These two operations reduce the representational overhead of ADS while preserving their semantics.

Semantic Reduction
Semantic functions naturally induce an equivalence relation: Definition 3.6 (Semantic Equivalence).Two ADSs  1 and  2 are semantically equivalent iff their semantic functions coincide The following theorem states that one of two different nodes of an ADS that are semantically equivalent is redundant: Theorem 3.7 (Semantic Reduction).
Let  be an ADS with two nodes  1 and  2 that are semantically equivalent, i.e.,  1 ∼  2 , and such that  2 is not reachable from  1 .Moreover, let  3 be the  2 into  1 merge of .Then  and  3 are semantically equivalent, i.e.,  ∼  3 .
Our implementation heuristically reduces the number of semantically equivalent nodes of the ADSs.However, in contrast to Algebraic Decision Diagrams [BFG + 97], which are known for their normal forms, we cannot guarantee canonicity here.

Vacuity Reduction
Typically, there are dependencies between different predicates in P, which induces so-called infeasible paths in the corresponding ADSs.This can be exploited for further reducing ADSs by eliminating so-called vacuous predicates: Definition 3.8 (Vacuity).Let P be the set of negated predicates of P. Then we call  =  0 • • •   ∈ (P ∪ P) * a predicate path.
- is called a predicate path of a decision structure  ∈ S  iff there exists a path  =  0 This allows us to define the following optimization step.

Definition 3.9 (Vacuity Reduction).
Let  ∈ S  be a decision structure with a vacuous node  and final() ∈ P ∪ P be the last predicate of some predicate path  ending in .Then, re-routing all incoming edges of  to the 'true'-successor of  in case of final() ∈ P and to the 'false'-successor otherwise is called a vacuity reduction step.
ADSs, being DAGs, only have finitely many predicate paths which can be effectively analysed for vacuous predicates, as long as the individual predicates are decidable.
As the elimination of vacuous predicates is a simple semantics-preserving transformation, we have:

Theorem 3.10 (Minimality).
Every ADS can be effectively transformed into a semantically equivalent, vacuity-free ADS that is minimal in the sense that any further reduction would change its semantics.
In the remainder of the paper, we will not explicitly discuss the effects of semantic reduction and vacuity reduction.
Rather, we will concentrate on the algebraic properties of ADS that they inherit from their leaf algebra via lifting.

Lifting
It is well-known that algebraic structures  = (A, ) can point-wise be lifted to cartesian products and arbitrary function spaces  → .This has successfully been exploited for Binary Decision Diagrams (BDDs) and Algebraic Decision Diagrams (ADDs) that canonically represent functions of type B  → B and B  → A respectively.In fact, the canonicity of these representations allows one to identify the BDD/ADD representations directly with their semantics, which in particular reduces the verification of semantic equivalence to checking for isomorphism.
In our case, canonicity is unrealistic for two reasons (cf., Section 6.1): 1. Considering predicates rather than Boolean values introduces infeasibility and thereby prohibits minimal canonical representations.
2. The ordering of predicates may lead to an exponential explosion of the representation.Please note that, in contrast to, e.g., the typical BDD setting, we do not have just a few (64, 128, 256,. . .or the like) input bits that specify the control of some circuit, but predicates capture the effect of the ReLU function in a history-dependent way; Predicates that result from computations in a later layer depend on predicates from earlier layers.Moreover, as predicates are continuous objects, the probability of them coinciding can be considered 0. Thus, ordering predicates would typically lead to representations that are doubly exponential in the number of neurons of a neural network.
We will see, however, that all the algebraic properties we need also hold for unordered ADSs, and that we can conveniently compute on (arbitrary) representatives of the partition defined by semantic equivalence.This way, we arrive at an exponential worst-case complexity (in the size of the argument PLNNs) both, for the algebraic operations and the decision of semantic equivalence.Although ADSs are not canonical one can effectively apply operators on concrete representatives while preserving semantics.Every operator can be lifted inductively as follows Definition 3.11 (Lifted Operators).For every operator : A 2 → A of an algebra  = (A, ) we define the lifted operator : S  2 → S  that operates over ADS inductively as where ,  ∈ A are ADS identified with an element of the algebra, , ,  ∈ S  are ADS, and  ∈ P is a predicate.
Intuitively, for two ADS  1 and  2 , this construction replaces leaves in  1 with copies of  2 .Thus, each path of the resulting ADS  3 expresses a conjunction of one path in  1 and one path in  2 .The partition of the domain imposed by all paths of  2 therefore coincides with the intersection imposed by the intersection of partitions imposed by  1 and  2 .The required lifting of the operators to leaf nodes is straightforward (cf., Figure 4 for illustration).
The following theorem which states the correctness of the lifted operators can straightforwardly be proved by induction: Theorem 3.12 (Correctness of Lifted Operators).Let  1 ,  2 ∈ S  be two ADS over some algebra  = (A, ).Let : S  2 → S  denote the lifted version of the operator ∈ .Then the following equation holds for all  ∈ Σ: 2 S  ()

Abstraction
Abstraction is one of the most powerful means for achieving scalability.The following easy to prove theorem concerns the interplay of abstractions imposed by a homomorphism of the leaf algebra and their effect on some classification function.Theorem 3.13 (Abstraction).
Let  = (A, ) and  = (A ,  ) be two algebras, and  :  →  a homomorphism.Then   : S  → S  defined by simply applying  to all the leaves of the argument ADS completes the following commutative diagram:

𝛼
We will see in Section 7 how elegantly abstraction can be dealt with in the TADS setting: The abstraction that transforms the XOR regression setting into a classification setting can be easily realized via the TADS composition operator.

Affine Functions
The following notations of linear algebra are based on the book [Axl97].The real vector space (R  , +, •) with  > 0 is an algebraic structure with the operations A real vector ( 1 , . . .,   ) of R  is abbreviated as ì .To refer to one of the components, we write ì   :=   (note the arrow ends before the subscript in contrast to ì   , which denotes the -th vector).The dimension of a real vector space R  is given as dim R  = .
A matrix  is a collection of real values arranged in a rectangular array with  rows and  columns.To indicate the number of rows and columns, one says  has type  ×  also notated as  ∈ R × .An element at position ,  of the matrix  is denoted by  ,  :=  ,  (where 1 ≤  ≤  and 1 ≤  ≤ ).A matrix  ∈ R × can be reflected along the main diagonal resulting in the transpose  ᵀ of shape  ×  defined by the equation The -th row of  can be regarded as a 1 ×  matrix given by  , • := ( ,1 , . . .,  , ).
Similarly, the -th column of  can be regarded as a  × 1 matrix defined as The -th unit vector ì e  is a vector where all entries are zero except the -th which is one.

Definition 4.1 (Affine Function).
A function  : R  → R  is called affine iff it can be written as for some matrix  ∈ R × and vector  ∈ R  . 7e identify the semantics and syntax of affine functions with the pair (, ì ), which can be considered as a canonical representation of affine functions.Furthermore, we denote the set of all affine functions R  → R  as Φ(, ) and call (, ) the type of Φ(, ).The untyped version Φ is meant to refer to the set of all affine functions, independently of their type.

Lemma 4.2 (Operations on Affine Functions).
Let  1 ,  2 be two affine functions in canonical form, i.e., Assuming matching types, the operations + (addition), • (scalar multiplication), and • (function application) can be calculated on the representation as resulting again in an affine function in canonical representation.
It is well-known that the type resulting from function composition evolves as follows The type of the operation is important for the closure axiom, the basis for most algebraic structures.This leads to the following well-known theorem [Axl97]: Denoting, as usual, scalar multiplication with • and function composition with •, we have: -(Φ(, ), +, •) forms a vector space and -(Φ(, ), •) forms a monoid.
This theorem can straightforwardly be lifted to untyped Φ by simply restricting all operations to the cases where they are well-typed, i.e., where addition is restricted to functions of the same type (+  ), and function composition to situation where the output type of the first function matches the input type of the second (•  ):
Piece-wise affine functions are usually defined over a polyhedral partitioning of the pre-image space [Bro83, GZB94, Ovc10].

Definition 4.5 (Halfspace).
Let ì  ∈ R  and  ∈ R. Then the set A hyperplane partitions R  into two convex subspaces, called halfspaces.The positive and negative halfspaces of  are defined as

(Polyhedron).
A polyhedron  ⊆ R  is the intersection of  halfspaces for some natural number .

(Piece-wise Affine Function).
A function  : R  → R  is called piece-wise affine if it can be written as where  = {  1 , . . .,   } is a set of polyhedra that partitions the space of ì  and  1 , . . .,   are some affine functions.We call The proof of the following property is straightforward:

(Continuity).
A piece-wise affine function is continuous iff at each border between two connected polyhedra the affine functions associated with either polygon agree.

The Activation Function ReLU
In this paper, we focus on neural network architectures that use the ReLU activation function: Definition 4.9 (ReLU).The Rectified Linear Unit (ReLU) The term max{ 0,   } is continuous and piece-wise linear.As ReLU operates independently on all dimensions of its input, it is itself piece-wise linear.
From a practical perspective, ReLU is one of the best understood activation functions, and the corresponding rectifier networks are one of the most popular modern neural network architectures [GBB11].
For ease of notation in later sections, we use the fact that ReLU operates on each component of a vector independently, and can therefore be decomposed into where    : R  → R  is the partial ReLU function defined by setting the -th component of a vector ì  to 0 iff   < 0.More formally,

Piece-wise Linear Neural Network
Piece-wise linear neural networks are specific representations of continuous piece-wise affine functions.Calling them piece-wise linear is formally incorrect (the term piece-wise affine would be correct), but established.For the ease of exposition, we restrict the following development to the case where all activation functions are partial ReLU functions.This suffices to capture the entire class of Rectifier Networks, which themselves can represent all piece-wise affine functions [HLXZ18].We adopt the popular naming in the following definition:

N (𝑛, 𝑚)
This definition of a PLNN slightly flexibilizes the classical definition as it does not require the strict alternation of affine functions and activation functions and uses partial ReLU functions instead of ReLU.We will exploit this flexibility to directly have the right granularity for defining according operational semantics (cf., Section 5.2).

Example 5.2 (Representing XOR as PLNN).
As stated in Section 2, our baseline solution to the XOR regression model is defined by the function | − |.We can represent this function as a PLNN  * .It consists of two affine functions and two partial ReLUs applied in this order: Note that typically  * would be defined as in the context of machine learning.However, as both definitions impose the same semantics we defined it directly using the notational conventions of this paper.This construction uses the observation that .
The following figure shows the (instantiated) corresponding network architecture: This example shows that PLNNs can encode our baseline solution to the XOR problem.However, it is important to note that PLNNs are not usually manually defined, but rather trained to approximate a function using approximate learning algorithms [GBC16], see also Section 7.

Semantics of PLNNs
PLNNs come with a very natural denotational semantics: The denotational semantics of PLNNs is inductively defined as the composition of all functions in a PLNN: where  ∈ {, }.
Remark: In this definition we overload  to represent both its corresponding syntactic artifact (e.g., a matrix) and its semantic artifact (e.g., the corresponding affine function or partial ReLU function, respectively).In the remainder of the paper it should always be clear from the context which interpretation we refer to.PLNNs can also be evaluated in an operational manner based on derivation rules which closely resemble their process of computation.For that we define the defect matrix    (1 ≤  ≤ ) as the identity matrix   where the -th entry on the main diagonal, i.e., element (, ), is set to zero.

Definition 5.4 (Operational Semantics).
The operational semantics of PLNNs is defined via the following three rules that operate on configurations , ì  consisting of the remainder  of the PLNN to process and the current intermediate result vector ì .
Affine  is affine

𝑥
The labels (the symbols above the arrow) provide a history of which rule was applied.It is easy to see that the rule to be applied next is always uniquely determined by the first component (the PLNN) which guarantees that the operational semantics is deterministic.In fact, for each input there exists a unique computation path.Thus, the following definition is well-defined: The semantic functional for the operational semantics is defined as Note that these rules stand in close correspondence to the denotational semantics of PLNNs with each rule describing the evaluation of one of its constituent functions.In fact, we have: For any  ∈ N we have  DS =  OS .

Proof.
The proof follows straightforwardly by induction on the number of layers of a PLNN.It suffices to show that the affine rule corresponds to the application of the affine function  and that the executions of the adequate rules ReLU 1 and ReLU 2 correctly cover the partial ReLU activation functions.
Thus, the operational semantics • OS provides a constructive, local, and correct semantic interpretation of PLNNs.
We consider the baseline solution to the XOR regression model defined by the function | −|.The network  * implements this function as a PLNN.We calculate  * OS by applying the SOS rules to the initial configuration  * , (1, 0) ᵀ .
This is the correct outcome.Note that the SOS rules correspond to an iterative processing of each component function (i.e., layer) of the neural network, much like function composition.
Next, we will naturally adapt the presented rules to symbolic execution, which by itself provides the first outcome explanation of PLNNs.

Symbolic Execution of PLNNs
Symbolic execution aims at characterizing program states in terms of symbolic input values and corresponding path conditions.In particular, it reveals how program states depend on the initial values during execution.PLNNs are ideally suited for symbolic execution as they are acyclic computation graphs and contain only affine computations.
-Affine functions are closed under composition.This allows one to aggregate (partially evaluate) the entire symbolic computation history corresponding to some symbolic execution path in terms of a single affine function, and to express all paths conditions as affine inequalities, also expressed in terms of the initial values.-PLNNs possess finite, acyclic computation graphs, which conceptually allow for precise execution without need for abstractions.
In Section 6, we will see that this results in a directed, acyclic, side-effect-free computation graph whose leaves are affine function in Φ(, ) that express the PLNN's effect on inputs belonging to the polyhedron specified by the path condition.We define the required symbolic execution via derivation rules that transform configurations of the form , ,  , where - ∈ N (, ), - : R  → R  with representation ( ì ) =  ì  + ì , -and  is a path condition throughout the transformation.The dimensions of  and  are bound by the initial PLNN while  is the dimension of some hidden layer.The following definition operates on the concrete representations of , , and .In the case of the last two, the representation is expected to be canonical and therefore syntax and semantics can be identified. 8perations are expected to be applied directly to the representation.Thus, the effect of a concrete execution path of • OS is aggregated (instead of simply recorded) into the components  and , while  is destructed further and further until all layers have been considered.

Definition 5.8 (Symbolic Execution of PLNNs).
; , , For a sequence Intuitively, the first identity states that derivations with the same prefix in the first component result in the same configuration after the prefix was completely processed.
The second states the effect of other starting values in the initial configuration.Note that this relation does not hold in the reversed case, as • and ∧ are not injective and the configuration is only determined up to isomorphism.The last identity corresponds to the result that − ⇀ of Definition 5.4 is uniquely determined.As the symbolic rules are more general, the result is restricted to the case where the word  is known.
Moreover, the path conditions induce a partition of the input space R  .Lemma 5.10 (Partition of ).For an arbitrary but fixed  ∈ N define the set of all derivations with depth  as Define the set of all path conditions of the same   as Π  , then -each  ∈ Π  defines a polyhedron for  > 0 -the polyhedra of Π  are a partition of R  .

Proof.
Induction over derivation sequences of .
Specifically, for each input vector ì  ∈ R  , there exists exactly one sequence of derivations , id, tt  − ⇀ SOS , ,  such that ( ì ) holds.Therefore, the following is well-defined: Definition 5.11 (Semantic Functional • SOS ).The semantic functional for the symbolic operational semantics Also the symbolic operational semantics is fully aligned with the denotational semantics: Theorem 5.12 (Correctness of • SOS ).
For any  ∈ N we have:  DS =  SOS .

Proof.
According to Theorem 5.12, it suffices to show the semantic equivalence with • OS .As both the concrete and the symbolic operational semantics define unique computation paths for each input vector, the proof follows straightforwardly by an inductive proof that establishes the desired equivalence as an invariant when simultaneously following these paths.More concretely, we can prove ∀ì  ∈ R  :  OS ( ì ) =  SOS ( ì ) using the following induction hypothesis by a simple analysis of the following three cases: The symbolic operational semantics of PLNNs is sufficient to derive local explanations and decision boundaries similar to the ones presented in [CHH + 18, GWZ + 18].In the following, we will show how symbolic operational semantics can be used to define semantically equivalent Typed Affine Decisions Structures (TADS), which themselves are specific Algebraic Decision Structures (ADS), as defined in the next section.TADS collect all the local explanations in an efficient query structure such that we arrive at model explanations.

Example 5.13 (XOR-Regression).
As a brief example for the symbolic execution of PLNNs, we will calculate  * SOS by applying the symbolic SOS rules to the initial configuration  * , id, tt .Symbolic interpretation is not deterministic for the partial ReLU functions.We therefore chose the execution path that corresponds to the former example ì  = (1, 0) ᵀ , i.e., with the label sequence  = (tt, 1, 0, tt), for illustration: Note that the path conditions and the affine functions have been simplified in every step.The affine functions are given in their canonical representation  ì  + ì  (as ì  is zero in all steps it is omitted).For the path conditions we have not fixed a representation, instead they are simplified to aid readability.The most important simplifications are 6 Typed Affine Decision Structures Consider the transition system (, − ⇀ SOS ) that represents the symbolic operational semantics • SOS of some  ∈ N (, ) where is the set of configurations which are reachable from , id, tt and let (recall Definitions 3.4 and 4.1) denote the following inductively defined transformation that closely follows the symbolic SOS rules: -( , , where " • " should be considered a don't care entry.Identifying  with its computation tree, which is specified by its set of configurations that are reachable from , id, tt , 9  can be regarded as an injective relabeling of this tree, which results in the structure of an ADT: Theorem 6.1 (TADT).Let  ∈ N (, ).Then () is an ADT over Φ(, ) whose predicates are all of the form of affine inequalities.

Proof.
The proof follows by straightforward induction along the isomorphic structure of the two trees.The following invariants hold for all steps of the transformation where we abbreviate  = , ,  ,   =  ,  ,  ∧  , and   =  ,  , ¬ ∧  We call the structures resulting from -transformation Typed Affine Decision Trees (TADT).A TADT inherits the type from its underlying algebra of typed affine functions Φ(, ) (cf., Lemma 4.2 and Theorem 4.4).Similar to ADTs, TADT can also be generalized to acyclic graph structures: Definition 6.2 (Typed Affine Decision Structure).An ADS over the algebra (Φ(, ), +  , •, •  ) where all predicates are linear inequalities in R  is called Typed Affine Decision Structure of type  × .
The set of all such decision structures is denoted by Θ(, ), and the set of all typed affine decision structures of any type with: 9 Please note that the transition labels tt, 1, and 0 are redundant.
TADS are special kinds of ADS.Thus, they inherit the ADS semantics (cf., Definition 3.5) when specializing Σ to R  and  to ì .The fact that the semantics of leafs is given by affine functions that are also applied to ì  is not important for the resulting specialized definition which reads: Definition 6.3 (Semantics of TADS).The semantic function for TADS is inductively defined as Every PLNN  defines an ADT   over Φ.We can therefore apply the results of Section 3. In particular, we can apply the various reduction techniques, which transform   into the more general form of an ADS, or more precisely, of a TADS.Optimizations in terms of semantic reduction and infeasible path elimination do not alter the semantics of a (T)ADS.In other words is closed under semantic reduction and infeasible path elimination.Moreover, we have: Theorem 6.4 (Correctness of  Θ ).Let  ∈ N and  ∈ Θ().Then we have: In the following, we sometimes abuse notation and also write () for other members of  ∈ Θ() when the concrete structure of the TADS does not matter.This concerns, in particular, Section 7 where we always apply semantic reduction and infeasible path elimination to reduce size.Following [GMR + 18]: In the state of the art a small set of existing interpretable models is recognized: decision tree, rules, linear models [. ..].These models are considered easily understandable and interpretable for humans.([GMR + 18]) we have: Corollary 6.5 (Model Explanation).TADS provide precise solutions to the model explanation problem, and therefore also to the outcome explanation problem.Please note that outcome explanation is easily derived from model explanation simply by following the respective evaluation path.

Example 6.6 (XOR-TADS).
As an example, the resulting TADS of the symbolic execution ADS of  * is shown in Figure 3.

The TADS Linear Algebra
According to Theorem 4.4, (Φ, +  , •  ) forms a typed algebra.Moreover, due to the canonical representation of affine functions, Φ also supports the equality relation =.Applying Theorem 3.12, all these operations can be lifted to obtain the following corresponding operations on TADS: 1. ⊕ : Θ(, ) × Θ(, ) → Θ(, ) An example of addition is given in Figure 4.
We will exploit this theorem in Section 7.
However, when lifting these two operators over affine predicates, a second interpretation occurs naturally: that of piece-wise affine functions.Both interpretations are compatible, as stated in the following lemma.

Theorem 6.8 (Two Consistent Views on TADS).
Let  1 ,  2 : R  → R  be two piece-wise affine functions and ì  ∈ R  be a real vector.Define  1 as the affine function of  1 that is associated with the region for ì  and  2 for  2 , respectively and denote with a generic operation over (piece-wise) affine functions.Then, if for all such ì holds both interpretations agree for .
One can easily show that this is indeed the case for ∈ { ⊕, , }.However, there is a slight difference in the interpretations.The first lifts affine functions over affine predicates and the latter associates affine functions with affine predicates.This distinction can, for example, be seen in the signature of the respective semantics: For TADS to be equivalent to piece-wise affine functions, the semantics have to be adapted to • Θ , which slightly differs from • S  in that the leafs are also evaluated under the input.Considering Lemma 5.10, one can easily see that every path in a TADS defines a polyhedron and that the set of all paths partitions R  .As all terminals of TADS are affine functions, it is straightforward to prove that for every TADS  the semantics  Θ is a piece-wise affine function.
The complexity of piece-wise affine functions is commonly defined as the smallest number of classes (socalled regions) that are needed to partition the input space [MPCB14, PMB13, HR19a], and which we call region complexity.This complexity measure can easily be adopted for TADS using the above reasoning, as it is simply the number of all paths from the root to its terminals.In other words, TADS are linear-size representations of PAF with respect to their region complexity, which implies: Theorem 6.9 (Complexity of Operations).The operations ⊕, , are of quadratic and of linear time region complexity.

Proof.
Via structural induction along Definition 3.11 it is easy to establish that each node of the tree underlying  1 is processed at most once, while the nodes of the tree underlying  2 may be processed at most once for each leaf of  1 .The theorem follows from the fact that the number of nodes in a binary tree is at most twice the number of its paths.Interesting is the expression  1  2 which evaluates to the constant function 0 iff  1 and  2 are semantically equivalent.Thus, we have the following: Corollary 6.10 (Complexity of ≡).
Deciding semantic equivalence between two TADS has quadratic time region complexity.
Please note that this way of deciding semantic equivalence does not only provide a Yes/No answer, but, in case of failure, also precise diagnostic information: For  2 −  1 we have (see Figure 11) -positive parts mark regions where  2 is bigger -zero marks regions where both TADS agree -negative parts mark regions where  1 is bigger This is particularly interesting when combined with a threshold  (see Figure 13).

The TADS Typed Monoid
As shown in previous sections, TADS are a comprehensible and efficient representation of piece-wise affine functions.In the following, we will go even further and show that TADS also directly support all common operations on piece-wise affine functions.Piece-wise affine functions form a typed monoid under function composition, i.e., the composition of two piece-wise affine functions is again piece-wise affine, assuming that domain and co-domain adequately match.This property is highly useful both for the design of neural networks (which are themselves fundamentally compositions of multiple, simple piece-wise affine functions) and neural network analysis, as will be shown in Section 7.
Consider the following result, which follows as a consequence of the previous correctness theorems and the compositionality of • DS : Corollary 6.11 (Compositionality).Let  0 ,  1 ,  2 ∈ N with  0 =  1 ;  2 and   ∈ Θ(  ).Then we have: Obviously, there is a gap in the result that poses the question: "Is it possible to define composition operator that directly works on TADS?" Just composing the affine functions at the leafs, which would be sufficient to, e.g., for ⊕, is insufficient because of the side effect of the first TADS.Thus, we end up with the following composition operator that handles this side effect in a way that is typical for structured operational semantics: Definition 6.12 (TADS Composition).
The composition operator of TADS with type is inductively defined as where ,  ∈ Φ are TADS identified with their affine function, , ,  ∈ Θ are TADS, and  ∈ P is a predicate.
Here  •  with  =  ()  ≥ 0 is defined as Notice that this definition is similar to the lifted operators of Definition 3.11.However, TADS composition is not side-effect free as can be seen by the modification of the predicate in the second case.This is due to the fact that the first TADS distorts the input vector space of the second TADS.Again, let us formalize the correctness of this operation.

Theorem 6.13 (TADS Composition).
Let  1 ∈ Θ(, ) and  2 ∈ Θ(, ).Then we have: Structural induction along the second component and in the inductive step induction along the first component.
An example of a composition can be found in Figure 5.This directly yields: Corollary 6.14 (The TADS typed Monoid).
The pair (Θ, ) forms a typed monoid, i.e., an algebraic structure that is closed under type-correct composition and that has typed neutral elements .
On this structure  is a homomorphism between the monoids (Θ, ) and (, ; ), i.e., the following diagram commutes Due to their similarity to the lifted operators, it is easy to show that composing to TADS results in a third TADS that has size complexity equal to product of its inputs and whose complexity with respect to the measure of affine regions is quadratic in its inputs.Following the same line of reasoning as for Theorem 6.9 yields:

Theorem 6.15 (Complexity of Composition).
TADS compositions has quadratic time region complexity.
One may argue that semantic equivalence between two TADS is of limited practical value, in particular, as in most applications of neural networks, small errors are, to a certain degree accepted.In contrast, -similarity, i.e., whether two TADS differ more than  for some small threshold  ∈ R, can be regarded as a practically very relevant notion, in particular, to study robustness properties.The corresponding property required for TADS leaves is easily defined: Intuitively, this function yields 0 if the difference of  and  is less than  and the absolute value (minus epsilon) of their difference otherwise.  can easily be realized using only standard algebraic operations and ReLU applications, which are already defined: Just lifting this function to the TADS level (where ReLU() =  (ReLU)) is sufficient to decide -similarity.Thus, we have: Corollary 6.16 (Deciding -similarity).-similarity has quadratic time region complexity.
Please note that, again, this way of deciding -similarity does not only provide a Yes/No answer, but, in case of failure, also precise diagnostic information.All this will be showcased in Section 7.
In the remainder of this section, we elaborate on the compositionality that is imposed by : Corollary 6.17 (Layer-wise Transformation).By Theorem 6.13, we can transform a PLNN layer-wise into a TADS.As a consequence, the transformation function  can also be inductively defined using the following three atomic TADS -identity  -affine functions  : R  → R  where ,  ∈ N -single ReLUs    where ,  ∈ N,  ≤  which are illustrated in Figure 6.

Corollary 6.18 (Inductive Definition of 𝜏).
The transformation of a network to a TADS can be defined inductively as This consistency of viewpoints and operational handling indicates that the TADS setup is natural, and that it supports to approach PLNN analysis and explanation from various perspectives

TADS at Work
In this section, we continue the discussion of the XOR function as a minimal example to showcase the power of TADS for: -Model Explanation.For a given PLNN, describe precisely its behavior in a comprehensible manner.This allows for a semantic comparison of PLNNs comprising (approximative) semantic equivalence with precise diagnostic information in case of violation.-Class Characterization.PLNNs are frequently extended by the so-called argmax function to be used as classifiers.TADS-based class characterization allows one to precisely characterize the set of inputs that are specifically classified, or the set of inputs where two (PLNN-based) classifier differ.-Verification.Verification is beyond the scope of this section but will be discussed in [NSMB23] in the setting of digit recognition.
In the remainder of this section we focus on the impact of Model Explanation and Class Characterization.Two properties of TADS are important here: Compositionality.Due to the compositional nature of TADS, any TADS that represents a given PLNN can be modified and extended by output interpretation mechanisms.This mirrors a very important use case of neural networks; while neural networks are fundamentally functions R  → R  , they are often used for discrete problems, which requires a different interpretation of their output.
Precision.As the TADS transformation of a PLNN is semantics-preserving, all results are precise.
Based on these properties, it is possible to solve all the aforementioned problems elegantly by simple algebraic transformations of TADS.

Model Explanation and Algebraic Implications
To start, we train a small neural network to solve the continuous XOR problem.The resulting network,  1 , represents a continuous function  1 =  1 DS (see Figure 7a). 1 solves the XOR problem relatively well, with all corners being within a distance of < 0.1 to the desired values of 1 and 0 respectively.
The architecture of  1 is shown in Figure 9.Note that this architecture is much bigger than the architecture for  * (cf., Section 5).This is needed as the training procedure is approximate and does not reach a global optimum.On all substantially smaller networks, we failed to train a network that was close to the specifications of XOR.Weights and biases are omitted for brevity.

Model Explanation
First, we consider full model explanation of  1 . 11We can attain a precise and complete characterization of  1 by creating the corresponding TADS  1 = ( 1 ), as shown in Figure 8a.This TADS describes precisely and completely the behavior of  1 in a white-box manner.
Similarly to the function plot shown in Figure 7a, the TADS gives a comprehensible view of  1 .In contrast to the mere function plot, the TADS of Figure 8a is a solid basis for further systematic analyses and extends to more than two dimensions.
Model Explanation as illustrated here is the basic use case of a TADS as a white-box model for PLNNs, however, the true power of TADS becomes apparent when used for high-level analyses using algebraic operations on TADS.

Algebraic Implications
As mentioned in the last section, the training process of neural networks is approximate and can lead to many different solutions.A very natural question to ask is: "How differently do two neural networks solve the same problem?".This question can be answered using algebraic operations on TADS.
Consider  2 , a PLNN that has also been trained with the network architecture shown in Figure 9, but with a different setting of hyperparameters. 12Its represented (semantic) function  2 =  2 DS is depicted in Figure 7b and the corresponding TADS  2 = ( 2 ) in Figure 8b.
As TADS form a linear algebra, one can easily mirror the computation  2 −  1 by  2 −  1 on TADS level.The result is identical because the transformation process is 11 Of course, in this two-dimensional case, a function plot akin to Figure 7a might seem sufficient, but this is not feasible in anything beyond two-dimensional problems. 12The discussion of the learning process is beyond the scope of this paper.precise, i.e., The resulting difference TADS  3 is shown in Figure 10 and the corresponding function graph in Figure 11.
The TADS  3 is ideal to study the semantic difference between PLNN  1 and 2 .Most interestingly, as can be visually seen in Figure 11, the largest differences between both networks occur in the middle of the function domain, i.e., in the region most distant from the edges where the XOR problem is clearly defined.This matches the intuition that points further away from known points are more uncertain under neural network training.
Further, observe that the difference of both networks yields a TADS of roughly double the size.This moderate increase in size indicates the similarity of  1 and  2 , as linear regions of the difference TADS  3 result from the intersection of the regions for  1 and  2 which could, in the worst case, grow quadratically.
As mentioned above (cf., Corollary 6.16), it is also possible to analyse -similarity via algebraic operations to, in this case, obtain the TADS shown in Figure 12, which is much smaller than the full difference TADS (cf., Figure 10).The piece-wise affine function of this TADS is visualised in Figure 13.
There are 8 regions in which the difference values exceed 0.3, all close to the center of [0, 1] 2 .This, again matches the intuition that the volatility of solution grows with the distance to the defined values.
This result is interesting as it shows that, while the two neural networks that we trained differ, they do not differ more than 0.3 except for a small region in the center of the input space.Similar constructions can be used to analyze robustness of neural networks.Robustness

Classification
Applications of neural networks are traditionally split into regression tasks and classification tasks.In regression tasks, one seeks to approximate a function with continuous values, whereas classification tasks have discrete outputs.As learned, piece-wise linear functions are inherently continuous, classification tasks require an additional step that interprets the continuous output of a neural network as one of multiple discrete classes.Note that this is a change of mindset, with the same neural network being interpreted differently depending on the context.In our context, one might be interested in a model that classifies each input point ì  ∈ R 2 as either 1 or 0 instead of returning a real-value.

Class Characterization
A standard method for classification tasks is the interpretation of neural network outputs as a probability distribution over classes [GBC16].In our XOR example, it is natural to interpret  1 (ì ) as the probability of ì  belonging to class 1 and 1 −  1 (ì ) as the probability of ì  belonging to class 0.
At evaluation time, one might naturally choose the class with the highest probability.Thus,  1 's output is set to 1 if it is greater than 0.5 and 0 otherwise, which is, actually, in line with the definition of  * .Applying . to the continuous learned function  1 therefore results in a suitable classifier for this problem: Note that I( ≥ 0.5) is not continuous and therefore cannot be represented by a PLNN. 13o construct the TADS, we use the compositionality of TADS.We manually construct the simple TADS (I( ≥ 0.5)), as shown in Figure 15 and compose it with the TADS  1 of  1 .The resulting TADS   1 = (I( ≥ 0.5))  1 is shown in Figure 14a.Note that this TADS is reminiscent of a binary decision diagram with just two final nodes.Figure 16a and shows precisely which inputs are interpreted as 1 and which as 0. As we only have two classes here, this classification can be considered as what is called class characterization in [GS21] for both classes 0 and 1. Please note that class characterizations allows one to change the perspective from a classification task to the task of finding adequate candidates of specific profile, here given as a corresponding class.
This shows that, given an output interpretation that maps the continuous network outputs to discrete classes, it is possible to transform neural networks, fundamentally black-box representations of real valued functions, into semantically equivalent decision diagrams, fundamentally white-box representations of discrete valued functions.

Comparison of Classifiers
After having constructed TADS that characterize the classification behavior of neural networks, we can also characterize the difference in classification behavior of two neural networks.We can simply do so by using the lifted equality relation to the TADS level and compute the TADS: The resulting TADS is shown in Figure 17a and the corresponding function graph in Figure 16c.This plot describes precisely the areas where both functions differ and where they coincide.
Notably, it shows that, while the absolute difference of  1 and  2 is highest in the center of the interval [0, 1] 2 , the networks agree in that area with respect to classification.Indeed, it appears that the largest difference with respect to classification occurs in the diagonals separating the classes 1 and 0. This is not too surprising, as it is at the borderline between classes were small changes may affect the classification result.
Using an encoding of boolean values as 1 and 0 respectively, we can also compute the difference of   1 and This TADS not only describes where   1 and   2 disagree, but also how they disagree.The corresponding TADS is shown in Figure 17b.
This shows the utility of TADS for output interpretation.While the absolute difference between two networks is a suitable measure of difference for regression tasks, the difference of the classification functions is suitable for classification.Playing with this difference, e.g., by modifying the classification function, is a powerful analytical instrument.E.g., in settings with many classes, separately analyzing the class characterizations of the individual classes typically leads to much smaller and easier to comprehend TADS and may therefore be a good means to increase scalability.
In machine learning, one often compares learned classifiers to groundtruth solutions by sampling from the groundtruth solution and checking whether the neural network matches the groundtruth predictions.TADS enable a straightforward and precise way of evaluating a neural network in instances where one has access to the groundtruth model.E.g., the TADS of Figure 13 precisely specifies where  1 differs from the baseline solution I(| − | ≥ 0.5).

Related Work
The presented TADS-based approach towards understanding of neural networks is explicitly meant to bridge between the various existing initiative that aim in the same direction, but typically with quite different means.In this section, we review the state of the art under three perspectives: -The intent, explainability, as approached in the neural networks community.-Applied concepts, e.g., symbolic execution that aim at (locally) precise results.-Applied background, in particular concerning piecewise affine functions.
Whereas the first perspective (Section 8.1) is conceptually distant, both in its applied technologies as well as in its achievements, the mindset of second perspective (Section 8.2) is similar in aims and means, but, except for our previous work, restricts its attention to a locally precise analysis close to some (partly symbolic) input.The third perspective just concerns the mathematical background (Section 8.3).We are not aware of any previous work that systematically applies algebraic reasoning to achieve precise explanation and verification results about neural networks.

Machine Learning Explainability
In recent years, explainable AI (XAI) as a subfield of machine learning has seen a surge of activity.In line with existing machine learning research, XAI focuses on approaches that scale efficiently at the cost of precision and comprehensibility.Due to vast amount of work in this direction we can only provide sketch of the field here, which from our perspective is characterized by is use of 'traditional' deep learning technologies such as gradient based optimization and its focus on directly investigating the neural networks themselves in an approximate fashion and without explicit link to some semantic model.
A typical example of a gradient-based method is activation maximization [MV16, SCD + 17], which seeks to find, for one class  and network , the input ì  for which ì  is maximal for class .Being based on gradient based optimization, this approach is clearly approximate.
Other examples of approaches working on the neural network level are frequently found in attribution methods.Attribution methods focus on attributing a prediction  ( ì ) = , to parts of the input that one deems responsible for this prediction.In general, this question is unclear and subjective.As a consequence, there exist multiple different methods that attribute the prediction differently to the original input.The latter methods depend strongly on the neural network architecture and not on its semantics.These methods are useful to gain rough intuition, but they do not offer any guarantees or reliable results.This is a direct consequence of most of these methods working with classical machine learning tools such as backpropagation and numerical optimization, which are fast but approximative [GBC16].
The class of XAI methods that is most closely related to TADS are local proxy models like LIME [RSG16] and SHAP [LL17].Both methods consider one fixed input ì  and treat the model as a black-box.They observe the model's behavior on multiple perturbations of the form ì  +  with  being sampled randomly.Then, they use simple machine learning models such as a linear classifier or a decision tree to describe the model's behavior on the perturbations ì  +  they observed.These methods are similar in their intent to the TADS approach, as they use conceptually simple models to represent the black-box behavior of a neural network.However, both LIME and SHAP are imprecise.They both sample only a few points ì  +  in the neighborhood of ì  and might miss important properties of the neural network model.Further, both methods use a machine learning classifier to represent these points.These classifiers are usually linear models (or a comparably simple model) and cannot capture the full behavior of the network, which leads to potentially large and uncontrolled errors.
We are not aware of XAI methods that provide guarantees strong enough to justify a responsible use in safety critical applications.

Conceptually Related Work
Symbolic Execution of Neural Networks.More closely related to TADS are approaches to explainability based on symbolic execution of neural networks.
The idea of explainability via symbolic (or rather concolic execution) of neural networks was already explored in the works of [GPW + 19].In their work, the authors translate a given PLNN into an imperative program and concolically execute one given input ì  ∈ R  .This corresponds to exploring the one path of a TADS corresponding to ì .This yields the path condition and the affine transformation that are responsible for the prediction  ( ì ).The authors further use these explanations to find adversarial examples and find parts of an input that they deem important for a given classification.The results of this work are promising, but (very) local, as they restrict themselves to one linear region of the input.
The authors of [CHH + 18] propose a method that closely mirrors the method of [GWZ + 18].In essence, both methods are almost identical, but differ in their conceptual derivation of the method.The authors of [CHH + 18] also consider sets of predictions and work out what features act as discriminators in many of these predictions.
Moving from the idea of explanation, the authors of [SWR + 18] consider concolic testing instead.Similar to the work of [GWZ + 18], they execute singular inputs concolically.They use the results from concolic execution to heuristically derive new inputs that cover large areas of the input space.
TADS improve on these approaches in two ways.First, TADS offer a global viewpoint on neural network semantics, independent of a sample set.Second, TADS support algebraic operations on a conceptual level to derive globally precise explanation and verification results.As illustrated in Section 7, algebraic operations nicely serve as a toolbox to derive tailored and precise analyses.
Neural Network Verification.Neural network verification aims to verify properties of neural networks, usually piece-wise linear neural networks using techniques from SMT-solving and abstract interpretation extended by domain-specific techniques [KBD + 17, WZX + 21, TMLM + 19].Verification approaches are usually precise, or at least provide a counterexample if a property is shown false.Modern solvers can scale quite well, but are still far from being able to tackle practically relevant applications [BLJ21].
Verification approaches are related to TADS as they also provide tools for the precise analysis of piece-wise linear neural networks.However, while SMT-based verification approaches currently scale better than TADS, they focus only on binary answers to a verification problem.They are not able to provide full diagnostics and descriptions of where and how an error occurs.However, please note, SMT-based approaches should not be considered as an alternative but rather as a provider of technologies that can also be applied at the TADS level.In fact, we use SMT solving, e.g., to eliminate infeasible paths in TADS.
Precise Explainability of Random Forests.This work is conceptually closely related to and builds upon the work of [GS21,MNSB23].There, ADDs are used and extended to derive explainable global models for random forests.Similar to the approach in this paper, these models are derived through a sequence of semantics-preserving transformations and later on refined by performing algebraic operations on the white-box representation of random forests.In fact, considering the underlying mindset, the work in this paper can be regarded as an extension of our work on random forest to neural networks.However, the much higher complexity of PLNN requires substantial generalization, which to our surprise did not clutter the theory, but rather added to its elegance.

Technologically Related Work
Linear Regions of Neural Networks.Vast amounts of research have been conducted regarding the number and shape of linear regions in a given PLNN [Hin21, CHH + 18, MPCB14, PMB13, ZW20, HR19b, STR18, HR19a, WL18, SKS + 20, RPK + 17, ABMM16].Linear regions are of huge interest to neural network research as they give a natural characterization of the expressive power of neural network classes.This research is beneficial to the understanding of TADS as it can be used to bound the size of TADS and understand where and when explosions and size occur.On the other hand, TADS give a precise and minimal representation of the linear regions belonging to given neural network and can be used to facilitate experiments in this field, e.g., to find a linear region containing a negative example for a given property that could not be verified [KBD + 17].
Structures for Polyhedral Sets.At their core, TADS are efficient representations of multiple polyhedral regions within high-dimensional spaces.Similar problems occur in other divisions of computer science, most notably computer graphics.
TADS are closely related to Binary Space Partition Trees (BSP-trees) [TN87] and comparable structures [TJB03].These structures are built to represent a partition of a real-dimensional space into polygons, much like TADS do.TADS extend these structures with optimizations from ADDs to account for domain-specific properties of piece-wise linear functions that are not present in the general case of polygonal partitions.

Conclusion and Future Work
We have presented an algebraic approach to the precise and global explanation of Rectifier Neural Networks (PLNNs), one of the most popular kinds of Neural Networks.Key to our approach is the symbolic execution of these networks that allows the construction of semantically equivalent Typed Affine Decision Structures (TADS).Due to their deterministic and sequential nature, TADS can be considered as white-box models and therefore as precise solutions to the model explanation problem, which directly imposes also solutions to the outcome explanation, and class characterization problems [GMS21,GS21].Moreover, as linear algebras, TADS support operations that allows one to elegantly compare Rectifier Networks for equivalence or -similarity, both with precise diagnostic information in case of failure, and to characterize their classification potential by precisely characterizing the set of inputs that are specifically classified, or the set of inputs where two Network-based classifiers differ.These are steps towards a more rigorous understanding of Neural Networks that is required when applying them in safety-critical domains without the possibility of human interference, such as self-driving cars.
This elegant situation at the semantic TADS level is in contrast with today's practical reality where people directly work with learned PLNNs that are in particular characterized by their hidden layers that often comprise millions sometimes even billions of parameters.The reason for this complex structure is learning efficiency, a property paid for with semantic intractability: There is essentially no way to control the impact of minor changes of a parameter or input values, and even the mere evaluation for a sample input exceed the capacity of a human's mind by far.This is why PLNNs are considered as black-box models.
The reason why TADS have not yet been studied may be due to their size: they may be exponentially larger than a corresponding PLNN.The reason for this expansion is the transformation of the incomprehensible hidden layers structure into a large decision structure, which conceptually is as easy to comprehend as a decision tree and a linear classifier.In this sense, our transformation into TADS can be regarded as trade of size for transparency, turning the verification and explanation problem into a scalability issue.There are at least three promising angles for attacking the scalability problem: 1. Learned PLNNs have a high amount of noise resulting from the underlying learning process that works by locally optimizing individual parameters of the hidden layers.Noise reduction may have a major impact on size.Detecting noise is clearly a semantic task and can therefore profit from TADS-based semantic analyses.
2. PLNNs are accepted to be approximate.Thus, controlled modifications with minor semantic impact are easily tolerated.TADS provide the means to control the effect of modifications and thereby to keep modifications in the tolerable range.
3. Modern neural network architectures are typically compositions of multiple sub-networks that are intended to support the learning of different subtasks.However, this structure at the representational layer gets semantically blurred during joint the learning process, which, e.g., prohibits compositional approaches as known from formal methods.The semantic transparency of TADS may provide means to reinforce the intended compositional structure also at the semantical level in order to support compositional reasoning and incremental construction.
Of course, there seems to be a hen/egg problem here.If we can construct the TADS, we are able to reduce it in order to achieve scalability.On the other hand, we need scalability first to construct the TADS.This is a wellknown problem in the formal methods world, and despite a wealth of heuristics and domain-specific technologies, the answer is compositionality and incremental construction.This is exactly in line with the observation reported in the third item above: We need to learn how to use divide and conquer techniques for PLNN in a semantics-aware fashion.TADS are designed to support this quest by providing both a leading mindset and a tool-supported technology.

Figure 1 :
Figure 1: A baseline solution to the XOR-regression problem given by  * (, ) = | − |.Note that this function is piece-wise linear, having two separate linear regions, which is minimal for the problem.
onto the space of positive vectors R  + defined by replacing each component   of a vector ì  by max{ 0,   }: ReLU  ( ì )  := max{ 0,   } If the input dimension is clear, we omit the index and just write ReLU.
Definition 5.1 (Rectifier Neural Networks).The syntax for Rectifier Neural Networks, or here synonymously used, Piece-wise Linear Neural Networks (PLNNs), is defined by the following BNF N ::=  |  ; N |  ; N where the meta variables  and  stand for affine functions and partial ReLU functions, respectively.Writing PLNNs as  =  0 ; • • • ;   where  ∈ { ,  } we denote the set of all PLNNs with dom(  0 ) = R  and codom(   ) = R  as N (, ) and the set of all PLNNs as N = ,∈N

2 Figure 4 :
Figure 4: Example for (T)ADS addition.The (T)ADS in (a) and (b) are based on partial ReLUs and (c) is the sum of both.The input vector is given as ì  = (, ) with ,  ∈ R.

Figure 5 :
Figure 5: Example for TADS composition.The TADS (a) and (b) are based on partial ReLUs.TADS (c) is the composition of (a) and (b).Note the difference between lifting (Figure 4) and composing in the inner nodes.The input vector is given as ì  = (, ) with ,  ∈ R.

Figure 6 :
Figure 6: A few examples for atomic TADS.The input vector is given as ì  = (, ) with ,  ∈ R.

Figure 7 :Figure 8 :Figure 9 :
Figure 7: Function graphs corresponding to the PLNNs  1 and  2 .Observe that both PLNNs fulfill the conditions of the XOR problem very closely.

Figure 10 :
Figure 10: The TADS  2 −  1 describing the difference of  2 and  1 .This TADS corresponds to the function plot of Figure 11.

Figure 11 :
Figure 11: The function plot describing the difference between the two networks  1 and  2 .

Figure 13 :
Figure 13: The function graph describing the difference between  2 and  1 iff it exceeds  = 0.3
Examples include gradient based saliency maps [SVZ13, MCF19], layer-wise relevance propagation (LRP) [BBM + 15] and deep taylor decomposition [MLB + 17].As attribution is natural to answer for linear models, these methods focus on linearly approximating the model (gradient based saliency maps) or parts of the model (LRP and deep taylor decomposition).

Figure 17 :Figure 18 :
Figure 16: Contour plots of the classification functions (a)  1 and (b)  2 .The difference between both classifiers is visualized in (c).
in case that  follows the left/true branch at   in  and   = p  otherwise.We denote the last predicate   ∈ P ∪ P of  by final().-Given a predicate path  =  0 • • •   the predicate final() is called vacuous for  iff the conjunction of the preceding predicates  0 ∧ • • • ∧  −1 in  implies final().-Let Π  be the set of predicate paths of  ∈ S  that end in a given node .We call  vacuous in , iff final() is vacuous for all paths  ∈ Π and final() coincides for all .-A decision structure  ∈ S  is called vacuity-free iff there exists no vacuous node.