eyeling 1.32.0 → 1.33.0
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.
- package/README.md +123 -18
- package/bin/eyeling.cjs +56 -4
- package/browser.d.ts +63 -0
- package/dist/browser/eyeling.browser.js +298 -14
- package/examples/eyelang/INTEGRATION.md +13 -0
- package/examples/eyelang/README.md +628 -0
- package/examples/eyelang/SPEC.md +684 -0
- package/examples/eyelang/access-control-policy.pl +52 -0
- package/examples/eyelang/ackermann.pl +46 -0
- package/examples/eyelang/age.pl +28 -0
- package/examples/eyelang/aliases-and-namespaces.pl +22 -0
- package/examples/eyelang/alignment-demo.pl +44 -0
- package/examples/eyelang/allen-interval-calculus.pl +64 -0
- package/examples/eyelang/ancestor.pl +21 -0
- package/examples/eyelang/animal.pl +21 -0
- package/examples/eyelang/annotation-rdf12.ttl +12 -0
- package/examples/eyelang/annotation.pl +34 -0
- package/examples/eyelang/auroracare.pl +309 -0
- package/examples/eyelang/backward.pl +12 -0
- package/examples/eyelang/basic-monadic.pl +10018 -0
- package/examples/eyelang/bayes-diagnosis.pl +108 -0
- package/examples/eyelang/bayes-therapy.pl +182 -0
- package/examples/eyelang/beam-deflection.pl +50 -0
- package/examples/eyelang/blocks-world-planning.pl +75 -0
- package/examples/eyelang/bmi.pl +232 -0
- package/examples/eyelang/braking-safety-worlds.pl +69 -0
- package/examples/eyelang/buck-converter-design.pl +78 -0
- package/examples/eyelang/cache-performance.pl +54 -0
- package/examples/eyelang/canary-release.pl +49 -0
- package/examples/eyelang/cat-koko.pl +24 -0
- package/examples/eyelang/clinical-trial-screening.pl +92 -0
- package/examples/eyelang/collatz-1000.pl +14 -0
- package/examples/eyelang/combinatorics-findall-sort.pl +37 -0
- package/examples/eyelang/competitive-enzyme-kinetics.pl +78 -0
- package/examples/eyelang/complex-matrix-stability.pl +45 -0
- package/examples/eyelang/complex.pl +121 -0
- package/examples/eyelang/composition-of-injective-functions-is-injective.pl +50 -0
- package/examples/eyelang/context-association.pl +53 -0
- package/examples/eyelang/control-system.pl +72 -0
- package/examples/eyelang/cryptarithmetic-send-more-money.pl +49 -0
- package/examples/eyelang/cyclic-path.pl +16 -0
- package/examples/eyelang/d3-group.pl +100 -0
- package/examples/eyelang/dairy-energy-balance.pl +65 -0
- package/examples/eyelang/data-negotiation.pl +39 -0
- package/examples/eyelang/deep-taxonomy-10.pl +115 -0
- package/examples/eyelang/deep-taxonomy-100.pl +385 -0
- package/examples/eyelang/deep-taxonomy-1000.pl +3085 -0
- package/examples/eyelang/deep-taxonomy-10000.pl +30094 -0
- package/examples/eyelang/deep-taxonomy-100000.pl +300184 -0
- package/examples/eyelang/delfour.pl +281 -0
- package/examples/eyelang/dense-hamiltonian-cycle.pl +92 -0
- package/examples/eyelang/deontic-logic.pl +52 -0
- package/examples/eyelang/derived-backward-rule.pl +30 -0
- package/examples/eyelang/derived-rule.pl +27 -0
- package/examples/eyelang/diamond-property.pl +38 -0
- package/examples/eyelang/dijkstra-findall-sort.pl +44 -0
- package/examples/eyelang/dijkstra-risk-path.pl +86 -0
- package/examples/eyelang/dijkstra.pl +46 -0
- package/examples/eyelang/dining-philosophers.pl +140 -0
- package/examples/eyelang/directional-language.ttl +9 -0
- package/examples/eyelang/dog.pl +25 -0
- package/examples/eyelang/drone-corridor-planner.pl +51 -0
- package/examples/eyelang/easter-computus.pl +89 -0
- package/examples/eyelang/electrical-rc-filter.pl +36 -0
- package/examples/eyelang/epidemic-policy.pl +67 -0
- package/examples/eyelang/equivalence-classes-overlap-implies-same-class.pl +27 -0
- package/examples/eyelang/eulerian-path.pl +85 -0
- package/examples/eyelang/ev-range-worlds.pl +82 -0
- package/examples/eyelang/exact-cover-sudoku.pl +113 -0
- package/examples/eyelang/existential-rule.pl +18 -0
- package/examples/eyelang/exoplanet-validation-worlds.pl +88 -0
- package/examples/eyelang/expression-eval.pl +43 -0
- package/examples/eyelang/eyeling-ackermann.n3 +41 -0
- package/examples/eyelang/eyeling-age-threshold.n3 +12 -0
- package/examples/eyelang/eyeling-alignment-demo.n3 +11 -0
- package/examples/eyelang/eyeling-allen-interval-calculus-small.n3 +13 -0
- package/examples/eyelang/eyeling-backward-recursion.n3 +11 -0
- package/examples/eyelang/eyeling-backward.n3 +10 -0
- package/examples/eyelang/eyeling-basic-monadic-small.n3 +11 -0
- package/examples/eyelang/eyeling-bmi.n3 +10 -0
- package/examples/eyelang/eyeling-cat-koko.n3 +15 -0
- package/examples/eyelang/eyeling-collatz-small.n3 +11 -0
- package/examples/eyelang/eyeling-collection.n3 +11 -0
- package/examples/eyelang/eyeling-complex-arithmetic.n3 +10 -0
- package/examples/eyelang/eyeling-context-association.n3 +11 -0
- package/examples/eyelang/eyeling-control-system-small.n3 +11 -0
- package/examples/eyelang/eyeling-crypto-builtins-extra.n3 +10 -0
- package/examples/eyelang/eyeling-crypto-builtins.n3 +8 -0
- package/examples/eyelang/eyeling-deep-taxonomy-10.n3 +18 -0
- package/examples/eyelang/eyeling-derived-backward-rule-flat.n3 +10 -0
- package/examples/eyelang/eyeling-derived-rule-flat.n3 +9 -0
- package/examples/eyelang/eyeling-digital-product-passport-small.n3 +11 -0
- package/examples/eyelang/eyeling-dijkstra-tiny.n3 +14 -0
- package/examples/eyelang/eyeling-dog-license.n3 +13 -0
- package/examples/eyelang/eyeling-drone-corridor-planner-small.n3 +13 -0
- package/examples/eyelang/eyeling-equals.n3 +8 -0
- package/examples/eyelang/eyeling-equivalence-classes.n3 +11 -0
- package/examples/eyelang/eyeling-euler-identity.n3 +9 -0
- package/examples/eyelang/eyeling-existential-rule.n3 +9 -0
- package/examples/eyelang/eyeling-expression-eval.n3 +11 -0
- package/examples/eyelang/eyeling-family-cousins-extended.n3 +12 -0
- package/examples/eyelang/eyeling-fastpow.n3 +10 -0
- package/examples/eyelang/eyeling-fibonacci.n3 +44 -0
- package/examples/eyelang/eyeling-french-cities-reachability.n3 +22 -0
- package/examples/eyelang/eyeling-goldbach-small.n3 +22 -0
- package/examples/eyelang/eyeling-good-cobbler.n3 +9 -0
- package/examples/eyelang/eyeling-list-builtins.n3 +10 -0
- package/examples/eyelang/eyeling-list-collection-extra.n3 +9 -0
- package/examples/eyelang/eyeling-math-builtins.n3 +9 -0
- package/examples/eyelang/eyeling-string-builtins-extra.n3 +9 -0
- package/examples/eyelang/eyeling-string-builtins.n3 +10 -0
- package/examples/eyelang/eyeling-time-builtins.n3 +11 -0
- package/examples/eyelang/eyeling-time-components-extra.n3 +10 -0
- package/examples/eyelang/eyeling-witch.n3 +10 -0
- package/examples/eyelang/family-cousins.n3 +17 -0
- package/examples/eyelang/family-cousins.pl +65 -0
- package/examples/eyelang/fastpow.pl +53 -0
- package/examples/eyelang/fft8-numeric.pl +83 -0
- package/examples/eyelang/fibonacci.pl +53 -0
- package/examples/eyelang/field-nitrogen-balance.pl +70 -0
- package/examples/eyelang/flandor.pl +296 -0
- package/examples/eyelang/floating-point.pl +23 -0
- package/examples/eyelang/four-color-map.pl +127 -0
- package/examples/eyelang/fundamental-theorem-arithmetic.pl +113 -0
- package/examples/eyelang/gcd-bezout-identity.pl +48 -0
- package/examples/eyelang/gd-step-certified.pl +158 -0
- package/examples/eyelang/gdpr-compliance.pl +69 -0
- package/examples/eyelang/goldbach-1000.pl +185 -0
- package/examples/eyelang/good-cobbler.pl +14 -0
- package/examples/eyelang/gps.pl +152 -0
- package/examples/eyelang/graph-reachability.pl +36 -0
- package/examples/eyelang/gray-code-counter.pl +48 -0
- package/examples/eyelang/greatest-lower-bound-uniqueness.pl +28 -0
- package/examples/eyelang/group-inverse-uniqueness.pl +34 -0
- package/examples/eyelang/hamiltonian-cycle.pl +55 -0
- package/examples/eyelang/hamiltonian-path.pl +49 -0
- package/examples/eyelang/hamming-code.pl +105 -0
- package/examples/eyelang/hanoi.pl +20 -0
- package/examples/eyelang/heat-loss.pl +51 -0
- package/examples/eyelang/heron-theorem.pl +36 -0
- package/examples/eyelang/ideal-gas-law.pl +37 -0
- package/examples/eyelang/illegitimate-reasoning.pl +88 -0
- package/examples/eyelang/kaprekar.pl +32 -0
- package/examples/eyelang/law-of-cosines.pl +31 -0
- package/examples/eyelang/least-squares-regression.pl +81 -0
- package/examples/eyelang/list-collection.pl +33 -0
- package/examples/eyelang/lldm.pl +78 -0
- package/examples/eyelang/manufacturing-quality-control.pl +73 -0
- package/examples/eyelang/matrix.pl +296 -0
- package/examples/eyelang/microgrid-dispatch.pl +85 -0
- package/examples/eyelang/monkey-bananas.pl +45 -0
- package/examples/eyelang/n-queens.pl +23 -0
- package/examples/eyelang/n3-builtins.n3 +28 -0
- package/examples/eyelang/network-sla.pl +48 -0
- package/examples/eyelang/newton-raphson.pl +49 -0
- package/examples/eyelang/nixon-diamond.pl +37 -0
- package/examples/eyelang/odrl-dpv-healthcare-risk-ranked.pl +266 -0
- package/examples/eyelang/odrl-dpv-risk-ranked.pl +320 -0
- package/examples/eyelang/orbital-transfer-design.pl +113 -0
- package/examples/eyelang/output/access-control-policy.pl +2 -0
- package/examples/eyelang/output/ackermann.pl +12 -0
- package/examples/eyelang/output/age.pl +2 -0
- package/examples/eyelang/output/aliases-and-namespaces.pl +5 -0
- package/examples/eyelang/output/alignment-demo.pl +32 -0
- package/examples/eyelang/output/allen-interval-calculus.pl +154 -0
- package/examples/eyelang/output/ancestor.pl +6 -0
- package/examples/eyelang/output/animal.pl +4 -0
- package/examples/eyelang/output/annotation-rdf12.ttl +1 -0
- package/examples/eyelang/output/annotation.pl +4 -0
- package/examples/eyelang/output/auroracare.pl +117 -0
- package/examples/eyelang/output/backward.pl +1 -0
- package/examples/eyelang/output/basic-monadic.pl +1518 -0
- package/examples/eyelang/output/bayes-diagnosis.pl +13 -0
- package/examples/eyelang/output/bayes-therapy.pl +23 -0
- package/examples/eyelang/output/beam-deflection.pl +5 -0
- package/examples/eyelang/output/blocks-world-planning.pl +4 -0
- package/examples/eyelang/output/bmi.pl +32 -0
- package/examples/eyelang/output/braking-safety-worlds.pl +18 -0
- package/examples/eyelang/output/buck-converter-design.pl +6 -0
- package/examples/eyelang/output/cache-performance.pl +4 -0
- package/examples/eyelang/output/canary-release.pl +5 -0
- package/examples/eyelang/output/cat-koko.pl +3 -0
- package/examples/eyelang/output/clinical-trial-screening.pl +9 -0
- package/examples/eyelang/output/collatz-1000.pl +1000 -0
- package/examples/eyelang/output/combinatorics-findall-sort.pl +2 -0
- package/examples/eyelang/output/competitive-enzyme-kinetics.pl +6 -0
- package/examples/eyelang/output/complex-matrix-stability.pl +5 -0
- package/examples/eyelang/output/complex.pl +1 -0
- package/examples/eyelang/output/composition-of-injective-functions-is-injective.pl +2 -0
- package/examples/eyelang/output/context-association.pl +3 -0
- package/examples/eyelang/output/control-system.pl +6 -0
- package/examples/eyelang/output/cryptarithmetic-send-more-money.pl +6 -0
- package/examples/eyelang/output/cyclic-path.pl +16 -0
- package/examples/eyelang/output/d3-group.pl +2 -0
- package/examples/eyelang/output/dairy-energy-balance.pl +13 -0
- package/examples/eyelang/output/data-negotiation.pl +1 -0
- package/examples/eyelang/output/deep-taxonomy-10.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-100.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-1000.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-10000.pl +16 -0
- package/examples/eyelang/output/deep-taxonomy-100000.pl +16 -0
- package/examples/eyelang/output/delfour.pl +31 -0
- package/examples/eyelang/output/dense-hamiltonian-cycle.pl +4 -0
- package/examples/eyelang/output/deontic-logic.pl +4 -0
- package/examples/eyelang/output/derived-backward-rule.pl +3 -0
- package/examples/eyelang/output/derived-rule.pl +2 -0
- package/examples/eyelang/output/diamond-property.pl +4 -0
- package/examples/eyelang/output/dijkstra-findall-sort.pl +2 -0
- package/examples/eyelang/output/dijkstra-risk-path.pl +29 -0
- package/examples/eyelang/output/dijkstra.pl +16 -0
- package/examples/eyelang/output/dining-philosophers.pl +350 -0
- package/examples/eyelang/output/directional-language.ttl +1 -0
- package/examples/eyelang/output/dog.pl +1 -0
- package/examples/eyelang/output/drone-corridor-planner.pl +17 -0
- package/examples/eyelang/output/easter-computus.pl +30 -0
- package/examples/eyelang/output/electrical-rc-filter.pl +3 -0
- package/examples/eyelang/output/epidemic-policy.pl +14 -0
- package/examples/eyelang/output/equivalence-classes-overlap-implies-same-class.pl +18 -0
- package/examples/eyelang/output/eulerian-path.pl +3 -0
- package/examples/eyelang/output/ev-range-worlds.pl +19 -0
- package/examples/eyelang/output/exact-cover-sudoku.pl +3 -0
- package/examples/eyelang/output/existential-rule.pl +2 -0
- package/examples/eyelang/output/exoplanet-validation-worlds.pl +22 -0
- package/examples/eyelang/output/expression-eval.pl +1 -0
- package/examples/eyelang/output/eyeling-ackermann.n3 +12 -0
- package/examples/eyelang/output/eyeling-age-threshold.n3 +4 -0
- package/examples/eyelang/output/eyeling-alignment-demo.n3 +1 -0
- package/examples/eyelang/output/eyeling-allen-interval-calculus-small.n3 +3 -0
- package/examples/eyelang/output/eyeling-backward-recursion.n3 +9 -0
- package/examples/eyelang/output/eyeling-backward.n3 +1 -0
- package/examples/eyelang/output/eyeling-basic-monadic-small.n3 +8 -0
- package/examples/eyelang/output/eyeling-bmi.n3 +2 -0
- package/examples/eyelang/output/eyeling-cat-koko.n3 +3 -0
- package/examples/eyelang/output/eyeling-collatz-small.n3 +3 -0
- package/examples/eyelang/output/eyeling-collection.n3 +1 -0
- package/examples/eyelang/output/eyeling-complex-arithmetic.n3 +5 -0
- package/examples/eyelang/output/eyeling-context-association.n3 +4 -0
- package/examples/eyelang/output/eyeling-control-system-small.n3 +4 -0
- package/examples/eyelang/output/eyeling-crypto-builtins-extra.n3 +3 -0
- package/examples/eyelang/output/eyeling-crypto-builtins.n3 +2 -0
- package/examples/eyelang/output/eyeling-deep-taxonomy-10.n3 +32 -0
- package/examples/eyelang/output/eyeling-derived-backward-rule-flat.n3 +4 -0
- package/examples/eyelang/output/eyeling-derived-rule-flat.n3 +2 -0
- package/examples/eyelang/output/eyeling-digital-product-passport-small.n3 +3 -0
- package/examples/eyelang/output/eyeling-dijkstra-tiny.n3 +9 -0
- package/examples/eyelang/output/eyeling-dog-license.n3 +1 -0
- package/examples/eyelang/output/eyeling-drone-corridor-planner-small.n3 +5 -0
- package/examples/eyelang/output/eyeling-equals.n3 +1 -0
- package/examples/eyelang/output/eyeling-equivalence-classes.n3 +2 -0
- package/examples/eyelang/output/eyeling-euler-identity.n3 +3 -0
- package/examples/eyelang/output/eyeling-existential-rule.n3 +4 -0
- package/examples/eyelang/output/eyeling-expression-eval.n3 +3 -0
- package/examples/eyelang/output/eyeling-family-cousins-extended.n3 +6 -0
- package/examples/eyelang/output/eyeling-fastpow.n3 +4 -0
- package/examples/eyelang/output/eyeling-fibonacci.n3 +6 -0
- package/examples/eyelang/output/eyeling-french-cities-reachability.n3 +25 -0
- package/examples/eyelang/output/eyeling-goldbach-small.n3 +2 -0
- package/examples/eyelang/output/eyeling-good-cobbler.n3 +2 -0
- package/examples/eyelang/output/eyeling-list-builtins.n3 +6 -0
- package/examples/eyelang/output/eyeling-list-collection-extra.n3 +5 -0
- package/examples/eyelang/output/eyeling-math-builtins.n3 +5 -0
- package/examples/eyelang/output/eyeling-string-builtins-extra.n3 +3 -0
- package/examples/eyelang/output/eyeling-string-builtins.n3 +4 -0
- package/examples/eyelang/output/eyeling-time-builtins.n3 +4 -0
- package/examples/eyelang/output/eyeling-time-components-extra.n3 +5 -0
- package/examples/eyelang/output/eyeling-witch.n3 +2 -0
- package/examples/eyelang/output/family-cousins.n3 +8 -0
- package/examples/eyelang/output/family-cousins.pl +28 -0
- package/examples/eyelang/output/fastpow.pl +6 -0
- package/examples/eyelang/output/fft8-numeric.pl +4 -0
- package/examples/eyelang/output/fibonacci.pl +6 -0
- package/examples/eyelang/output/field-nitrogen-balance.pl +21 -0
- package/examples/eyelang/output/flandor.pl +43 -0
- package/examples/eyelang/output/floating-point.pl +9 -0
- package/examples/eyelang/output/four-color-map.pl +3 -0
- package/examples/eyelang/output/fundamental-theorem-arithmetic.pl +9 -0
- package/examples/eyelang/output/gcd-bezout-identity.pl +36 -0
- package/examples/eyelang/output/gd-step-certified.pl +79 -0
- package/examples/eyelang/output/gdpr-compliance.pl +6 -0
- package/examples/eyelang/output/goldbach-1000.pl +667 -0
- package/examples/eyelang/output/good-cobbler.pl +1 -0
- package/examples/eyelang/output/gps.pl +21 -0
- package/examples/eyelang/output/graph-reachability.pl +3 -0
- package/examples/eyelang/output/gray-code-counter.pl +1 -0
- package/examples/eyelang/output/greatest-lower-bound-uniqueness.pl +2 -0
- package/examples/eyelang/output/group-inverse-uniqueness.pl +2 -0
- package/examples/eyelang/output/hamiltonian-cycle.pl +4 -0
- package/examples/eyelang/output/hamiltonian-path.pl +121 -0
- package/examples/eyelang/output/hamming-code.pl +6 -0
- package/examples/eyelang/output/hanoi.pl +1 -0
- package/examples/eyelang/output/heat-loss.pl +5 -0
- package/examples/eyelang/output/heron-theorem.pl +4 -0
- package/examples/eyelang/output/ideal-gas-law.pl +3 -0
- package/examples/eyelang/output/illegitimate-reasoning.pl +15 -0
- package/examples/eyelang/output/kaprekar.pl +8 -0
- package/examples/eyelang/output/law-of-cosines.pl +3 -0
- package/examples/eyelang/output/least-squares-regression.pl +5 -0
- package/examples/eyelang/output/list-collection.pl +3 -0
- package/examples/eyelang/output/lldm.pl +6 -0
- package/examples/eyelang/output/manufacturing-quality-control.pl +6 -0
- package/examples/eyelang/output/matrix.pl +10 -0
- package/examples/eyelang/output/microgrid-dispatch.pl +6 -0
- package/examples/eyelang/output/monkey-bananas.pl +5 -0
- package/examples/eyelang/output/n-queens.pl +93 -0
- package/examples/eyelang/output/n3-builtins.n3 +6 -0
- package/examples/eyelang/output/network-sla.pl +4 -0
- package/examples/eyelang/output/newton-raphson.pl +3 -0
- package/examples/eyelang/output/nixon-diamond.pl +5 -0
- package/examples/eyelang/output/odrl-dpv-healthcare-risk-ranked.pl +42 -0
- package/examples/eyelang/output/odrl-dpv-risk-ranked.pl +120 -0
- package/examples/eyelang/output/orbital-transfer-design.pl +7 -0
- package/examples/eyelang/output/path-discovery.pl +3 -0
- package/examples/eyelang/output/peano-arithmetic.pl +3 -0
- package/examples/eyelang/output/peasant.pl +10 -0
- package/examples/eyelang/output/pendulum-period.pl +4 -0
- package/examples/eyelang/output/polynomial.pl +14 -0
- package/examples/eyelang/output/project-portfolio-optimization.pl +6 -0
- package/examples/eyelang/output/proof-contrapositive.pl +3 -0
- package/examples/eyelang/output/quadratic-formula.pl +6 -0
- package/examples/eyelang/output/quine-mccluskey.pl +3 -0
- package/examples/eyelang/output/radioactive-decay.pl +5 -0
- package/examples/eyelang/output/resilient-city-orchestration.pl +67 -0
- package/examples/eyelang/output/riemann-hypothesis.pl +12 -0
- package/examples/eyelang/output/sat-dpll.pl +5 -0
- package/examples/eyelang/output/security-incident-correlation.pl +3 -0
- package/examples/eyelang/output/service-impact.pl +11 -0
- package/examples/eyelang/output/sieve.pl +1 -0
- package/examples/eyelang/output/skolem-functions.pl +16 -0
- package/examples/eyelang/output/socket-age.pl +1 -0
- package/examples/eyelang/output/socket-family.pl +3 -0
- package/examples/eyelang/output/socrates.n3 +1 -0
- package/examples/eyelang/output/socrates.pl +2 -0
- package/examples/eyelang/output/statistics-summary.pl +4 -0
- package/examples/eyelang/output/sudoku.pl +2 -0
- package/examples/eyelang/output/superdense-coding.pl +6 -0
- package/examples/eyelang/output/traveling-salesman.pl +1 -0
- package/examples/eyelang/output/triple-term.n3 +2 -0
- package/examples/eyelang/output/turing.pl +12 -0
- package/examples/eyelang/output/vector-similarity.pl +4 -0
- package/examples/eyelang/output/witch.pl +7 -0
- package/examples/eyelang/output/wolf-goat-cabbage.pl +3 -0
- package/examples/eyelang/output/zebra.pl +3 -0
- package/examples/eyelang/path-discovery.pl +44998 -0
- package/examples/eyelang/peano-arithmetic.pl +31 -0
- package/examples/eyelang/peasant.pl +30 -0
- package/examples/eyelang/pendulum-period.pl +50 -0
- package/examples/eyelang/polynomial.pl +124 -0
- package/examples/eyelang/project-portfolio-optimization.pl +101 -0
- package/examples/eyelang/proof/age.pl +71 -0
- package/examples/eyelang/proof/aliases-and-namespaces.pl +78 -0
- package/examples/eyelang/proof/ancestor.pl +140 -0
- package/examples/eyelang/proof/animal.pl +68 -0
- package/examples/eyelang/proof/annotation.pl +80 -0
- package/examples/eyelang/proof/backward.pl +22 -0
- package/examples/eyelang/proof/cat-koko.pl +86 -0
- package/examples/eyelang/proof/data-negotiation.pl +76 -0
- package/examples/eyelang/proof/derived-rule.pl +43 -0
- package/examples/eyelang/proof/dog.pl +31 -0
- package/examples/eyelang/proof/electrical-rc-filter.pl +105 -0
- package/examples/eyelang/proof/existential-rule.pl +40 -0
- package/examples/eyelang/proof/floating-point.pl +160 -0
- package/examples/eyelang/proof/good-cobbler.pl +16 -0
- package/examples/eyelang/proof/group-inverse-uniqueness.pl +84 -0
- package/examples/eyelang/proof/list-collection.pl +52 -0
- package/examples/eyelang/proof/proof-contrapositive.pl +78 -0
- package/examples/eyelang/proof/socket-age.pl +32 -0
- package/examples/eyelang/proof/socket-family.pl +59 -0
- package/examples/eyelang/proof/socrates.pl +38 -0
- package/examples/eyelang/proof-contrapositive.pl +27 -0
- package/examples/eyelang/quadratic-formula.pl +54 -0
- package/examples/eyelang/quine-mccluskey.pl +143 -0
- package/examples/eyelang/radioactive-decay.pl +56 -0
- package/examples/eyelang/resilient-city-orchestration.pl +303 -0
- package/examples/eyelang/riemann-hypothesis.pl +110 -0
- package/examples/eyelang/sat-dpll.pl +80 -0
- package/examples/eyelang/security-incident-correlation.pl +69 -0
- package/examples/eyelang/service-impact.pl +41 -0
- package/examples/eyelang/sieve.pl +20 -0
- package/examples/eyelang/skolem-functions.pl +52 -0
- package/examples/eyelang/socket-age.pl +39 -0
- package/examples/eyelang/socket-family.pl +28 -0
- package/examples/eyelang/socrates.n3 +11 -0
- package/examples/eyelang/socrates.pl +19 -0
- package/examples/eyelang/statistics-summary.pl +54 -0
- package/examples/eyelang/sudoku.pl +20 -0
- package/examples/eyelang/superdense-coding.pl +84 -0
- package/examples/eyelang/traveling-salesman.pl +64 -0
- package/examples/eyelang/triple-term.n3 +9 -0
- package/examples/eyelang/turing.pl +67 -0
- package/examples/eyelang/vector-similarity.pl +56 -0
- package/examples/eyelang/witch.pl +38 -0
- package/examples/eyelang/wolf-goat-cabbage.pl +56 -0
- package/examples/eyelang/zebra.pl +44 -0
- package/eyelang.d.ts +92 -0
- package/eyeling-builtins.ttl +3 -3
- package/eyeling.js +298 -14
- package/index.d.ts +290 -283
- package/index.js +95 -1
- package/lib/builtins.js +297 -14
- package/lib/cli.js +1 -0
- package/lib/eyelang/bin.js +7 -0
- package/lib/eyelang/builtins/aggregation.mjs +81 -0
- package/lib/eyelang/builtins/alphametic.mjs +144 -0
- package/lib/eyelang/builtins/arithmetic.mjs +197 -0
- package/lib/eyelang/builtins/control.mjs +22 -0
- package/lib/eyelang/builtins/core.mjs +78 -0
- package/lib/eyelang/builtins/formula.mjs +42 -0
- package/lib/eyelang/builtins/lists.mjs +149 -0
- package/lib/eyelang/builtins/matrix.mjs +226 -0
- package/lib/eyelang/builtins/n3.mjs +483 -0
- package/lib/eyelang/builtins/number-theory.mjs +114 -0
- package/lib/eyelang/builtins/portfolio.mjs +73 -0
- package/lib/eyelang/builtins/registry.mjs +54 -0
- package/lib/eyelang/builtins/search.mjs +579 -0
- package/lib/eyelang/builtins/strings.mjs +41 -0
- package/lib/eyelang/builtins/sudoku.mjs +141 -0
- package/lib/eyelang/cli.mjs +192 -0
- package/lib/eyelang/explain.mjs +324 -0
- package/lib/eyelang/hash.mjs +294 -0
- package/lib/eyelang/index.mjs +48 -0
- package/lib/eyelang/parser.mjs +428 -0
- package/lib/eyelang/program.mjs +244 -0
- package/lib/eyelang/rdf.mjs +747 -0
- package/lib/eyelang/solver.mjs +237 -0
- package/lib/eyelang/term.mjs +328 -0
- package/package.json +15 -5
- package/test/builtins.test.js +49 -1
- package/test/eyelang/conformance/README.md +45 -0
- package/test/eyelang/conformance/cases/core/001_fact_output.pl +4 -0
- package/test/eyelang/conformance/cases/core/001_fact_query.query +1 -0
- package/test/eyelang/conformance/cases/core/002_rule_recursion.pl +7 -0
- package/test/eyelang/conformance/cases/core/002_rule_recursion.query +1 -0
- package/test/eyelang/conformance/cases/core/003_terms_and_readback.pl +16 -0
- package/test/eyelang/conformance/cases/core/003_terms_and_readback.query +1 -0
- package/test/eyelang/conformance/cases/core/004_conjunction_and_parentheses.pl +5 -0
- package/test/eyelang/conformance/cases/core/004_conjunction_and_parentheses.query +1 -0
- package/test/eyelang/conformance/cases/core/005_list_deconstruction.pl +6 -0
- package/test/eyelang/conformance/cases/core/005_list_deconstruction.query +1 -0
- package/test/eyelang/conformance/cases/core/006_comma_formula_data.pl +4 -0
- package/test/eyelang/conformance/cases/core/006_comma_formula_data.query +1 -0
- package/test/eyelang/conformance/cases/core/007_anonymous_variables.pl +5 -0
- package/test/eyelang/conformance/cases/core/007_anonymous_variables.query +1 -0
- package/test/eyelang/conformance/cases/core/008_graphic_atoms.pl +6 -0
- package/test/eyelang/conformance/cases/core/008_graphic_atoms.query +1 -0
- package/test/eyelang/conformance/cases/core/009_comments_and_whitespace.pl +5 -0
- package/test/eyelang/conformance/cases/core/009_comments_and_whitespace.query +1 -0
- package/test/eyelang/conformance/cases/core/010_variable_scope_and_reuse.pl +8 -0
- package/test/eyelang/conformance/cases/core/010_variable_scope_and_reuse.query +1 -0
- package/test/eyelang/conformance/cases/core/011_predicate_arity.pl +6 -0
- package/test/eyelang/conformance/cases/core/011_predicate_arity.query +1 -0
- package/test/eyelang/conformance/cases/core/012_nested_compound_unification.pl +5 -0
- package/test/eyelang/conformance/cases/core/012_nested_compound_unification.query +1 -0
- package/test/eyelang/conformance/cases/core/013_multiple_clauses_order.pl +6 -0
- package/test/eyelang/conformance/cases/core/013_multiple_clauses_order.query +1 -0
- package/test/eyelang/conformance/cases/core/014_failure_filters_answers.pl +7 -0
- package/test/eyelang/conformance/cases/core/014_failure_filters_answers.query +1 -0
- package/test/eyelang/conformance/cases/core/015_improper_list_unification.pl +6 -0
- package/test/eyelang/conformance/cases/core/015_improper_list_unification.query +1 -0
- package/test/eyelang/conformance/cases/core/016_zero_arity_compound.pl +4 -0
- package/test/eyelang/conformance/cases/core/016_zero_arity_compound.query +1 -0
- package/test/eyelang/conformance/cases/core/017_three_step_recursion.pl +8 -0
- package/test/eyelang/conformance/cases/core/017_three_step_recursion.query +1 -0
- package/test/eyelang/conformance/cases/core/018_quoted_atom_readback.pl +6 -0
- package/test/eyelang/conformance/cases/core/018_quoted_atom_readback.query +1 -0
- package/test/eyelang/conformance/cases/core/019_parenthesized_three_conjuncts.pl +7 -0
- package/test/eyelang/conformance/cases/core/019_parenthesized_three_conjuncts.query +1 -0
- package/test/eyelang/conformance/cases/core/020_nested_list_terms.pl +5 -0
- package/test/eyelang/conformance/cases/core/020_nested_list_terms.query +1 -0
- package/test/eyelang/conformance/cases/core/021_repeated_variable_head.pl +7 -0
- package/test/eyelang/conformance/cases/core/022_rule_head_structure.pl +5 -0
- package/test/eyelang/conformance/cases/core/023_quoted_escapes_readback.pl +5 -0
- package/test/eyelang/conformance/cases/core/024_numeric_literal_readback.pl +6 -0
- package/test/eyelang/conformance/cases/core/025_body_parentheses_with_formula_data.pl +5 -0
- package/test/eyelang/conformance/cases/core/026_underscore_named_variable_reuse.pl +5 -0
- package/test/eyelang/conformance/cases/extension/001_default_derived_output.pl +5 -0
- package/test/eyelang/conformance/cases/extension/002_materialize_focus.pl +5 -0
- package/test/eyelang/conformance/cases/extension/003_arithmetic_and_comparison.pl +12 -0
- package/test/eyelang/conformance/cases/extension/003_arithmetic_and_comparison.query +1 -0
- package/test/eyelang/conformance/cases/extension/004_strings_and_atoms.pl +6 -0
- package/test/eyelang/conformance/cases/extension/004_strings_and_atoms.query +1 -0
- package/test/eyelang/conformance/cases/extension/005_lists_aggregation_ordering.pl +10 -0
- package/test/eyelang/conformance/cases/extension/005_lists_aggregation_ordering.query +1 -0
- package/test/eyelang/conformance/cases/extension/006_formula_terms.pl +5 -0
- package/test/eyelang/conformance/cases/extension/006_formula_terms.query +1 -0
- package/test/eyelang/conformance/cases/extension/007_negation_once_generators.pl +7 -0
- package/test/eyelang/conformance/cases/extension/007_negation_once_generators.query +1 -0
- package/test/eyelang/conformance/cases/extension/008_equality_and_inequality.pl +6 -0
- package/test/eyelang/conformance/cases/extension/008_equality_and_inequality.query +1 -0
- package/test/eyelang/conformance/cases/extension/009_list_relations.pl +6 -0
- package/test/eyelang/conformance/cases/extension/009_list_relations.query +1 -0
- package/test/eyelang/conformance/cases/extension/010_append_splits.pl +3 -0
- package/test/eyelang/conformance/cases/extension/010_append_splits.query +1 -0
- package/test/eyelang/conformance/cases/extension/011_matching_and_comparison.pl +7 -0
- package/test/eyelang/conformance/cases/extension/011_matching_and_comparison.query +1 -0
- package/test/eyelang/conformance/cases/extension/012_memoize_declaration.pl +8 -0
- package/test/eyelang/conformance/cases/extension/012_memoize_declaration.query +1 -0
- package/test/eyelang/conformance/cases/extension/013_numeric_functions.pl +9 -0
- package/test/eyelang/conformance/cases/extension/013_numeric_functions.query +1 -0
- package/test/eyelang/conformance/cases/extension/014_between_enumeration.pl +3 -0
- package/test/eyelang/conformance/cases/extension/014_between_enumeration.query +1 -0
- package/test/eyelang/conformance/cases/extension/015_smallest_divisor.pl +3 -0
- package/test/eyelang/conformance/cases/extension/015_smallest_divisor.query +1 -0
- package/test/eyelang/conformance/cases/extension/016_negation_filter.pl +7 -0
- package/test/eyelang/conformance/cases/extension/016_negation_filter.query +1 -0
- package/test/eyelang/conformance/cases/extension/017_once_user_predicate.pl +5 -0
- package/test/eyelang/conformance/cases/extension/017_once_user_predicate.query +1 -0
- package/test/eyelang/conformance/cases/extension/018_findall_user_goal.pl +6 -0
- package/test/eyelang/conformance/cases/extension/018_findall_user_goal.query +1 -0
- package/test/eyelang/conformance/cases/extension/019_sort_deduplicates_atoms.pl +3 -0
- package/test/eyelang/conformance/cases/extension/019_sort_deduplicates_atoms.query +1 -0
- package/test/eyelang/conformance/cases/extension/020_append_bound_prefix_suffix.pl +4 -0
- package/test/eyelang/conformance/cases/extension/020_append_bound_prefix_suffix.query +1 -0
- package/test/eyelang/conformance/cases/extension/021_nth0_index_generation.pl +3 -0
- package/test/eyelang/conformance/cases/extension/021_nth0_index_generation.query +1 -0
- package/test/eyelang/conformance/cases/extension/022_set_nth0_edges.pl +4 -0
- package/test/eyelang/conformance/cases/extension/022_set_nth0_edges.query +1 -0
- package/test/eyelang/conformance/cases/extension/023_select_duplicate_occurrences.pl +3 -0
- package/test/eyelang/conformance/cases/extension/023_select_duplicate_occurrences.query +1 -0
- package/test/eyelang/conformance/cases/extension/024_not_member_filter.pl +6 -0
- package/test/eyelang/conformance/cases/extension/024_not_member_filter.query +1 -0
- package/test/eyelang/conformance/cases/extension/025_is_list_filter.pl +5 -0
- package/test/eyelang/conformance/cases/extension/025_is_list_filter.query +1 -0
- package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.pl +5 -0
- package/test/eyelang/conformance/cases/extension/026_nested_formula_terms.query +1 -0
- package/test/eyelang/conformance/cases/extension/027_materialize_excludes_source_fact.pl +6 -0
- package/test/eyelang/conformance/cases/extension/028_numeric_and_lexical_comparison.pl +5 -0
- package/test/eyelang/conformance/cases/extension/028_numeric_and_lexical_comparison.query +1 -0
- package/test/eyelang/conformance/cases/extension/029_string_matching_filters.pl +6 -0
- package/test/eyelang/conformance/cases/extension/029_string_matching_filters.query +1 -0
- package/test/eyelang/conformance/cases/extension/030_string_and_atom_concat.pl +4 -0
- package/test/eyelang/conformance/cases/extension/030_string_and_atom_concat.query +1 -0
- package/test/eyelang/conformance/cases/extension/031_countall_empty_and_nonempty.pl +4 -0
- package/test/eyelang/conformance/cases/extension/031_countall_empty_and_nonempty.query +1 -0
- package/test/eyelang/conformance/cases/extension/032_sumall_numeric_template.pl +5 -0
- package/test/eyelang/conformance/cases/extension/032_sumall_numeric_template.query +1 -0
- package/test/eyelang/conformance/cases/extension/033_aggregate_min_template.pl +5 -0
- package/test/eyelang/conformance/cases/extension/033_aggregate_min_template.query +1 -0
- package/test/eyelang/conformance/cases/extension/034_aggregate_max_compound_key.pl +5 -0
- package/test/eyelang/conformance/cases/extension/034_aggregate_max_compound_key.query +1 -0
- package/test/eyelang/conformance/cases/extension/035_date_difference.pl +4 -0
- package/test/eyelang/conformance/cases/extension/036_extended_gcd.pl +3 -0
- package/test/eyelang/conformance/cases/extension/037_collatz_trajectory.pl +3 -0
- package/test/eyelang/conformance/cases/extension/038_kaprekar_steps.pl +3 -0
- package/test/eyelang/conformance/cases/extension/039_goldbach_pair.pl +3 -0
- package/test/eyelang/conformance/cases/extension/040_matrix_operations.pl +5 -0
- package/test/eyelang/conformance/cases/extension/041_atom_range_generators.pl +5 -0
- package/test/eyelang/conformance/cases/extension/042_n_queens_small.pl +3 -0
- package/test/eyelang/conformance/cases/extension/043_cnf_model.pl +3 -0
- package/test/eyelang/conformance/cases/extension/044_cover9_filter.pl +6 -0
- package/test/eyelang/conformance/cases/extension/045_alphametic_sum_small.pl +3 -0
- package/test/eyelang/conformance/cases/extension/046_bounded_subset.pl +4 -0
- package/test/eyelang/conformance/expected/core/001_fact_output.out +1 -0
- package/test/eyelang/conformance/expected/core/002_rule_recursion.out +2 -0
- package/test/eyelang/conformance/expected/core/003_terms_and_readback.out +13 -0
- package/test/eyelang/conformance/expected/core/004_conjunction_and_parentheses.out +1 -0
- package/test/eyelang/conformance/expected/core/005_list_deconstruction.out +2 -0
- package/test/eyelang/conformance/expected/core/006_comma_formula_data.out +1 -0
- package/test/eyelang/conformance/expected/core/007_anonymous_variables.out +1 -0
- package/test/eyelang/conformance/expected/core/008_graphic_atoms.out +3 -0
- package/test/eyelang/conformance/expected/core/009_comments_and_whitespace.out +2 -0
- package/test/eyelang/conformance/expected/core/010_variable_scope_and_reuse.out +2 -0
- package/test/eyelang/conformance/expected/core/011_predicate_arity.out +2 -0
- package/test/eyelang/conformance/expected/core/012_nested_compound_unification.out +2 -0
- package/test/eyelang/conformance/expected/core/013_multiple_clauses_order.out +2 -0
- package/test/eyelang/conformance/expected/core/014_failure_filters_answers.out +1 -0
- package/test/eyelang/conformance/expected/core/015_improper_list_unification.out +3 -0
- package/test/eyelang/conformance/expected/core/016_zero_arity_compound.out +1 -0
- package/test/eyelang/conformance/expected/core/017_three_step_recursion.out +3 -0
- package/test/eyelang/conformance/expected/core/018_quoted_atom_readback.out +3 -0
- package/test/eyelang/conformance/expected/core/019_parenthesized_three_conjuncts.out +1 -0
- package/test/eyelang/conformance/expected/core/020_nested_list_terms.out +2 -0
- package/test/eyelang/conformance/expected/core/021_repeated_variable_head.out +2 -0
- package/test/eyelang/conformance/expected/core/022_rule_head_structure.out +2 -0
- package/test/eyelang/conformance/expected/core/023_quoted_escapes_readback.out +2 -0
- package/test/eyelang/conformance/expected/core/024_numeric_literal_readback.out +3 -0
- package/test/eyelang/conformance/expected/core/025_body_parentheses_with_formula_data.out +1 -0
- package/test/eyelang/conformance/expected/core/026_underscore_named_variable_reuse.out +1 -0
- package/test/eyelang/conformance/expected/extension/001_default_derived_output.out +3 -0
- package/test/eyelang/conformance/expected/extension/002_materialize_focus.out +1 -0
- package/test/eyelang/conformance/expected/extension/003_arithmetic_and_comparison.out +10 -0
- package/test/eyelang/conformance/expected/extension/004_strings_and_atoms.out +4 -0
- package/test/eyelang/conformance/expected/extension/005_lists_aggregation_ordering.out +9 -0
- package/test/eyelang/conformance/expected/extension/006_formula_terms.out +4 -0
- package/test/eyelang/conformance/expected/extension/007_negation_once_generators.out +2 -0
- package/test/eyelang/conformance/expected/extension/008_equality_and_inequality.out +4 -0
- package/test/eyelang/conformance/expected/extension/009_list_relations.out +5 -0
- package/test/eyelang/conformance/expected/extension/010_append_splits.out +3 -0
- package/test/eyelang/conformance/expected/extension/011_matching_and_comparison.out +5 -0
- package/test/eyelang/conformance/expected/extension/012_memoize_declaration.out +2 -0
- package/test/eyelang/conformance/expected/extension/013_numeric_functions.out +7 -0
- package/test/eyelang/conformance/expected/extension/014_between_enumeration.out +3 -0
- package/test/eyelang/conformance/expected/extension/015_smallest_divisor.out +1 -0
- package/test/eyelang/conformance/expected/extension/016_negation_filter.out +2 -0
- package/test/eyelang/conformance/expected/extension/017_once_user_predicate.out +1 -0
- package/test/eyelang/conformance/expected/extension/018_findall_user_goal.out +1 -0
- package/test/eyelang/conformance/expected/extension/019_sort_deduplicates_atoms.out +1 -0
- package/test/eyelang/conformance/expected/extension/020_append_bound_prefix_suffix.out +2 -0
- package/test/eyelang/conformance/expected/extension/021_nth0_index_generation.out +1 -0
- package/test/eyelang/conformance/expected/extension/022_set_nth0_edges.out +2 -0
- package/test/eyelang/conformance/expected/extension/023_select_duplicate_occurrences.out +2 -0
- package/test/eyelang/conformance/expected/extension/024_not_member_filter.out +1 -0
- package/test/eyelang/conformance/expected/extension/025_is_list_filter.out +1 -0
- package/test/eyelang/conformance/expected/extension/026_nested_formula_terms.out +6 -0
- package/test/eyelang/conformance/expected/extension/027_materialize_excludes_source_fact.out +1 -0
- package/test/eyelang/conformance/expected/extension/028_numeric_and_lexical_comparison.out +3 -0
- package/test/eyelang/conformance/expected/extension/029_string_matching_filters.out +2 -0
- package/test/eyelang/conformance/expected/extension/030_string_and_atom_concat.out +2 -0
- package/test/eyelang/conformance/expected/extension/031_countall_empty_and_nonempty.out +1 -0
- package/test/eyelang/conformance/expected/extension/032_sumall_numeric_template.out +1 -0
- package/test/eyelang/conformance/expected/extension/033_aggregate_min_template.out +1 -0
- package/test/eyelang/conformance/expected/extension/034_aggregate_max_compound_key.out +1 -0
- package/test/eyelang/conformance/expected/extension/035_date_difference.out +2 -0
- package/test/eyelang/conformance/expected/extension/036_extended_gcd.out +1 -0
- package/test/eyelang/conformance/expected/extension/037_collatz_trajectory.out +1 -0
- package/test/eyelang/conformance/expected/extension/038_kaprekar_steps.out +1 -0
- package/test/eyelang/conformance/expected/extension/039_goldbach_pair.out +2 -0
- package/test/eyelang/conformance/expected/extension/040_matrix_operations.out +3 -0
- package/test/eyelang/conformance/expected/extension/041_atom_range_generators.out +8 -0
- package/test/eyelang/conformance/expected/extension/042_n_queens_small.out +2 -0
- package/test/eyelang/conformance/expected/extension/043_cnf_model.out +1 -0
- package/test/eyelang/conformance/expected/extension/044_cover9_filter.out +2 -0
- package/test/eyelang/conformance/expected/extension/045_alphametic_sum_small.out +4 -0
- package/test/eyelang/conformance/expected/extension/046_bounded_subset.out +5 -0
- package/test/eyelang/run-all.mjs +20 -0
- package/test/eyelang/run-conformance.mjs +80 -0
- package/test/eyelang/run-examples.mjs +126 -0
- package/test/eyelang/run-regression.mjs +640 -0
- package/test/eyelang/test-style.mjs +91 -0
- package/test/eyelang.test.js +58 -0
- package/test/run.js +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
% Weighted path enumeration adapted from Eyeling dijkstra.n3.
|
|
2
|
+
% The Eyeling source uses collect/sort built-ins for Dijkstra's queue.
|
|
3
|
+
% This eyelang variant enumerates simple paths and keeps the bounded frontier
|
|
4
|
+
% that appears in the Eyeling output for a -> f.
|
|
5
|
+
% The input weighted graph is quoted as ... data and projected locally,
|
|
6
|
+
% so the route network is not asserted as ambient edge facts.
|
|
7
|
+
|
|
8
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
9
|
+
materialize(edge, 2).
|
|
10
|
+
materialize(path, 2).
|
|
11
|
+
|
|
12
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
13
|
+
weighted_graph(dijkstraGraph, (
|
|
14
|
+
edge(a, arc(b, 4)),
|
|
15
|
+
edge(a, arc(c, 2)),
|
|
16
|
+
edge(b, arc(c, 1)),
|
|
17
|
+
edge(b, arc(d, 5)),
|
|
18
|
+
edge(c, arc(d, 8)),
|
|
19
|
+
edge(c, arc(e, 10)),
|
|
20
|
+
edge(d, arc(e, 2)),
|
|
21
|
+
edge(d, arc(f, 6)),
|
|
22
|
+
edge(e, arc(f, 3))
|
|
23
|
+
)).
|
|
24
|
+
|
|
25
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
26
|
+
base_link(A, B, Cost) :-
|
|
27
|
+
weighted_graph(dijkstraGraph, Formula),
|
|
28
|
+
formula_binary(Formula, A, edge, arc(B, Cost)).
|
|
29
|
+
|
|
30
|
+
link(A, B, Cost) :- base_link(A, B, Cost).
|
|
31
|
+
link(B, A, Cost) :- base_link(A, B, Cost).
|
|
32
|
+
|
|
33
|
+
path(Goal, Goal, _Visited, [Goal], 0).
|
|
34
|
+
path(Node, Goal, Visited, [Node|Path], Cost) :-
|
|
35
|
+
link(Node, Next, StepCost),
|
|
36
|
+
not_member(Next, Visited),
|
|
37
|
+
path(Next, Goal, [Next|Visited], Path, RestCost),
|
|
38
|
+
add(StepCost, RestCost, Cost).
|
|
39
|
+
|
|
40
|
+
% Derived reverse links, mirroring the rule output in the Eyeling example.
|
|
41
|
+
edge([B, A], Cost) :-
|
|
42
|
+
base_link(A, B, Cost).
|
|
43
|
+
|
|
44
|
+
path([a, f], [Path, Cost]) :-
|
|
45
|
+
path(a, f, [a], Path, Cost),
|
|
46
|
+
le(Cost, 16).
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
% Chandy-Misra dining philosophers trace adapted from Eyeling dining-philosophers.n3.
|
|
2
|
+
% Requests and sends are derived; KeepFork facts copy forks that are not sent.
|
|
3
|
+
|
|
4
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
|
+
materialize(dp_type, 2).
|
|
6
|
+
materialize(dp_in, 2).
|
|
7
|
+
materialize(dp_from, 2).
|
|
8
|
+
materialize(dp_to, 2).
|
|
9
|
+
materialize(dp_fork, 2).
|
|
10
|
+
materialize(dp_philosopher, 2).
|
|
11
|
+
materialize(dp_mealNo, 2).
|
|
12
|
+
materialize(dp_inSlot, 2).
|
|
13
|
+
materialize(dp_usesFork, 2).
|
|
14
|
+
|
|
15
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
16
|
+
left_fork(dp_P1, dp_F51). right_fork(dp_P1, dp_F12).
|
|
17
|
+
left_fork(dp_P2, dp_F12). right_fork(dp_P2, dp_F23).
|
|
18
|
+
left_fork(dp_P3, dp_F23). right_fork(dp_P3, dp_F34).
|
|
19
|
+
left_fork(dp_P4, dp_F34). right_fork(dp_P4, dp_F45).
|
|
20
|
+
left_fork(dp_P5, dp_F45). right_fork(dp_P5, dp_F51).
|
|
21
|
+
|
|
22
|
+
slot(dp_C0, dp_s1, 1). after_sends(dp_C0, dp_C1). after_eat(dp_C1, dp_C2).
|
|
23
|
+
slot(dp_C2, dp_s2, 1). after_sends(dp_C2, dp_C3). after_eat(dp_C3, dp_C4).
|
|
24
|
+
slot(dp_C4, dp_s3, 1). after_sends(dp_C4, dp_C5). after_eat(dp_C5, dp_C6).
|
|
25
|
+
slot(dp_C6, dp_s4, 2). after_sends(dp_C6, dp_C7). after_eat(dp_C7, dp_C8).
|
|
26
|
+
slot(dp_C8, dp_s5, 2). after_sends(dp_C8, dp_C9). after_eat(dp_C9, dp_C10).
|
|
27
|
+
slot(dp_C10, dp_s6, 2). after_sends(dp_C10, dp_C11). after_eat(dp_C11, dp_C12).
|
|
28
|
+
slot(dp_C12, dp_s7, 3). after_sends(dp_C12, dp_C13). after_eat(dp_C13, dp_C14).
|
|
29
|
+
slot(dp_C14, dp_s8, 3). after_sends(dp_C14, dp_C15). after_eat(dp_C15, dp_C16).
|
|
30
|
+
slot(dp_C16, dp_s9, 3). after_sends(dp_C16, dp_C17). after_eat(dp_C17, dp_C18).
|
|
31
|
+
|
|
32
|
+
hungry(dp_C0, dp_P1). hungry(dp_C0, dp_P3).
|
|
33
|
+
hungry(dp_C2, dp_P2). hungry(dp_C2, dp_P4).
|
|
34
|
+
hungry(dp_C4, dp_P5).
|
|
35
|
+
hungry(dp_C6, dp_P1). hungry(dp_C6, dp_P3).
|
|
36
|
+
hungry(dp_C8, dp_P2). hungry(dp_C8, dp_P4).
|
|
37
|
+
hungry(dp_C10, dp_P5).
|
|
38
|
+
hungry(dp_C12, dp_P1). hungry(dp_C12, dp_P3).
|
|
39
|
+
hungry(dp_C14, dp_P2). hungry(dp_C14, dp_P4).
|
|
40
|
+
hungry(dp_C16, dp_P5).
|
|
41
|
+
|
|
42
|
+
start_state(dp_C0, dp_F12, dp_P1, dp_Dirty).
|
|
43
|
+
start_state(dp_C0, dp_F23, dp_P2, dp_Dirty).
|
|
44
|
+
start_state(dp_C0, dp_F34, dp_P3, dp_Dirty).
|
|
45
|
+
start_state(dp_C0, dp_F45, dp_P4, dp_Dirty).
|
|
46
|
+
start_state(dp_C0, dp_F51, dp_P1, dp_Dirty).
|
|
47
|
+
start_state(dp_C2, dp_F12, dp_P1, dp_Dirty).
|
|
48
|
+
start_state(dp_C2, dp_F23, dp_P3, dp_Dirty).
|
|
49
|
+
start_state(dp_C2, dp_F34, dp_P3, dp_Dirty).
|
|
50
|
+
start_state(dp_C2, dp_F45, dp_P4, dp_Dirty).
|
|
51
|
+
start_state(dp_C2, dp_F51, dp_P1, dp_Dirty).
|
|
52
|
+
start_state(dp_C4, dp_F12, dp_P2, dp_Dirty).
|
|
53
|
+
start_state(dp_C4, dp_F23, dp_P2, dp_Dirty).
|
|
54
|
+
start_state(dp_C4, dp_F34, dp_P4, dp_Dirty).
|
|
55
|
+
start_state(dp_C4, dp_F45, dp_P4, dp_Dirty).
|
|
56
|
+
start_state(dp_C4, dp_F51, dp_P1, dp_Dirty).
|
|
57
|
+
start_state(dp_C6, dp_F12, dp_P2, dp_Dirty).
|
|
58
|
+
start_state(dp_C6, dp_F23, dp_P2, dp_Dirty).
|
|
59
|
+
start_state(dp_C6, dp_F34, dp_P4, dp_Dirty).
|
|
60
|
+
start_state(dp_C6, dp_F45, dp_P5, dp_Dirty).
|
|
61
|
+
start_state(dp_C6, dp_F51, dp_P5, dp_Dirty).
|
|
62
|
+
start_state(dp_C8, dp_F12, dp_P1, dp_Dirty).
|
|
63
|
+
start_state(dp_C8, dp_F23, dp_P3, dp_Dirty).
|
|
64
|
+
start_state(dp_C8, dp_F34, dp_P3, dp_Dirty).
|
|
65
|
+
start_state(dp_C8, dp_F45, dp_P5, dp_Dirty).
|
|
66
|
+
start_state(dp_C8, dp_F51, dp_P1, dp_Dirty).
|
|
67
|
+
start_state(dp_C10, dp_F12, dp_P2, dp_Dirty).
|
|
68
|
+
start_state(dp_C10, dp_F23, dp_P2, dp_Dirty).
|
|
69
|
+
start_state(dp_C10, dp_F34, dp_P4, dp_Dirty).
|
|
70
|
+
start_state(dp_C10, dp_F45, dp_P4, dp_Dirty).
|
|
71
|
+
start_state(dp_C10, dp_F51, dp_P1, dp_Dirty).
|
|
72
|
+
start_state(dp_C12, dp_F12, dp_P2, dp_Dirty).
|
|
73
|
+
start_state(dp_C12, dp_F23, dp_P2, dp_Dirty).
|
|
74
|
+
start_state(dp_C12, dp_F34, dp_P4, dp_Dirty).
|
|
75
|
+
start_state(dp_C12, dp_F45, dp_P5, dp_Dirty).
|
|
76
|
+
start_state(dp_C12, dp_F51, dp_P5, dp_Dirty).
|
|
77
|
+
start_state(dp_C14, dp_F12, dp_P1, dp_Dirty).
|
|
78
|
+
start_state(dp_C14, dp_F23, dp_P3, dp_Dirty).
|
|
79
|
+
start_state(dp_C14, dp_F34, dp_P3, dp_Dirty).
|
|
80
|
+
start_state(dp_C14, dp_F45, dp_P5, dp_Dirty).
|
|
81
|
+
start_state(dp_C14, dp_F51, dp_P1, dp_Dirty).
|
|
82
|
+
start_state(dp_C16, dp_F12, dp_P2, dp_Dirty).
|
|
83
|
+
start_state(dp_C16, dp_F23, dp_P2, dp_Dirty).
|
|
84
|
+
start_state(dp_C16, dp_F34, dp_P4, dp_Dirty).
|
|
85
|
+
start_state(dp_C16, dp_F45, dp_P4, dp_Dirty).
|
|
86
|
+
start_state(dp_C16, dp_F51, dp_P1, dp_Dirty).
|
|
87
|
+
keep(dp_C0, dp_F12). keep(dp_C0, dp_F34). keep(dp_C0, dp_F45). keep(dp_C0, dp_F51).
|
|
88
|
+
keep(dp_C2, dp_F45). keep(dp_C2, dp_F51).
|
|
89
|
+
keep(dp_C4, dp_F12). keep(dp_C4, dp_F23). keep(dp_C4, dp_F34).
|
|
90
|
+
keep(dp_C6, dp_F45).
|
|
91
|
+
keep(dp_C8, dp_F51).
|
|
92
|
+
keep(dp_C10, dp_F12). keep(dp_C10, dp_F23). keep(dp_C10, dp_F34).
|
|
93
|
+
keep(dp_C12, dp_F45).
|
|
94
|
+
keep(dp_C14, dp_F51).
|
|
95
|
+
keep(dp_C16, dp_F12). keep(dp_C16, dp_F23). keep(dp_C16, dp_F34).
|
|
96
|
+
|
|
97
|
+
meal_handle(dp_P1, 1, dp_mP1_1). meal_handle(dp_P1, 2, dp_mP1_2). meal_handle(dp_P1, 3, dp_mP1_3).
|
|
98
|
+
meal_handle(dp_P2, 1, dp_mP2_1). meal_handle(dp_P2, 2, dp_mP2_2). meal_handle(dp_P2, 3, dp_mP2_3).
|
|
99
|
+
meal_handle(dp_P3, 1, dp_mP3_1). meal_handle(dp_P3, 2, dp_mP3_2). meal_handle(dp_P3, 3, dp_mP3_3).
|
|
100
|
+
meal_handle(dp_P4, 1, dp_mP4_1). meal_handle(dp_P4, 2, dp_mP4_2). meal_handle(dp_P4, 3, dp_mP4_3).
|
|
101
|
+
meal_handle(dp_P5, 1, dp_mP5_1). meal_handle(dp_P5, 2, dp_mP5_2). meal_handle(dp_P5, 3, dp_mP5_3).
|
|
102
|
+
|
|
103
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
104
|
+
request(C, P, Q, F) :-
|
|
105
|
+
hungry(C, P), left_fork(P, F), start_state(C, F, Q, _Cleanliness), neq(Q, P).
|
|
106
|
+
request(C, P, Q, F) :-
|
|
107
|
+
hungry(C, P), right_fork(P, F), start_state(C, F, Q, _Cleanliness), neq(Q, P).
|
|
108
|
+
|
|
109
|
+
send_fork(C, Q, P, F) :-
|
|
110
|
+
request(C, P, Q, F), start_state(C, F, Q, dp_Dirty).
|
|
111
|
+
|
|
112
|
+
after_send_state(CS, F, P, dp_Clean) :-
|
|
113
|
+
after_sends(C, CS), send_fork(C, _Q, P, F).
|
|
114
|
+
after_send_state(CS, F, H, Cleanliness) :-
|
|
115
|
+
after_sends(C, CS), keep(C, F), start_state(C, F, H, Cleanliness).
|
|
116
|
+
|
|
117
|
+
meal(M, P, N, S) :-
|
|
118
|
+
after_sends(C, CS), slot(C, S, N), hungry(C, P), meal_handle(P, N, M),
|
|
119
|
+
left_fork(P, LF), right_fork(P, RF),
|
|
120
|
+
after_send_state(CS, LF, P, _LeftCleanliness),
|
|
121
|
+
after_send_state(CS, RF, P, _RightCleanliness).
|
|
122
|
+
|
|
123
|
+
dp_type(request(C, P, Q, F), dp_Request) :- request(C, P, Q, F).
|
|
124
|
+
dp_in(request(C, P, Q, F), C) :- request(C, P, Q, F).
|
|
125
|
+
dp_from(request(C, P, Q, F), P) :- request(C, P, Q, F).
|
|
126
|
+
dp_to(request(C, P, Q, F), Q) :- request(C, P, Q, F).
|
|
127
|
+
dp_fork(request(C, P, Q, F), F) :- request(C, P, Q, F).
|
|
128
|
+
|
|
129
|
+
dp_type(send(C, Q, P, F), dp_SendFork) :- send_fork(C, Q, P, F).
|
|
130
|
+
dp_in(send(C, Q, P, F), C) :- send_fork(C, Q, P, F).
|
|
131
|
+
dp_from(send(C, Q, P, F), Q) :- send_fork(C, Q, P, F).
|
|
132
|
+
dp_to(send(C, Q, P, F), P) :- send_fork(C, Q, P, F).
|
|
133
|
+
dp_fork(send(C, Q, P, F), F) :- send_fork(C, Q, P, F).
|
|
134
|
+
|
|
135
|
+
dp_type(M, dp_Meal) :- meal(M, _P, _N, _S).
|
|
136
|
+
dp_philosopher(M, P) :- meal(M, P, _N, _S).
|
|
137
|
+
dp_mealNo(M, N) :- meal(M, _P, N, _S).
|
|
138
|
+
dp_inSlot(M, S) :- meal(M, _P, _N, S).
|
|
139
|
+
dp_usesFork(M, LF) :- meal(M, P, _N, _S), left_fork(P, LF).
|
|
140
|
+
dp_usesFork(M, RF) :- meal(M, P, _N, _S), right_fork(P, RF).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
% The output reports only the compliance obligation derived below.
|
|
2
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
3
|
+
materialize(mustHave, 2).
|
|
4
|
+
|
|
5
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
6
|
+
% Dog-license example adapted from Eyeling dog.n3.
|
|
7
|
+
% A subject with more than four dogs must have a dog license.
|
|
8
|
+
|
|
9
|
+
hasDog(alice, dog1).
|
|
10
|
+
hasDog(alice, dog2).
|
|
11
|
+
hasDog(alice, dog3).
|
|
12
|
+
hasDog(alice, dog4).
|
|
13
|
+
hasDog(alice, dog5).
|
|
14
|
+
hasDog(bob, dog6).
|
|
15
|
+
hasDog(bob, dog7).
|
|
16
|
+
|
|
17
|
+
% countall/2 counts all matching dogs for the same subject.
|
|
18
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
19
|
+
dogCount(Subject, Count) :-
|
|
20
|
+
hasDog(Subject, _Any),
|
|
21
|
+
countall(hasDog(Subject, _Dog), Count).
|
|
22
|
+
|
|
23
|
+
mustHave(Subject, dogLicense) :-
|
|
24
|
+
dogCount(Subject, Count),
|
|
25
|
+
gt(Count, 4).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
% Memoize bounded paths because surviving-plan metrics reuse route prefixes.
|
|
2
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
3
|
+
materialize(gps_plan, 2).
|
|
4
|
+
|
|
5
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
6
|
+
memoize(path, 9).
|
|
7
|
+
|
|
8
|
+
% Bounded drone corridor planner adapted from Eyeling drone-corridor-planner.n3.
|
|
9
|
+
% A fuel list bounds recursion; duration and cost are summed, belief and comfort
|
|
10
|
+
% are multiplied along the action sequence.
|
|
11
|
+
|
|
12
|
+
fuel(fuel7, [t, t, t, t, t, t, t]).
|
|
13
|
+
|
|
14
|
+
step(state(gent, full, P), state(brugge, mid, P), fly_gent_brugge, 1500.0, 0.006, 0.99, 0.99).
|
|
15
|
+
step(state(gent, B, P), state(brugge, B, P), train_gent_brugge, 1700.0, 0.012, 0.999, 0.995).
|
|
16
|
+
step(state(gent, full, P), state(kortrijk, mid, P), fly_gent_kortrijk, 1600.0, 0.007, 0.99, 0.99).
|
|
17
|
+
step(state(kortrijk, mid, P), state(brugge, low, P), fly_kortrijk_brugge, 1600.0, 0.007, 0.99, 0.99).
|
|
18
|
+
step(state(brugge, mid, P), state(kortrijk, low, P), fly_brugge_kortrijk, 1600.0, 0.007, 0.985, 0.98).
|
|
19
|
+
step(state(kortrijk, B, none), state(kortrijk, B, yes), get_zone_permit_kortrijk, 300.0, 0.001, 0.999, 1.0).
|
|
20
|
+
step(state(brugge, B, none), state(brugge, B, yes), buy_permit_brugge, 450.0, 0.002, 0.98, 1.0).
|
|
21
|
+
step(state(brugge, low, P), state(brugge, full, P), quick_charge_brugge, 600.0, 0.004, 0.999, 0.97).
|
|
22
|
+
step(state(brugge, mid, P), state(brugge, full, P), topup_brugge, 400.0, 0.003, 0.999, 0.98).
|
|
23
|
+
step(state(kortrijk, mid, P), state(kortrijk, full, P), emergency_charge_kortrijk, 500.0, 0.003, 0.999, 0.95).
|
|
24
|
+
step(state(brugge, full, yes), state(oostende, mid, yes), cross_corridor_brugge_oostende, 900.0, 0.004, 0.98, 1.0).
|
|
25
|
+
step(state(brugge, mid, P), state(oostende, low, P), public_coastline_brugge_oostende, 1300.0, 0.006, 0.97, 0.96).
|
|
26
|
+
step(state(brugge, full, P), state(oostende, mid, P), public_coastline_brugge_oostende, 1200.0, 0.006, 0.975, 0.96).
|
|
27
|
+
step(state(kortrijk, full, yes), state(oostende, mid, yes), direct_corridor_kortrijk_oostende, 1100.0, 0.009, 0.955, 0.92).
|
|
28
|
+
|
|
29
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
30
|
+
path(From, To, [Act], Duration, Cost, Belief, Comfort, FuelIn, FuelOut) :-
|
|
31
|
+
step(From, To, Act, Duration, Cost, Belief, Comfort),
|
|
32
|
+
rest(FuelIn, FuelOut).
|
|
33
|
+
|
|
34
|
+
path(From, To, Actions, Duration, Cost, Belief, Comfort, FuelIn, FuelOut) :-
|
|
35
|
+
step(From, Mid, Act, D1, C1, B1, M1),
|
|
36
|
+
rest(FuelIn, FuelMid),
|
|
37
|
+
path(Mid, To, RestActions, D2, C2, B2, M2, FuelMid, FuelOut),
|
|
38
|
+
append([Act], RestActions, Actions),
|
|
39
|
+
add(D1, D2, Duration),
|
|
40
|
+
add(C1, C2, Cost),
|
|
41
|
+
mul(B1, B2, Belief),
|
|
42
|
+
mul(M1, M2, Comfort).
|
|
43
|
+
|
|
44
|
+
surviving_plan(Actions, Duration, Cost, Belief, Comfort, Battery, Permit, FuelLeft) :-
|
|
45
|
+
fuel(fuel7, Fuel),
|
|
46
|
+
path(state(gent, full, none), state(oostende, Battery, Permit), Actions, Duration, Cost, Belief, Comfort, Fuel, FuelLeft),
|
|
47
|
+
gt(Belief, 0.94),
|
|
48
|
+
lt(Cost, 0.03).
|
|
49
|
+
|
|
50
|
+
gps_plan(d1, plan(Actions, Duration, Cost, Belief, Comfort, Battery, Permit, FuelLeft)) :-
|
|
51
|
+
surviving_plan(Actions, Duration, Cost, Belief, Comfort, Battery, Permit, FuelLeft).
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
% Adapted from Eyeling's easter.n3.
|
|
2
|
+
% Gregorian computus for a sample decade, with independent range/window checks.
|
|
3
|
+
|
|
4
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
|
+
materialize(easterDate, 2).
|
|
6
|
+
materialize(computusRemainders, 2).
|
|
7
|
+
materialize(legalGregorianWindow, 2).
|
|
8
|
+
|
|
9
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
10
|
+
% Sample years for which the computed Easter date is materialized.
|
|
11
|
+
case(y2026, 2026).
|
|
12
|
+
case(y2027, 2027).
|
|
13
|
+
case(y2028, 2028).
|
|
14
|
+
case(y2029, 2029).
|
|
15
|
+
case(y2030, 2030).
|
|
16
|
+
case(y2031, 2031).
|
|
17
|
+
case(y2032, 2032).
|
|
18
|
+
case(y2033, 2033).
|
|
19
|
+
case(y2034, 2034).
|
|
20
|
+
case(y2035, 2035).
|
|
21
|
+
|
|
22
|
+
% These checks document the legal ranges of intermediate computus values.
|
|
23
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
24
|
+
valid_golden(N) :- between(0, 18, N).
|
|
25
|
+
valid_epact(N) :- between(0, 29, N).
|
|
26
|
+
valid_weekday(N) :- between(0, 6, N).
|
|
27
|
+
legal_easter_date(3, D) :- between(22, 31, D).
|
|
28
|
+
legal_easter_date(4, D) :- between(1, 25, D).
|
|
29
|
+
month_name(3, march).
|
|
30
|
+
month_name(4, april).
|
|
31
|
+
|
|
32
|
+
% Butcher/Meeus-style integer arithmetic, kept explicit for proof readability.
|
|
33
|
+
computus(Case, Year, Month, Day, J, K, Q, R, V, Z) :-
|
|
34
|
+
case(Case, Year),
|
|
35
|
+
mod(Year, 19, J),
|
|
36
|
+
div(Year, 100, K),
|
|
37
|
+
mod(Year, 100, H),
|
|
38
|
+
div(K, 4, M),
|
|
39
|
+
mod(K, 4, N),
|
|
40
|
+
add(K, 8, KP8),
|
|
41
|
+
div(KP8, 25, P),
|
|
42
|
+
sub(K, P, KminusP),
|
|
43
|
+
add(KminusP, 1, KminusPplus1),
|
|
44
|
+
div(KminusPplus1, 3, Q),
|
|
45
|
+
mul(19, J, NineteenJ),
|
|
46
|
+
add(NineteenJ, K, T1),
|
|
47
|
+
sub(T1, M, T2),
|
|
48
|
+
sub(T2, Q, T3),
|
|
49
|
+
add(T3, 15, T4),
|
|
50
|
+
mod(T4, 30, R),
|
|
51
|
+
div(H, 4, S),
|
|
52
|
+
mod(H, 4, U),
|
|
53
|
+
mul(2, N, TwoN),
|
|
54
|
+
mul(2, S, TwoS),
|
|
55
|
+
add(32, TwoN, L1),
|
|
56
|
+
add(L1, TwoS, L2),
|
|
57
|
+
sub(L2, R, L3),
|
|
58
|
+
sub(L3, U, L4),
|
|
59
|
+
mod(L4, 7, V),
|
|
60
|
+
mul(11, R, ElevenR),
|
|
61
|
+
mul(22, V, TwentyTwoV),
|
|
62
|
+
add(J, ElevenR, W1),
|
|
63
|
+
add(W1, TwentyTwoV, W2),
|
|
64
|
+
div(W2, 451, W),
|
|
65
|
+
mul(7, W, SevenW),
|
|
66
|
+
add(R, V, X1),
|
|
67
|
+
sub(X1, SevenW, X2),
|
|
68
|
+
add(X2, 114, X3),
|
|
69
|
+
div(X3, 31, Month),
|
|
70
|
+
mod(X3, 31, Z),
|
|
71
|
+
add(Z, 1, Day).
|
|
72
|
+
|
|
73
|
+
checks_pass(Case) :-
|
|
74
|
+
computus(Case, _Year, Month, Day, J, _K, _Q, R, V, _Z),
|
|
75
|
+
valid_golden(J),
|
|
76
|
+
valid_epact(R),
|
|
77
|
+
valid_weekday(V),
|
|
78
|
+
month_name(Month, _Name),
|
|
79
|
+
legal_easter_date(Month, Day).
|
|
80
|
+
|
|
81
|
+
easterDate(Case, date(Year, MonthName, Day)) :-
|
|
82
|
+
computus(Case, Year, Month, Day, _J, _K, _Q, _R, _V, _Z),
|
|
83
|
+
month_name(Month, MonthName).
|
|
84
|
+
|
|
85
|
+
computusRemainders(Case, remainders(J, R, V)) :-
|
|
86
|
+
computus(Case, _Year, _Month, _Day, J, _K, _Q, R, V, _Z).
|
|
87
|
+
|
|
88
|
+
legalGregorianWindow(Case, true) :-
|
|
89
|
+
checks_pass(Case).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
% Engineering example: RC low-pass filter sizing.
|
|
2
|
+
%
|
|
3
|
+
% The cutoff frequency is 1 / (2*pi*R*C).
|
|
4
|
+
|
|
5
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
6
|
+
materialize(type, 2).
|
|
7
|
+
materialize(timeConstant_s, 2).
|
|
8
|
+
materialize(cutoffFrequency_Hz, 2).
|
|
9
|
+
|
|
10
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
11
|
+
component(filter1, resistor_ohm, 10000.0).
|
|
12
|
+
component(filter1, capacitor_f, 0.000001).
|
|
13
|
+
constant(pi, 3.141592653589793).
|
|
14
|
+
|
|
15
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
16
|
+
time_constant(Filter, Tau) :-
|
|
17
|
+
component(Filter, resistor_ohm, R),
|
|
18
|
+
component(Filter, capacitor_f, C),
|
|
19
|
+
mul(R, C, Tau).
|
|
20
|
+
|
|
21
|
+
cutoff_frequency(Filter, Frequency) :-
|
|
22
|
+
time_constant(Filter, Tau),
|
|
23
|
+
constant(pi, Pi),
|
|
24
|
+
mul(2.0, Pi, TwoPi),
|
|
25
|
+
mul(TwoPi, Tau, Denominator),
|
|
26
|
+
div(1.0, Denominator, Frequency).
|
|
27
|
+
|
|
28
|
+
type(Filter, first_order_low_pass) :-
|
|
29
|
+
component(Filter, resistor_ohm, _R),
|
|
30
|
+
component(Filter, capacitor_f, _C).
|
|
31
|
+
|
|
32
|
+
timeConstant_s(Filter, Tau) :-
|
|
33
|
+
time_constant(Filter, Tau).
|
|
34
|
+
|
|
35
|
+
cutoffFrequency_Hz(Filter, Frequency) :-
|
|
36
|
+
cutoff_frequency(Filter, Frequency).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
% EYE-inspired epidemic policy choice.
|
|
2
|
+
% Policies are evaluated by estimated reproduction risk and social cost.
|
|
3
|
+
|
|
4
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
|
+
materialize(riskScore, 2).
|
|
6
|
+
materialize(cost, 2).
|
|
7
|
+
materialize(status, 2).
|
|
8
|
+
materialize(recommendedPolicy, 2).
|
|
9
|
+
materialize(reason, 2).
|
|
10
|
+
|
|
11
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
12
|
+
% Candidate interventions combine vaccination and mask factors.
|
|
13
|
+
policy(no_mandate).
|
|
14
|
+
policy(vaccination_campaign).
|
|
15
|
+
policy(indoor_masks).
|
|
16
|
+
policy(vaccination_and_masks).
|
|
17
|
+
|
|
18
|
+
base_risk(1.40).
|
|
19
|
+
|
|
20
|
+
vaccination_factor(no_mandate, 1.00).
|
|
21
|
+
vaccination_factor(vaccination_campaign, 0.55).
|
|
22
|
+
vaccination_factor(indoor_masks, 1.00).
|
|
23
|
+
vaccination_factor(vaccination_and_masks, 0.55).
|
|
24
|
+
|
|
25
|
+
mask_factor(no_mandate, 1.00).
|
|
26
|
+
mask_factor(vaccination_campaign, 1.00).
|
|
27
|
+
mask_factor(indoor_masks, 0.65).
|
|
28
|
+
mask_factor(vaccination_and_masks, 0.65).
|
|
29
|
+
|
|
30
|
+
policy_cost(no_mandate, 0).
|
|
31
|
+
policy_cost(vaccination_campaign, 3).
|
|
32
|
+
policy_cost(indoor_masks, 2).
|
|
33
|
+
policy_cost(vaccination_and_masks, 5).
|
|
34
|
+
|
|
35
|
+
% Risk multiplies the base reproduction estimate by policy-specific factors.
|
|
36
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
37
|
+
risk_score(P, R) :-
|
|
38
|
+
base_risk(Base),
|
|
39
|
+
vaccination_factor(P, VF),
|
|
40
|
+
mask_factor(P, MF),
|
|
41
|
+
mul(Base, VF, A),
|
|
42
|
+
mul(A, MF, R).
|
|
43
|
+
|
|
44
|
+
acceptable(P) :-
|
|
45
|
+
risk_score(P, R),
|
|
46
|
+
le(R, 0.75).
|
|
47
|
+
|
|
48
|
+
status(P, insufficient_control) :-
|
|
49
|
+
policy(P),
|
|
50
|
+
risk_score(P, R),
|
|
51
|
+
gt(R, 0.75).
|
|
52
|
+
|
|
53
|
+
status(P, acceptable_control) :-
|
|
54
|
+
acceptable(P).
|
|
55
|
+
|
|
56
|
+
% The recommendation is the only candidate below the outbreak threshold.
|
|
57
|
+
recommended(vaccination_and_masks) :-
|
|
58
|
+
acceptable(vaccination_and_masks),
|
|
59
|
+
status(no_mandate, insufficient_control),
|
|
60
|
+
status(vaccination_campaign, insufficient_control),
|
|
61
|
+
status(indoor_masks, insufficient_control).
|
|
62
|
+
|
|
63
|
+
riskScore(P, R) :- risk_score(P, R).
|
|
64
|
+
cost(P, C) :- policy_cost(P, C).
|
|
65
|
+
recommendedPolicy(epidemic_policy, P) :- recommended(P).
|
|
66
|
+
reason(epidemic_policy, "combined vaccination and indoor masks are the only policy below the outbreak threshold") :-
|
|
67
|
+
recommended(vaccination_and_masks).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
2
|
+
materialize(sameClassBecauseOfSharedMember, 3).
|
|
3
|
+
|
|
4
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
5
|
+
% Equivalence-classes example adapted from Eyeling
|
|
6
|
+
% equivalence-classes-overlap-implies-same-class.n3.
|
|
7
|
+
% The finite class membership facts represent the equivalence closure generated
|
|
8
|
+
% by b~a and b~c; the rule packages every shared-member witness.
|
|
9
|
+
|
|
10
|
+
classMember(class_abc, a).
|
|
11
|
+
classMember(class_abc, b).
|
|
12
|
+
classMember(class_abc, c).
|
|
13
|
+
|
|
14
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
15
|
+
inClassOf(U, X) :-
|
|
16
|
+
classMember(Class, U),
|
|
17
|
+
classMember(Class, X).
|
|
18
|
+
|
|
19
|
+
sameClass(X, Y) :-
|
|
20
|
+
classMember(Class, X),
|
|
21
|
+
classMember(Class, Y).
|
|
22
|
+
|
|
23
|
+
sameClassBecauseOfSharedMember(X, Y, Z) :-
|
|
24
|
+
inClassOf(Z, X),
|
|
25
|
+
inClassOf(Z, Y),
|
|
26
|
+
sameClass(X, Y),
|
|
27
|
+
neq(X, Y).
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
% Eyelet-inspired Eulerian path example using findall/3 and sort/2.
|
|
2
|
+
% The graph is undirected; edges are represented by identifiers so each edge is used once.
|
|
3
|
+
|
|
4
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
|
+
materialize(oddVertices, 2).
|
|
6
|
+
materialize(path, 2).
|
|
7
|
+
materialize(edgeCount, 2).
|
|
8
|
+
materialize(reason, 2).
|
|
9
|
+
|
|
10
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
11
|
+
% Edge identifiers let the search remove each physical edge exactly once.
|
|
12
|
+
edge(e12, v1, v2).
|
|
13
|
+
edge(e13, v1, v3).
|
|
14
|
+
edge(e15, v1, v5).
|
|
15
|
+
edge(e16, v1, v6).
|
|
16
|
+
edge(e23, v2, v3).
|
|
17
|
+
edge(e24, v2, v4).
|
|
18
|
+
edge(e26, v2, v6).
|
|
19
|
+
edge(e34, v3, v4).
|
|
20
|
+
edge(e36, v3, v6).
|
|
21
|
+
edge(e45, v4, v5).
|
|
22
|
+
edge(e46, v4, v6).
|
|
23
|
+
|
|
24
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
25
|
+
vertex(V) :- edge(_E, V, _U).
|
|
26
|
+
vertex(V) :- edge(_E, _U, V).
|
|
27
|
+
|
|
28
|
+
incident(V, E) :- edge(E, V, _U).
|
|
29
|
+
incident(V, E) :- edge(E, _U, V).
|
|
30
|
+
|
|
31
|
+
adjacent_by_edge(V, U, E) :- edge(E, V, U).
|
|
32
|
+
adjacent_by_edge(V, U, E) :- edge(E, U, V).
|
|
33
|
+
|
|
34
|
+
select(Item, [Item | Rest], Rest).
|
|
35
|
+
select(Item, [Head | Tail], [Head | Rest]) :-
|
|
36
|
+
select(Item, Tail, Rest).
|
|
37
|
+
|
|
38
|
+
% Eulerian paths start at an odd-degree vertex when exactly two exist.
|
|
39
|
+
odd_degree(V) :-
|
|
40
|
+
findall(E, incident(V, E), Edges),
|
|
41
|
+
length(Edges, Degree),
|
|
42
|
+
mod(Degree, 2, 1).
|
|
43
|
+
|
|
44
|
+
odd_vertices(Odds) :-
|
|
45
|
+
findall(V, odd_degree(V), Raw),
|
|
46
|
+
sort(Raw, Odds).
|
|
47
|
+
|
|
48
|
+
all_edges(Edges) :-
|
|
49
|
+
findall(E, edge(E, _A, _B), Raw),
|
|
50
|
+
sort(Raw, Edges).
|
|
51
|
+
|
|
52
|
+
vertices(Vertices) :-
|
|
53
|
+
findall(V, vertex(V), Raw),
|
|
54
|
+
sort(Raw, Vertices).
|
|
55
|
+
|
|
56
|
+
eulerian_start(Start) :-
|
|
57
|
+
odd_vertices([Start, _End]).
|
|
58
|
+
eulerian_start(Start) :-
|
|
59
|
+
odd_vertices([]),
|
|
60
|
+
vertices([Start | _Rest]).
|
|
61
|
+
|
|
62
|
+
eulerian_path(Path) :-
|
|
63
|
+
eulerian_start(Start),
|
|
64
|
+
all_edges(Edges),
|
|
65
|
+
dfs_euler(Start, [Start], Edges, ReversedPath),
|
|
66
|
+
reverse(ReversedPath, Path).
|
|
67
|
+
|
|
68
|
+
% Depth-first search consumes the remaining edge-id list one edge at a time.
|
|
69
|
+
dfs_euler(_Current, Path, [], Path).
|
|
70
|
+
dfs_euler(Current, Visited, Remaining, Path) :-
|
|
71
|
+
adjacent_by_edge(Current, Next, Edge),
|
|
72
|
+
select(Edge, Remaining, NewRemaining),
|
|
73
|
+
dfs_euler(Next, [Next | Visited], NewRemaining, Path).
|
|
74
|
+
|
|
75
|
+
oddVertices(eulerian_path_case, Odds) :-
|
|
76
|
+
odd_vertices(Odds).
|
|
77
|
+
|
|
78
|
+
path(eulerian_path_case, Path) :-
|
|
79
|
+
once(eulerian_path(Path)).
|
|
80
|
+
|
|
81
|
+
edgeCount(eulerian_path_case, Count) :-
|
|
82
|
+
all_edges(Edges),
|
|
83
|
+
length(Edges, Count).
|
|
84
|
+
|
|
85
|
+
reason(eulerian_path_case, "findall collects graph structure and sort canonicalizes vertices and edges").
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
% EYE-inspired electric-vehicle range worlds.
|
|
2
|
+
% Four simple worlds estimate whether trips fit the available battery.
|
|
3
|
+
|
|
4
|
+
% Output declarations: materialize/2 selects the relations written to this example's golden output.
|
|
5
|
+
materialize(safeInWorld, 2).
|
|
6
|
+
materialize(riskyInWorld, 2).
|
|
7
|
+
materialize(reason, 2).
|
|
8
|
+
materialize(status, 2).
|
|
9
|
+
|
|
10
|
+
% Program structure: facts set up the scenario, and rules derive the materialized conclusions.
|
|
11
|
+
trip(city_errand).
|
|
12
|
+
trip(winter_highway).
|
|
13
|
+
trip(heavy_delivery).
|
|
14
|
+
trip(cold_commute).
|
|
15
|
+
|
|
16
|
+
% trip_data(Trip, DistanceKm, SpeedKmh, TemperatureC, PayloadKg, BatteryKWh, BaseKWhPerKm).
|
|
17
|
+
trip_data(city_errand, 40, 45, 20, 100, 30, 0.18).
|
|
18
|
+
trip_data(winter_highway, 260, 115, -5, 400, 60, 0.20).
|
|
19
|
+
trip_data(heavy_delivery, 180, 80, 15, 700, 55, 0.22).
|
|
20
|
+
trip_data(cold_commute, 120, 90, -8, 100, 35, 0.19).
|
|
21
|
+
|
|
22
|
+
% Derivation rules: each rule below contributes one logical step toward the displayed results.
|
|
23
|
+
speed_factor(T, 1.20) :- trip_data(T, _, S, _, _, _, _), gt(S, 100).
|
|
24
|
+
speed_factor(T, 1.00) :- trip_data(T, _, S, _, _, _, _), le(S, 100).
|
|
25
|
+
|
|
26
|
+
temperature_factor(T, 1.15) :- trip_data(T, _, _, Temp, _, _, _), lt(Temp, 0).
|
|
27
|
+
temperature_factor(T, 1.00) :- trip_data(T, _, _, Temp, _, _, _), ge(Temp, 0).
|
|
28
|
+
|
|
29
|
+
payload_factor(T, 1.15) :- trip_data(T, _, _, _, P, _, _), gt(P, 500).
|
|
30
|
+
payload_factor(T, 1.08) :- trip_data(T, _, _, _, P, _, _), gt(P, 250), le(P, 500).
|
|
31
|
+
payload_factor(T, 1.00) :- trip_data(T, _, _, _, P, _, _), le(P, 250).
|
|
32
|
+
|
|
33
|
+
base_energy(T, E) :-
|
|
34
|
+
trip_data(T, D, _, _, _, _, B),
|
|
35
|
+
mul(D, B, E).
|
|
36
|
+
|
|
37
|
+
required_energy(T, w1, E) :-
|
|
38
|
+
base_energy(T, E).
|
|
39
|
+
|
|
40
|
+
required_energy(T, w2, E) :-
|
|
41
|
+
base_energy(T, Base),
|
|
42
|
+
speed_factor(T, SF),
|
|
43
|
+
mul(Base, SF, E).
|
|
44
|
+
|
|
45
|
+
required_energy(T, w0, E) :-
|
|
46
|
+
base_energy(T, Base),
|
|
47
|
+
speed_factor(T, SF),
|
|
48
|
+
temperature_factor(T, TF),
|
|
49
|
+
payload_factor(T, PF),
|
|
50
|
+
mul(Base, SF, A),
|
|
51
|
+
mul(A, TF, B),
|
|
52
|
+
mul(B, PF, E).
|
|
53
|
+
|
|
54
|
+
required_energy(T, w3, E) :-
|
|
55
|
+
required_energy(T, w0, W0),
|
|
56
|
+
mul(W0, 1.30, E).
|
|
57
|
+
|
|
58
|
+
safe_in_world(T, W) :-
|
|
59
|
+
trip_data(T, _, _, _, _, Battery, _),
|
|
60
|
+
required_energy(T, W, Required),
|
|
61
|
+
le(Required, Battery).
|
|
62
|
+
|
|
63
|
+
risky_in_world(T, W) :-
|
|
64
|
+
trip_data(T, _, _, _, _, Battery, _),
|
|
65
|
+
required_energy(T, W, Required),
|
|
66
|
+
gt(Required, Battery).
|
|
67
|
+
|
|
68
|
+
safeInWorld(T, W) :- safe_in_world(T, W).
|
|
69
|
+
riskyInWorld(T, W) :- risky_in_world(T, W).
|
|
70
|
+
reason(winter_highway, "cold fast payload trip exceeds battery in physics-aware worlds") :-
|
|
71
|
+
risky_in_world(winter_highway, w0),
|
|
72
|
+
risky_in_world(winter_highway, w2),
|
|
73
|
+
risky_in_world(winter_highway, w3),
|
|
74
|
+
safe_in_world(winter_highway, w1).
|
|
75
|
+
reason(heavy_delivery, "safety buffer turns a physics-safe delivery into a cautious risk") :-
|
|
76
|
+
safe_in_world(heavy_delivery, w0),
|
|
77
|
+
risky_in_world(heavy_delivery, w3).
|
|
78
|
+
status(ev_range_worlds, expected_world_pattern) :-
|
|
79
|
+
safe_in_world(city_errand, w3),
|
|
80
|
+
risky_in_world(winter_highway, w0),
|
|
81
|
+
risky_in_world(heavy_delivery, w3),
|
|
82
|
+
safe_in_world(cold_commute, w3).
|