Talk:Two

From Esolang
Jump to navigation Jump to search

Definition

This language is interesting. Assuming I've understood everything correctly, here's my crack at a more rigorous definition.

Def. 1: An I-sequence is an infinite sequence of non-negative integers, or, in other words, a mapping from {0,1,2...} to itself.

Def. 2: If A and B are two I-sequences, A is greater than B iff some element of A is greater than the corresponding element of B and no element of A is less than the corresponding element of B.

Now, let's define the language "Tame Two". It's the same as Two, except for the following:

  • In addition to the usual I/O, it takes an I-sequence as input.
  • The I instruction reads a number from the inputted I-sequence, and adds that number to the current cell.

Def. 3: A Tame Two program P accepts an I-sequence S iff running P with S has the same effect as running P with any I-sequence greater than S.

Now we can define how I works in Two. When I is called, it chooses the smallest number such that the sequence of numbers chosen by I so far is a prefix of some I-sequence that is accepted by the corresponding Tame Two program. It then adds the chosen number to the current cell. The only way this fails is if no I-sequence is accepted. In that case, the I instruction loops forever. Caenbe (talk) 03:46, 9 August 2020 (UTC)