---
# System prepended metadata

title: Structure and Property

---

# Structure and Property

(under construction)

([home](https://github.com/alexhkurz/introduction-to-numbers/blob/master/README.md) ... [previous](https://hackmd.io/@alexhkurz/S1xSrvwjL) ... [next]())


One of the most important themes in mathematics is structure vs property.

The structures we looked at in the previous sessions are tables such as

	0 1 2 3 4
	1 4 3 0 2
	2 3 4 1 0
	3 2 0 4 1
	4 0 1 2 3
    
And properties of the structures we looked at were, for example, whether the table

- has a neutral element, that is, whether there is a special element $e$ such that $ex=x$ and $xe=x$ for all elements $x$;
- has inverses, that is, whether for all $x$ there is a $y$ such that $xy=e$ and $yx=e$;
- is associative, that is, whether $x(yz)=(xy)z$;
- is commutative, that is, wheter $xy=yx$.

Later we will learn more about how to implement such structure on a computer. So it can't harm to already start using some notation from the **Python** programming language. In Python, we would give the table above a name, eg `table`. Then, what we write mathematically as $x+y$, or $x\cdot y$, or simply, as in the laws above, as $xy$, is written in Python as

    table[x][y]
    
For example, in the table above, we have `table[4][1]=0` and `table[1][4]=2`. To understand this better, we should know that lists and tables in Python are indexed from `0`, not from `1`. So the top left element of a table is always `table[0][0]`.

**Exercise:** What is `table[1][3]` and `table[3][1]`? 

We can also write the equations in Python. We just need to know that the mathematical $=$ is `==` in Python (and many other programming languages such as Java, C, and Haskell). So commutativity is in Python

    table[x][y] == table[y][x]

Sometimes structure and properties correspond to each other in obvious ways and sometimes they don't. Both ways are equally interesting to mathematicians.

For example, that in the table above,
-  $0$ is a neutral element is immediately visible from the fact that the first row and the first column is `0 1 2 3 4`;
    
- that each element has an inverse is immediately visible from the fact that each row and each column is a permutation of `0 1 2 3 4`;

- commutativity holds is immediately visible from the fact that the diagonal from the top-left to the bottom-right is a line of symmetry.

On the other hand, it is not immediately clear whether that table is associative. To check this by hand is quite tedious and error prone. This is a point where one would want to write a short program.

    

