Skip to content

Commit

Permalink
using explicit rule:vars in rdfreasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Nov 24, 2023
1 parent 3951064 commit dbb3287
Show file tree
Hide file tree
Showing 4 changed files with 212 additions and 0 deletions.
112 changes: 112 additions & 0 deletions rdfreasoning/complex-numbers/complex-numbers.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

# exponentiation
[] a rule:BackwardRule;
rule:vars (
_:A
_:B
_:C
_:D
_:E
_:F
_:R
_:T
_:Z1
_:Z2
_:Z3
_:Z4
_:Z5
_:Z6
_:Z7
_:Z8
_:Z9
_:Z10
);
rule:conclusion (
(((_:A _:B) (_:C _:D)) complex:exponentiation (_:E _:F))
);
Expand All @@ -25,6 +45,29 @@

# asin
[] a rule:BackwardRule;
rule:vars (
_:A
_:B
_:C
_:D
_:E
_:F
_:Z1
_:Z2
_:Z3
_:Z4
_:Z5
_:Z6
_:Z7
_:Z8
_:Z9
_:Z10
_:Z11
_:Z12
_:Z13
_:Z14
_:Z15
);
rule:conclusion (
((_:A _:B) complex:asin (_:C _:D))
);
Expand Down Expand Up @@ -52,6 +95,30 @@

# acos
[] a rule:BackwardRule;
rule:vars (
_:A
_:B
_:C
_:D
_:E
_:F
_:Z1
_:Z2
_:Z3
_:Z4
_:Z5
_:Z6
_:Z7
_:Z8
_:Z9
_:Z10
_:Z11
_:Z12
_:Z13
_:Z14
_:Z15
_:U
);
rule:conclusion (
((_:A _:B) complex:acos (_:C _:D))
);
Expand Down Expand Up @@ -80,6 +147,18 @@

# polar
[] a rule:BackwardRule;
rule:vars (
_:X
_:Y
_:R
_:Tp
_:Z1
_:Z2
_:Z3
_:Z4
_:Z5
_:T
);
rule:conclusion (
((_:X _:Y) complex:polar(_:R _:Tp))
);
Expand All @@ -96,6 +175,12 @@

# dial
[] a rule:BackwardRule;
rule:vars (
_:X
_:Y
_:T
_:Tp
);
rule:conclusion (
((_:X _:Y _:T) complex:dial _:Tp)
);
Expand All @@ -106,6 +191,12 @@
).

[] a rule:BackwardRule;
rule:vars (
_:X
_:Y
_:T
_:Tp
);
rule:conclusion (
((_:X _:Y _:T) complex:dial _:Tp)
);
Expand All @@ -116,6 +207,12 @@
).

[] a rule:BackwardRule;
rule:vars (
_:X
_:Y
_:T
_:Tp
);
rule:conclusion (
((_:X _:Y _:T) complex:dial _:Tp)
);
Expand All @@ -126,6 +223,13 @@
).

[] a rule:BackwardRule;
rule:vars (
_:X
_:Y
_:T
_:Tp
_:Z1
);
rule:conclusion (
((_:X _:Y _:T) complex:dial _:Tp)
);
Expand All @@ -138,6 +242,14 @@

# query
[] a rule:QueryRule;
rule:vars (
_:C1
_:C2
_:C3
_:C4
_:C5
_:C6
);
rule:premise (
(((-1 0) (0.5 0)) complex:exponentiation _:C1)
(((2.718281828459045 0) (0 3.141592653589793)) complex:exponentiation _:C2)
Expand Down
8 changes: 8 additions & 0 deletions rdfreasoning/complex-numbers/out/complex-numbers.ttl.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@prefix complex: <http://eyereasoner.github.io/complex#>.

((-1 0) (0.5 0)) complex:exponentiation (6.123233995736766e-17 1.0).
((2.718281828459045 0) (0 3.141592653589793)) complex:exponentiation (-1.0 1.2246467991473532e-16).
((0 1) (0 1)) complex:exponentiation (0.20787957635076193 0.0).
((2.718281828459045 0) (-1.57079632679 0)) complex:exponentiation (0.20787957635177984 0.0).
(2 0) complex:asin (1.5707963267948966 1.3169578969248166).
(2 0) complex:acos (0.0 -1.3169578969248166).
6 changes: 6 additions & 0 deletions rdfreasoning/turing/out/turing.ttl.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@prefix : <http://example.org/ns#>.

(1 0 1 0 0 1) :compute (1 0 1 0 1 0 "#").
(1 0 1 1 1 1) :compute (1 1 0 0 0 0 "#").
(1 1 1 1 1 1) :compute (1 0 0 0 0 0 0 "#").
() :compute (1 "#").
86 changes: 86 additions & 0 deletions rdfreasoning/turing/turing.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

# interpreter for Turing machine
[] a rule:BackwardRule;
rule:vars (
_:OutTape
_:Machine
_:I
);
rule:conclusion (
(() :compute _:OutTape)
);
Expand All @@ -14,6 +19,14 @@
).

[] a rule:BackwardRule;
rule:vars (
_:List
_:OutTape
_:Head
_:Tail
_:Machine
_:I
);
rule:conclusion (
(_:List :compute _:OutTape)
);
Expand All @@ -24,6 +37,19 @@
).

[] a rule:BackwardRule;
rule:vars (
_:State
_:Left
_:Cell
_:Right
_:OutTape
_:Write
_:Move
_:Next
_:A
_:B
_:C
);
rule:conclusion (
((_:State _:Left _:Cell _:Right) :find _:OutTape)
);
Expand All @@ -34,6 +60,14 @@
).

[] a rule:BackwardRule;
rule:vars (
_:Left
_:Cell
_:Right
_:OutTape
_:R
_:List
);
rule:conclusion (
((:halt _:Left _:Cell _:Right) :continue _:OutTape)
);
Expand All @@ -44,6 +78,13 @@
).

[] a rule:BackwardRule;
rule:vars (
_:State
_:Left
_:Cell
_:Right
_:OutTape
);
rule:conclusion (
((_:State _:Left _:Cell _:Right) :continue _:OutTape)
);
Expand All @@ -52,6 +93,11 @@
).

[] a rule:BackwardRule;
rule:vars (
_:Cell
_:Right
_:L
);
rule:conclusion (
((:left () _:Cell _:Right () "#" _:L) :move true)
);
Expand All @@ -60,6 +106,14 @@
).

[] a rule:BackwardRule;
rule:vars (
_:List
_:Cell
_:Right
_:Tail
_:Head
_:L
);
rule:conclusion (
((:left _:List _:Cell _:Right _:Tail _:Head _:L) :move true)
);
Expand All @@ -69,12 +123,22 @@
).

[] a rule:BackwardRule;
rule:vars (
_:Left
_:Cell
_:Right
);
rule:conclusion (
((:stop _:Left _:Cell _:Right _:Left _:Cell _:Right) :move true)
);
rule:premise ().

[] a rule:BackwardRule;
rule:vars (
_:Left
_:Cell
_:L
);
rule:conclusion (
((:right _:Left _:Cell () _:L "#" ()) :move true)
);
Expand All @@ -83,6 +147,14 @@
).

[] a rule:BackwardRule;
rule:vars (
_:Left
_:Cell
_:List
_:L
_:Head
_:Tail
);
rule:conclusion (
((:right _:Left _:Cell _:List _:L _:Head _:Tail) :move true)
);
Expand All @@ -92,12 +164,20 @@
).

[] a rule:BackwardRule;
rule:vars ();
rule:conclusion (
(() :reverse ())
);
rule:premise ().

[] a rule:BackwardRule;
rule:vars (
_:List
_:Reverse
_:Head
_:Tail
_:R
);
rule:conclusion (
(_:List :reverse _:Reverse)
);
Expand All @@ -119,6 +199,12 @@

# query
[] a rule:QueryRule;
rule:vars (
_:A1
_:A2
_:A3
_:A4
);
rule:premise (
((1 0 1 0 0 1) :compute _:A1)
((1 0 1 1 1 1) :compute _:A2)
Expand Down

0 comments on commit dbb3287

Please sign in to comment.