deriva 0.0.14 → 0.0.15
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/docs/guide.md +1 -0
- package/docs/language-reference.md +5 -0
- package/examples/herbrand-semantics.pl +16 -0
- package/examples/output/herbrand-semantics.pl +2 -0
- package/examples/proof/herbrand-semantics.pl +30 -0
- package/package.json +1 -1
- package/playground.html +1 -0
- package/test/run-examples.mjs +1 -0
package/docs/guide.md
CHANGED
|
@@ -416,6 +416,7 @@ Use `holds/2` when you want to match the member term directly, for example `name
|
|
|
416
416
|
| [`hamming-code.pl`](../examples/hamming-code.pl) | Corrects a single-bit Hamming word. | [`output/hamming-code.pl`](../examples/output/hamming-code.pl) |
|
|
417
417
|
| [`hanoi.pl`](../examples/hanoi.pl) | Derives the Towers of Hanoi moves. | [`output/hanoi.pl`](../examples/output/hanoi.pl) |
|
|
418
418
|
| [`heat-loss.pl`](../examples/heat-loss.pl) | Computes conductive heat loss. | [`output/heat-loss.pl`](../examples/output/heat-loss.pl) |
|
|
419
|
+
| [`herbrand-semantics.pl`](../examples/herbrand-semantics.pl) | Shows how unique names and free constructors make symbolic identity predictable. | [`output/herbrand-semantics.pl`](../examples/output/herbrand-semantics.pl) |
|
|
419
420
|
| [`herbrand-witnesses.pl`](../examples/herbrand-witnesses.pl) | Represents existential-style consequences as stable Herbrand witness terms. | [`output/herbrand-witnesses.pl`](../examples/output/herbrand-witnesses.pl) |
|
|
420
421
|
| [`heron-theorem.pl`](../examples/heron-theorem.pl) | Computes triangle area by Heron's theorem. | [`output/heron-theorem.pl`](../examples/output/heron-theorem.pl) |
|
|
421
422
|
| [`ideal-gas-law.pl`](../examples/ideal-gas-law.pl) | Applies the ideal gas law. | [`output/ideal-gas-law.pl`](../examples/output/ideal-gas-law.pl) |
|
|
@@ -440,6 +440,11 @@ different(alice, bob).
|
|
|
440
440
|
different(ticket(alice), ticket(bob)).
|
|
441
441
|
```
|
|
442
442
|
|
|
443
|
+
The complete runnable example, normal output, and proof output are available as
|
|
444
|
+
[`examples/herbrand-semantics.pl`](../examples/herbrand-semantics.pl),
|
|
445
|
+
[`examples/output/herbrand-semantics.pl`](../examples/output/herbrand-semantics.pl),
|
|
446
|
+
and [`examples/proof/herbrand-semantics.pl`](../examples/proof/herbrand-semantics.pl).
|
|
447
|
+
|
|
443
448
|
In an unrestricted Tarskian interpretation, the constants `alice` and `bob`
|
|
444
449
|
may denote the same domain element unless a distinctness axiom says otherwise.
|
|
445
450
|
Even if they denote different elements, the function denoted by `ticket` need
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
% Herbrand terms denote themselves: distinct names and constructor applications
|
|
2
|
+
% remain distinct without extra unique-name or free-constructor axioms.
|
|
3
|
+
|
|
4
|
+
% Output declaration: materialize/2 selects the relation written to this
|
|
5
|
+
% example's golden output.
|
|
6
|
+
materialize(different, 2).
|
|
7
|
+
|
|
8
|
+
% Under unrestricted Tarskian semantics, alice and bob could denote the same
|
|
9
|
+
% element. In Deriva's Herbrand universe, their different syntax is enough.
|
|
10
|
+
different(alice, bob) :-
|
|
11
|
+
neq(alice, bob).
|
|
12
|
+
|
|
13
|
+
% A general Tarskian function need not be injective. Herbrand compound terms
|
|
14
|
+
% are free constructors, so different arguments produce different terms.
|
|
15
|
+
different(ticket(alice), ticket(bob)) :-
|
|
16
|
+
neq(ticket(alice), ticket(bob)).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
different(alice, bob).
|
|
2
|
+
why(
|
|
3
|
+
different(alice, bob),
|
|
4
|
+
proof(
|
|
5
|
+
goal(different(alice, bob)),
|
|
6
|
+
by(rule("herbrand-semantics.pl", clause(2))),
|
|
7
|
+
uses([
|
|
8
|
+
proof(
|
|
9
|
+
goal(neq(alice, bob)),
|
|
10
|
+
by(builtin(neq, 2))
|
|
11
|
+
)
|
|
12
|
+
])
|
|
13
|
+
)
|
|
14
|
+
).
|
|
15
|
+
|
|
16
|
+
different(ticket(alice), ticket(bob)).
|
|
17
|
+
why(
|
|
18
|
+
different(ticket(alice), ticket(bob)),
|
|
19
|
+
proof(
|
|
20
|
+
goal(different(ticket(alice), ticket(bob))),
|
|
21
|
+
by(rule("herbrand-semantics.pl", clause(3))),
|
|
22
|
+
uses([
|
|
23
|
+
proof(
|
|
24
|
+
goal(neq(ticket(alice), ticket(bob))),
|
|
25
|
+
by(builtin(neq, 2))
|
|
26
|
+
)
|
|
27
|
+
])
|
|
28
|
+
)
|
|
29
|
+
).
|
|
30
|
+
|
package/package.json
CHANGED
package/playground.html
CHANGED
package/test/run-examples.mjs
CHANGED