-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathIn.metta
executable file
·33 lines (26 loc) · 1.07 KB
/
In.metta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
;; Definitions of ∈ and ∉ types including axioms and rules
;; Import modules
!(import! &self Num)
!(import! &self OrderedSet)
;; Type representing whether an element is or not in a set
(: ∈ (-> $a (OrderedSet $a) Type))
(: ∉ (-> $a (OrderedSet $a) Type))
;; Constructors for ∉
;; Nothing is in an empty set
(: notin-empty-axiom (-> Atom))
(= (notin-empty-axiom)
(: NotInEmpty (∉ $x ∅)))
;; TODO: the following is problematic as explained in issue
;; https://github.com/trueagi-io/hyperon-experimental/issues/385
;; If x ∉ S, y ∉ S and x < y, then x ∉ (y ∪ S)
(= (lt-notin-recursive-left-rule)
(: LTNotInRecursiveLeft (-> (∉ $x $S)
(∉ $y $S)
(⍃ $x $y)
(∉ $x (insert $y $S)))))
;; If x ∉ S, y ∉ S and x < y, then y ∉ (x ∪ S)
(= (lt-notin-recursive-right-rule)
(: LTNotInRecursiveRight (-> (∉ $x $S)
(∉ $y $S)
(⍃ $x $y)
(∉ $y (insert $x $S)))))