**Abstract:** Feature algebra was introduced as an abstract framework for feature oriented software development. One goal is to provide a common, clearly defined basis for the key ideas of feature orientation. So far, feature algebra captures major aspects of feature orientation, like the hierarchical structure of features and feature composition. However, as we will show, it is not able to model aspects at the level of code, i.e., situations where code fragments of different features have to be merged. With other words, it does not reflect details of concret implementations. In the paper we first present concrete models for the original axioms of feature algebra which represent the main concepts of feature oriented programs. This shows that the abstract feature algebra can be interpreted in different ways. We then use these models to show that the axioms of feature algebra do not reflect all aspects of feature orientation properly. This gives the motivation to extend the abstract algebra — which is the second main contribution of the paper. We modify the axioms and introduce the concept of an extended feature algebra. The original algebra can be retrieved by a single additional axiom. As third contribution we introduce more operators to coveer concepts like overriding in the abstract setting.

**Paper:** pdf

For proving the lemmata and theorems presented in the paper we made use of the following tools:

Waldmeister [BHF96] is a theorem prover for unit equational logic. Its proof procedure is unfailing Knuth-Bendix completion [BDP89]. Waldmeister's main advantage is that efficiency has been reached in terms of time as well as of space. The provided files were tested with Version July 99.

Isabelle/HOL [NPW02] is a generic proof assistant. It allows mathematical formulas to be expressed in a formal language and provides tools for proving those formulas in a logical calculus. The provided theories were tested using Isabelle 2015.

Haskell (e.g. [Pey03]) is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing.

A *Feature Algebra* is a tuple (M, I, +, ⚬,·, 0,1) such that for all m,n∈M and all i,j∈I

- (I,+,0) is a monoid of
*introductions*satisfying the additional axiom of distant idempotence, i.e., i+j+i = j+i. - The set of
*modifications*M contains a special modification 1. - The operations ⚬: M×M → M and ·: M×I → I satisfy the following axioms:

– 1 · i = i (1 is left-identity w.r.t. ·),

– m · 0 = 0 (0 is a right-annihilator),

– (m ⚬ n) · i = m · (n · i) (pseudoassociativity of ·/⚬). - · distributes over +, i.e., m · (i + j)= (m · i)+(m · j).

We have used Waldmeister and Isabelle/HOL to prove various facts about Feature Algebra.

An input file for Waldmeister for the original Feature Algebra can be downloaded here. All theorems presented in our paper can be proven in no time. The input file contains all proof goals; just uncomment the goals you want to prove.

The Isabelle theory containing all presented lemmas and proofs of Feature Algebra can be found here.

In our paper we presented two different models for Feature algebra. The first one is based on prefix-closed sets, the other is based on prefix-free lists.

The first Isabelle theory shows that sets (under set union) and prefix-closed sets form a distant-idempotent monoid. The former is not mentioned in the paper, but a nice exercise in formalise the algebra in Isabelle/HOL. If the models are equipped with the right rewrite-functions, the two models form a feature algebra.

The second Isabelle theory showing that the list-based model forms a feature algebra is also available.

An *Extended Feature Algebra* (EFA) is a tuple (M, I, C, E, +, ⚬, ·, ▻, 0,1) such that the following properties hold for all m,n∈M, i,j∈I, x∈E and a,b∈C.

- The set C of
*code fragments*offers an associative*update*or*override*operation ▻, i.e., (C,▻) is a semigroup; - (E,+,0) is a monoid of
*extended introductions*with I[C] ⊆ E satisfying i[a] + i[b] = i[a ▻ b]; - (M,⚬,1) is a groupoid of
*modifications*operating via · on E:

–1 · x = x (1 is left-identity w.r.t. ·),

–m · 0 = 0 (0 is a right-annihilator),

–(m ⚬ n) · x = m · (n · x) (pseudoassociativity of $·/⚬). - 0 is a right-annihilator for · and
- · distributes over +.

We proved all facts presented in the paper using Isabelle and Waldmeister; the input files can be found here and here.

The *restriction* ⇂: L × N → L and the *removal* -:L × N→ L have to satisfy the following axioms:

where a,b∈L, p,q∈N. Moreover we assume that N is closed under $⇂$ and $-$, i.e.,if p,q∈N then also p ⇂ q, p-q∈N.

(a⊔ b) ⇂ p = (a ⇂ p) ⊔ (b ⇂ p) | (2) | a=(a⇂ p) ⊔ (a-p) | (7) |

a ⇂ (p⊔ q) = (a ⇂ p) ⊔ (a ⇂ q) | (3) | a⇂(q-p) = (a-p)⇂ q = (a⇂ q) - p | (8) |

(a⊔ b)-p = (a-p)⊔ (b-p) | (4) | p-p=0_{C} | (9) |

a-(p⊔ q) = (a-p)-q | (5) | p⇂ q ⊑ q | (10) |

a ⇂ 0_{C} = 0_{C} | (6) |

The Isabelle sources can be found here; the theory uses two files from the AFP entry about Kleene Algebra; the two files can be found here.^{1}

- [BDP89]
- L. Bachmair, N. Dershowitz, D.A. Plaisted:
*Completion Without Failure*.In H. Ait-Kaci, M. Nivat (eds.)Resolution of Equations in Algebraic Structures, 1-30.Academic Press, 1989. - [BHF96]
- A. Buch, Th. Hillenbrand, R. Fettig:
*WALDMEISTER: High performance equational theorem proving*.In J. Calmet, C. Limongelli (eds.)Symposium on Design and Implementation of Symbolic Computation Systems, 63-64.Lecture Notes in Computer Science 1128, 1996. - [Pey03]
- S. Peyton Jones:
*Haskell 98 Language and Libraries: The Revised Report.*Cambridge University Press, 2003. - [NPW02]
- T. Nipkow, L.C. Paulson, M. Wenzel:
*Isabelle/HOL: A Proof Assistant for Higher-Order Logic*In Lecture Notes in Computer Science 2283. Springer, 2002.

**Contact:** Peter Höfner: peter <at> hoefner-online.de