eyeling 1.24.0 → 1.24.1

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.
Files changed (154) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/see/README.md +10 -11
  4. package/see/examples/age.js +10 -10
  5. package/see/examples/annotation.js +10 -10
  6. package/see/examples/backward.js +10 -10
  7. package/see/examples/backward_recursion.js +10 -10
  8. package/see/examples/bayes_diagnosis.js +10 -10
  9. package/see/examples/bayes_therapy.js +10 -10
  10. package/see/examples/bmi.js +10 -10
  11. package/see/examples/builtin_coverage.js +10 -10
  12. package/see/examples/collection.js +10 -10
  13. package/see/examples/complex.js +10 -10
  14. package/see/examples/complex_matrix_stability.js +10 -10
  15. package/see/examples/composition_of_injective_functions_is_injective.js +10 -10
  16. package/see/examples/control_system.js +10 -10
  17. package/see/examples/crypto_builtins_tests.js +10 -10
  18. package/see/examples/delfour.js +10 -10
  19. package/see/examples/digital_product_passport.js +10 -10
  20. package/see/examples/dijkstra.js +10 -10
  21. package/see/examples/dijkstra_risk_path.js +10 -10
  22. package/see/examples/doc/age.md +1 -1
  23. package/see/examples/doc/annotation.md +1 -1
  24. package/see/examples/doc/backward.md +1 -1
  25. package/see/examples/doc/backward_recursion.md +1 -1
  26. package/see/examples/doc/bayes_diagnosis.md +1 -1
  27. package/see/examples/doc/bayes_therapy.md +1 -1
  28. package/see/examples/doc/bmi.md +1 -1
  29. package/see/examples/doc/builtin_coverage.md +1 -1
  30. package/see/examples/doc/collection.md +1 -1
  31. package/see/examples/doc/complex.md +1 -1
  32. package/see/examples/doc/complex_matrix_stability.md +1 -1
  33. package/see/examples/doc/composition_of_injective_functions_is_injective.md +1 -1
  34. package/see/examples/doc/control_system.md +1 -1
  35. package/see/examples/doc/crypto_builtins_tests.md +1 -1
  36. package/see/examples/doc/delfour.md +1 -1
  37. package/see/examples/doc/digital_product_passport.md +1 -1
  38. package/see/examples/doc/dijkstra.md +1 -1
  39. package/see/examples/doc/dijkstra_risk_path.md +1 -1
  40. package/see/examples/doc/dog.md +1 -1
  41. package/see/examples/doc/eco_route_insight.md +1 -1
  42. package/see/examples/doc/equals.md +1 -1
  43. package/see/examples/doc/equivalence_classes_overlap_implies_same_class.md +1 -1
  44. package/see/examples/doc/euler_identity.md +1 -1
  45. package/see/examples/doc/ev_roundtrip_planner.md +1 -1
  46. package/see/examples/doc/existential_rule.md +1 -1
  47. package/see/examples/doc/expression_eval.md +1 -1
  48. package/see/examples/doc/family_cousins.md +1 -1
  49. package/see/examples/doc/fastpow.md +1 -1
  50. package/see/examples/doc/fibonacci.md +1 -1
  51. package/see/examples/doc/french_cities.md +1 -1
  52. package/see/examples/doc/fundamental_theorem_arithmetic.md +1 -1
  53. package/see/examples/doc/genetic_knapsack_selection.md +1 -1
  54. package/see/examples/doc/goldbach_1000.md +1 -1
  55. package/see/examples/doc/good_cobbler.md +1 -1
  56. package/see/examples/doc/gps.md +1 -1
  57. package/see/examples/doc/gray_code_counter.md +1 -1
  58. package/see/examples/doc/greatest_lower_bound_uniqueness.md +1 -1
  59. package/see/examples/doc/group_inverse_uniqueness.md +1 -1
  60. package/see/examples/doc/hadamard_approx.md +1 -1
  61. package/see/examples/doc/hanoi.md +1 -1
  62. package/see/examples/doc/odrl_dpv_risk_ranked.md +1 -1
  63. package/see/examples/doc/path_discovery.md +1 -1
  64. package/see/examples/doc/rc_discharge_envelope.md +1 -1
  65. package/see/examples/doc/rdf_message_flow.md +1 -1
  66. package/see/examples/doc/rdf_messages.md +1 -1
  67. package/see/examples/doc/school_placement_audit.md +1 -1
  68. package/see/examples/doc/smoke_arithmetic.md +1 -1
  69. package/see/examples/doc/socrates.md +1 -1
  70. package/see/examples/doc/wind_turbine.md +1 -1
  71. package/see/examples/doc/witch.md +1 -1
  72. package/see/examples/dog.js +10 -10
  73. package/see/examples/eco_route_insight.js +10 -10
  74. package/see/examples/equals.js +10 -10
  75. package/see/examples/equivalence_classes_overlap_implies_same_class.js +10 -10
  76. package/see/examples/euler_identity.js +10 -10
  77. package/see/examples/ev_roundtrip_planner.js +10 -10
  78. package/see/examples/existential_rule.js +10 -10
  79. package/see/examples/expression_eval.js +10 -10
  80. package/see/examples/family_cousins.js +10 -10
  81. package/see/examples/fastpow.js +10 -10
  82. package/see/examples/fibonacci.js +10 -10
  83. package/see/examples/french_cities.js +10 -10
  84. package/see/examples/fundamental_theorem_arithmetic.js +10 -10
  85. package/see/examples/genetic_knapsack_selection.js +10 -10
  86. package/see/examples/goldbach_1000.js +10 -10
  87. package/see/examples/good_cobbler.js +10 -10
  88. package/see/examples/gps.js +10 -10
  89. package/see/examples/gray_code_counter.js +10 -10
  90. package/see/examples/greatest_lower_bound_uniqueness.js +10 -10
  91. package/see/examples/group_inverse_uniqueness.js +10 -10
  92. package/see/examples/hadamard_approx.js +10 -10
  93. package/see/examples/hanoi.js +10 -10
  94. package/see/examples/odrl_dpv_risk_ranked.js +10 -10
  95. package/see/examples/output/age.md +3 -3
  96. package/see/examples/output/annotation.md +4 -4
  97. package/see/examples/output/backward.md +3 -3
  98. package/see/examples/output/backward_recursion.md +3 -3
  99. package/see/examples/output/bayes_diagnosis.md +1 -1
  100. package/see/examples/output/bayes_therapy.md +1 -1
  101. package/see/examples/output/bmi.md +1 -1
  102. package/see/examples/output/builtin_coverage.md +3 -3
  103. package/see/examples/output/collection.md +3 -3
  104. package/see/examples/output/complex.md +4 -4
  105. package/see/examples/output/complex_matrix_stability.md +1 -1
  106. package/see/examples/output/composition_of_injective_functions_is_injective.md +3 -3
  107. package/see/examples/output/control_system.md +3 -3
  108. package/see/examples/output/crypto_builtins_tests.md +3 -3
  109. package/see/examples/output/delfour.md +1 -1
  110. package/see/examples/output/digital_product_passport.md +1 -1
  111. package/see/examples/output/dijkstra.md +3 -3
  112. package/see/examples/output/dijkstra_risk_path.md +1 -1
  113. package/see/examples/output/dog.md +3 -3
  114. package/see/examples/output/eco_route_insight.md +1 -1
  115. package/see/examples/output/equals.md +3 -3
  116. package/see/examples/output/equivalence_classes_overlap_implies_same_class.md +3 -3
  117. package/see/examples/output/euler_identity.md +3 -3
  118. package/see/examples/output/ev_roundtrip_planner.md +1 -1
  119. package/see/examples/output/existential_rule.md +3 -3
  120. package/see/examples/output/expression_eval.md +3 -3
  121. package/see/examples/output/family_cousins.md +3 -3
  122. package/see/examples/output/fastpow.md +1 -1
  123. package/see/examples/output/fibonacci.md +1 -1
  124. package/see/examples/output/french_cities.md +3 -3
  125. package/see/examples/output/fundamental_theorem_arithmetic.md +1 -1
  126. package/see/examples/output/genetic_knapsack_selection.md +1 -1
  127. package/see/examples/output/goldbach_1000.md +1 -1
  128. package/see/examples/output/good_cobbler.md +4 -4
  129. package/see/examples/output/gps.md +1 -1
  130. package/see/examples/output/gray_code_counter.md +1 -1
  131. package/see/examples/output/greatest_lower_bound_uniqueness.md +3 -3
  132. package/see/examples/output/group_inverse_uniqueness.md +3 -3
  133. package/see/examples/output/hadamard_approx.md +3 -3
  134. package/see/examples/output/hanoi.md +3 -3
  135. package/see/examples/output/odrl_dpv_risk_ranked.md +3 -3
  136. package/see/examples/output/path_discovery.md +3 -3
  137. package/see/examples/output/rc_discharge_envelope.md +1 -1
  138. package/see/examples/output/rdf_message_flow.md +1 -1
  139. package/see/examples/output/rdf_messages.md +1 -1
  140. package/see/examples/output/school_placement_audit.md +1 -1
  141. package/see/examples/output/smoke_arithmetic.md +1 -1
  142. package/see/examples/output/socrates.md +3 -3
  143. package/see/examples/output/wind_turbine.md +1 -1
  144. package/see/examples/output/witch.md +3 -3
  145. package/see/examples/path_discovery.js +10 -10
  146. package/see/examples/rc_discharge_envelope.js +10 -10
  147. package/see/examples/rdf_message_flow.js +10 -10
  148. package/see/examples/rdf_messages.js +10 -10
  149. package/see/examples/school_placement_audit.js +10 -10
  150. package/see/examples/smoke_arithmetic.js +10 -10
  151. package/see/examples/socrates.js +10 -10
  152. package/see/examples/wind_turbine.js +10 -10
  153. package/see/examples/witch.js +10 -10
  154. package/see/see.js +381 -93
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -2913,7 +2913,7 @@ const RULES = [
2913
2913
  }
2914
2914
  ];
2915
2915
  const QUERIES = [];
2916
- const DOC_MARKDOWN = "# BMI — Body Mass Index example.\n\nGenerated by `see.js` from a Notation3 source file.\n\nThis example turns a familiar health calculation into a small, inspectable\nSEE example. It normalizes either metric or US inputs, computes BMI, assigns\na WHO adult category, and derives a healthy-range weight band for the given\nheight. The report explains the result and includes independent validations for\nboundary handling and category behavior.\nFor reproducibility and documentation only; not medical advice.\n\n## Compilation summary\n\n- Example name: `bmi`\n- Input facts emitted: 3\n- Forward rules compiled: 12\n- Backward predicate rules compiled: 0\n- Fuses compiled: 1\n- Predicate count: 27\n\n## Built-ins used\n\n- `log:notEqualTo`\n- `log:outputString`\n- `math:lessThan`\n- `math:notLessThan`\n- `math:product`\n- `math:quotient`\n- `math:rounded`\n- `string:concatenation`\n\n## Runtime model\n\nThe generated `examples/bmi.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/bmi.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/bmi.trig` or `examples/input/bmi.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/bmi.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2916
+ const DOC_MARKDOWN = "# BMI — Body Mass Index example.\n\nGenerated by `see.js` from a Notation3 source file.\n\nThis example turns a familiar health calculation into a small, inspectable\nSEE example. It normalizes either metric or US inputs, computes BMI, assigns\na WHO adult category, and derives a healthy-range weight band for the given\nheight. The report explains the result and includes independent validations for\nboundary handling and category behavior.\nFor reproducibility and documentation only; not medical advice.\n\n## Compilation summary\n\n- Example name: `bmi`\n- Input facts emitted: 3\n- Forward rules compiled: 12\n- Backward predicate rules compiled: 0\n- Fuses compiled: 1\n- Predicate count: 27\n\n## Built-ins used\n\n- `log:notEqualTo`\n- `log:outputString`\n- `math:lessThan`\n- `math:notLessThan`\n- `math:product`\n- `math:quotient`\n- `math:rounded`\n- `string:concatenation`\n\n## Runtime model\n\nThe generated `examples/bmi.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/bmi.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/bmi.trig` or `examples/input/bmi.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/bmi.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2917
2917
  function seeMetadata(data) { return (data && data.__see) || {}; }
2918
2918
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "c7163f49a56f4405350787563e15aee0975fabd71ca773a8b32077b19ef25d3c") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "c7163f49a56f4405350787563e15aee0975fabd71ca773a8b32077b19ef25d3c", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 13, 'compiled query directives were loaded': QUERIES.length === 0, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
2919
2919
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -2399,7 +2399,7 @@ const QUERIES = [
2399
2399
  ]
2400
2400
  }
2401
2401
  ];
2402
- const DOC_MARKDOWN = "# Builtin coverage smoke\n\nGenerated by `see.js` from a Notation3 source file.\n\nExercises math, string, list, crypto, time, and log builtins in compiled JavaScript.\n\n## Compilation summary\n\n- Example name: `builtin_coverage`\n- Input facts emitted: 0\n- Forward rules compiled: 1\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 58\n\n## Built-ins used\n\n- `crypto:sha256`\n- `list:append`\n- `list:first`\n- `list:in`\n- `list:last`\n- `list:length`\n- `list:member`\n- `list:remove`\n- `list:rest`\n- `list:reverse`\n- `log:conjunction`\n- `math:absoluteValue`\n- `math:degrees`\n- `math:difference`\n- `math:integerQuotient`\n- `math:negation`\n- `math:product`\n- `math:quotient`\n- `math:remainder`\n- `math:sum`\n- `string:charAt`\n- `string:concatenation`\n- `string:contains`\n- `string:containsIgnoringCase`\n- `string:format`\n- `string:length`\n- `string:scrape`\n- `string:setCharAt`\n\n## Runtime model\n\nThe generated `examples/builtin_coverage.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/builtin_coverage.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/builtin-coverage.trig` or `examples/input/builtin_coverage.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/builtin_coverage.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2402
+ const DOC_MARKDOWN = "# Builtin coverage smoke\n\nGenerated by `see.js` from a Notation3 source file.\n\nExercises math, string, list, crypto, time, and log builtins in compiled JavaScript.\n\n## Compilation summary\n\n- Example name: `builtin_coverage`\n- Input facts emitted: 0\n- Forward rules compiled: 1\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 58\n\n## Built-ins used\n\n- `crypto:sha256`\n- `list:append`\n- `list:first`\n- `list:in`\n- `list:last`\n- `list:length`\n- `list:member`\n- `list:remove`\n- `list:rest`\n- `list:reverse`\n- `log:conjunction`\n- `math:absoluteValue`\n- `math:degrees`\n- `math:difference`\n- `math:integerQuotient`\n- `math:negation`\n- `math:product`\n- `math:quotient`\n- `math:remainder`\n- `math:sum`\n- `string:charAt`\n- `string:concatenation`\n- `string:contains`\n- `string:containsIgnoringCase`\n- `string:format`\n- `string:length`\n- `string:scrape`\n- `string:setCharAt`\n\n## Runtime model\n\nThe generated `examples/builtin_coverage.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/builtin_coverage.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/builtin-coverage.trig` or `examples/input/builtin_coverage.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/builtin_coverage.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2403
2403
  function seeMetadata(data) { return (data && data.__see) || {}; }
2404
2404
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "4ea25a79da436dd28fb54de1a7d0f5d49729b47f384f9bd36411c5cc1b821dbc") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "4ea25a79da436dd28fb54de1a7d0f5d49729b47f384f9bd36411c5cc1b821dbc", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 1, 'compiled query directives were loaded': QUERIES.length === 1, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
2405
2405
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -1195,7 +1195,7 @@ const TITLE = "Collection";
1195
1195
  const EXPECTED_INPUT_FACTS = 2;
1196
1196
  const RULES = [];
1197
1197
  const QUERIES = [];
1198
- const DOC_MARKDOWN = "# Collection\n\nGenerated by `see.js` from a Notation3 source file.\n\n## Compilation summary\n\n- Example name: `collection`\n- Input facts emitted: 2\n- Forward rules compiled: 0\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 2\n\n## Built-ins used\n\n- none\n\n## Runtime model\n\nThe generated `examples/collection.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/collection.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/collection.trig` or `examples/input/collection.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/collection.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
1198
+ const DOC_MARKDOWN = "# Collection\n\nGenerated by `see.js` from a Notation3 source file.\n\n## Compilation summary\n\n- Example name: `collection`\n- Input facts emitted: 2\n- Forward rules compiled: 0\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 2\n\n## Built-ins used\n\n- none\n\n## Runtime model\n\nThe generated `examples/collection.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/collection.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/collection.trig` or `examples/input/collection.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/collection.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
1199
1199
  function seeMetadata(data) { return (data && data.__see) || {}; }
1200
1200
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "ebce812d5e37729432cb77a638cde078af333450cc12ebd66b06083867cee7fa") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "ebce812d5e37729432cb77a638cde078af333450cc12ebd66b06083867cee7fa", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 0, 'compiled query directives were loaded': QUERIES.length === 0, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
1201
1201
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -3637,7 +3637,7 @@ const RULES = [
3637
3637
  }
3638
3638
  ];
3639
3639
  const QUERIES = [];
3640
- const DOC_MARKDOWN = "# Complex numbers\n\nGenerated by `see.js` from a Notation3 source file.\n\nSee https://en.wikipedia.org/wiki/Complex_number\n\n## Compilation summary\n\n- Example name: `complex`\n- Input facts emitted: 0\n- Forward rules compiled: 1\n- Backward predicate rules compiled: 8\n- Fuses compiled: 0\n- Predicate count: 19\n\n## Built-ins used\n\n- `math:absoluteValue`\n- `math:acos`\n- `math:asin`\n- `math:cos`\n- `math:difference`\n- `math:exponentiation`\n- `math:lessThan`\n- `math:negation`\n- `math:notLessThan`\n- `math:product`\n- `math:quotient`\n- `math:sin`\n- `math:sum`\n\n## Runtime model\n\nThe generated `examples/complex.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/complex.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/complex.trig` or `examples/input/complex.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/complex.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
3640
+ const DOC_MARKDOWN = "# Complex numbers\n\nGenerated by `see.js` from a Notation3 source file.\n\nSee https://en.wikipedia.org/wiki/Complex_number\n\n## Compilation summary\n\n- Example name: `complex`\n- Input facts emitted: 0\n- Forward rules compiled: 1\n- Backward predicate rules compiled: 8\n- Fuses compiled: 0\n- Predicate count: 19\n\n## Built-ins used\n\n- `math:absoluteValue`\n- `math:acos`\n- `math:asin`\n- `math:cos`\n- `math:difference`\n- `math:exponentiation`\n- `math:lessThan`\n- `math:negation`\n- `math:notLessThan`\n- `math:product`\n- `math:quotient`\n- `math:sin`\n- `math:sum`\n\n## Runtime model\n\nThe generated `examples/complex.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/complex.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/complex.trig` or `examples/input/complex.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/complex.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
3641
3641
  function seeMetadata(data) { return (data && data.__see) || {}; }
3642
3642
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "f06171b97fcf380a64522165c21d4544ef88af39e5f8a679aad2e51bcc63c2b6") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "f06171b97fcf380a64522165c21d4544ef88af39e5f8a679aad2e51bcc63c2b6", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 9, 'compiled query directives were loaded': QUERIES.length === 0, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
3643
3643
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -2848,7 +2848,7 @@ const RULES = [
2848
2848
  }
2849
2849
  ];
2850
2850
  const QUERIES = [];
2851
- const DOC_MARKDOWN = "# Complex Matrix Stability\n\nGenerated by `see.js` from a Notation3 source file.\n\nDiagonal 2x2 complex matrices are classified for discrete-time stability.\nThis adapts the Eyeling complex matrix example as a committed SEE N3\nsource that compiles to a standalone JavaScript example.\n\n## Compilation summary\n\n- Example name: `complex_matrix_stability`\n- Input facts emitted: 40\n- Forward rules compiled: 2\n- Backward predicate rules compiled: 15\n- Fuses compiled: 0\n- Predicate count: 28\n\n## Built-ins used\n\n- `log:outputString`\n- `math:difference`\n- `math:greaterThan`\n- `math:lessThan`\n- `math:notLessThan`\n- `math:product`\n- `math:sum`\n- `string:format`\n\n## Runtime model\n\nThe generated `examples/complex_matrix_stability.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/complex_matrix_stability.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/complex-matrix-stability.trig` or `examples/input/complex_matrix_stability.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/complex_matrix_stability.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2851
+ const DOC_MARKDOWN = "# Complex Matrix Stability\n\nGenerated by `see.js` from a Notation3 source file.\n\nDiagonal 2x2 complex matrices are classified for discrete-time stability.\nThis adapts the Eyeling complex matrix example as a committed SEE N3\nsource that compiles to a standalone JavaScript example.\n\n## Compilation summary\n\n- Example name: `complex_matrix_stability`\n- Input facts emitted: 40\n- Forward rules compiled: 2\n- Backward predicate rules compiled: 15\n- Fuses compiled: 0\n- Predicate count: 28\n\n## Built-ins used\n\n- `log:outputString`\n- `math:difference`\n- `math:greaterThan`\n- `math:lessThan`\n- `math:notLessThan`\n- `math:product`\n- `math:sum`\n- `string:format`\n\n## Runtime model\n\nThe generated `examples/complex_matrix_stability.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/complex_matrix_stability.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/complex-matrix-stability.trig` or `examples/input/complex_matrix_stability.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/complex_matrix_stability.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2852
2852
  function seeMetadata(data) { return (data && data.__see) || {}; }
2853
2853
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "0ffed52d668e21ce26c5de11d2783603153ab79b6e2f92dece41e70777531297") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "0ffed52d668e21ce26c5de11d2783603153ab79b6e2f92dece41e70777531297", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 17, 'compiled query directives were loaded': QUERIES.length === 0, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
2854
2854
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -2045,7 +2045,7 @@ const QUERIES = [
2045
2045
  ]
2046
2046
  }
2047
2047
  ];
2048
- const DOC_MARKDOWN = "# Composition of injective functions is injective.\n\nGenerated by `see.js` from a Notation3 source file.\n\n## Compilation summary\n\n- Example name: `composition_of_injective_functions_is_injective`\n- Input facts emitted: 12\n- Forward rules compiled: 8\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 10\n\n## Built-ins used\n\n- `log:notEqualTo`\n\n## Runtime model\n\nThe generated `examples/composition_of_injective_functions_is_injective.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/composition_of_injective_functions_is_injective.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/composition-of-injective-functions-is-injective.trig` or `examples/input/composition_of_injective_functions_is_injective.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/composition_of_injective_functions_is_injective.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2048
+ const DOC_MARKDOWN = "# Composition of injective functions is injective.\n\nGenerated by `see.js` from a Notation3 source file.\n\n## Compilation summary\n\n- Example name: `composition_of_injective_functions_is_injective`\n- Input facts emitted: 12\n- Forward rules compiled: 8\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 10\n\n## Built-ins used\n\n- `log:notEqualTo`\n\n## Runtime model\n\nThe generated `examples/composition_of_injective_functions_is_injective.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/composition_of_injective_functions_is_injective.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/composition-of-injective-functions-is-injective.trig` or `examples/input/composition_of_injective_functions_is_injective.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/composition_of_injective_functions_is_injective.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
2049
2049
  function seeMetadata(data) { return (data && data.__see) || {}; }
2050
2050
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "59429a6490d6587b42c78b3206d390c6a9c1570a2fcdfa09407be0261c99b88f") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "59429a6490d6587b42c78b3206d390c6a9c1570a2fcdfa09407be0261c99b88f", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 8, 'compiled query directives were loaded': QUERIES.length === 1, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
2051
2051
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -1793,7 +1793,7 @@ const QUERIES = [
1793
1793
  ]
1794
1794
  }
1795
1795
  ];
1796
- const DOC_MARKDOWN = "# Control System\n\nGenerated by `see.js` from a Notation3 source file.\n\nCompact SEE version of the EYE reasoning/control-system example.\n\n## Compilation summary\n\n- Example name: `control_system`\n- Input facts emitted: 7\n- Forward rules compiled: 2\n- Backward predicate rules compiled: 2\n- Fuses compiled: 0\n- Predicate count: 15\n\n## Built-ins used\n\n- `math:difference`\n- `math:exponentiation`\n- `math:lessThan`\n- `math:notLessThan`\n- `math:product`\n- `math:quotient`\n- `math:sum`\n\n## Runtime model\n\nThe generated `examples/control_system.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/control_system.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/control-system.trig` or `examples/input/control_system.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/control_system.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
1796
+ const DOC_MARKDOWN = "# Control System\n\nGenerated by `see.js` from a Notation3 source file.\n\nCompact SEE version of the EYE reasoning/control-system example.\n\n## Compilation summary\n\n- Example name: `control_system`\n- Input facts emitted: 7\n- Forward rules compiled: 2\n- Backward predicate rules compiled: 2\n- Fuses compiled: 0\n- Predicate count: 15\n\n## Built-ins used\n\n- `math:difference`\n- `math:exponentiation`\n- `math:lessThan`\n- `math:notLessThan`\n- `math:product`\n- `math:quotient`\n- `math:sum`\n\n## Runtime model\n\nThe generated `examples/control_system.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/control_system.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/control-system.trig` or `examples/input/control_system.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/control_system.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
1797
1797
  function seeMetadata(data) { return (data && data.__see) || {}; }
1798
1798
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "0950a7098972ffc4883c2cc7410f7d54f5699111ecfc026bc88dba74ef0ffc40") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "0950a7098972ffc4883c2cc7410f7d54f5699111ecfc026bc88dba74ef0ffc40", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 4, 'compiled query directives were loaded': QUERIES.length === 1, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
1799
1799
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }
@@ -1040,19 +1040,19 @@ function renderStructuredOutput({ title, graph, queries = [], rules = [], initia
1040
1040
  const lines = [];
1041
1041
  lines.push('# ' + title);
1042
1042
  lines.push('');
1043
- lines.push('## Insight');
1043
+ lines.push('## Entailment');
1044
1044
  if (mode === 'query') {
1045
1045
  lines.push('The compiled query selected ' + selected.length + ' fact(s) after the rule closure was computed.');
1046
1046
  } else if (mode === 'formula') {
1047
- lines.push('The derivation produced ' + selected.length + ' formula-valued conclusion(s).');
1047
+ lines.push('The derivation produced ' + selected.length + ' formula-valued entailment(s).');
1048
1048
  } else {
1049
1049
  lines.push('The derivation produced ' + derived.length + ' new fact(s) from ' + initialFacts.length + ' stated fact(s).');
1050
1050
  }
1051
- if (keyFact) lines.push('Main conclusion: **' + factSentence(keyFact) + '**');
1051
+ if (keyFact) lines.push('Main entailment: **' + factSentence(keyFact) + '**');
1052
1052
  const bullets = selected.slice(-6).reverse();
1053
1053
  if (bullets.length) {
1054
1054
  lines.push('');
1055
- lines.push('Selected conclusions:');
1055
+ lines.push('Selected entailments:');
1056
1056
  for (const fact of bullets) lines.push('- ' + codeFact(fact));
1057
1057
  }
1058
1058
  lines.push('');
@@ -1114,15 +1114,15 @@ function dedupeExplanationHeadings(text) {
1114
1114
  function normalizePublicReport(markdown, title) {
1115
1115
  let text = String(markdown || '').trimEnd();
1116
1116
  if (!/^\s*#\s+/m.test(text)) text = '# ' + title + '\n\n' + text;
1117
- if (!/^##\s+Insight\s*$/mi.test(text)) {
1118
- text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Insight\n');
1117
+ if (!/^##\s+Entailment\s*$/mi.test(text)) {
1118
+ text = text.replace(/^(#\s+[^\n]+\n*)/, '$1\n## Entailment\n');
1119
1119
  }
1120
1120
  if (!/^##\s+Explanation\s*$/mi.test(text)) {
1121
1121
  text += '\n\n## Explanation\nNo additional explanation was provided by the generated output.';
1122
1122
  }
1123
1123
  text = text.replace(/^##\s+([^\n]+?)\s*$/gm, (line, heading) => {
1124
1124
  const normalized = heading.trim().toLowerCase();
1125
- if (normalized === 'insight' || normalized === 'explanation') return '## ' + (normalized === 'insight' ? 'Insight' : 'Explanation');
1125
+ if (normalized === 'insight' || normalized === 'conclusion' || normalized === 'entailment' || normalized === 'explanation') return '## ' + (normalized === 'explanation' ? 'Explanation' : 'Entailment');
1126
1126
  return '**' + heading.trim() + '**';
1127
1127
  });
1128
1128
  text = dedupeExplanationHeadings(text);
@@ -1131,13 +1131,13 @@ function normalizePublicReport(markdown, title) {
1131
1131
  function markdownize(raw, title) {
1132
1132
  let text = String(raw || '');
1133
1133
  text = text
1134
- .replace(/===\s*Answer\s*===/g, '## Insight')
1134
+ .replace(/===\s*Answer\s*===/g, '## Entailment')
1135
1135
  .replace(/===\s*Reason\s+Why\s*===/gi, '## Explanation')
1136
1136
  .replace(/===\s*Explanation\s*===/gi, '## Explanation')
1137
1137
  .replace(/===\s*([^=]+?)\s*===/g, (_, h) => '**' + h.trim() + '**');
1138
1138
  text = text.replace(/^C(\d+)\s+OK\s*-\s*/gm, 'C$1: ');
1139
1139
  text = dedupeExplanationHeadings(text);
1140
- if (!text.trim()) text = '## Insight\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1140
+ if (!text.trim()) text = '## Entailment\nNo log:outputString facts were derived.\n\n## Explanation\nThe compiled derivation did not produce authored report text.';
1141
1141
  return normalizePublicReport(text, title);
1142
1142
  }
1143
1143
  function authoredSupportAppendix(graph, queries, rules, initialFacts, trace) {
@@ -1364,7 +1364,7 @@ const RULES = [
1364
1364
  }
1365
1365
  ];
1366
1366
  const QUERIES = [];
1367
- const DOC_MARKDOWN = "# crypto builtins tests\n\nGenerated by `see.js` from a Notation3 source file.\n\n## Compilation summary\n\n- Example name: `crypto_builtins_tests`\n- Input facts emitted: 0\n- Forward rules compiled: 4\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 5\n\n## Built-ins used\n\n- `crypto:md5`\n- `crypto:sha`\n- `crypto:sha256`\n- `crypto:sha512`\n\n## Runtime model\n\nThe generated `examples/crypto_builtins_tests.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/crypto_builtins_tests.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/crypto-builtins-tests.trig` or `examples/input/crypto_builtins_tests.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/crypto_builtins_tests.js` produces a SEE-style Markdown report with an **Insight** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
1367
+ const DOC_MARKDOWN = "# crypto builtins tests\n\nGenerated by `see.js` from a Notation3 source file.\n\n## Compilation summary\n\n- Example name: `crypto_builtins_tests`\n- Input facts emitted: 0\n- Forward rules compiled: 4\n- Backward predicate rules compiled: 0\n- Fuses compiled: 0\n- Predicate count: 5\n\n## Built-ins used\n\n- `crypto:md5`\n- `crypto:sha`\n- `crypto:sha256`\n- `crypto:sha512`\n\n## Runtime model\n\nThe generated `examples/crypto_builtins_tests.js` is a specialized JavaScript derivation program. For ordinary sources, `see.js` emits the source facts as `examples/input/crypto_builtins_tests.trig`. For rules-only sources, generation can reuse an existing external evidence file such as `examples/input/crypto-builtins-tests.trig` or `examples/input/crypto_builtins_tests.trig`. The runner reads that TriG evidence directly and performs a local fixpoint derivation; it does not parse the program source or call an external reasoner.\n\n## Output model\n\nRunning `node examples/crypto_builtins_tests.js` produces a SEE-style Markdown report with an **Entailment** section, an **Explanation** section, and a **Formal TriG Output** section containing the selected derived/query facts.\n";
1368
1368
  function seeMetadata(data) { return (data && data.__see) || {}; }
1369
1369
  function trustedDerivation(data) { const meta = seeMetadata(data); const facts = data && Array.isArray(data.facts) ? data.facts : []; const expectedFacts = EXPECTED_INPUT_FACTS || Number(meta.InputFacts || 0); if (meta.SourceSHA256 && meta.SourceSHA256 !== "36867ada425da37071cbc96e74a10311adbfe437adf3d8e56b4a1d95a23763b5") throw new Error('input evidence does not match the N3 source compiled into this example'); const result = saturate(facts, RULES); const rawOutput = renderRawOutput(result.graph, QUERIES, RULES, facts); fail('Compiled N3 derivation failed', { 'input evidence metadata is present and matches compiled source': meta.SourceSHA256 === "36867ada425da37071cbc96e74a10311adbfe437adf3d8e56b4a1d95a23763b5", 'input evidence facts were loaded': expectedFacts > 0 ? facts.length === expectedFacts : facts.length >= 0, 'compiled rules were loaded': RULES.length === 4, 'compiled query directives were loaded': QUERIES.length === 0, 'a derivation fixpoint was reached': result.graph.facts.length >= facts.length, 'query or output facts were produced': rawOutput.length > 0 }); return { ...result, rawOutput, inputFacts: facts }; }
1370
1370
  function snapshotMarkdown(markdown) { return markdown.split(/\n/).map((line) => line ? line + ' \n' : '\n').join(''); }