Closure of Operations in Computer Programming
deniskyashif.com·16h·
Discuss: r/programming
🌳Data Structures
Preview
Report Post

In algebra, we say that a set is closed under an operation (or rule) if applying that operation to elements of the set never produces a result outside the set. For example, the set of integers ( \mathbb{Z} ) is closed under multiplication. Multiplying two integers would always produce an integer:

[ \forall a,b \in \mathbb{Z}, a * b \in \mathbb{Z} ]

However, the integers are not closed under division. Dividing one integer by another can produce a fractional value that does not belong to ( \mathbb{Z} ):

[ \exists a,b \in \mathbb{Z} \text{ such that } a \div b \notin \mathbb{Z} ]

For example:

[ \frac{1}{2} \notin \mathbb{Z} ]

When a set is closed under its allowed operations, repeatedly applying those operations—no matter how many times—never takes us…

Similar Posts

Loading similar posts...