Skip to content

Commit

Permalink
replaced use of \phi with \emptyset
Browse files Browse the repository at this point in the history
  • Loading branch information
mroughan committed Sep 7, 2018
1 parent 237f98c commit 9bae7df
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 47 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -572,14 +572,15 @@ There are other implementations of the surreals. For instance
+ Haskell https://github.com/Lacaranian/surreal (only integers)
+ Haskell https://github.com/serialhex/Surreal-Numbers (not quite working)
+ Haskell https://github.com/elfakyn/Haskell-surreals (only integers)
+ Javascript http://www.iwriteiam.nl/SurrealNumbers.html
+ Mathematica http://demonstrations.wolfram.com/GeneratingTheSurrealNumbers/
(only generation)
+ Lua https://github.com/Ryan1729/lua-Surreal-numbers?files=1
+ Python https://github.com/codeinthehole/python-surreal (not much
implemented)
+ Python https://github.com/314eter/surreal-numbers
+ Ruby http://raganwald.com/2009/03/07/elegance-and-the-surreals.html


And some of these languages might be more appropriate in some ways for
this task. But I wanted to learn Julia, and see how far I could take
it here. Moreover, most of these are at least as incomplete as the
Expand Down
42 changes: 35 additions & 7 deletions examples/Data/multiplication_table.tex
Expand Up @@ -6,12 +6,40 @@
\text{$\overline{2} \times \overline{2}$} & 6 & 11 & 14 & 5 & 0.0 & 13 & 6 & 11 \\
\text{$\overline{3} \times \overline{2}$} & 12 & 45 & 82 & 625 & 0.07 & 83 & 9 & 69 \\
\text{$\overline{4} \times \overline{2}$} & 20 & 153 & 331 & \text{7.5E+05} & 0.01 & 460 & 12 & 393 \\
\text{$\overline{5} \times \overline{2}$} & 30 & 428 & 1015 & \text{6.1E+09} & 0.12 & 1935 & 15 & 1705 \\
\text{$\overline{6} \times \overline{2}$} & 42 & 1024 & 2565 & \text{2.9E+14} & 0.74 & 6330 & 18 & 5708 \\
\text{$\overline{7} \times \overline{2}$} & 56 & 2172 & 5637 & \text{7.0E+19} & 3.9 & 17234 & 21 & 15802 \\
\text{$\overline{8} \times \overline{2}$} & 72 & 4196 & 11160 & \text{8.6E+25} & 15.94 & 40904 & 24 & 37970 \\
\text{$\overline{9} \times \overline{2}$} & 90 & 7529 & 20384 & \text{5.0E+32} & 56.7 & 87363 & 27 & 81860 \\
\text{$\overline{3} \times \overline{3}$} & 31 & 1627 & 6042 & \text{4.3E+12} & 0.35 & 3485 & 10 & 3242 \\
\text{$\overline{4} \times \overline{2}$} & 42 & 14961 & 80196 & \text{7.3E+19} & 9.08 & 23448 & 30 & 21510 \\
\text{$\overline{5} \times \overline{2}$} & 30 & 428 & 1015 & \text{6.1E+09} & 0.1 & 1935 & 15 & 1705 \\
\text{$\overline{6} \times \overline{2}$} & 42 & 1024 & 2565 & \text{2.9E+14} & 0.58 & 6330 & 18 & 5708 \\
\text{$\overline{7} \times \overline{2}$} & 56 & 2172 & 5637 & \text{7.0E+19} & 2.9 & 17234 & 21 & 15802 \\
\text{$\overline{8} \times \overline{2}$} & 72 & 4196 & 11160 & \text{8.6E+25} & 11.84 & 40904 & 24 & 37970 \\
\text{$\overline{9} \times \overline{2}$} & 90 & 7529 & 20384 & \text{5.0E+32} & 40.99 & 87363 & 27 & 81860 \\
\text{$\overline{10} \times \overline{2}$} & 110 & 12729 & 34928 & \text{1.3E+38} & 129.2 & 171690 & 30 & 162059 \\
\text{$\overline{11} \times \overline{2}$} & 132 & 20495 & 56828 & \text{ overflow } & 360.0 & 315502 & 33 & 299559 \\
\text{$\overline{12} \times \overline{2}$} & 156 & 31683 & 88585 & \text{ overflow } & 895.2 & 548628 & 36 & 523415 \\
\text{$\overline{2} \times \overline{-2}$} & 6 & 11 & 14 & 5 & 0.0 & 13 & 9 & 12 \\
\text{$\overline{1} \times \overline{3}$} & 3 & 4 & 3 & 1 & 0.0 & 3 & 7 & 3 \\
\text{$\overline{2} \times \overline{3}$} & 12 & 45 & 82 & 625 & 0.0 & 83 & 9 & 69 \\
\text{$\overline{3} \times \overline{3}$} & 31 & 737 & 2052 & \text{9.4E+10} & 0.25 & 3419 & 10 & 3182 \\
\text{$\overline{4} \times \overline{3}$} & 64 & 16958 & 64653 & \text{6.1E+27} & 184.1 & 286358 & 14 & 281775 \\
\text{$\overline{1} \times \overline{4}$} & 4 & 5 & 4 & 1 & 0.0 & 4 & 9 & 4 \\
\text{$\overline{2} \times \overline{4}$} & 20 & 153 & 331 & \text{7.5E+05} & 0.01 & 460 & 12 & 393 \\
\text{$\overline{1} \times \overline{1//2}$} & 2 & 3 & 3 & 2 & 0.0 & 2 & 5 & 2 \\
\text{$\overline{2} \times \overline{1//2}$} & 6 & 15 & 31 & 29 & 0.0 & 18 & 8 & 15 \\
\text{$\overline{3} \times \overline{1//2}$} & 12 & 65 & 174 & 5397 & 0.0 & 125 & 11 & 102 \\
\text{$\overline{4} \times \overline{1//2}$} & 20 & 216 & 650 & \text{8.1E+06} & 0.02 & 684 & 14 & 582 \\
\text{$\overline{5} \times \overline{1//2}$} & 30 & 582 & 1869 & \text{7.7E+10} & 0.17 & 2740 & 17 & 2413 \\
\text{$\overline{6} \times \overline{1//2}$} & 42 & 1344 & 4497 & \text{4.0E+15} & 1.25 & 8574 & 20 & 7733 \\
\text{$\overline{7} \times \overline{1//2}$} & 56 & 2766 & 9520 & \text{1.1E+21} & 8.23 & 22498 & 23 & 20635 \\
\text{$\overline{8} \times \overline{1//2}$} & 72 & 5211 & 18308 & \text{1.4E+27} & 46.92 & 51816 & 26 & 48113 \\
\text{$\overline{9} \times \overline{1//2}$} & 90 & 9157 & 32679 & \text{8.9E+33} & 226.3 & 107982 & 29 & 101204 \\
\text{$\overline{10} \times \overline{1//2}$} & 110 & 15213 & 54963 & \text{ overflow } & 986.0 & 207950 & 32 & 196322 \\
\text{$\overline{11} \times \overline{1//2}$} & 132 & 24135 & 88066 & \text{1.5E+37} & 3727.0 & 375716 & 35 & 356784 \\
\text{$\overline{12} \times \overline{1//2}$} & 156 & 36842 & 135534 & \text{9.0E+37} & 12588.0 & 644052 & 38 & 614528 \\
\text{$\overline{1} \times \overline{1//4}$} & 3 & 4 & 5 & 3 & 0.0 & 3 & 7 & 3 \\
\text{$\overline{2} \times \overline{1//4}$} & 12 & 108 & 426 & 48218 & 0.0 & 163 & 11 & 128 \\
\text{$\overline{3} \times \overline{1//4}$} & 31 & 4828 & 30377 & \text{1.9E+16} & 6.21 & 24455 & 15 & 23192 \\
\text{$\overline{1//2} \times \overline{1//2}$} & 6 & 13 & 27 & 28 & 0.0 & 15 & 6 & 12 \\
\text{$\overline{1//2} \times \overline{1//4}$} & 12 & 93 & 374 & 37674 & 0.0 & 139 & 9 & 109 \\
\text{$\overline{1//4} \times \overline{1//4}$} & 31 & 4755 & 34920 & \text{1.6E+17} & 7.39 & 19020 & 10 & 17836 \\
\text{$\overline{4} \times \overline{2}$} & 42 & 1905 & 5980 & \text{6.7E+15} & 2.92 & 16108 & 30 & 14904 \\
\text{$\overline{0} \times \overline{2}$} & 6 & 16 & 24 & 20 & 0.0 & 29 & 11 & 24 \\
\end{array}
\right]
52 changes: 40 additions & 12 deletions examples/Data/multiplication_tables.csv
@@ -1,13 +1,41 @@
"i","n1","n2","generation","nodes","edges","paths","density","time","bytes","adds","prods","created","equals","leq"
0,0//1,2//1,0,1,0,1.0,1.0,8.019e-6,1216.0,0,1,0,0,0
1,1//1,2//1,2,3,2,1.0,1.0,7.8116e-5,10912.0,2,5,2,0,0
2,2//1,2//1,6,11,14,5.0,1.3636363636363635,0.000214553,48608.0,13,6,11,0,0
3,3//1,2//1,12,45,82,625.0,1.8444444444444446,0.068835036,1.298532e6,83,9,69,0,0
4,4//1,2//1,20,153,331,748077.0,2.1699346405228757,0.013266295,5.08984e6,460,12,393,0,0
5,5//1,2//1,30,428,1015,6.085358435e9,2.3738317757009346,0.122446419,4.3640128e7,1935,15,1705,0,0
6,6//1,2//1,42,1024,2565,2.85343216243798e14,2.505859375,0.743089202,2.71792416e8,6330,18,5708,0,0
7,7//1,2//1,56,2172,5637,7.0352688036251116e19,2.595764272559853,3.897952511,1.486446016e9,17234,21,15802,0,0
8,8//1,2//1,72,4196,11160,8.615540969651363e25,2.659914204003813,15.940410716,5.622187952e9,40904,24,37970,0,0
9,9//1,2//1,90,7529,20384,5.0443458043182515e32,2.7075308805950327,56.699081147,1.6828904896e10,87363,27,81860,0,0
10,3//1,3//1,31,1627,6042,4.326138913672e12,3.71419791026429,0.353743509,1.48495424e8,3485,10,3242,0,0
11,4//1,2//1,42,14961,80196,7.27448190950702e19,5.360403716329122,9.077178159,3.59409528e9,23448,30,21510,0,0
0,0//1,2//1,0,1,0,1.0,1.0,6.522e-6,1216.0,0,1,0,0,0
1,1//1,2//1,2,3,2,1.0,1.0,8.2687e-5,10912.0,2,5,2,0,0
2,2//1,2//1,6,11,14,5.0,1.3636363636363635,0.000249978,48096.0,13,6,11,0,0
3,3//1,2//1,12,45,82,625.0,1.8444444444444446,0.068390523,1.276372e6,83,9,69,0,0
4,4//1,2//1,20,153,331,748077.0,2.1699346405228757,0.011966549,4.673024e6,460,12,393,0,0
5,5//1,2//1,30,428,1015,6.085358435e9,2.3738317757009346,0.103476073,3.9358208e7,1935,15,1705,0,0
6,6//1,2//1,42,1024,2565,2.85343216243798e14,2.505859375,0.575546313,2.37728064e8,6330,18,5708,0,0
7,7//1,2//1,56,2172,5637,7.0352688036251116e19,2.595764272559853,2.902520881,1.290840368e9,17234,21,15802,0,0
8,8//1,2//1,72,4196,11160,8.615540969651363e25,2.659914204003813,11.837685148,4.880489248e9,40904,24,37970,0,0
9,9//1,2//1,90,7529,20384,5.0443458043182515e32,2.7075308805950327,40.991869265,1.3886006016e10,87363,27,81860,0,0
10,10//1,2//1,110,12729,34928,1.3205472893970104e38,2.744049021918454,129.232637597,4.5452954608e10,171690,30,162059,0,0
11,11//1,2//1,132,20495,56828,-9.935518445889285e37,2.772822639668212,360.014984408,1.24926111152e11,315502,33,299559,0,0
12,12//1,2//1,156,31683,88585,-7.282291779914621e37,2.7960104788056688,895.24701852,2.76990644032e11,548628,36,523415,0,0
13,2//1,-2//1,6,11,14,5.0,1.3636363636363635,0.000283992,55712.0,13,9,12,0,0
14,1//1,3//1,3,4,3,1.0,1.0,6.3001e-5,16064.0,3,7,3,0,0
15,2//1,3//1,12,45,82,625.0,1.8444444444444446,0.001342992,459312.0,83,9,69,0,0
16,3//1,3//1,31,737,2052,9.4415698647e10,2.78561736770692,0.248545979,1.0444824e8,3419,10,3182,0,0
17,4//1,3//1,64,16958,64653,6.108237799500018e27,3.812595824979361,184.052318177,6.6680640112e10,286358,14,281775,0,0
18,1//1,4//1,4,5,4,1.0,1.0,8.6929e-5,21216.0,4,9,4,0,0
19,2//1,4//1,20,153,331,748077.0,2.1699346405228757,0.012298217,4.720544e6,460,12,393,0,0
20,1//1,1//2,2,3,3,2.0,1.3333333333333333,4.4732e-5,12144.0,2,5,2,0,0
21,2//1,1//2,6,15,31,29.0,2.1333333333333333,0.000293467,89424.0,18,8,15,0,0
22,3//1,1//2,12,65,174,5397.0,2.6923076923076925,0.002329558,877584.0,125,11,102,0,0
23,4//1,1//2,20,216,650,8.098328e6,3.013888888888889,0.020582507,8.497504e6,684,14,582,0,0
24,5//1,1//2,30,582,1869,7.6582035353e10,3.2130584192439864,0.171186132,7.1555952e7,2740,17,2413,0,0
25,6//1,1//2,42,1344,4497,4.013602463789026e15,3.3467261904761907,1.252807822,5.14580608e8,8574,20,7733,0,0
26,7//1,1//2,56,2766,9520,1.0808789143539522e21,3.442154736080983,8.231138148,3.229056608e9,22498,23,20635,0,0
27,8//1,1//2,72,5211,18308,1.4246720832694277e27,3.513529073114565,46.922879728,1.693481232e10,51816,26,48113,0,0
28,9//1,1//2,90,9157,32679,8.887943639244825e33,3.568854428306214,226.27318923,7.5223131184e10,107982,29,101204,0,0
29,10//1,1//2,110,15213,54963,-7.631638640409828e37,3.612962597778216,985.976136546,3.1699412416e11,207950,32,196322,0,0
30,11//1,1//2,132,24135,88066,1.453474986156403e37,3.6489330847317176,3726.889421884,1.07794863488e12,375716,35,356784,0,0
31,12//1,1//2,156,36842,135534,9.023451080536431e37,3.678817653764725,12588.248204712,3.191343287296e12,644052,38,614528,0,0
32,1//1,1//4,3,4,5,3.0,1.5,0.000176371,20112.0,3,7,3,0,0
33,2//1,1//4,12,108,426,48218.0,3.9537037037037037,0.003946962,1.901664e6,163,11,128,0,0
34,3//1,1//4,31,4828,30377,1.934147339911883e16,6.292046396023198,6.211790538,2.913187312e9,24455,15,23192,0,0
35,1//2,1//2,6,13,27,28.0,2.1538461538461537,0.000251611,76176.0,15,6,12,0,0
36,1//2,1//4,12,93,374,37674.0,4.032258064516129,0.003455267,1.660064e6,139,9,109,0,0
37,1//4,1//4,31,4755,34920,1.591733963543244e17,7.344058885383807,7.389094209,3.303960288e9,19020,10,17836,0,0
38,4//1,2//1,42,1905,5980,6.742040747418136e15,3.1396325459317587,2.922999648,1.249701968e9,16108,30,14904,0,0
39,0//1,2//1,6,16,24,20.0,1.5625,0.000416443,125856.0,29,11,24,0,0
4 changes: 2 additions & 2 deletions examples/multiplication_tables.jl
Expand Up @@ -24,8 +24,8 @@ ns1 = convert.(SurrealFinite, [0; 1:n2; 2; 1:n3; 1:n4;
ns2 = convert.(SurrealFinite, [2; 2*ones(n2); -2; 3*ones(n3); 4*ones(n4); 1//2*ones(n_12); 1//4*ones(n_14); 1//2; 1//4; 1//4; 2; 2])
# ns1 = convert.(SurrealFinite, [0:n2-1; 1:n3; 1:n4; 1:n_12; 1:n_14; 1//2; 1//2])
# ns2 = convert.(SurrealFinite, [2*ones(n2); 3*ones(n3); 4*ones(n4); 1//2*ones(n_12); 1//4*ones(n_14); 1//2; 1//4])
# ns1 = convert.(SurrealFinite, [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 3; a])
# ns2 = convert.(SurrealFinite, [2; 2; 2; 2; 2; 2; 2; 2; 2; 2; 3; 2])
# ns1 = convert.(SurrealFinite, [0; 1; 2; 3; 4; 5; 6; 7; 8; 3; a])
# ns2 = convert.(SurrealFinite, [2; 2; 2; 2; 2; 2; 2; 2; 2; 3; 2])
# ns1 = [2; 4]
# ns2 = [1/2; 1/4]
n = length(ns1)
Expand Down
51 changes: 34 additions & 17 deletions src/SurrealFinite.jl
Expand Up @@ -116,15 +116,15 @@ function convert(::Type{SurrealFinite}, n::Int )
else
result = SurrealFinite(string(n), ϕ, [convert(SurrealFinite, n+1)] )
end
h = hash(result)
ExistingSurreals[h] = result
ExistingCanonicals[Rational(n)] = h
hr = hash(result)
ExistingSurreals[hr] = result
ExistingCanonicals[Rational(n)] = hr
return result
# should check to make sure abs(n) is not too big, i.e., causes too much recursion
end
function convert(::Type{SurrealFinite}, r::Rational )
global ExistingSurreals
global ExistingCanonicals
global ExistingCanonicals
if haskey(ExistingCanonicals, r)
return ExistingSurreals[ ExistingCanonicals[r] ]
elseif isinteger(r)
Expand All @@ -143,7 +143,7 @@ function convert(::Type{SurrealFinite}, r::Rational )
end
h = hash(result)
ExistingSurreals[h] = result
ExistingCanonicals[r] = h
ExistingCanonicals[r] = h
return result
end
function convert(::Type{SurrealFinite}, f::Float64 )
Expand Down Expand Up @@ -249,8 +249,10 @@ promote_rule(::Type{T}, ::Type{SurrealFinite}) where {T<:Real} = SurrealFinite

@static if VERSION < v"0.7.0"
const ϕ = Array{SurrealFinite,1}(0) # empty array of SurrealFinites
const= ϕ
else
const ϕ = Array{SurrealFinite,1}(undef,0) # empty array of SurrealFinites
const= ϕ
end
const SurrealZero = SurrealFinite("0", ϕ, ϕ )
const SurrealOne = SurrealFinite("1", [ zero(SurrealFinite) ], ϕ )
Expand Down Expand Up @@ -388,11 +390,16 @@ function -(x::SurrealFinite)
result = SurrealFinite(x.shorthand[2:end], -x.R, -x.L )
else
result = SurrealFinite("-"*x.shorthand, -x.R, -x.L )
end
end
hr = hash(result)
if haskey(ExistingSurreals, hr)
result = ExistingSurreals[hr] # don't double up on memory
else
ExistingSurreals[hr] = result
end
ExistingSurreals[hx] = x
ExistingSurreals[hash(result)] = result
ExistingNegations[hx] = hash(result)
ExistingNegations[hash(result)] = hx
ExistingNegations[hr] = hx
Count['-'] += 1
return result
end
Expand Down Expand Up @@ -440,7 +447,11 @@ function +(x::SurrealFinite, y::SurrealFinite)
ExistingSums[hy] = Dict{UInt64,UInt64}()
end
hr = hash(result)
ExistingSurreals[hr] = result
if haskey(ExistingSurreals, hr)
result = ExistingSurreals[hr] # don't double up on memory
else
ExistingSurreals[hr] = result
end
ExistingSums[hx][hy] = hr
ExistingSums[hy][hx] = hr
Count['+'] += 1
Expand Down Expand Up @@ -494,7 +505,11 @@ function *(x::SurrealFinite, y::SurrealFinite)
ExistingProducts[hy] = Dict{UInt64,UInt64}()
end
hr = hash(result)
ExistingSurreals[hr] = result
if haskey(ExistingSurreals, hr)
result = ExistingSurreals[hr] # don't double up on memory
else
ExistingSurreals[hr] = result
end
ExistingProducts[hx][hy] = hr
ExistingProducts[hy][hx] = hr
Count['*'] += 1
Expand Down Expand Up @@ -550,8 +565,8 @@ function expand(x::SurrealFinite; level=0)
if level==0
s = x.shorthand != "" ? x.shorthand : expand(x; level=1)
elseif level==1
tmpL = isempty(x.L) ? "ϕ" : join(convert.(String, x.L), ',')
tmpR = isempty(x.R) ? "ϕ" : join(convert.(String, x.R), ',')
tmpL = isempty(x.L) ? "" : join(convert.(String, x.L), ',')
tmpR = isempty(x.R) ? "" : join(convert.(String, x.R), ',')
s = "{ " * tmpL * " | " * tmpR * " }"
return s
elseif level>=1
Expand All @@ -567,10 +582,10 @@ function convert(::Type{SurrealFinite}, s::AbstractString )
# interpret, (i) numbers as canonical, (ii) phi, \phi, ϕ correctly, (iii) structure
@static if VERSION < v"0.7.0"
s = replace(s, r"\s+", "") # remove white space
s = replace(s, r"phi|\\phi|ϕ|\{\}", "") # replace phi or \phi with empty set
s = replace(s, r"phi|\\phi|ϕ|∅|\{\}", "") # replace phi or \phi with empty set
else
s = replace(s, r"\s+" => "") # remove white space
s = replace(s, r"phi|\\phi|ϕ|\{\}" => "") # replace phi or \phi with empty set
s = replace(s, r"phi|\\phi|ϕ|∅|\{\}" => "") # replace phi or \phi with empty set
end
# println(" s1 = $s")
not_end = true
Expand Down Expand Up @@ -627,13 +642,15 @@ function surreal2tex(io::IO, x::SurrealFinite; level=0)
s = expand(x; level=level)
@static if VERSION < v"0.7.0"
s = replace(s, r"\{", " \\{ ")
s = replace(s, r"ϕ", " \\phi ")
s = replace(s, r"ϕ", " \\emptyset ")
s = replace(s, r"", " \\emptyset ")
s = replace(s, r"\|", " \\mid ")
s = replace(s, r"\}", " \\} ")
s = replace(s, r"(\d+)//(\d+)", s"\\frac{\1}{\2}")
else
s = replace(s, r"\{" => " \\{ ")
s = replace(s, r"ϕ" => " \\phi ")
s = replace(s, r"ϕ" => " \\emptyset ")
s = replace(s, r"" => " \\emptyset ")
s = replace(s, r"\|" => " \\mid ")
s = replace(s, r"\}" => " \\} ")
s = replace(s, r"(\d+)//(\d+)" => s"\\frac{\1}{\2}")
Expand All @@ -660,7 +677,7 @@ end
# show(io::IO, X::Array{SurrealFinite}) = print(io, "{", join(X, ", "), "}")
function show(io::IO, X::Array{SurrealFinite})
if isempty(X)
print(io, "ϕ")
print(io, "")
else
print(io, join(X, ", "))
end
Expand Down
4 changes: 2 additions & 2 deletions src/SurrealNumbers.jl
Expand Up @@ -16,15 +16,15 @@ export clearcache
# export SurrealAlt2
# export ExistingSurrealsAlt2, ExistingProductsAlt2, ExistingSumsAlt2

export <=, zero, one, ==, , , <, -, +, *, , , , dag_add,
export ∅, ϕ, <=, zero, one, ==, , , <, -, +, *, , , , dag_add,
dali, convert, promote, hash,
pf, pff, spf, show, surreal2node, surreal2dot, surreal2dag, surreal2tex, read, expand,
generation, canonicalise, iscanonical, parents, isancestor, , , , ,
unique2!,
sign, round, floor, ceil, trunc, mod,
isinteger, isinf, isnan, isfinite, isodd, iseven, isdivisible,
dag_stats, nodes, edges, paths, tree_nodes, breadth, width, surrealDAG

abstract type Surreal <: Real end

@static if VERSION < v"0.7.0"
Expand Down
7 changes: 2 additions & 5 deletions src/todo.txt
@@ -1,9 +1,6 @@

*** replace caches with dict -> another hash, and have a global list
of all surreals to
(a) reduce memory footprint
(b) avoid the problem that 1+3 == 2 +2, but at the moment might
point to new memory
- use a hash based cache in DAG stats, so that we avoid doubling up if
by mistake the same surreal is allocated twice

- put "values" into surreals in the same way as hashes,
- but for surreals resulting from computations this should be easy
Expand Down
2 changes: 1 addition & 1 deletion test/Data/test_surreals_io.tex
@@ -1,3 +1,3 @@
\frac{13}{16}
\{ 3/4 \mid 7/8 \}
\{ \{ \{ \{ \phi \mid \phi \} \mid \{ \{ \phi \mid \phi \} \mid \phi \} \} \mid \{ \{ \phi \mid \phi \} \mid \phi \} \} \mid \{ \{ \{ \{ \phi \mid \phi \} \mid \{ \{ \phi \mid \phi \} \mid \phi \} \} \mid \{ \{ \phi \mid \phi \} \mid \phi \} \} \mid \{ \{ \phi \mid \phi \} \mid \phi \} \} \}
\{ \{ \{ \{ \emptyset \mid \emptyset \} \mid \{ \{ \emptyset \mid \emptyset \} \mid \emptyset \} \} \mid \{ \{ \emptyset \mid \emptyset \} \mid \emptyset \} \} \mid \{ \{ \{ \{ \emptyset \mid \emptyset \} \mid \{ \{ \emptyset \mid \emptyset \} \mid \emptyset \} \} \mid \{ \{ \emptyset \mid \emptyset \} \mid \emptyset \} \} \mid \{ \{ \emptyset \mid \emptyset \} \mid \emptyset \} \} \}

0 comments on commit 9bae7df

Please sign in to comment.