Monday, May 20, 2013

Cultured Software, Part IV

Continuing my thoughts upon the subject of fixed points, geometrically a fixed point is any point that remains fixed when a figure is transformed. For instance, under the operation of rotation the center point of a circle is a fixed point.

Algebraically we look for elements that remain unchanged under some mapping that is consistent with the system's assumptions. Group theory calls these mappings homomorphisms, and when they are 1:1 and cover all the elements under consideration, they are isomorphisms or permutations.

Take, for instance, the set ø, A, B, α, β  } under addition defined by:

ø + (any element) = the same element
A + A = B
A + B = α
B + B = β  
A + α β
B + β = A
α + α = A
α + β = B
β + β = α
A + β = ø 
B + α = ø 

The first rule gives the identity element. The last two give inverses. This set of elements is isomorphic to Z5, the set of integers mod 5.  We can show this by a bijective function that preserves identity and inverses (an isomorphism):

{ (ø, 5), (A, 1), (B, 2), (α, 3), (β, 4) }
We can see the symmetry about 0 and the inverses more directly by restating the domain set and the isomorphism as: 
{ (ø, 0), (A, 1), (B, 2), (α, -1), (β, -2) }
A group like Z5 has a unique identity element. An identity element remains fixed under all group isomorphisms. Whatever the identity is in the input it must  map to the identity element in the output. Five is the identity element under addition mod 5 since 0=5 mod 5.

Addition also remains well-defined: inverses and the 'order' of each element (in effect, the way skip-counting works) must be preserved:
{ (ø, 0), (A, -2), (B, 1), (α, 2), (β, -1) }

The structure of the group is maintained across the transformation:
  • ø goes to 0, identity to identity. 0 is its own inverse, and 0 has order 1 (one element results from skip counting 0+0). 
  • A goes to -2 and its inverse α goes to 2, the inverse of -2. Similarly for  B and β.
  • By skip counting  2, 2+2=4, +2=6=1 mod 5, +2=3 mod 5,  +2=5=0 mod 5 we get that the order of 2 (and -2) is 5. Similarly for B and β.
Had this been a slightly different type of group, say, Z6, there would be elements 2 and 3 which, by being factors of 6, are factors of 0 in that group; such elements give rise to sub-structures. The element 2 skip counts to { 0, 2, 4 } and 3 to { 0, 3 }, both of which are a fraction of the complete set Z6 ; neither subset includes 1 or 5, which fall out of the orbits of 2 and 3.

And here is the point: when we grow software, like it or not, we are implicitly defining a kind of broken algebra. Usually it is a messy affair, both incomplete and inconsistent, replete with exceptions. Yet despite the incongruities identifiable structure exists.

Fixed points in software give rise to symmetries analogous to those found in algebras - similarity and congruence in subordinate structures, inverses and zero divisors. If we fix two diagonally opposing corners of a square figure, we define an axis of symmetry. By fixing points we constrain the set of morphisms on the space defined by the square, leaving just one valid movement: a flip about the diagonal.

In a software code base, fixed points act to constrain, inhibit or completely proscribe adaptations. Like local fault inclusions formed in a crystal lattice by too-fast growth or foreign particles, fixed points introduce cleavage planes into the structure. If the system is well-formed the structure may be minimally complex. 

But fixed points in software are often incidental and accidental, leading to anomalous structuring. In a software system,  every random fixed point injected renders it more prone weird structuring. Whether we get a well-structured system with clean cleavage planes, a quizzical Rube Goldberg contraption, or an amorphous mass largely depends upon the environment in which the software is grown and the rate at which decisions crystalize.

No comments: