logic_tools 0.3.4 → 0.3.5
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.
- checksums.yaml +4 -4
- data/exe/complement +12 -0
- data/lib/logic_tools/logicsimplify_es.rb +7 -2
- data/lib/logic_tools/logicsimplify_qm.rb +34 -32
- data/lib/logic_tools/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d95a4f55c418f319f6757dcd33238a96e29942
|
4
|
+
data.tar.gz: 41b8969baf1766988bfbd87d49ac42bda2c70b95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26fe17b9471050c15cc5df53bc49cc87a4e280954853871845706d84317e2c3b76c79d83efe94257a3536048b6cfb09c1e68414d3cd0e1e1f3f160a26866ca00
|
7
|
+
data.tar.gz: 07e758d9512566bd492b8644fd074769be0e2db6ee7b18d8df1f713c21aadf8dbdec2beeeb842e8a6512a5b1adc513efcb9d7d319f72f16581081160d256d8a4
|
data/exe/complement
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
######################################################################
|
3
|
+
# Computes (quickly) the complement of a logic expression #
|
4
|
+
######################################################################
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'logic_tools'
|
9
|
+
rescue LoadError
|
10
|
+
end
|
11
|
+
|
12
|
+
load "logic_tools/complement.rb"
|
@@ -9,9 +9,10 @@ require "logic_tools/traces.rb"
|
|
9
9
|
module LogicTools
|
10
10
|
|
11
11
|
|
12
|
-
|
12
|
+
#--
|
13
13
|
# Enhances the Cube class with methods for applying the
|
14
|
-
# Espresso algorithm
|
14
|
+
# Espresso algorithm.
|
15
|
+
#++
|
15
16
|
class Cube
|
16
17
|
|
17
18
|
## Computes the blocking matrix relatively to an +off+ cover.
|
@@ -530,8 +531,10 @@ module LogicTools
|
|
530
531
|
end
|
531
532
|
|
532
533
|
|
534
|
+
#--
|
533
535
|
# Enhances the Cover class with simplifying using the Espresso
|
534
536
|
# algorithm.
|
537
|
+
#++
|
535
538
|
class Cover
|
536
539
|
|
537
540
|
include LogicTools::Traces
|
@@ -713,8 +716,10 @@ module LogicTools
|
|
713
716
|
end
|
714
717
|
|
715
718
|
|
719
|
+
#--
|
716
720
|
# Enhances the Node class with expression simplifying using the
|
717
721
|
# Espresso algorithm.
|
722
|
+
#++
|
718
723
|
class Node
|
719
724
|
|
720
725
|
## Generates an equivalent but simplified representation of the
|
@@ -13,7 +13,7 @@ module LogicTools
|
|
13
13
|
|
14
14
|
|
15
15
|
## Converts the array of variables +var+ to a bit vector according to
|
16
|
-
# their values
|
16
|
+
# their values.
|
17
17
|
def vars2int(vars)
|
18
18
|
res = ""
|
19
19
|
vars.each_with_index do |var,i|
|
@@ -27,7 +27,7 @@ module LogicTools
|
|
27
27
|
|
28
28
|
|
29
29
|
##
|
30
|
-
# Represents a logic implicant
|
30
|
+
# Represents a logic implicant.
|
31
31
|
class Implicant
|
32
32
|
include Enumerable
|
33
33
|
|
@@ -76,7 +76,7 @@ module LogicTools
|
|
76
76
|
@bits
|
77
77
|
end
|
78
78
|
|
79
|
-
def inspect
|
79
|
+
def inspect # :nodoc:
|
80
80
|
@bits.dup
|
81
81
|
end
|
82
82
|
|
@@ -217,35 +217,37 @@ module LogicTools
|
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
|
-
##
|
221
|
-
# Describes a pseudo variable associated to an implicant.
|
222
|
-
#
|
223
|
-
# Used for the Petrick's method.
|
224
|
-
class VarImp < Variable
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
end
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
220
|
+
# ##
|
221
|
+
# # Describes a pseudo variable associated to an implicant.
|
222
|
+
# #
|
223
|
+
# # Used for the Petrick's method.
|
224
|
+
# class VarImp < Variable
|
225
|
+
# @@base = 0 # The index of the VarImp for building the variable names
|
226
|
+
|
227
|
+
# ## The implicant the pseudo variable is associated to.
|
228
|
+
# attr_reader :implicant
|
229
|
+
|
230
|
+
# ## Creates a pseudo variable assoctiated to an +implicant+.
|
231
|
+
# def initialize(implicant)
|
232
|
+
# # Create the name of the variable
|
233
|
+
# name = nil
|
234
|
+
# begin
|
235
|
+
# name = "P" + @@base.to_s
|
236
|
+
# @@base += 1
|
237
|
+
# end while Variable.exists?(name)
|
238
|
+
# # Create the variable
|
239
|
+
# super(name)
|
240
|
+
# # Associate it with the implicant
|
241
|
+
# @implicant = implicant
|
242
|
+
# implicant.var = self
|
243
|
+
# end
|
244
|
+
# end
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
#--
|
249
|
+
# Enhances the Node class with expression simplifying.
|
250
|
+
#++
|
249
251
|
class Node
|
250
252
|
|
251
253
|
## Generates an equivalent but simplified representation of the
|
data/lib/logic_tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logic_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ description: "LogicTools is a set of command-line tools for processing logic exp
|
|
76
76
|
email:
|
77
77
|
- lovic@ariake-nct.ac.jp
|
78
78
|
executables:
|
79
|
+
- complement
|
79
80
|
- is_tautology
|
80
81
|
- simplify_es
|
81
82
|
- simplify_qm
|
@@ -93,6 +94,7 @@ files:
|
|
93
94
|
- Rakefile
|
94
95
|
- bin/console
|
95
96
|
- bin/setup
|
97
|
+
- exe/complement
|
96
98
|
- exe/is_tautology
|
97
99
|
- exe/simplify_es
|
98
100
|
- exe/simplify_qm
|