Example:Bijective undo/redo operations

From CS2800 wiki

Many user interfaces can be thought of as a collection of functions that transform a document into another document. For example, let [math]A [/math] be the set of all plain text files. Pressing the 'x' key in a text editor causes an 'x' to be inserted; you can think of this as applying a function [math]f : A \href{/cs2800/wiki/index.php/%5Cto}{\to} A [/math] that takes the document without the 'x' and outputs the document with the 'x'.

If you want to provide an undo/redo capability, then the functions should be bijections. If they are, then their two-sided inverses give the undo operations.

Sometimes you can make a function into a bijection by adding an "undo log": by expanding the set [math]A [/math] you can keep enough history to implement an undo function.