A368954
Row lengths of A368953: in the MIU formal system, number of distinct strings n steps distant from the MI string.
Original entry on oeis.org
1, 2, 3, 6, 15, 48, 232, 1544, 14959, 203333, 3919437, 105126522
Offset: 0
- Douglas R. Hofstadter, Gödel, Escher, Bach: an Eternal Golden Braid, Basic Books, 1979, pp. 33-41.
-
MIUStepDW3[s_] := DeleteDuplicates[Flatten[Map[{If[StringEndsQ[#, "1"], # <> "0", Nothing], # <> #, StringReplaceList[#, {"111" -> "0","00" -> ""}]}&, s]]];
With[{rowmax = 9}, Map[Length, NestList[MIUStepDW3, {"1"}, rowmax]]]
-
from itertools import islice
def occurrence_swaps(w, s, t):
out, oi = [], w.find(s)
while oi != -1:
out.append(w[:oi] + t + w[oi+len(s):])
oi = w.find(s, oi+1)
return out
def moves(w): # moves for word w in MIU system, encoded as 310
nxt = []
if w[-1] == '1': nxt.append(w + '0') # Rule 1
if w[0] == '3': nxt.append(w + w[1:]) # Rule 2
nxt.extend(occurrence_swaps(w, '111', '0')) # Rule 3
nxt.extend(occurrence_swaps(w, '00', '')) # Rule 4
return nxt
def agen(): # generator of terms
frontier = {'31'}
while len(frontier) > 0:
yield len(frontier)
reach1 = set(m for p in frontier for m in moves(p))
frontier, reach1 = reach1, set()
print(list(islice(agen(), 10))) # Michael S. Branicky, Jan 14 2024
A368946
Irregular triangle read by rows: row n lists the strings of the MIU formal system at the n-th level of the tree generated by recursively applying the system rules, starting from the MI string (see comments and example).
Original entry on oeis.org
31, 310, 311, 31010, 3110, 31111, 310101010, 3110110, 311110, 311111111, 301, 310, 31010101010101010, 3110110110110, 31111011110, 3010, 3100, 3111111110, 31111111111111111, 3011111, 3101111, 3110111, 3111011, 3111101, 3111110, 3010, 30101, 31010
Offset: 0
After recursively applying the rules three times, we get the following tree (cf. Hofstadter (1979), page 40, Figure 11).
.
MI
0 ---------------------- 31
/ \
1 2 <--- Rule applied
/ \
MIU MII
1 ---------------- 310 311
/ / \
2 1 2
/ / \
MIUIU MIIU MIIII
2 --------- 31010 3110 31111 Here rule 3 can
/ / / | | \ be applied twice:
2 2 1 2 3 3 <--- it is first applied
/ / / | | \ to the leftmost
MIUIUIUIU MIIUIIU MIIIIU | MUI MIU III substring
3 --- 310101010 3110110 311110 | 301 310
MIIIIIIII
311111111
.
By reading the tree from top to bottom, left to right, the triangle begins:
[0] 31;
[1] 310 311;
[2] 31010 3110 31111;
[3] 310101010 3110110 311110 311111111 301 310;
[4] 31010101010101010 3110110110110 ... 3010 ... 3010 30101 31010;
...
Please note that some strings may be duplicated in different rows and within the same row: within the first four rows, the string MIU (310) is present in rows 1 and 3. In row 4, the string MUIU (3010) is present twice: it can be generated both by applying rule 3 to MIIIIU (311110) and by applying rule 1 to MUI (301). The initial string MI (31) first reappears in row 5.
- Douglas R. Hofstadter, Gödel, Escher, Bach: an Eternal Golden Braid, Basic Books, 1979, pp. 33-41 and pp. 261-262.
Cf.
A369586 (shortest proofs),
A369408 (length of shortest proofs),
A369587 (number of symbols of shortest proofs).
-
MIUStepO[s_] := Flatten[Map[{If[StringEndsQ[#, "1"], # <> "0", Nothing], # <> StringDrop[#, 1], StringReplaceList[#, "111" -> "0"], StringReplaceList[#, "00" -> ""]}&, s]];
With[{rowmax = 4}, Map[FromDigits, NestList[MIUStepO, {"31"}, rowmax], {2}]]
-
from itertools import islice
def occurrence_swaps(w, s, t):
out, oi = [], w.find(s)
while oi != -1:
out.append(w[:oi] + t + w[oi+len(s):])
oi = w.find(s, oi+1)
return out
def moves(w): # moves for word w in MIU system, encoded as 310
nxt = []
if w[-1] == '1': nxt.append(w + '0') # Rule 1
if w[0] == '3': nxt.append(w + w[1:]) # Rule 2
nxt.extend(occurrence_swaps(w, '111', '0')) # Rule 3
nxt.extend(occurrence_swaps(w, '00', '')) # Rule 4
return nxt
def agen(): # generator of terms
frontier = ['31']
while len(frontier) > 0:
yield from [int(t) for t in frontier]
reach1 = [m for p in frontier for m in moves(p)]
frontier, reach1 = reach1, []
print(list(islice(agen(), 28))) # Michael S. Branicky, Jan 14 2024
A331536
Number of theorems in the MIU formal system which can be proved in n steps or fewer starting with the axiom 'mi'.
Original entry on oeis.org
1, 3, 6, 11, 25, 69, 282, 1730, 15885, 210105, 3986987, 106053474
Offset: 1
The a(2) = 3 words that can be reached in at most one step are mi, miu, mii.
The a(3) = 6 words that can be reached in at most two steps are mi, miu, mii, miiii, miiu, miuiu.
- Sean A. Irvine, Java program (github)
- A. Matos, On the number of lines of theorems in the formal system MIU, Universidade do Porto, 2000, 1-10.
- Wikipedia, Gödel, Escher, Bach
- Wikipedia, MU Puzzle
- Index entries for sequences from "Goedel, Escher, Bach"
-
MIURules = {StartOfString ~~ x : _ ~~ "I" ~~ EndOfString :> x <> "IU", StartOfString ~~ "M" ~~ x : _ ~~ EndOfString :> "M" <> x <> x, "III" :> "U", "UU" :> ""}; (*The rules of the MIU formal system*)
MIUNext[s_String, rule_Integer] :=StringReplaceList[s, MIURules[[rule]]]
g[x_]:=DeleteDuplicates[Flatten[Join[{x},Table[Table[MIUNext[x[[j]],n], {n, 1, 4}],{j, 1,Length[x]}]]]]
a[n_Integer]:=Nest[g, "MI", n] // Length (*a[n] gives the number of theorems that can be proved in n steps or fewer. A331536[n]=a[n]. Remove //Length if you wish to see the theorems being counted.*)
(* Brian Tenneson, Sep 21 2023 *)
-
def occurrence_swaps(w, s, t):
out, oi = [], w.find(s)
while oi != -1:
out.append(w[:oi] + t + w[oi+len(s):])
oi = w.find(s, oi+1)
return out
def moves(w): # moves for word w in miu system
nxt = [w + w] # Rule 2 ('m' not stored; else use nxt = [w + w[1:]])
if w[-1] == 'i': nxt.append(w + 'u') # Rule 1
nxt.extend(occurrence_swaps(w, 'iii', 'u')) # Rule 3
nxt.extend(occurrence_swaps(w, 'uu', '')) # Rule 4
return nxt
def alst(maxd=float('inf'), v=False):
alst, d = [], 0
reached, frontier = {'i'}, {'i'} # don't store 'm's (else use 'mi' twice)
alst.append(len(reached))
if v: print(len(reached), end=", ")
while len(frontier) > 0 and d < maxd:
reach1 = set(m for p in frontier for m in moves(p) if m not in reached)
if v: print(len(reached)+len(reach1), end=", ")
alst.append(len(reached)+len(reach1))
reached |= reach1
frontier = reach1
d += 1
return alst
alst(maxd=10, v=True) # Michael S. Branicky, Dec 29 2020
Showing 1-3 of 3 results.
Comments