# A Hierarchy of Data Types: From Trees to Sets

• Chapter

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4350))

• 1291 Accesses

## Abstract

In Section 4.4.1 we have introduced equational attributes as a means of declaring some equational properties of binary operators that allow Maude to use these properties efficiently in a built-in way in parsing and in matching modulo such equational axioms. We recall that Maude supports the following equational attributes:

• assoc (associativity),

• comm (commutativity),

• id:$$\langle Term\rangle$$ (identity, with the corresponding term for the identity element), with variations for left identity and right identity, and

• idem (idempotency).

An important restriction to bear in mind is that the assoc and idem attributes cannot be used together in any combination.

In this chapter we will show that equational attributes correspond to structural axioms of well-known data types built with a binary constructor operator. In this way we obtain a hierarchy of data types:

• non-empty binary trees, with elements only in their leaves, built with a free binary constructor, that is, a constructor with no equational axioms;

• non-empty lists, built with an associative constructor;

• lists, built with an associative constructor and an identity;

• multisets (or bags), built with an associative and commutative constructor and an identity; and

• sets, built with an associative, commutative, and idempotent constructor and an identity.

All these data types are generic, so that they can be constructed on top of any given data type of basic elements; for example, we can have lists of natural numbers, lists of Booleans, lists of sets of integers, etc. This genericity corresponds to making use of parameterized modules in Maude, which will be introduced later in Section 8.3. Therefore, in this chapter we only consider constructions over natural numbers. In Section 9.12 we will describe the predefined parameterized versions of lists and sets provided in the Maude prelude, and in Chapter 10 we will describe many other parameterized data types, like stacks, queues, sorted lists, multisets, and different versions of trees.

This is a preview of subscription content, log in via an institution to check access.

## Subscribe and save

Springer+ Basic
\$34.99 /Month
• Get 10 units per month
• 1 Unit = 1 Article or 1 Chapter
• Cancel anytime

Chapter
USD 29.95
Price excludes VAT (USA)
• Available as PDF
• Own it forever
eBook
USD 79.99
Price excludes VAT (USA)
• Available as PDF
• Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Authors

## Rights and permissions

Reprints and permissions

### Cite this chapter

Clavel, M. et al. (2007). A Hierarchy of Data Types: From Trees to Sets. In: All About Maude - A High-Performance Logical Framework. Lecture Notes in Computer Science, vol 4350. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-71999-1_5

• DOI: https://doi.org/10.1007/978-3-540-71999-1_5

• Publisher Name: Springer, Berlin, Heidelberg

• Print ISBN: 978-3-540-71940-3

• Online ISBN: 978-3-540-71999-1

• eBook Packages: Computer ScienceComputer Science (R0)