-
Notifications
You must be signed in to change notification settings - Fork 6
/
feature-complete.psl
33 lines (33 loc) · 1.52 KB
/
feature-complete.psl
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
// This is an example that showcases most of the features in the fox-DSL.
// Classes:
class Person: anna, bob, carl
class Party: demo, repub
class Woman: anna
class Course: db, ai
// Predicates with arguments of any class:
predicate: retired(_)
predicate: young(_)
// Predicates with arguments of different classes (which should be explicitly defined):
predicate: professor(Person)
predicate: teaches(Person, Course, Person)
// Predicates with predicate properties, like functionality and symmetry.
// Other keywords include PartialFunctional, InverseFunctional and InversePartialFunctional.
predicate [Functional]: votes(Person, Party)
predicate [Symmetric]: friends(Person, Person)
// Rules with weights and distance measures, possible values are linear, squared,
// experimentalSquared (for an experimental solver).
// && = AND, || = OR, => = IMPLICATION
rule[weight=3, distanceMeasure = linear]: young(P) => !retired(P)
rule [weight=5, distanceMeasure = squared]: votes(A,P) && friends(A,B) => votes(B,P)
rule[1]: teaches(A, C, B) && votes(A, P) => votes(B, P)
// Rules without any weight are considered hard rules (infinite weight).
// EXISTS is an existential quantifier that quantifies the variables in the brackets.
rule : professor(P) => EXISTS [C, S] teaches(P,C,S) || retired(P)
// Soft truth facts.
fact : professor(bob)
fact [0.8]: young(bob)
fact [truthValue=0.8]: friends(bob, carl)
fact [truthValue=0.7]: friends(anna, carl)
fact [0.9]: !votes(bob, repub)
// Individuals without class.
individuals: ufo