Lojban, Math, mekso, and bridi cmaci

Context And Goals

This essay was written at least 4 years ago (it is Nov 2010 as I write this) on my old PalmOS device. It is poorly formatted and generally needs some re-working. If you see this note, feel free to complain.

The basic point here is simple: mekso/MEX in Lojban, at least past the "1 + 1 = 2" level or so (i.e. everyday arithmetic) is a piece of crap, and you should just use mathematical bridi instead.


Through a number of discussions about and extensive attempts to use mekso, I have come to the conclusion that they don't work. ga'i I believe myself to have used non-trivial mekso more than any other Lojbanist to date, so when I say they don't work, I'm speaking from experience. sa'e They don't serve the purposes they were designed for particularily well, and Lojban would be better off without them. I repeat those goals here, from chapter 18 of the reference grammar:

Design Goals Of Lojban MEX

<quote> Its formal design goals include:

1) representing all the different forms of expression used by mathematicians in their normal modes of writing, so that a reader can unambiguously read off mathematical text as written with minimal effort and expect a listener to understand it;

2) providing a vocabulary of commonly used mathematical terms which can readily be expanded to include newly coined words using the full resources of Lojban;

3) permitting the formulation, both in writing and in speech, of unambiguous mathematical text;

4) encompassing all forms of quantified expression found in natural languages, as well as encouraging greater precision in ordinary language situations than natural languages allow. </quote>

How Lojban MEX Lives Up To Its Design Goals

In fact, it is not fair to say that mekso have failed at all of their design goals, because it's simply not true: goals 2, 3 and 4 are covered excellently by mekso. However, and this is the key point, *we don't need mekso for those goals*. I will now cover each goal briefly in turn:

Goal 1

Goal 1 is the total failure point, and the motivation for the essay. It is absolutely not the case that a written equation of any complexity can be turned into mekso with "minimal effort". In fact, I don't think that anyone has ever done it successfully on the first try (i.e. without parse-mandated revisions).

Some of this is due to the precedence issue, but I agree with the CLL that fixing that is the wrong solution: whatever we pick will be wrong at least some of the time if our goal is that mekso should act like mathematical symbols.

Some of the problem may be lack of familiarity with mekso. The idea of a subset of the language being almost as hard to get comfortable with as the entire rest of the language wouldn't bother me if it had any benefit, but I can't see any except syllable count. Certainly a serious equation written out with mekso bears only a slim relation to the original symbols, so that not a plus. As for syllable count, my tests with non-trivial examples have yet to show even a 30% improvement.

Representing different forms of mathematical expression is a place where mekso is ahead os any trivial changes to regular Lojban bridi in one, and only one, respect: Reverse Polish Notation. Whether supporting RPN in a *spoken* language is a good thing or not is, to put it mildly, arguable (when was the last time you heard mathematicians speaking RPN at each other? I've a B.Math and my answer is "Never, except when explaining what RPN is to someone."). In addition, whether mekso *itself* supports RPN in any useful sense is arguable (2 arguments exactly is... sad). None the less, RPN is something bridi math doesn't have, and a possible solution consumes a large portion of this essay.

Goal 2

Providing a vocabulary of commonly used mathematical terms is good, and mekso succeeds, but all of the terms and operations mekso has, there are gismu or simple lujvo for. A few more math gismu would be nice, but that's no big deal: gismu space is huge. Certainly incorporating new terms is much easier without the overhead mekso imposes for importing brivla.

Goal 3

If we can't formulate unambiguous mathematical texts using bridi, we might as well give up on Lojban now.

Goal 4

For Goal 4, the CLL gives a few examples of "folk" numbers and arithmetic. These can all be easily encompassed without resorting to mekso.

The Shape Of bridi mekso (Goal 1)

For the most part, brime'o work just like you'd expect. For example, "1 + 1 = 2" is "li re sumji li pa li pa". If you want to have something more like an equation, try this: "le sumji be li pa bei li pa cu du li re" (the "cu" really is required ther, but you can put the "du" out front to avoid it).


The nesting of be/bei/be'o gets a bit confusing after a while, and in some cases wastes syllables. For that reason, I've coined ni'ai as a member of NU to mean something like "x1 is the numerical result of calculation bridi under system / interpretation x2". Eimi (other name?) has pointed out that this is identical to an idea that he has had, which is "x1 is the result / value / truth of the first empty / marked place in bridi under system / interpretation x2" (my defintion). Basically, "le ni'ai brivla x2 x3 ..." == "le bridi be x2 bei x3 ...": it's a transform of le + be/bei/be'o into a NU structure without the be/bei/be'o.

I've also been using ce'u as the marker for which place to extract a value from, but I'm pretty sure this is wrong; ce'u seems more like something to be used in function definition, although I've been using xy and so on for that purpose. I think there probably needs to be something that is to output what ce'u is to input, but I'm going to keep using ce'u until someone who isn't as easily confused by ce'u as me takes a look.

It is possible that with an output marker, du'u can be shoehorned to this purpose, I'm not sure.

So with ni'ai, we get structures like "sumji ny le ni'ai pilji li re li pai li xy" for "n + (2 * pi * x)".

As you can see, you spemd some syllables on ni'ai, be/bei/be'o, and li. There's little or no loss due to using brivla, as most (all?) of the mekso operators are 2 syllables. There seem to be about the same number of boi required in both methods.

To li Or Not To li

Grammatically, in something like "x = t + 2" it is perfectly legal to do either "li xy" for the first part or just "xy". In the first case, we are clearly talking about the variable x. In the second case, we are using the pro-sumti xy to stand in for the variable x. The second case is therefore somewhat ambiguous; many things start with "x". However, in mathematical texts confusion is unlikely to result, so it probably doesn't matter very much, just be aware of it. It sometimes saves some syllables, but not always (I prefer "sumji xy li ty" to "sumji xy boi ty", but that's a stylistic preference).

Folk Math (Goal 4)

Here it suffices to simply list the CLL examples and perform them with bridi.


Obviously, na'u is no problem, since it's for importing selbri.

The CLL's example 18.1 is "li na'u tanjo te'u vei pai fe'i re ve'o du li ci'i" for "tan(pi/2) = infinity". In bridi math this might be: "le tanjo be le se pilji be li pau bei li re du li ci'i". These are exactly the same number of syllables.


The CLL's example 18.2 is "li ni'e ni clani te'u pi'i ni'e ni ganra te'u pi'i ni'e ni condi te'u du li ni'e ni canlu" which is "Length � Width � Depth = Volume". A bridi math version, pretending we know what "ni" means and that we have an infinite argument pilji: "le ni'ai pilji le ni clani kei le ni ganra kei le ni condi cu du le ni canlu". There's a clear savings with bridi math here; the bridi version is 25 syllables, the mekso version 29.


The CLLs example 18.3 is "li mo'e re ratcu su'i mo'e re ractu du li mo'e vo danlu" which is "2 rats + 2 rabbits = 4 animals", which is just "re ratcu re ractu cu te sumji vo danlu". Again, bridi math wins: 13 vs. 20.


The CLL's example 18.4 is "mi viska vei mo'e lo'e lanzu ve'o cinfo", or "I see a pride of lions." Pretending I know what the x1 of klani means, that's "mi viska le cinfo poi klani lo'e lanzu".

Odds And Ends

There are a few other issues that need to be covered.

Mathematical functions can be written out using me, so "f(x) + 1" is "sumji li pa le me fy be xy" or "sumji li pa le ni'ai me fy li xy" or similar.

We need a way to represent functions as ideas rather than calculations, although we might not make the distinction very often. I suggest si'o for this purpose: "le si'o sumji li pa li pa" is "(the formula / the idea of) one plus one", "le ni'ai sumji li pa li pa" is "two", loosely speaking. We also need a way to talk about the symbols and words themselves. For the time being, la'e lu ... li'u will do nicely, although a NU might be nice. It's also possible that "se du'u math" is correct, but I'd like others' opinion on that. Combining these we have "zoi zoi 1 + 1 zoi poi se fanva fu la'e lu sumji li pa li pa li'u poi panra le si'o sumji li pa li pa cu sinxa le ni'ai sumji li pa li pa kei ku? po'u li re".

I have no idea what, if any, difference lo vs. le makes in front of ni'ai. Suggestions welcome.

RPN Issues

Note: The solution for RPN I propose below is not in any way limited to math; it's a general afterthought NU system. Whether that's a good idea or not is debatable.

Reverse Polish Notation is also know as postfix, and looks like this (assuming binary + and using "," to seperate arguments): "1,2+3+" for "1 + 2 + 3". RPN is the one major capability that mekso has that bridi math doesn't. It's worth noting that mekso's RPN is rather half-assed, because all operators have exactly two arguments. Even if it was full-assed, I have yet to talk to anyone who thinks that having RPN in Lojban is important in any way; RPN is for talking to calculators, not people. Therefore, please don't take the fact that I've put a lot of effort into making RPN work in bridi math as any sort of support for the idea of having RPN in the language: I think it sucks, and we should drop it.

For those of you who are wondering why anyone would ever bother with RPN at all, the reason is that you never need brackets to indicate nesting. How that works is beyond the scope of this essay; ask wikipedia.

Enough preamble. The problem with RPN outside of a calculator is that RPN requires that when we see an operator we pull off the stack exactly as many arguments as that operator requires, but in Lojban bridi skip arguments all the time, so RPN in the normal sense is totally infeasible; this is the reason for the 2 argument (and assiociated null operator and operand) hack in mekso, but that seems rather infeasible in bridi, so I've gone in a different direction.

Argument Consumption Markers

Instead of limiting the number of arguments (i.e. sumti) we can state how many we want to use. To fully simulate RPN we need to flip ni'ai backwards, to. This looks very, very strange to the practiced Lojbanist, but I belief it to be PEG parseable. "li pa li re te sumji gi'ui ni'ai le li ci se pilji" is "(1 + 2) * ci". The word gi'ui must come after a bridi. It takes two words after it: a NU and a LE. The expression evaluates to a sumti made from the LE, the NU, and the bridi, in that order. In other words: "bridi NU LE" == "LE NU bridi".

Please note that gi'ui and all its friends work with *any* NU, so it is of general utility. If you want to say "I went to the store at the same time as you", but you don't plan the sentence out properly, you might find yourself at "mi klama le zarci" and realizing that you wanted to say "le nu mi ...". In this system you can recover by then saying "gi'ui nu le cabna le nu do klama".

The word gi'ui is only one of a small series of words with the same basic purpose. It grabs the preceding bridi, including all arguments before the selbri. To create certain arrangements of nesting, however, we need versions that grab fewer front arguments: 0 (gi'ai), 1 (gi'au), 2 (gi'oi). For more than 2 but less than all, follow gi'oi with xei. For example, "(1 2 (3 4 5)+ 6 7)+ 8+ 9 neg +" (where "neg" is unitary negation) becomes "li pa li re li ci li vo li mu zilsumji gi'oi xei ni'ai le li xa li ze zilsumji gi'ui ni'ai le li bi zilsumji gi'ai ni'ai le li so fatne? gi'au ni'ai le zilsumji gi'oi ni'ai le", where "zilsumji" is defined as "infinite sumji, output last".

Clumsy as hell, but it *does* work, and has at least some general (i.e. non-mathematical) utility.

Subtraction And Division

While I myself am inclined to grab new gismu for subtraction and division, it is possible to use sumji and pilji for this purpose. Please note that, as with all of this essay, we are pretending we have an infinite place version of both. Besides potentially being useful, this mini-proof is a good example of how to think about bridi math.

Symbolic Proofs

The key insight is that no matter where you put it, the x1 of sumji / pilji is the only special place, in that it's the result of the summation. Therefore, we start with whatever used to be the x1 place on the left of the equals and work until the order matches the SE transform we've created.

se pilji

x2 = x1 * x3 * x4 * ... x2/x1 = x3 * x4 * ... x1/x2 = 1 / (x3 * x4 * ...) x1 = x2 / (x3 * x4 * ...) x1 = x2 / x3 / x4 / ...

@3 te pilji

x3 = x1 * x2 * x4 * ... x3/x1 = x2 * x4 * ... x1/x3 = 1 / (x2 * x4 * ...) x1 = x3 / (x2 * x4 * ...) x1 = x3 / x2 / x4 / ...

bridi mekso nibli

ra'u le pa moi te gismu be fi zo pilji .o nai zo sumji cu po'o frica lo drata te sumji lo ka ce'u jalge .i se ki'u bo va'o tu'a le cmavo be zo se le sumti poi pa moi se cau le se zei cmavo cu pa mei zunle zo du .i mi'o galfi te zu'e le sumti porsi cu mapti le se zei cmavo

se pilji

(pretend we have other word for division?) (is xy re legal?)

xy xi re du le ni'ai pilji li xy xi pa li xy xi ci li xy xi vo li'o x2 = x1 * x3 * x4 * ... x2/x1 = x3 * x4 * ... x1/x2 = 1 / (x3 * x4 * ...) x1 = x2 / (x3 * x4 * ...) x1 = x2 / x3 / x4 / ...

@3 te pilji

x3 = x1 * x2 * x4 * ... x3/x1 = x2 * x4 * ... x1/x3 = 1 / (x2 * x4 * ...) x1 = x3 / (x2 * x4 * ...) x1 = x3 / x2 / x4 / ...

Word Issues


It is pretty difficult to do bridi math without infinte place pilji and sumji, but that's a pretty minor change. Having gismu for infinite-place subtract and divide is a nice-to-have, just to save syllables and use in lujvo.

I'm really unsure what the x1 of klani means. It seems unnecessarily hard, therefore, to say "the number of books on the table is 5" without using quantifiers (or kancu, which is distastefully agentive).

Other than that, I haven't found anything that lujvo can't handle.

What To Do With mekso cmavo

Dump the whole lot, says I. That is, make them available for re-use. As far as I know, only Nick Nicholas and I have ever seriously used them, and neither of us have used them very much.

In particular, it would be awfully nice for bridi math if we could use vei for "le ni'ai". I've also thought that ve'o for "gi'ui le ni'ai" would make RPN more useful, but that has some issues in itself.

Examples Of bridi math

The dots are syllable counts; I push the button for each syllable as I read.

-GOAL: show examples in similar style for logic and other notations

-do ex. programming, function definition in particular


-plus or minus: absolute value: nacnilbra

-subset: klesi

-expected: mathematical expextation is tricky, because the expected value of a fair die roll is 1 + ... 6 / 6 = 3.5, which appears on no die, so kanpe is right out. It's really the average across possible outcomes. Something with cnano to make it "average" in this sense ("mean"?) should do nicely.

-mean: selpi'ina'o: c1=sp1 is the mean / numeric average obtained by adding up and dividing the total by the count of members in set c3 — c2 is "numeric", c4 is the standard mean calculation; selpilji is in there descriptively and so the other places are lost

-median: mijna'o: c1=m1 is the median value / numeric value in set c3=m2 such that an equal number of set elements are >= it and <= it.

-expected value: selpi'ina'o le cumki ni'ai <calculation>, assuming ni'ai means something like "mathematical result of calculation..."


Example 1: Sigma Summation


f( 1 , 2 ) = sum from 1 to 5 of g of x, pretending there's no si'i (or could use whatever the mult sum is)

bridi mekso

le ni'ai me fy li pa li re du vei kupsumji le ni'ai me gy boi xy kei li pa li mu

Old mekso

li ma'o fy boi pa boi re du li na'u kupsumji vei ma'o gy boi xy ve'o pa boi mu

Example 2: Set Theory


A inter B subs A subs A union B

bridi mekso

This is very likely how one would do this with old mekso, too.

.a bu ku'a by cu klesi .a bu .i ri klesi .a bu jo'e by

Example 3: Quadratic Formula


Iff ax2 + bx + c = 0, then x = ( -b � sqrt(b2 - 4ac) ) / 2a

bridi mekso

go le ni'ai sumji cy le pilji be by bei xy le pilji be .a bu bei le tenfa be xy bei li re du li no gi xy du le ni'ai te pilji le pilji be li re bei .a bu le sumji be li ni'u by bei le ni'ai li re te tenfa ce'u le ni'ai se sumji le tenfa be by bei li re le pilji be li vo bei .a bu bei cy — inf pilji/sumji, ordered for length ..............................................................................................

Old mekso

go li .abu bi'epi'i vei xy. te'a re ve'o su'i by. bi'epi'i xy. su'i cy. du li no gi li xy. du li vei va'a by. ku'e su'i ja vu'u fe'a vei by. bi'ete'a re vu'u vo bi'epi'i .abu bi'epi'i cy. ve'o ku'e ve'o fe'i re bi'epi'i .abu — trying to preserve form .................................................................................

Example 4: From Feymnan (sp?)


r = I(xN)/xN ~= log_2(n)/N = I(N)/N

bridi mekso

ry du le ni'ai se pilji le me ga'e .i bu bei le pilji be xy bei ga'e ny le pilji be xy bei ga'e ny .i le se go'i cu simsa le ni'ai te pilji ga'e ny le dugri be ny bei li re .i le se go'i du le ni'ai se pilji le me ga'e .i bu be ga'e ny ga'e ny .................................................................................... 84

Old mekso

ry du li vei ma'o .i bu boi xy pi'i ga'e ny ve'o vu'u vei xy pi'i ga'e ny .i le se go'i cu simsa li vei de'o re boi ny ve'o vu'u ga'e ny .i le se go'i du li vei ma'o .i bu boi ga'e ny ve'o vu'u ga'e ny — could almost certainly be syllabically optimized ............................................................................. 77

bridi mekso With Magic vei

ry du vei se pilji vei me ga'e .i bu vei pilji xy boi ga'e ny vei pilji xy boi ga'e ny .i simsa le se go'i vei te pilji ga'e ny vei dugri ny li re .i du le se go'i vei se pilji vei me ga'e .i bu ga'e ny kei ga'e ny — vei == le ni'ai, no be/bei ...................................................................... 71

Example 5: From Feynman, Again


<I> = N * sigma i=1 to M of (-p_i * log_2(p_i)) — I is info is message, <I> is expected info

Exmaple 6: Still More Feynman


f(t) = (1/2pi) * integral -W(v) to W(v) of g(omega) * e^( -2pi * I * omega * t ) d-over omega

Example 7: Umm, Tensors, Or Something


inner-product( phi_1 t-prod phi_2 , psi_1 t-prod psi_2 ) = in-prod( phi_1 , psi_1 )_1 * in-prod( phi_2 , psi_2 )_2 for all phi_1 , psi_1 elements of H_1 and phi_2 , psi_2 elements of H_2

Example 7: Programming: Scheme


(define (fib n) (fib-iter 1 0 n))

(define (fib-iter a b count) (if (= count 0) b (fib-iter (+ a b) a (- count 1))))

Example 7: Programming: C


int fact( int n ) { int result=1;

for( i = n; i--; i > 1 ) { result *= i; }

return result; }

RPN Nesting Notes

-is: mi klama gi'ai nu le do klama gi'ai nu le cabna == le nu mi klama kei le nu do klama kei cabna OR == le nu do klama le nu mi klama kei kei cabna -with regular RPN, this is solved by strict place structure requirements -no Lojban solution has yet presented itself -ex: (3 (1 1 2 +) 4 ((2 5 +) (2 7 3 *) +) *) -hell, just try: 1 7 (2 5 3 +) 4 * -the problem may *always* be insoluble with variable numbers of args... Yeah, pretty sure. Without parens or other tricks, anyways -we could mark how many arguments we're consuming. Parseable? Certainly parseable if we set a finite limit. Getting a bit pointless? -just use the ".i le ni'ai go'i" trick, but that gets complicated with multiple args

-argument consumption markers -pretend zilsumji takes inf args, and last arg is always result -(1 2 (3 4 5 +) 6 7)+ 8 + 9 neg + -have words for 0 (gi'ai), 1 (gi'au), 2 (gi'oi) and addt'l (xei), and all (gi'ui) -li pa li re li ci li vo li mu zilsumji gi'oi xei ni'ai le li xa li ze zilsumji gi'ui ni'ai le li bi zilsumji gi'ai ni'ai le li so fatne? gi'au ni'ai le zilsumji gi'oi ni'ai le -seems to work -a bit clumsy, but no worse than 2 args required

Old Notes

-NU reverser? helps with RPN, also of general utility: mi klama lo nu gi'ai cabna do klama lo nu gi'ai -what it does is "everything preceding goes in the NU just declared" -this allows RPN: li'ai li pa li pa ziljmina li'ai gi'ai li pa ziljmina -li pa li pa selsumji le ni gi'ai li pa selsumji le ni gi'ai -need some clarity in "everything". probably "sentence". jcowan mentioned the gua!spi's version is like .i, which is prbably almost TRT -NU uses subsentence, which is sentence + optional prenex -it gets used in tanru-unit, which seems like it won't work here - terms (or whatever's at the front of sentence) = ... / subsentence LE? tanru-unit(??) NU gi'ai - BOGGLE: could just allow multiple selbri, if 2nd and up start with NU -no, bad lookahead on say "broda nu lo brode" -kpried's gi'ai: -li pa li pa te sumji gi'ai nu'ui le = le nu'ui li ... -li pa li pa te sumji gi'ai le = le sumji be ... (first unfilled place) -broda gau gi'ai lo brode = lo jai gau broda cu brode

General Notes

-GOAL: show examples in similar style for logic and other notations -replace mekso with bridi, but need some things -need a NU for math -use ca'e? for output, as opposed to symbols?: li pa su'i pa du li re =� li? ni'ai sumji li pa li re du li re == li? sumji be li pa bei li pa du li re - ni + ce'u works, although not with li, but that's probably OK — kpried doesn't like ni; ni'ai for now - le/lo + se to output place also - lo / le distimction might have interesting side effects? - so: li pa su'i pa du li re == le ni ce'u sumji li pa li re du li re == le sumji be li pa bei li pa du li re - need something else for theorem: su'u seems about right - need something else for symbols. Perhaps steal me'o? Also: le sinxa be lo su'u sumji li pa li pa. Or maybe just use la'e lu...li'u? -la'a expand li to include selbri - would probably need a terminator -not sure it buys us anything exvcept syllables - how deal with leading args? "li re sumji li pa li pa"? "li li re sumji"?

-nesting, either with be or ni'ai: li pa su'i vei pa su'i pa du li ci = li ni'ai li pa ziljmina li ni'ai li pa ziljmina li pa kei ca'e du li ci = li te ziljmina be li pa bei li te ziljmina be li pa bei li pa du li ci -gets a bit hairy; perhaps better to make li'ai = li ni'ai and ma'e = la'e ni'ai or something -save us nothing over le ni -sumji: le ni sumji li pa le ni sumji li pa li pa — le sumji be li pa bei le sumji be li pa bei li pa

-would want new gismu, la'a also try to grab some single syllable cmavo -vei = li'ai (= le ni), ve'o = vei gi'ai -MOI for function names; fy moi'oi -what else turns things into selbri? -me - will it work here? - should


-disads: extra syllables. 1? + 1 for each bare number + 2? for each nesting (RPN or not) -adv: less things to memorize; ordering of bridi well understood -mekso fails at goal #1: if you read off a mathematical expression into mekso, you will *not* get the same calculation without a *lot* of effort -RPN is lost here (but see the consumption markers in the RPN notes), because RPN requires a fixed number of arguments, with the number known in advance, but the Lojban RPN implementation has always been a hack, because of the "exactly two arguments" thing.

Show PHP error messages