The Universe of Discourse


Wed, 12 Aug 2015

Another solution to Tuesday's git problem

On Tuesday I discussed an interesting solution to the problem of turning this:

  no X              X on

    A --------------- C

into this:

  no X     X off    X on

    A ------ B ------ C

Dave Du Cros has suggested an alternative solution: Make the changes required to turn off feature X, and commit them as B, as in my solution:

  no X     X on     X off

    A ------ C ------ B

Then use git-revert to revert the changes, making a new C commit in the right place:

  no X     X on     X off     X on

    A ------ C ------ B ------ C'

C' and C have identical trees.

Then use git-rebase to squash together C and B:

  no X              X off     X on

    A --------------- B ------ C'

This has the benefit of not requiring anything strange. I think my solution is more general, but it's also weird, and it's not clear that the increased generality is useful.

However, what if there were a git-reorder-commits command? Then my solution would seem much less weird. It would look like this: create B, as before, and do:

    git reorder-commits 0 1

This last command would mean that the previous two commits, normally HEAD~1 and HEAD~0, should switch places. This might be a useful standard tool. Or similarly to turn

    B -- 3 -- 2 -- 1 -- 0

into

    B -- 2 -- 0 -- 3 -- 1

one would use

    git reorder-commits 2 0 3 1

I think git-reorder-commits would be easy to implement, as a loop atop git-commit-tree, as in the previous article.

[ Addendum 20200531: Curtis Dunham suggested a much better interface to this functionality than my git-reorder-commits proposal. ]


[Other articles in category /prog] permanent link

A message to the aliens, part 2/23 (arithmetic)

Earlier articles: Introduction Common features Page 1 (numerals)

This is page 2 of the Cosmic Call message. An explanation follows.

Reminder: the previous page explained the ten digits:


0

1

2

3

4

5

6

7

8

9

This page, headed with the glyph for “mathematics” , explains the arithmetic operations on numbers.

The page is in five sections, three on top and two below.
The first four sections explain addition , subtraction , multiplication , and division . Each is explained with a series of five typical arithmetic equalities. For example, !!4\times 3= 12!!:

The subtraction sign actually appeared back on page 1 in the Mersenne prime !!2^{3021377}-1!! .

The negative sign is introduced in connection with subtraction, since !!1-2={}^-1!!:

Note that the negative-number sign is not the same as the subtraction sign.

The decimal point is introduced in connection with division. For example, !!3\div 2 = 1.5!!:

There is also an attempt to divide by zero:

It's not clear what the authors mean by this; the mysterious glyph does not appear anywhere else in the document. What did they think it meant? Infinity? Indeterminate? Well, I found out later they published a cheat sheet, which assigns the meaning “undetermined” to this glyph. Not a great choice, in my opinion, because !!1÷0!! is not numerically equal to anything.

For some reason, perhaps because of space limitations, the authors have stuck the equation !!0-1 = {}^-1!! at the bottom of the division section.

The fifth section, at lower right, displays some nonterminating decimal fractions and introduces the ellipsis or ‘…’ symbol. For example, !!1\div 9 = 0.1111\ldots!!:

I would have put !!2÷27 = 0.0740…!! here instead of !!2\div 3!!, which I think is too similar to the other examples.

The next article, to appear 2015-08-14, will discuss page 3, shown at right. (Click to enlarge.) Try to figure it out before then.


[Other articles in category /aliens/dd] permanent link

A message to the aliens, part 1/23 (numbers)

Earlier articles: Introduction Common features

This is page 1 of the Cosmic Call message. An explanation follows.

This page, headed with the glyph for “mathematics” , explains the numeral symbols that will be used throughout the rest of the document. I should warn you that these first few pages are a little dull, establishing basic mathematical notions. The good stuff comes a little later.

The page is in three sections. The first section explains the individual digit symbols. A typical portion looks like this:


•••• ••• = 0111 = 7

Here the number 7 is written in three ways: first, as seven dots, probably unmistakable. Second, as a 4-bit binary number, using the same bit symbols that are used in the page numbers. The three forms are separated by the glyph , which means “equals”. The ten digits, in order from 0 to 9, are represented by the glyphs


0

1

2

3

4

5

6

7

8

9

The authors did a great job selecting glyphs that resemble the numerals they represent. All have some resemblance except for 4, which has 4 horizontal strokes. Watch out for 4; it's easy to confuse with 3.

The second section serves two purposes. It confirms the meaning of the ten digits, and it also informs the aliens that the rest of the message will write numerals in base ten. For example, the number 14:


••••• ••••• •••• = 14

Again, there are 14 dots, an equal sign, and the numeral 14, this time written with the two glyphs (1) and (4). The base-2 version is omitted this time, to save space. The aliens know from this that we are using base 10; had it been, say, base 8, the glyphs would have been .

People often ask why the numbers are written in base 10, rather than say in base 2. One good answer is: why not? We write numbers in base 10; is there a reason to hide that from the aliens? The whole point of the message is to tell the aliens a little bit about ourselves, so why disguise the fact that we use base-10 numerals? Another reason is that base-10 numbers are easier to proofread for the humans sending the message.

The third section of the page is a list of prime numbers from 2 to 89:


67, 71, 73, 79, 83

and finally the number !!2^{3021377}-1!!

,
!!2^{3021377}-1!!

which was the largest prime number known to humans at the time. (The minus sign and exponentiation notation are explained on later pages.) Why? Again. to tell the aliens about ourselves: here's a glimpse of the limits of our mathematical knowledge.

I often wonder what the aliens will think of the !!2^{3021377}-1!!. Will they laugh at how cute we are, boasting about the sweet little prime number we found? Or will they be astounded and wonder why we think we know that such a big number is prime?

The next article, to appear 2015-08-12, will discuss page 2, shown at right. (Click to enlarge.) Try to figure it out before then.


[Other articles in category /aliens/dd] permanent link