syllogism 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6611c1ac7aedc538dbf5d55944bff8e98c780fe2951e23f1b4f6c1d09a25de3
4
- data.tar.gz: 37d5b0b6458e970dff65057733e06783f1e40bac8135d09a69e74f37c7259b76
3
+ metadata.gz: 26dd7a01178ea39e1474914a56f16b4f903b302acda0f78d662000c137b85a00
4
+ data.tar.gz: 6a657acaef3ec4485eedd43ca25f3d649e6657eb0f80233b86c1649f405b36bd
5
5
  SHA512:
6
- metadata.gz: f6faccb91d838b5e9834ce178b2530ba02a5ba2dbd09319b61ae3225cd04e73d76fcb35c29f4948ab1bba43ce91582f97bd3722dfcfe31db7a29cebdf17b4028
7
- data.tar.gz: '09feaa85885909252e80cc2e6987056df2388d7fb5e4dae8399d2fb574c455c058f4e2174f7085eaed0803954cb5680940de00ca1329f5a3e2864d906940e36b'
6
+ metadata.gz: c1d328e06496620c3a660f69694a46f7071ffc75df431220a5775a77cb96f50d87f2436c7aeea0fd7ffd73a5efac454d93230c933dfe482135aba180ea129f50
7
+ data.tar.gz: 3f3a1de1da37f1e8f74f0495c865cac13fd858734ec6ec38067fa54c42f0493c1196779f5b37ab9550c25c80251a4c6f1d390903b8cc03d5bbd4d0566f387fce
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.0.2
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syllogism (0.2.0)
4
+ syllogism (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.4.4)
9
+ diff-lcs (1.5.0)
10
10
  rake (12.3.3)
11
- rspec (3.10.0)
12
- rspec-core (~> 3.10.0)
13
- rspec-expectations (~> 3.10.0)
14
- rspec-mocks (~> 3.10.0)
15
- rspec-core (3.10.1)
16
- rspec-support (~> 3.10.0)
17
- rspec-expectations (3.10.1)
11
+ rspec (3.12.0)
12
+ rspec-core (~> 3.12.0)
13
+ rspec-expectations (~> 3.12.0)
14
+ rspec-mocks (~> 3.12.0)
15
+ rspec-core (3.12.0)
16
+ rspec-support (~> 3.12.0)
17
+ rspec-expectations (3.12.0)
18
18
  diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.10.0)
20
- rspec-mocks (3.10.2)
19
+ rspec-support (~> 3.12.0)
20
+ rspec-mocks (3.12.0)
21
21
  diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.10.0)
23
- rspec-support (3.10.2)
22
+ rspec-support (~> 3.12.0)
23
+ rspec-support (3.12.0)
24
24
 
25
25
  PLATFORMS
26
26
  ruby
data/README.md CHANGED
@@ -42,6 +42,10 @@ argument = Syllogism["all A is B", "some C is A", "some C is B"]
42
42
  other_argument = Syllogism["all X is Y", "some Z is X", "some Z is Y"]
43
43
 
44
44
  argument == other_argument # => true
45
+
46
+ # Generate random argument
47
+ Syllogism.sample.statements.map(&:to_s)
48
+ => ["all M is C", "no L is M", "some L is C"]
45
49
  ```
46
50
 
47
51
  ## Development
@@ -6,6 +6,6 @@ class Syllogism
6
6
 
7
7
  private
8
8
 
9
- GENERAL_TERM_VALUES = ("A".."Z").freeze
9
+ GENERAL_TERM_VALUES = ("A".."Z")
10
10
  end
11
11
  end
@@ -6,6 +6,6 @@ class Syllogism
6
6
 
7
7
  private
8
8
 
9
- SINGULAR_TERM_VALUES = ("a".."z").freeze
9
+ SINGULAR_TERM_VALUES = ("a".."z")
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  class Syllogism
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/syllogism.rb CHANGED
@@ -25,15 +25,32 @@ class Syllogism
25
25
  new(raw_statements.map { |raw_statement| Statement.parse(raw_statement) })
26
26
  end
27
27
 
28
+ def self.random_statement(letter, other_letter)
29
+ case (1..4).to_a.sample
30
+ when 1 then "all #{letter} is #{other_letter}"
31
+ when 2 then "no #{letter} is #{other_letter}"
32
+ when 3 then "some #{letter} is #{other_letter}"
33
+ when 4 then "some #{letter} is #{other_letter}"
34
+ end
35
+ end
36
+
37
+ def self.sample
38
+ first, second, third = ("A".."Z").to_a.sample(3)
39
+ parse(
40
+ random_statement(first, second),
41
+ random_statement(third, first),
42
+ random_statement(third, second)
43
+ )
44
+ end
45
+
28
46
  def initialize(statements)
29
47
  @errors = []
30
48
  @statements = statements
31
49
  end
32
50
 
33
51
  def ==(other)
34
- premises.map(&:formula).sort == other.premises.map(&:formula) &&
35
- conclusion.formula == other.conclusion.formula &&
36
- valid? == valid?
52
+ premises.map(&:formula).sort == other.premises.map(&:formula).sort &&
53
+ conclusion.formula == other.conclusion.formula
37
54
  end
38
55
 
39
56
  def premises
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syllogism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayson Virissimo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2022-11-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Proof checker for arguments in Aristotle's term logic
14
14
  email:
@@ -20,6 +20,7 @@ files:
20
20
  - ".github/workflows/test.yml"
21
21
  - ".gitignore"
22
22
  - ".rspec"
23
+ - ".tool-versions"
23
24
  - Gemfile
24
25
  - Gemfile.lock
25
26
  - LICENSE.txt
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
68
  - !ruby/object:Gem::Version
68
69
  version: '0'
69
70
  requirements: []
70
- rubygems_version: 3.0.3
71
+ rubygems_version: 3.3.5
71
72
  signing_key:
72
73
  specification_version: 4
73
74
  summary: Proof checker for arguments in Aristotle's term logic