10,951 Pages

I made some changes on R function II, and get this version. The strength still remains the same.

## Definition

### Syntax

Symbol { is called lbrace, with ASCII=123, LaTeX=\{ or \lbrace.

Symbol } is called rbrace, with ASCII=125, LaTeX=\} or \rbrace.

Symbol + is called plus, with ASCII=43.

The brace can be defined as follows:

• String {+m} where "+m" is at the superscript position and m is a nonnegative integer is a brace. This m is called the brace rank of that brace.
• String {A1A2...Ak+m} is a brace iff all the A1, A2, ..., Ak are brace. And its brace rank is m, too.

A separator is a brace with brace rank > 0.

The standard form of R function is nRA1A2...Ak, where -

• n is a positive integer, here called "base number"
• R is a symbol for the function
• All the A1, A2, ..., Ak are braces but not separators. k=0 is allowed too, which means the string after R is empty.

And there're some shorthands:

• The superscript "+0" can be omitted, and the superscript "+1" can be written as "+".
• {+1} can be also written as a comma.

### Main process

Scan and apply rules. Case A1, A2, D and E are terminal, but A3, B and C are not. After you apply a terminal rule, you'll return here, then you can choose any R to start scanning.

Scanning starts at the R symbol. Scan from left to right. Scan braces at the same nested level. Before scanning, set s = 0 (that's for case D).

• Case A: If there's a {},
• ​Case A1: If R is immediately before it, then apply \(nR\{\}\odot=(\cdots(nR\odot) R\odot\cdots) R\odot\) with n \(R\odot\)'s. And return.
• Case A2: If an lbrace is immediately before it, then apply \(\{\{\}\odot\}=\{\odot\}\{\odot\}\cdots\{\odot\}\) with n \(\{\odot\}\)'s (here n is the base number). And return.
• Case A3: If a separator is immediately before it, then apply \(\{\odot\}\{\}=\{\odot\}\{\}\{\odot\}\), add s by 1 then set As = \(\{\odot\}\), then scan inside the first \(\{\odot\}\).
• Case B: If there's a brace neither a separator nor the {}, add s by 1 then set As to that brace, then continue scanning inside it.
• ​Case C: If there's a separator, ignore it and continue scanning.
• Case D: If there's no more braces you can scan, and you meet "+m}" with m > 0,
1. Let brace Ss be such that the rbrace of the "+m}" is the rbrace of it, set t = s
2. Repeat this:
1. Subtract t by 1
2. Let St be the brace such that "nested level of St = nested level of St+1 - 1" and "St+1 is inside St"
3. If t = 1, then break the repeating, or else continue repeating.
3. Set k = m, s(m) = s, B(m) = {+(m-1)}, string X(m) = "{" and Y(m) = "{}+(m-1)}".
4. Repeat this:
1. Subtract k by 1
2. Set s(k) = s(k+1)
3. Repeat this:
1. Subtract s(k) by 1
2. If level of As(k) < level of As(k+1), then break the repeating, or else continue repeating.
4. If level of As(k) < level of B(k+1), then let string P and Q be such that A1 = P As(k)+1 Q, then change the original brace A1 into P X(k+1) As(k)+1 Y(k+1) Q, and return. Or else -
5. If k = 0, then break the repeating, or else -
6. Let string X(k) and Y'(k) be such that Ss(k) = X(k) Ss(k+1) {} Y'(k), set Y(k) = {} Y'(k) and set B(k) = X(k) Y'(k).
5. Let string P and Q be such that Ss(0) = P Ss(1) Q, then apply Ss(0) = P P ... P P Q Q ... Q Q with n P's and n Q's, and return.
• Case E: If there's nothing you can scan, and nothing is after you, change the whole expression into 2^n where n is the base number, and return.

The \(\odot\) can be any string or empty.

### Subrule

It's actually a property of the main process. But it's necessary when comparing levels.

1. \(\{\odot_1\{\odot_2^{+a}\}^{+b}\}=\{\odot_1^{+b}\}\) where a>0
2. AB = B where A and B are separator and level of A < level of B (this one is just an approximation)

### Levels

First, {} has the lowest level, and others have higher level. The same braces have the same level.

Then, we can compare the level of A and B as follows, if there's no separator inside A or B.

• Let A = {A1A2...Ac+a} and B = {B1B2...Bd+b}, where Ai's and Bi's are braces.
• If brace rank of A > brace rank of B then A>B on level; If brace rank of A < brace rank of B then A<B on level. or else -
• Compare levels of Ai's and find highest-level ones - AM. And the same as B.
• If level of AM > BM, then A>B; if AM < BM, then A<B. or else -
• If the amount of AM > BM, then A>B; if the amount of AM < BM, then A<B. or else -
• Delete string after the first AM(including) and before the rbrace of A (excluding), and the same as B. We make two reduced braces: A' and B'.
• If level of A' > B', then A > B; if A' < B' , then A < B; if A' = B' , then A = B.

Finally, we can compare the level of A and B as follows:

• Use subrule on A and B until the subrule cannot apply any more.
• If brace rank of A > brace rank of B then A>B on level; If brace rank of A < brace rank of B then A<B on level. or else -
• All the separators of A are {A1}, {A2},... {An}. And the same as B.
• Compare levels of {Ai}'s and find highest-level ones - {AM}. And the same as B.
• If level of {AM}>{BM}, then A>B; if {AM}<{BM}, then A<B. or else -
• If the amount of {AM}>{BM}, then A>B; if the amount of {AM}<{BM}, then A<B. or else -
• Find the last {AM} of A, and A={A-{AM}A+} and the same as B.
• If the level of {A+}>{B+}, then A>B; if {A+}<{B+}, then A<B. or else -
• If the level of {A-}>{B-}, then A>B; if {A-}<{B-}, then A<B; if {A-}={B-}, then A=B.
Community content is available under CC-BY-SA unless otherwise noted.