eyeling 1.12.0 → 1.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ @prefix dqc: <https://eyereasoner.github.io/eye/reasoning/dqc#> .
2
+
3
+ 1 dqc:superdense-coding 1 .
4
+ 3 dqc:superdense-coding 3 .
5
+ 0 dqc:superdense-coding 0 .
6
+ 2 dqc:superdense-coding 2 .
@@ -0,0 +1,112 @@
1
+ # -----------------------------------
2
+ # Superdense coding and teleportation
3
+ # -----------------------------------
4
+ #
5
+ # See https://arxiv.org/pdf/1101.3764.pdf and https://arxiv.org/pdf/1010.2929.pdf
6
+ #
7
+ # One remarkable feature of entangled states is superdense coding, whereby
8
+ # entanglement can double the information capacity of a quantum system.
9
+ # Suppose that Alice and Bob initially share a pair of mobits in the joint
10
+ # state |R). Alice can encode two bits (four possible messages) by choosing
11
+ # to apply the operators 1, G, K or KG to her mobit, resulting in one of the
12
+ # four states |R), |S), |U) or |V ). If she then delivers her transformed
13
+ # mobit to Bob, he can perform a joint measurement on both mobits to
14
+ # reliably distinguish these possibilities.
15
+ # The same set of entangled mobit states and single-mobit transformations
16
+ # can also be used to accomplish the analogue of quantum teleportation.
17
+
18
+ @prefix dqc: <https://eyereasoner.github.io/eye/reasoning/dqc#>.
19
+ @prefix math: <http://www.w3.org/2000/10/swap/math#>.
20
+ @prefix log: <http://www.w3.org/2000/10/swap/log#>.
21
+
22
+ # |R) = |0, 0) + |1, 1)
23
+ false dqc:r false.
24
+ true dqc:r true.
25
+
26
+ # |S) = |0, 1) + |1, 0)
27
+ false dqc:s true.
28
+ true dqc:s false.
29
+
30
+ # |U) = |0, 0) + |1, 0) + |1, 1)
31
+ false dqc:u false.
32
+ true dqc:u false.
33
+ true dqc:u true.
34
+
35
+ # |V ) = |0, 0) + |0, 1) + |1, 0)
36
+ false dqc:v false.
37
+ false dqc:v true.
38
+ true dqc:v false.
39
+
40
+ # 1 |0) = |0)
41
+ false dqc:id false.
42
+ # 1 |1) = |1)
43
+ true dqc:id true.
44
+
45
+ # G |0) = |1)
46
+ false dqc:g true.
47
+ # G |1) = |0)
48
+ true dqc:g false.
49
+
50
+ # K |0) = |0)
51
+ false dqc:k false.
52
+ # K |1) = |0) + |1)
53
+ true dqc:k false.
54
+ true dqc:k true.
55
+
56
+ # KG
57
+ {?X dqc:kg ?Y} <= {
58
+ ?X dqc:g ?Z.
59
+ ?Z dqc:k ?Y.
60
+ }.
61
+
62
+ # GK
63
+ {?X dqc:gk ?Y} <= {
64
+ ?X dqc:k ?Z.
65
+ ?Z dqc:g ?Y.
66
+ }.
67
+
68
+ # Superdense coding
69
+ {?N dqc:sdcoding ?M} <= {
70
+ ?X dqc:r ?Y.
71
+ ?N dqc:alice (?X ?B).
72
+ (?B ?Y) dqc:bob ?M.
73
+ }.
74
+
75
+ # Alice
76
+ {0 dqc:alice (?X ?Y)} <= {
77
+ ?X dqc:id ?Y.
78
+ }.
79
+ {1 dqc:alice (?X ?Y)} <= {
80
+ ?X dqc:g ?Y.
81
+ }.
82
+ {2 dqc:alice (?X ?Y)} <= {
83
+ ?X dqc:k ?Y.
84
+ }.
85
+ {3 dqc:alice (?X ?Y)} <= {
86
+ ?X dqc:kg ?Y.
87
+ }.
88
+
89
+ # Bob
90
+ {(?S1 ?S2) dqc:bob 0} <= {
91
+ ?S1 dqc:gk ?S2.
92
+ }.
93
+ {(?S1 ?S2) dqc:bob 1} <= {
94
+ ?S1 dqc:k ?S2.
95
+ }.
96
+ {(?S1 ?S2) dqc:bob 2} <= {
97
+ ?S1 dqc:g ?S2.
98
+ }.
99
+ {(?S1 ?S2) dqc:bob 3} <= {
100
+ ?S1 dqc:id ?S2.
101
+ }.
102
+
103
+ # remove answers that appear an even number of times
104
+ {
105
+ ?X dqc:sdcoding ?Y.
106
+ (1 {?X dqc:sdcoding ?Y} ?A) log:collectAllIn ?SCOPE.
107
+ ?A math:sum ?B.
108
+ (?B 2) math:remainder 1.
109
+ } => {
110
+ ?X dqc:superdense-coding ?Y.
111
+ }.
112
+
package/eyeling.js CHANGED
@@ -1418,7 +1418,8 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
1418
1418
  // math:sum
1419
1419
  // Schema: ( $s.i+ )+ math:sum $o-
1420
1420
  if (pv === MATH_NS + 'sum') {
1421
- if (!(g.s instanceof ListTerm) || g.s.elems.length < 2) return [];
1421
+ // We accept any (possibly empty) closed list here.
1422
+ if (!(g.s instanceof ListTerm)) return [];
1422
1423
  const xs = g.s.elems;
1423
1424
 
1424
1425
  const dtOut0 = commonNumericDatatype(xs, g.o);
@@ -1472,7 +1473,8 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
1472
1473
  // math:product
1473
1474
  // Schema: ( $s.i+ )+ math:product $o-
1474
1475
  if (pv === MATH_NS + 'product') {
1475
- if (!(g.s instanceof ListTerm) || g.s.elems.length < 2) return [];
1476
+ // We accept any (possibly empty) closed list here.
1477
+ if (!(g.s instanceof ListTerm)) return [];
1476
1478
  const xs = g.s.elems;
1477
1479
 
1478
1480
  const dtOut0 = commonNumericDatatype(xs, g.o);
package/lib/builtins.js CHANGED
@@ -1406,7 +1406,8 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
1406
1406
  // math:sum
1407
1407
  // Schema: ( $s.i+ )+ math:sum $o-
1408
1408
  if (pv === MATH_NS + 'sum') {
1409
- if (!(g.s instanceof ListTerm) || g.s.elems.length < 2) return [];
1409
+ // We accept any (possibly empty) closed list here.
1410
+ if (!(g.s instanceof ListTerm)) return [];
1410
1411
  const xs = g.s.elems;
1411
1412
 
1412
1413
  const dtOut0 = commonNumericDatatype(xs, g.o);
@@ -1460,7 +1461,8 @@ function evalBuiltin(goal, subst, facts, backRules, depth, varGen, maxResults) {
1460
1461
  // math:product
1461
1462
  // Schema: ( $s.i+ )+ math:product $o-
1462
1463
  if (pv === MATH_NS + 'product') {
1463
- if (!(g.s instanceof ListTerm) || g.s.elems.length < 2) return [];
1464
+ // We accept any (possibly empty) closed list here.
1465
+ if (!(g.s instanceof ListTerm)) return [];
1464
1466
  const xs = g.s.elems;
1465
1467
 
1466
1468
  const dtOut0 = commonNumericDatatype(xs, g.o);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eyeling",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "A minimal Notation3 (N3) reasoner in JavaScript.",
5
5
  "main": "./index.js",
6
6
  "keywords": [
@@ -101,7 +101,10 @@ function rmrf(p) {
101
101
  ok(`cloned notation3tests ${C.dim}(${r.ms} ms)${C.n}`);
102
102
 
103
103
  // 2) Install suite dependencies
104
- r = run('npm', ['ci'], { cwd: suiteDir });
104
+ // Notation3tests can carry vulnerabilities in its transient dependency tree.
105
+ // These are outside Eyeling's control, and npm's audit summary can be noisy in logs.
106
+ // Disable audit/funding output for this integration test install.
107
+ r = run('npm', ['ci', '--audit=false', '--fund=false'], { cwd: suiteDir });
105
108
  if (r.status !== 0) {
106
109
  fail(`npm ci failed (exit ${r.status})`);
107
110
  rmrf(workDir);
@@ -131,7 +134,8 @@ function rmrf(p) {
131
134
  ok(`packed ${tgzName} ${C.dim}(${pack.ms} ms)${C.n}`);
132
135
 
133
136
  // 4) Install local tarball into suite
134
- r = run('npm', ['install', '--no-save', tgzPath], { cwd: suiteDir });
137
+ // Keep the install output focused on the actual test run.
138
+ r = run('npm', ['install', '--no-save', '--audit=false', '--fund=false', tgzPath], { cwd: suiteDir });
135
139
  if (r.status !== 0) {
136
140
  fail(`npm install eyeling tarball failed (exit ${r.status})`);
137
141
  rmrf(tgzPath);