Search NKS | Online
21 - 25 of 25 for Union
The collection of all events that will lead to a given set of events (the union of their past light cones) is known as the filter of that set.
One-element-dependence tag systems [emulating TMs]
Writing the rule {3, {{0, _, _} {0, 0}, {1, _, _} {1, 1, 0, 1}}} from page 895 as {3, {0 {0, 0}, 1 {1, 1, 0, 1}}} the evolution of a tag system that depends only on its first element is obtained from
TS1EvolveList[rule_, init_, t_] := NestList[TS1Step[rule, #] &, init, t]
TS1Step[{n_, subs_}, {}] = {}
TS1Step[{n_, subs_}, list_] := Drop[Join[list, First[list] /. subs], n]
Given a Turing machine in the form used on page 888 the following will construct a tag system that emulates it:
TMToTS1[rules_] := {2, Union[Flatten[rules /.
MapIndexed[ #1 First[#2] &, Union[Map[# 〚 1, 1 〛 &, #]]] &[ With[{b = Ceiling[Log[2, k]] - 1}, Flatten[Table[ {Table[{Table[{{m, i, n, d}, c} {{m, Mod[i, 2 n - 1 ], n - 1, d}, Quotient[i, 2 n - 1 ], 1}, {n, 2, b}, {i, 0, 2 n - 1}], Table[{ {m, i, 1, d}, c} {{m, -1, 1, d}, i, d}, {i, 0, 1}], Table[ {{m, -1, n, d}, c} {{m, -1, n + 1, d}, c, d}, {n, b - 1}], {{m, -1, b, d}, c} {{0, 0, m}, c, d}}, {d, -1, 1, 2}], Table[{{i, n, m}, c} {{ i + 2 n c, n + 1, m}, c, -1}, {n, 0, b - 1}, {i, 0, 2 n - 1}], With[{r = 2 b }, Table[ If[i + r c ≥ k, {}, Cases[rule, ({m, i + r c} {x_, y_, z_}) {{i, b, m}, c} {{x, Mod[y, r], b, z}, Quotient[y, r], 1})]], {i, 0, r - 1}]]}, {m, s}, {c, 0, 1}]]]]
Some of these states are usually unnecessary, and in the main text such states have been pruned.
Given an original DNF list s , this can be done using PI[s, n] :
PI[s_, n_] := Union[Flatten[ FixedPointList[f[Last[#], n] &, {{}, s}] 〚 All, 1 〛 , 1]]
g[a_, b_] := With[{i = Position[Transpose[{a, b}], {0,1}]}, If[Length[i] 1 && Delete[a, i] === Delete[b, i], {ReplacePart[a, _, i]}, {}]]
f[s_, n_] := With[ {w = Flatten[Apply[Outer[g, #1, #2, 1] &, Partition[Table[ Select[s, Count[#, 1] i &], {i, 0, n}], 2, 1], {1}], 3]}, {Complement[s, w, SameTest MatchQ], w}]
The minimal DNF then consists of a collection of these prime implicants.
Here are examples of how some of the basic Mathematica constructs used in the notes in this book work:
• Iteration
Nest[f, x, 3] ⟶ f[f[f[x]]]
NestList[f, x, 3] ⟶ {x, f[x], f[f[x]], f[f[f[x]]]}
Fold[f, x, {1, 2}] ⟶ f[f[x, 1], 2]
FoldList[f, x, {1, 2}] ⟶ {x, f[x, 1], f[f[x, 1], 2]}
• Functional operations
Function[x, x + k][a] ⟶ a + k
(# + k&)[a] ⟶ a + k
(r[#1] + s[#2]&)[a, b] ⟶ r[a] + s[b]
Map[f, {a, b, c}] ⟶ {f[a], f[b], f[c]}
Apply[f, {a, b, c}] ⟶ f[a, b, c]
Select[{1, 2, 3, 4, 5}, EvenQ] ⟶ {2, 4}
MapIndexed[f, {a, b, c}] ⟶ {f[a, {1}], f[b, {2}], f[c, {3}]}
• List manipulation
{a, b, c, d} 〚 3 〛 ⟶ c
{a, b, c, d} 〚 {2, 4, 3, 2} 〛 ⟶ {b, d, c, b}
Take[{a, b, c, d, e}, 2] ⟶ {a, b}
Drop[{a, b, c, d, e}, -2] ⟶ {a, b, c}
Rest[{a, b, c, d}] ⟶ {b, c, d}
ReplacePart[{a, b, c, d}, x, 3] ⟶ {a, b, x, d}
Length[{a, b, c}] ⟶ 3
Range[5] ⟶ {1, 2, 3, 4, 5}
Table[f[i], {i, 4}] ⟶ {f[1], f[2], f[3], f[4]}
Table[f[i, j], {i, 2}, {j, 3}] ⟶ {{f[1, 1], f[1, 2], f[1, 3]}, {f[2, 1], f[2, 2], f[2, 3]}}
Array[f, {2, 2}] ⟶ {{f[1, 1], f[1, 2]}, {f[2, 1], f[2, 2]}}
Flatten[{{a, b}, {c}, {d, e}}] ⟶ {a, b, c, d, e}
Flatten[{{a, {b, c}}, {{d}, e}}, 1] ⟶ {a, {b, c}, {d}, e}
Partition[{a, b, c, d}, 2, 1] ⟶ {{a, b}, {b, c}, {c, d}}
Split[{a, a, a, b, b, a, a}] ⟶ {{a, a, a}, {b, b}, {a, a}}
ListConvolve[{a, b}, {1, 2, 3, 4, 5}] ⟶ {2a + b, 3a + 2b, 4a + 3b, 5a + 4b}
Position[{a, b, c, a, a}, a] ⟶ {{1}, {4}, {5}}
RotateLeft[{a, b, c, d, e}, 2] ⟶ {c, d, e, a, b}
Join[{a, b, c}, {d, b}] ⟶ {a, b, c, d, b}
Union[{a, a, c, b, b}] ⟶ {a, b, c}
• Transformation rules
{a, b, c, d} /. b p ⟶ {a, p, c, d}
{f[a], f[b], f[c]} /. f[a] p ⟶ {p, f[b], f[c]}
{f[a], f[b], f[c]} /. f[x_] p[x] ⟶ {p[a], p[b], p[c]}
{f[1], f[b], f[2]} /. f[x_Integer] p[x] ⟶ {p[1], f[b], p[2]}
{f[1, 2], f[3], f[4, 5]} /. f[x_, y_] x + y ⟶ {3, f[3], 9}
{f[1], g[2], f[2], g[3]} /. f[1] | g[_] p ⟶ {p, p, f[2], p}
• Numerical functions
Quotient[207, 10] ⟶ 20
Mod[207, 10] ⟶ 7
Floor[1.45] ⟶ 1
Ceiling[1.45] ⟶ 2
IntegerDigits[13, 2] ⟶ {1, 1, 0, 1}
IntegerDigits[13, 2, 6] ⟶ {0, 0, 1, 1, 0, 1}
DigitCount[13, 2, 1] ⟶ 3
FromDigits[{1, 1, 0, 1}, 2] ⟶ 13
The Mathematica programs in these notes are formatted in Mathematica StandardForm .