Isomorphisms & Meaning

Haskell juvenilia; investigating when two theories or representations mean the same things.
philosophy, computer-science
2009-04-252015-01-03 finished certainty: remote importance: 3


Metaphors and analo­gies are the coin of hu­man thought and key to in­ter­pre­ta­tion in art. We often speak of sys­tems be­ing trans­lat­able or be­ing equiv­a­lent in some sense, and es­pe­cially we want to use sys­tems to look at each other and gain in­sight; but a trans­la­tion be­tween sys­tems with no com­mon­al­ity strikes us as sense­less and wrong in some way. We know that some trans­la­tions are good and valid, and some are not. But how are we judg­ing this?

Mad morphisms

Trans­la­tions be­come more patho­log­i­cal the more de­tailed and thor­ough they are. That such trans­la­tions are not use­ful, or of val­ue, or even harm­less is the rea­son why we need to know what sep­a­rates the healthy from the ill; you may not be in­ter­ested in dis­eased think­ing, but dis­eased think­ing is in­ter­ested in you (ask sur­vivors of ide­o­log­i­cal regimes like Com­mu­nis­m). has a pas­sage in chap­ter 66 (one of many well worth read­ing) on this ma­nia:

“Last night I hap­pened to come across a dri­ver’s man­u­al. Maybe it was the semi­dark­ness, or what you had said to me, but I be­gan to imag­ine that those pages were say­ing Some­thing Else. Sup­pose the au­to­mo­bile ex­isted only to serve as metaphor of cre­ation? And we must­n’t con­fine our­selves to the ex­te­ri­or, or to the sur­face re­al­ity of the dash­board; we must learn to see what only the Maker sees, what lies be­neath. What lies be­neath and what lies above. It is the Tree of the .”

“You don’t say.”

“I am not the one who says; it is the thing it­self that says. The is the trunk of the tree. Count the parts: , 2 front wheels, , , two , , and 2 rear wheels. Ten parts, ten Se­firot.”

“But the po­si­tions don’t co­in­cide.”

“Who says they don’t? Dio­tal­levi ex­plained to us that in cer­tain ver­sions is­n’t the sixth Se­fi­rah, but the eighth, be­low and . My axle-tree is the tree of Bel­both.”

.”

“But let’s pur­sue the di­alec­tic of the tree. At the sum­mit is the en­gine, Om­nia Movens, of which more lat­er: this is the Cre­ative Source. The en­gine com­mu­ni­cates its cre­ative en­ergy to the 2 front or higher wheels: the Wheel of In­tel­li­gence and the Wheel of Knowl­edge.”

“If the car has .”

“The good thing about the Bel­both tree is that it al­lows meta­phys­i­cal al­ter­na­tives. So we have the im­age of a spir­i­tual cos­mos with fron­t-wheel-drive, where the en­gine, in front, trans­mits its wishes to the higher wheels, whereas in the ma­te­ri­al­is­tic ver­sion we have a de­gen­er­ate cos­mos in which mo­tion is im­parted by the en­gine to the 2 lower wheels: from the depths, the cos­mic em­a­na­tion re­leases the base forces of mat­ter.”

“What about an en­gine in back, ?”

“Sa­tan­ic. Higher and lower co­in­cide. God is iden­ti­fied with the mo­tion of crude mat­ter. God as an eter­nally frus­trated as­pi­ra­tion to di­vin­i­ty. The re­sult of the [t­sim-sun].”

“Not the Break­ing of the Muffler?”

“That oc­curs in aborted uni­vers­es, where the nox­ious breath of the spreads through the ether. But we must­n’t di­gress. After the en­gine and 2 wheels comes the clutch, the Se­fi­rah of grace that es­tab­lishes or in­ter­rupts the flow of love that binds the rest of the tree of the Su­per­nal En­er­gy. A disk, a that ca­resses an­other man­dala. Then the coffer of change—the gear box, or trans­mis­sion, as the pos­i­tivists call it, which is the prin­ci­ple of Evil, be­cause it al­lows hu­man will to speed up or slow down the con­stant process of em­a­na­tion. For this rea­son, an costs more, for there it is the tree it­self that de­cides, in ac­cor­dance with its own Sov­er­eign Equi­lib­ri­um. Then comes the uni­ver­sal joint, the axle, the drive shaft, the differ­en­tial–note the op­po­si­tion/rep­e­ti­tion of the of cylin­ders in the en­gine, be­cause the differ­en­tial (Mi­nor ) trans­mits mo­tion to the earthly wheels. Here the func­tion of the Se­fi­rah of differ­ence is ob­vi­ous, as, with a ma­jes­tic sense of beau­ty, it dis­trib­utes the cos­mic forces to the Wheel of Glory and the Wheel of Vic­to­ry, which in an un­aborted uni­verse (fron­t-wheel dri­ve) are sub­or­di­nate to the mo­tion im­parted by the higher wheels.”

“A co­her­ent ex­e­ge­sis. And the heart of the en­gine, seat of the One, the Crown?”

“You have but to look with the eyes of an ini­ti­ate. The supreme en­gine lives by an . A com­plex, di­vine res­pi­ra­tion, a cy­cle ini­tially based on 2 units called cylin­ders (an ob­vi­ous geo­met­ri­cal ar­che­type), which then gen­er­ate a third, and fi­nally gaze upon one an­other in mu­tual love and bring forth the glory of a fourth. In the cy­cle of the first cylin­der (none is first hi­er­ar­chi­cal­ly, but only through the mirac­u­lous al­ter­na­tion of po­si­tion), the (e­t­y­mol­o­gy: ) de­scends from the up­per neu­tral po­si­tion to the lower neu­tral po­si­tion as the cylin­der fills with en­ergy in the pure state. I’m sim­pli­fy­ing, be­cause here come into play, the valves, which, as my hand­book says, ‘al­low the open­ing and clos­ing of the aper­tures that link the in­te­rior of the cylin­ders to the in­duc­tion pipes lead­ing out of the car­bu­re­tor.’ The in­ner seat of the en­gine can com­mu­ni­cate with the rest of the cos­mos only through this me­di­a­tion, and here I be­lieve is re­vealed—I am re­luc­tant to ut­ter heresy—the orig­i­nal limit of the One, which, in or­der to cre­ate, some­how de­pends on the Great Ec­centrics. A closer read­ing of the text may be re­quired here. The cylin­der fills with en­er­gy, the pis­ton re­turns to the up­per neu­tral po­si­tion and achieves max­i­mum com­pres­sion–the tsim-sun. And lo, the glory of the Big Bang: com­bus­tion, ex­pan­sion. A spark flies, the mix­ture of fuel flares and blazes, and this the hand­book calls the ac­tive phase of the cy­cle. And woe, woe if in the mix­ture of fuel the Shells in­trude, the , drops of im­pure mat­ter like wa­ter or Co­ca-Co­la. Then ex­pan­sion does not take place or oc­curs in abortive starts…”

“Then the mean­ing of Shell is qelip­pot? We’d bet­ter not use it any­more. From now on, only Vir­gin’s Milk…”

“We’ll check. It could be a trick of the , lower em­a­na­tions try­ing to con­trol the process of cre­ation…In any case, after ex­pan­sion, be­hold the great di­vine re­lease, the ex­haust. The pis­ton rises again to the up­per neu­tral po­si­tion and ex­pels the form­less mat­ter, now com­bust­ed. Only if this process of pu­rifi­ca­tion suc­ceeds can the new cy­cle be­gin. Which, if you think about it, is also the mech­a­nism of Ex­o­dus and , mirac­u­lous di­alec­tic of the Way Up and the Way Down.”

Quan­tum mor­talia pec­tora cea­cae noc­tis habent!1 And the sons of mat­ter never re­al­ized it!”

“They never saw the con­nec­tion be­tween the philoso­pher’s stone and .”

“For to­mor­row, I’ll pre­pare a mys­ti­cal in­ter­pre­ta­tion of the phone book.”

The acute reader will be ei­ther hor­ri­fied or amused by the fore­go­ing. Some­times the trans­lat­ing is self­-con­sciously void of any truth, and be­ing used solely di­dac­ti­cal­ly; no-one read­ing through the te­dious al­le­gories of will se­ri­ously think that the lay­out of a room ‘re­ally’ has any­thing to do with Protes­tant Chris­tian­i­ty. But then did­n’t the read­ers of the past who made it a best-seller which every Eng­lish and Amer­i­can fam­ily had a copy of (sit­ting next to their Bible) take it quite se­ri­ous­ly? Was­n’t it a com­mon­place of older the­o­log­i­cal thought that every­thing in the Bible had—at the very least—2 mean­ings (such as the ex­o­teric and es­o­ter­ic)? Why is it a bad in­ter­pre­ta­tion?

Telling the good from bad

But some­times they are clearly wrong and sense­less (such as in­ter­pret­ing through quan­tum me­chan­ic­s), but the au­thor plows on­ward con­vinced he is en­gaged in valu­able in­ter­pre­ta­tion, and other times they are dan­ger­ously close to be­ing plau­si­ble (Old Tes­ta­ment ethics & in­junc­tions for mod­ern life, or per­haps eco­nom­ic­s—Key­ne­sian or Aus­tri­an). How do we know what is a valid trans­la­tion, when there is a real ?

I sug­gest we can test iso­mor­phisms by see­ing whether the same ma­nip­u­la­tions on the same start­ing points give us the same re­sults. The more such sim­i­lar­i­ties there are, the more sim­i­lar the sys­tems are; the more analo­gies can be trust­ed. When all such ma­nip­u­la­tions co­in­cide, then we can call the 2 sys­tems the same.

Unary versus Decimal

Here’s an ex­am­ple of what I mean. Sup­pose we had in­vented the dec­i­mal num­ber sys­tem, and also an unary sys­tem. Some­times one sys­tem is more con­ve­nient than the oth­er—dec­i­mal’s great for mul­ti­pli­ca­tion & di­vi­sion, but an unary sys­tem can be phys­i­cally in­stan­ti­ated with sticks or peb­bles and worked with in the dark. You no­tice that the 2 sys­tems seem to have a lot of shared traits, and work­ing in one is a lot like work­ing in the oth­er; in­deed, you hap­pen to’ve for­mal­ized your dec­i­mals and have put a lot of effort into prov­ing var­i­ous the­o­rems about them—­would­n’t it be nice if you could eas­ily trans­late them into the­o­rems also about your new unary sys­tem? Per­haps there are good analo­gies be­tween the sys­tems.

We can’t be sure a pri­ori that they’re just the same, that they’re both num­ber sys­tems and have done with it. func­tion differ­ently from the , which are very differ­ent from the nat­ural num­bers. Or, an­other ex­am­ple might be if we add 2 ap­ples to­geth­er, we have 2 things; but if I add 2 pails of liq­uids to­geth­er, I have only 1 wa­ter—it’s the vol­ume that in­creas­es, not the num­ber of com­po­nents.2

So if we were in­ter­ested in show­ing a good trans­la­tion be­tween unary and dec­i­mal, what would this even mean? Well, it would mean that a prop­erty holds: if we take a sys­tem as a sin­gle func­tion, ‘round-trip’ means we’re ask­ing for a be­tween the in­puts and out­puts of the 2 func­tions. For ex­am­ple, we can turn a dec­i­mal into an unary and then back again into the orig­i­nal, and vice-ver­sa. If we pre­fer to see our sys­tems as lit­tle ma­chines or , we’re defin­ing their equal­ity as a .

Hacking the code

OK, so how can we show that? Let’s do a lit­tle Haskell pro­gram­ming.

Translating back and forth

Unary num­bers as we know are just de­fined as a se­quence of an ar­bi­trary to­ken; ob­vi­ously the num­ber of these to­kens, the length of the se­quence, is its nu­mer­i­cal val­ue. So if we de­fine a unary type which is just a list of some ar­bi­trary mark­er, to turn it into a dec­i­mal, we just get its length. And we do the op­po­site—we ask for a list of length n for the num­ber n. The code:

type Unary = [()]
unaryToDecimal :: Unary -> Int
unaryToDecimal = length

decimalToUnary :: Int -> Unary
decimalToUnary a = replicate a ()

And our prop­erty is that Dec­i­mal → Unary → Dec­i­mal is a loss­less trans­for­ma­tion, as is Unary → Dec­i­mal → Unary. Let’s ex­press these as prop­er­ties (QuickCheck does­n’t pro­vide for­mal proofs, but it will test ran­dom in­puts look­ing for dis­proofs of the prop­er­ty):

udProp x = x>=0 ==> -- discard all non-natural integers
                unaryToDecimal (decimalToUnary x) == x
duProp x = decimalToUnary (unaryToDecimal x) == x

QuickCheck duly ver­i­fies that these two prop­er­ties were true for all the cases it de­vised.

Check addition

Now let’s tackle a more in­ter­est­ing case. A map­ping from just items in one sys­tem to items in an­other sys­tem is bor­ing and not very valu­able. What would be more valu­able is if we knew some things like ad­di­tion were the same!

So here our prop­erty is that if we trans­late 2 num­bers into Unary and add them and trans­late the re­sult back into Dec­i­mal, we get the same num­ber as we would have in Dec­i­mal adding.

First, what is adding in unary? As each ‘num­ber’ is a list of dis­crete el­e­ments, we can as­sume, I think, that con­cate­nat­ing the 2 lists to­gether is enough. Haskell is nice enough to let us de­fine + on lists if we ask po­lite­ly:

{-# LANGUAGE TypeSynonymInstances #-}

type Unary = [()]

instance Num Unary where
    (+) = (++)
-- We reuse the + defined on Ints, of course

This seems in­tu­itively right. If ||||→4, and |||||→5, and 9→|||||||||, then the ob­vi­ous way from |||| and ||||| to ||||||||| is to smash them to­geth­er. (Is in­tu­ition not good enough a jus­ti­fi­ca­tion? Well, it’s sim­ple; and it’s not like all the other pos­si­ble op­er­a­tors for im­ple­ment­ing ad­di­tion in unary have any bet­ter claim to our at­ten­tion. The ul­ti­mate jus­ti­fi­ca­tion is whether it work­s.)

So two prop­er­ties looks like:

unEqualDec x y = (x>=0 && y>=0) ==> x+y == unaryToDecimal ((decimalToUnary x) + (decimalToUnary y))
decEqualUn x y = x+y == decimalToUnary ((unaryToDecimal x) + (unaryToDecimal y))

QuickCheck again will tell us that they pass the test­cases it de­vised.

Suc­cess? Not quite.

Essential vs accidental

We can think of other prop­er­ties that dec­i­mals have, but which unary can’t. For ex­am­ple, one can note that (, , etc.)

How would we ex­press this in unary? The key is that we’re speak­ing about 0—and yet unary has no 0! That’s part of the de­fi­n­i­tion, for if it had one sym­bol for noth­ing­ness, and an­other sym­bol for some­thing, then it’s a bi­nary num­ber sys­tem and not unary. That’s why we’ve dealt with nat­ural num­bers through­out: zero is present in unary by the ab­sence of any unary num­ber at all. There is no nam­ing of it, no in­di­rec­tion that al­lows us to speak of or men­tion it. We can’t say any­thing like ‘if 0 is in the ones place, then adding the lead­ing nu­meral gives us a ty­po­graph­i­cal du­pli­ca­tion’. Sup­pose we tried some con­torted scheme in­volv­ing di­vi­sion by 10; but would this work when we try to find an iso­mor­phism to, say, or ?

If this ex­am­ple does­n’t sat­isfy you, con­sider other pos­si­ble prop­er­ties. How about prop­er­ties based on how many vow­els the Eng­lish words of a num­ber have? We can get sil­lier, but I think the point is clear: there are ‘es­sen­tial’ prop­er­ties and ‘ac­ci­den­tal’ ones. The vow­el-count of ‘five’ is ac­ci­den­tal, but some­thing like is es­sen­tial.

When the sys­tems are for­mal­ized such that we can ask for their bi­jec­tion or their bisim­u­la­tion, then we have well-de­fined ways to see whether es­sen­tial prop­er­ties hold. (Peter de Blanc if an agent has a sim­ple model of the world, it can up­date its model based on sur­pris­ing ob­ser­va­tions by pick­ing a new, more com­plex mod­el, which ac­counts for all past ob­ser­va­tions but differs min­i­mal­ly—as de­fined by —from the pre­vi­ous mod­el.)

How to know when some­thing is es­sen­tial, and when the prop­erty is ac­ci­den­tal, is un­clear, and this is be­cause, as Alan J. Perlis re­minds us, “One can’t pro­ceed from the in­for­mal to the for­mal by for­mal means.”

Appendix: the code

A few notes on the code:

  • we have that LANGUAGE pragma there so we can de­fine our own ad­di­tion on lists (as the de­fault List type does­n’t de­fine a silly thing like ad­di­tion); - the very acute Haskeller will be ask­ing him­self, “why not de­fine the ab­stract struc­ture as that of a (see Da­ta.­Monoid3), and get list con­cate­na­tion & in­te­ger ad­di­tion for free?” That’s be­cause while there’s only one sen­si­ble monoid on lists, there are 2 for in­te­gers—Sum and Product.
  • we’re ac­tu­ally us­ing Ints here which al­low for both neg­a­tive and pos­i­tive in­te­gers, while unary no­ta­tion is usu­ally just for the (and the en­cod­ing of neg­a­tive num­bers into unary is te­dious), so we gen­er­ally ig­nore the pos­si­bil­ity of neg­a­tive num­bers ex­cept our test prop­er­ty, unEqualDec, which just dis­cards any neg­a­tive num­bers.
  • we don’t de­fine a newtype or data for Unary be­cause that’s overkill

The con­sol­i­dated code, with type sig­na­tures and a test har­ness:

{-# LANGUAGE TypeSynonymInstances #-}
import Test.QuickCheck

type Unary = [()]

instance Num Unary where
    (+) = (++)

unaryToDecimal :: Unary -> Int
unaryToDecimal = length

decimalToUnary :: Int -> Unary
decimalToUnary a = replicate a ()

-- Roundtrip: number->number
udProp :: Int -> Property
udProp x = x>=0 ==> -- discard all non-natural integers
                unaryToDecimal (decimalToUnary x) == x

duProp :: Unary -> Bool
duProp x = decimalToUnary (unaryToDecimal x) == x

-- Roundtrip: addition->concatenation
unEqualDec :: Int -> Int -> Property
unEqualDec x y = (x>=0 && y>=0) ==> x+y == unaryToDecimal ((decimalToUnary x) + (decimalToUnary y))

decEqualUn :: Unary -> Unary -> Bool
decEqualUn x y = x+y == decimalToUnary ((unaryToDecimal x) + (unaryToDecimal y))

-- test harness
test :: IO ()
test = do quickCheck udProp
          quickCheck duProp
          quickCheck unEqualDec
          quickCheck decEqualUn

  1. “ye gods, how much dark night there is / in mor­tal breasts!” .↩︎

  2. To those who ar­gue that the num­ber of atoms dou­bled when I added the 2 pails to­geth­er: what if the 2 liq­uids have differ­ent den­si­ties?↩︎

  3. apfel­mus’s fin­gertree tu­to­r­ial also ably cov­ers monoids.↩︎