hilbert 0.0.2700110 → 0.0.2700210

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
  SHA1:
3
- metadata.gz: 8b6c55b9859234a6710c7d633a13a06112ab0a4f
4
- data.tar.gz: 2c336de0d9940bb01e151f8fe235d107248540b9
3
+ metadata.gz: b5504e360e4fc6ff8787b6afb21fb32b73e1bf53
4
+ data.tar.gz: 3500645d88a619fc8e78962a003374deab4813bd
5
5
  SHA512:
6
- metadata.gz: 4b567ae6c9b84b1ff938035dccf82fa3fae2473264c030ba5691deef2ab004c8c85991f33159da43d0cd6e5301bb89afe43e344262ddc3bfa3b5167a561bda8d
7
- data.tar.gz: 7eb3fda6ec81613dbdd59dafe0b558ad8deef8fcac1b00dbe3a828e81d3f7ceb574aaba62a5749bc877dabe09a30294529446e79c62b52c5ac2d8d137fbaa56e
6
+ metadata.gz: 8ed780a081d43467792c2386114e150f381a45bcc252b1498598530af5522446b3a6e47897af1921de19873c026f2cf6e048f39035b41d9fb6a887498693925c
7
+ data.tar.gz: 74f09536225b22137482d27d8b3de55326e06b81a27e9f24274cdb8dc12a516ca35b39e0fb2e23af2ccecd6d799234a53bd7cf6c415a222fd60abe1f9db17485
@@ -1,3 +1,3 @@
1
1
  module Hilbert
2
- VERSION = '0.0.2700110'
2
+ VERSION = '0.0.2700210'
3
3
  end
data/lib/hilbert/world.rb CHANGED
@@ -12,16 +12,25 @@ module Hilbert
12
12
  end
13
13
 
14
14
  def impl(logic_str)
15
- # HOTFIX:
15
+ # HOTFIX: we need to ..
16
16
  return eval_rslt(logic_str, 'UNDEFINED') if @@propositions.empty?
17
- str = (!!!!!!!(@@propositions.inject(:*) >= to_rb_obj(logic_str))).to_s
17
+ logic = (@@propositions.inject(:*) >= to_rb_obj(logic_str))
18
+ str = (!!!!!!!logic).to_s
18
19
  case str
19
20
  when 'TRUE'
20
21
  eval_rslt(logic_str, 'TRUE')
21
22
  when 'FALSE'
22
23
  eval_rslt(logic_str, 'FALSE')
23
24
  else
24
- eval_rslt(logic_str, 'UNDEFINED')
25
+ str = (!!!!!!!(@@propositions.inject(:*) * logic)).to_s
26
+ case str
27
+ when 'TRUE'
28
+ eval_rslt(logic_str, 'TRUE')
29
+ when 'FALSE'
30
+ eval_rslt(logic_str, 'FALSE')
31
+ else
32
+ eval_rslt(logic_str, 'UNDEFINED')
33
+ end
25
34
  end
26
35
  end
27
36
 
@@ -10,7 +10,7 @@ class TestPropositionalLogic < TestInterpreterBase
10
10
  assert_equal(output, Hilbert::Iq.execute(input))
11
11
  end
12
12
 
13
- def test_general
13
+ def test_ex1
14
14
  assert_iq_equal('Defined: A is TRUE', 'A')
15
15
  assert_iq_equal('Evaluate: A is TRUE', 'A?')
16
16
  assert_iq_equal('Evaluate: B is UNDEFINED', 'B?')
@@ -18,6 +18,12 @@ class TestPropositionalLogic < TestInterpreterBase
18
18
  assert_iq_equal('Evaluate: B is TRUE', 'B?')
19
19
  end
20
20
 
21
+ def test_ex2
22
+ assert_iq_equal('Evaluate: A is UNDEFINED', 'A?')
23
+ assert_iq_equal('Defined: ~A is TRUE', '~A')
24
+ assert_iq_equal('Evaluate: A is FALSE', 'A?')
25
+ end
26
+
21
27
  def test_syllogisms
22
28
  assert_iq_equal('Evaluate: A is UNDEFINED', 'A?')
23
29
  assert_iq_equal('Evaluate: A -> C is UNDEFINED', 'A -> C ?')
@@ -51,6 +51,7 @@ class TestPropLogic < MiniTest::Unit::TestCase
51
51
  assert_to_s("((Q|P)&(R|P))", $p + ($q * $r))
52
52
  assert_to_s("(P&Q&R)", $p * ($q * $r))
53
53
  assert_to_s("(P&(~P|Q))", $p * ($p >= $q))
54
+ assert_to_s("P", (~$p >= $p))
54
55
  end
55
56
 
56
57
  def test_tautology
@@ -59,9 +60,11 @@ class TestPropLogic < MiniTest::Unit::TestCase
59
60
  assert_to_s("TRUE", (($p >= $q) * ($q >= $r)) >= ($p >= $r))
60
61
  assert_to_s("TRUE", (~$p * ($p + $q)) >= ($q))
61
62
  assert_to_s("TRUE", (($p >= $q) * ($q >= $r) * $p) >= ($r))
63
+ assert_to_s("TRUE", ($p * ~$p) >= $r)
62
64
  end
63
65
 
64
66
  def test_no_tautology
65
67
  assert_to_s("FALSE", $p * $q * ~$p)
68
+ assert_to_s("FALSE", ~$p * (~$p >= $p))
66
69
  end
67
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hilbert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2700110
4
+ version: 0.0.2700210
5
5
  platform: ruby
6
6
  authors:
7
7
  - gogotanaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-17 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dydx