-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcc.trig
106 lines (82 loc) · 1.92 KB
/
gcc.trig
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -----------------
# Gray Code Counter
# -----------------
#
# See https://en.wikipedia.org/wiki/Gray_code
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix : <http://example.org/#>.
(0 0) :and 0.
(0 1) :and 0.
(1 0) :and 0.
(1 1) :and 1.
(0 0) :or 0.
(0 1) :or 1.
(1 0) :or 1.
(1 1) :or 1.
[] rdf:value 0; :inv 1.
[] rdf:value 1; :inv 0.
_:bng_1 log:isImpliedBy true.
_:bng_1 {
(var:D 0 var:Q) :dff var:Q.
}
_:bng_2 log:isImpliedBy true.
_:bng_2 {
(var:D 1 var:Q) :dff var:D.
}
_:bng_3 log:isImpliedBy _:bng_4.
_:bng_3 {
(var:A var:B) :neta var:Q.
}
_:bng_4 {
(var:A var:B) :and var:T1.
var:A :inv var:NA.
var:B :inv var:NB.
(var:NA var:NB) :and var:T2.
(var:T1 var:T2) :or var:Q.
}
_:bng_5 log:isImpliedBy _:bng_6.
_:bng_5 {
(var:A var:B var:C) :netb (var:Q1 var:Q2).
}
_:bng_6 {
(var:A var:C) :and var:T1.
var:C :inv var:NC.
(var:B var:NC) :and var:T2.
var:A :inv var:NA.
(var:NA var:C) :and var:T3.
(var:T1 var:T2) :or var:Q1.
(var:T2 var:T3) :or var:Q2.
}
_:bng_7 log:isImpliedBy _:bng_8.
_:bng_7 {
(var:C (var:Qa var:Qb var:Qc)) :gcc (var:Za var:Zb var:Zc).
}
_:bng_8 {
(var:Qa var:Qb var:Qc) :netb (var:D1 var:D2).
(var:Qa var:Qb) :neta var:D3.
(var:D1 var:C var:Qa) :dff var:Za.
(var:D2 var:C var:Qb) :dff var:Zb.
(var:D3 var:C var:Qc) :dff var:Zc.
}
_:bng_9 log:isImpliedBy true.
_:bng_9 {
(() var:S) :testgcc ().
}
_:bng_10 log:isImpliedBy _:bng_11.
_:bng_10 {
(var:Cc var:S) :testgcc var:Nc.
}
_:bng_11 {
var:Cc list:firstRest (var:C var:Cs).
var:Nc list:firstRest (var:N var:Ns).
(var:C var:S) :gcc var:N.
(var:Cs var:N) :testgcc var:Ns.
}
# query
_:bng_12 log:query _:bng_12.
_:bng_12 {
((1 1 1 1 1 1 1 1 1) (0 0 0)) :testgcc var:Q.
}