catlogic 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +7 -0
- data/bin2/.idea/.name +1 -0
- data/bin2/.idea/bin.iml +9 -0
- data/bin2/.idea/encodings.xml +5 -0
- data/bin2/.idea/misc.xml +5 -0
- data/bin2/.idea/modules.xml +9 -0
- data/bin2/.idea/scopes/scope_settings.xml +5 -0
- data/bin2/.idea/vcs.xml +7 -0
- data/bin2/.idea/workspace.xml +129 -0
- data/bin2/displayInferredTruths.rb +43 -0
- data/bin2/getAllValidPropositions.rb +24 -0
- data/bin2/testCombineSets.rb +27 -0
- data/bin2/testIfUnique.rb +14 -0
- data/bin2/testPremisePair.rb +10 -0
- data/bin2/testProposition.rb +47 -0
- data/bin2/testPropositionType.rb +40 -0
- data/bin2/testQuantity.rb +12 -0
- data/bin2/testReduceToUniqueSet.rb +18 -0
- data/bin2/testSyllogism.rb +45 -0
- data/bin2/testSyllogismForm.rb +51 -0
- data/catlogic.gemspec +25 -0
- data/lib/catlogic/distribution.rb +16 -0
- data/lib/catlogic/figure.rb +45 -0
- data/lib/catlogic/form.rb +22 -0
- data/lib/catlogic/mood.rb +14 -0
- data/lib/catlogic/premise_collection.rb +211 -0
- data/lib/catlogic/premise_pair.rb +61 -0
- data/lib/catlogic/proposition.rb +181 -0
- data/lib/catlogic/proposition_type.rb +47 -0
- data/lib/catlogic/quality.rb +16 -0
- data/lib/catlogic/quantity.rb +16 -0
- data/lib/catlogic/syllogism.rb +171 -0
- data/lib/catlogic/term.rb +32 -0
- data/lib/catlogic/version.rb +3 -0
- data/lib/catlogic.rb +17 -0
- data/spec/distribution_spec.rb +26 -0
- data/spec/figure_spec.rb +27 -0
- data/spec/form_spec.rb +22 -0
- data/spec/mood_spec.rb +17 -0
- data/spec/premise_pair_spec.rb +51 -0
- data/spec/proposition_spec.rb +215 -0
- data/spec/proposition_type_spec.rb +37 -0
- data/spec/quality_spec.rb +17 -0
- data/spec/quantity_spec.rb +19 -0
- data/spec/spec_helper.rb +89 -0
- data/spec/syllogism_spec.rb +121 -0
- data/spec/term_spec.rb +35 -0
- metadata +166 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57afcbee35246b90edd31886a66d0d2cf921886b
|
4
|
+
data.tar.gz: d800074866220096293953f434c5b102a07f0bcd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7205ea09f5d5337b984364a89df4321bbbe00589ab7086812156491461d7ec46fa07c16152476de084f724e807dba2ab185d7b82975c7dfccec5d7324ef44c08
|
7
|
+
data.tar.gz: bb1b1ef80850971219ec479b711649161d078208b9f7e19bc5fa75fb3a12a9950d298ea44dbed723d9519af0ff61e86416048504c16ee92fd8af799fcd6eb54e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
catlogic
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2.0
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Jeffrey C. Witt
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Catlogic
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
gem install catlogic
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
require 'catlogic'
|
10
|
+
|
11
|
+
# create a categorical proposition
|
12
|
+
proposition = Proposition.new(Quantity.new("Universal"), Term.new("Dogs), Quality.new("Affirmative"), Term.new("Mortal"), true)
|
13
|
+
|
14
|
+
# get the type of the proposition
|
15
|
+
proposition.type
|
16
|
+
|
17
|
+
#get a human readable form of the proposition
|
18
|
+
propostion.label
|
19
|
+
|
20
|
+
#make immediate inferences
|
21
|
+
#obverse
|
22
|
+
proposition.obverse
|
23
|
+
|
24
|
+
# Build a proposition from its type
|
25
|
+
proposition = PropositionType.new("I").proposition
|
26
|
+
|
27
|
+
# Build a syllogism
|
28
|
+
syllogism = Syllogism.new(majorproposition, minorproposition, conclusion)
|
29
|
+
|
30
|
+
# Test the validity of a syllogism
|
31
|
+
syllogism.validity
|
32
|
+
|
33
|
+
# Get form of syllogism
|
34
|
+
syllogism.form
|
35
|
+
|
36
|
+
|
data/Rakefile
ADDED
data/bin2/.idea/.name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bin
|
data/bin2/.idea/bin.iml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager">
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
5
|
+
<orderEntry type="inheritedJdk" />
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
7
|
+
</component>
|
8
|
+
</module>
|
9
|
+
|
data/bin2/.idea/misc.xml
ADDED
data/bin2/.idea/vcs.xml
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="d767b6e2-95a4-49ff-be35-d0ed463e2819" name="Default" comment="" />
|
5
|
+
<ignored path="bin.iws" />
|
6
|
+
<ignored path=".idea/workspace.xml" />
|
7
|
+
<option name="TRACKING_ENABLED" value="true" />
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
12
|
+
</component>
|
13
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
14
|
+
<component name="CreatePatchCommitExecutor">
|
15
|
+
<option name="PATCH_PATH" value="" />
|
16
|
+
</component>
|
17
|
+
<component name="DaemonCodeAnalyzer">
|
18
|
+
<disable_hints />
|
19
|
+
</component>
|
20
|
+
<component name="FavoritesManager">
|
21
|
+
<favorites_list name="bin" />
|
22
|
+
</component>
|
23
|
+
<component name="ProjectFrameBounds">
|
24
|
+
<option name="y" value="22" />
|
25
|
+
<option name="width" value="1280" />
|
26
|
+
<option name="height" value="723" />
|
27
|
+
</component>
|
28
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
29
|
+
<OptionsSetting value="true" id="Add" />
|
30
|
+
<OptionsSetting value="true" id="Remove" />
|
31
|
+
<OptionsSetting value="true" id="Checkout" />
|
32
|
+
<OptionsSetting value="true" id="Update" />
|
33
|
+
<OptionsSetting value="true" id="Status" />
|
34
|
+
<OptionsSetting value="true" id="Edit" />
|
35
|
+
<ConfirmationsSetting value="0" id="Add" />
|
36
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
37
|
+
</component>
|
38
|
+
<component name="ProjectReloadState">
|
39
|
+
<option name="STATE" value="0" />
|
40
|
+
</component>
|
41
|
+
<component name="ProjectView">
|
42
|
+
<navigator currentView="ProjectPane" proportions="" version="1">
|
43
|
+
<flattenPackages />
|
44
|
+
<showMembers />
|
45
|
+
<showModules />
|
46
|
+
<showLibraryContents />
|
47
|
+
<hideEmptyPackages />
|
48
|
+
<abbreviatePackageNames />
|
49
|
+
<autoscrollToSource />
|
50
|
+
<autoscrollFromSource />
|
51
|
+
<sortByType />
|
52
|
+
</navigator>
|
53
|
+
<panes>
|
54
|
+
<pane id="Scope" />
|
55
|
+
<pane id="ProjectPane">
|
56
|
+
<subPane>
|
57
|
+
<PATH>
|
58
|
+
<PATH_ELEMENT>
|
59
|
+
<option name="myItemId" value="bin" />
|
60
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
61
|
+
</PATH_ELEMENT>
|
62
|
+
</PATH>
|
63
|
+
</subPane>
|
64
|
+
</pane>
|
65
|
+
</panes>
|
66
|
+
</component>
|
67
|
+
<component name="PropertiesComponent">
|
68
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
69
|
+
</component>
|
70
|
+
<component name="RunManager">
|
71
|
+
<list size="0" />
|
72
|
+
</component>
|
73
|
+
<component name="ShelveChangesManager" show_recycled="false" />
|
74
|
+
<component name="SvnConfiguration">
|
75
|
+
<configuration />
|
76
|
+
</component>
|
77
|
+
<component name="TaskManager">
|
78
|
+
<task active="true" id="Default" summary="Default task">
|
79
|
+
<changelist id="d767b6e2-95a4-49ff-be35-d0ed463e2819" name="Default" comment="" />
|
80
|
+
<created>1411577433444</created>
|
81
|
+
<updated>1411577433444</updated>
|
82
|
+
</task>
|
83
|
+
<servers />
|
84
|
+
</component>
|
85
|
+
<component name="ToolWindowManager">
|
86
|
+
<frame x="0" y="22" width="1280" height="723" extended-state="6" />
|
87
|
+
<editor active="true" />
|
88
|
+
<layout>
|
89
|
+
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
90
|
+
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
91
|
+
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
92
|
+
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
93
|
+
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
94
|
+
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24959612" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
95
|
+
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
96
|
+
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
97
|
+
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
98
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
99
|
+
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
100
|
+
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
101
|
+
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
102
|
+
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
103
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
104
|
+
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
105
|
+
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
106
|
+
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
107
|
+
</layout>
|
108
|
+
</component>
|
109
|
+
<component name="Vcs.Log.UiProperties">
|
110
|
+
<option name="RECENTLY_FILTERED_USER_GROUPS">
|
111
|
+
<collection />
|
112
|
+
</option>
|
113
|
+
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
|
114
|
+
<collection />
|
115
|
+
</option>
|
116
|
+
</component>
|
117
|
+
<component name="VcsContentAnnotationSettings">
|
118
|
+
<option name="myLimit" value="2678400000" />
|
119
|
+
</component>
|
120
|
+
<component name="VcsManagerConfiguration">
|
121
|
+
<option name="myTodoPanelSettings">
|
122
|
+
<TodoPanelSettings />
|
123
|
+
</option>
|
124
|
+
</component>
|
125
|
+
<component name="XDebuggerManager">
|
126
|
+
<breakpoint-manager />
|
127
|
+
</component>
|
128
|
+
</project>
|
129
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlog.rb"
|
4
|
+
|
5
|
+
premises2 = [Proposition.new("universal", "Mammals", "affirmative", "Mortal Things", true),
|
6
|
+
Proposition.new("universal", "People", "affirmative", "Mammals", true)]
|
7
|
+
|
8
|
+
premises3 = [Proposition.new("universal", "Mammals", "affirmative", "Mortal Things", true),
|
9
|
+
Proposition.new("universal", "People", "affirmative", "Mammals", true),
|
10
|
+
Proposition.new("universal", "Ants", "negative", "Mammals", true)]
|
11
|
+
|
12
|
+
|
13
|
+
premises4 = [Proposition.new("universal", "planes", "affirmative", "things with wings", true),
|
14
|
+
Proposition.new("particular", "planes", "affirmative", "things with propellors", true),
|
15
|
+
Proposition.new("universal", "pilots", "affirmative", "things that fly planes", true),
|
16
|
+
Proposition.new("universal", "things that fly planes", "affirmative", "tall things", true)]
|
17
|
+
|
18
|
+
premises5 = [Proposition.new("universal", "dogs", "affirmative", "animals", true),
|
19
|
+
Proposition.new("universal", "cats", "affirmative", "animals", true),
|
20
|
+
Proposition.new("universal", "animals", "affirmative", "mortals", true),
|
21
|
+
Proposition.new("universal", "mortals", "affirmative", "things that disintegrate", true),
|
22
|
+
Proposition.new("particular", "dogs", "affirmative", "brown", true)]
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
collection = PremiseCollection.new(premises4)
|
31
|
+
|
32
|
+
|
33
|
+
puts "==============="
|
34
|
+
puts "intial set"
|
35
|
+
puts premises4.count
|
36
|
+
puts
|
37
|
+
premises4.each do |proposition|
|
38
|
+
proposition.displayProposition
|
39
|
+
end
|
40
|
+
puts "==============="
|
41
|
+
|
42
|
+
collection.displayLoopedInferredTruths
|
43
|
+
#puts "#{collection.getNumberOfInferredTruths} / #{collection.getNumberOfInputTruths}: #{collection.getRatioInputToInferred}/1"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlog.rb"
|
4
|
+
|
5
|
+
typeArray = ["A", "E", "I", "O"]
|
6
|
+
numberArray = [1,2,3,4]
|
7
|
+
i=0
|
8
|
+
c=0
|
9
|
+
numberArray.each do |i|
|
10
|
+
puts "\n"
|
11
|
+
typeArray.each do |type|
|
12
|
+
|
13
|
+
typeArray.each do |secondtype|
|
14
|
+
typeArray.each do |thirdtype|
|
15
|
+
mood = Mood.new(PropositionType.new(type), PropositionType.new(secondtype), PropositionType.new(thirdtype))
|
16
|
+
form = Form.new(mood, Figure.new(i))
|
17
|
+
|
18
|
+
if form.validity == true
|
19
|
+
puts form.label
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlog.rb"
|
4
|
+
|
5
|
+
premises1 = [Proposition.new("universal", "dogs", "affirmative", "animals", true),
|
6
|
+
Proposition.new("universal", "cats", "affirmative", "animals", true),
|
7
|
+
Proposition.new("universal", "animals", "affirmative", "mortals", true),
|
8
|
+
Proposition.new("universal", "mortals", "affirmative", "things that disintegrate", true),
|
9
|
+
Proposition.new("particular", "dogs", "affirmative", "brown", true),
|
10
|
+
Proposition.new("particular", "cats", "negative", "mean things", true),
|
11
|
+
Proposition.new("particular", "cats", "negative", "mean things", true),
|
12
|
+
Proposition.new("universal", "animals", "negative", "divine things", true),
|
13
|
+
Proposition.new("particular", "animals", "affirmative", "carnivores", true)]
|
14
|
+
|
15
|
+
|
16
|
+
premises2 = [Proposition.new("universal", "Events", "affirmative", "Caused Happenings", true),
|
17
|
+
Proposition.new("universal", "Free Decisions", "negative", "Caused Happenings", true),
|
18
|
+
Proposition.new("universal", "Caused Happenings", "affirmative", "Physical", true)]
|
19
|
+
|
20
|
+
collection = PremiseCollection.new(premises1)
|
21
|
+
|
22
|
+
newcollection = collection.combineSets(premises2)
|
23
|
+
|
24
|
+
|
25
|
+
newcollection.each do |proposition|
|
26
|
+
proposition.displayProposition
|
27
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlogic.rb"
|
4
|
+
|
5
|
+
premisesArray = [Proposition.new(Quantity.new("universal"), Term.new("Events"), Quality.new("affirmative"), Term.new("Caused Happenings"), true),
|
6
|
+
Proposition.new(Quantity.new("universal"), Term.new("Free Decisions"), Quality.new("negative"), Term.new("Caused Happenings"), true),
|
7
|
+
Proposition.new(Quantity.new("universal"), Term.new("Fun"), Quality.new("affirmative"), Term.new("Events"), true)]
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
proposition = Proposition.new(Quantity.new("universal"), Term.new("Free Decisions"), Quality.new("negative"), Term.new("Caused Happenings"), true)
|
13
|
+
|
14
|
+
puts proposition.number_of_occurences(premisesArray)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlog.rb"
|
4
|
+
|
5
|
+
premise1 = Proposition.new("universal", "Mammals", "affirmative", "Dogs", true)
|
6
|
+
premise2 = Proposition.new("universal", "Mammals", "affirmative", "Mortal Things", true)
|
7
|
+
|
8
|
+
|
9
|
+
pair = PremisePair.new(premise1, premise2)
|
10
|
+
puts pair.isThreeTermPair?;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#require_relative "../lib/catlogic"
|
4
|
+
begin
|
5
|
+
require 'catlogic'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'catlogic'
|
9
|
+
end
|
10
|
+
|
11
|
+
proposition = Proposition.new(Quantity.new("particular"), Term.new("Free Decisions"), Quality.new("negative"), Term.new("Caused Happenings"), false)
|
12
|
+
|
13
|
+
#converse = proposition.getContrapolated
|
14
|
+
#converse.displayProposition
|
15
|
+
#puts converse.getTruthValue
|
16
|
+
|
17
|
+
puts "======Proposition========="
|
18
|
+
puts proposition.label
|
19
|
+
puts "======Proposition Type========="
|
20
|
+
puts "type: #{proposition.type.label}"
|
21
|
+
puts "======Assumed Truth Value========="
|
22
|
+
puts "assumed: #{proposition.truthvalue}"
|
23
|
+
puts "=====Immediate Inferences========="
|
24
|
+
contradictory = proposition.contradictory
|
25
|
+
if proposition.quantity.label == "universal"
|
26
|
+
contrary_subcontrary = proposition.contrary
|
27
|
+
elsif proposition.quantity.label == "particular"
|
28
|
+
contrary_subcontrary = proposition.subcontrary
|
29
|
+
end
|
30
|
+
subaltern = proposition.subaltern
|
31
|
+
converse = proposition.converse
|
32
|
+
obverse = proposition.obverse
|
33
|
+
contrapolated = proposition.contrapolated
|
34
|
+
|
35
|
+
puts "====contradictory: #{contradictory.type.label}: #{contradictory.truthvalue}==="
|
36
|
+
puts contradictory.label
|
37
|
+
puts "====contrary/subcontrary: #{contrary_subcontrary.type.label}: #{contrary_subcontrary.truthvalue}===="
|
38
|
+
puts contrary_subcontrary.label
|
39
|
+
puts "====subaltern: #{subaltern.type.label}: #{subaltern.truthvalue}===="
|
40
|
+
puts subaltern.label
|
41
|
+
puts "====converse: #{converse.type.label}: #{converse.truthvalue}===="
|
42
|
+
puts converse.label
|
43
|
+
puts "====obverse: #{obverse.type.label}: #{obverse.truthvalue}===="
|
44
|
+
puts obverse.label
|
45
|
+
puts "====contrapolated = #{contrapolated.type.label}: #{contrapolated.truthvalue}===="
|
46
|
+
puts contrapolated.label
|
47
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlogic"
|
4
|
+
|
5
|
+
type = PropositionType.new("O", true)
|
6
|
+
proposition = type.proposition
|
7
|
+
|
8
|
+
## this is repeated from testProposition.rb
|
9
|
+
|
10
|
+
puts "======Proposition========="
|
11
|
+
puts proposition.label
|
12
|
+
puts "======Proposition Type========="
|
13
|
+
puts "type: #{proposition.type.label}"
|
14
|
+
puts "======Assumed Truth Value========="
|
15
|
+
puts "assumed: #{proposition.truthvalue}"
|
16
|
+
|
17
|
+
puts "=====Immediate Inferences========="
|
18
|
+
contradictory = proposition.contradictory
|
19
|
+
if proposition.quantity.label == "universal"
|
20
|
+
contrary_subcontrary = proposition.contrary
|
21
|
+
elsif proposition.quantity.label == "particular"
|
22
|
+
contrary_subcontrary = proposition.subcontrary
|
23
|
+
end
|
24
|
+
subaltern = proposition.subaltern
|
25
|
+
converse = proposition.converse
|
26
|
+
obverse = proposition.obverse
|
27
|
+
contrapolated = proposition.contrapolated
|
28
|
+
|
29
|
+
puts "====contradictory: #{contradictory.type.label}: #{contradictory.truthvalue}==="
|
30
|
+
puts contradictory.label
|
31
|
+
puts "====contrary/subcontrary: #{contrary_subcontrary.type.label}: #{contrary_subcontrary.truthvalue}===="
|
32
|
+
puts contrary_subcontrary.label
|
33
|
+
puts "====subaltern: #{subaltern.type.label}: #{subaltern.truthvalue}===="
|
34
|
+
puts subaltern.label
|
35
|
+
puts "====converse: #{converse.type.label}: #{converse.truthvalue}===="
|
36
|
+
puts converse.label
|
37
|
+
puts "====obverse: #{obverse.type.label}: #{obverse.truthvalue}===="
|
38
|
+
puts obverse.label
|
39
|
+
puts "====contrapolated = #{contrapolated.type.label}: #{contrapolated.truthvalue}===="
|
40
|
+
puts contrapolated.label
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlog.rb"
|
4
|
+
|
5
|
+
premisesArray = [Proposition.new("universal", "Events", "affirmative", "Caused Happenings", true),
|
6
|
+
Proposition.new("universal", "Free Decisions", "negative", "Caused Happenings", true),
|
7
|
+
Proposition.new("universal", "Fun", "affirmative", "Events", true),
|
8
|
+
Proposition.new("universal", "Fun", "affirmative", "Events", true),
|
9
|
+
Proposition.new("universal", "Fun", "affirmative", "Events", true)]
|
10
|
+
|
11
|
+
|
12
|
+
collection = PremiseCollection.new(premisesArray)
|
13
|
+
|
14
|
+
reducedcollection = collection.reduceToUniqueSet
|
15
|
+
|
16
|
+
reducedcollection.each do |proposition|
|
17
|
+
proposition.displayProposition
|
18
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlogic"
|
4
|
+
|
5
|
+
major = Proposition.new(Quantity.new("universal"), Term.new("pollution free"), Quality.new("negative"), Term.new("completely efficient"), true)
|
6
|
+
minor = Proposition.new(Quantity.new("universal"), Term.new("automobile"), Quality.new("negative"), Term.new("completely efficient"), true)
|
7
|
+
conclusion = Proposition.new(Quantity.new("universal"), Term.new("automobile"), Quality.new("negative"), Term.new("pollution free"), true)
|
8
|
+
syllogism = Syllogism.new(major, minor, conclusion)
|
9
|
+
|
10
|
+
puts "=========="
|
11
|
+
puts "Testing syllogism (#{syllogism.form.label}):"
|
12
|
+
puts "====Syllogism======"
|
13
|
+
puts syllogism.label
|
14
|
+
puts "====Propositional Form===="
|
15
|
+
puts Form.new(syllogism.mood, syllogism.figure).syllogism.label
|
16
|
+
puts "=====Validity===="
|
17
|
+
puts "Validity: #{syllogism.validity}"
|
18
|
+
puts "=========="
|
19
|
+
|
20
|
+
if (!syllogism.validity)
|
21
|
+
if (!syllogism.undistributed_middle_test)
|
22
|
+
puts "undistributed_middle_test failed"
|
23
|
+
puts "=========="
|
24
|
+
end
|
25
|
+
if (!syllogism.illicit_major_test)
|
26
|
+
puts "illicit_major_test failed"
|
27
|
+
puts "=========="
|
28
|
+
end
|
29
|
+
if (!syllogism.illicit_minor_test)
|
30
|
+
puts "illicit_minor_test failed"
|
31
|
+
puts "=========="
|
32
|
+
end
|
33
|
+
if (!syllogism.exclusive_premises_test)
|
34
|
+
puts "exclusive_premises_test failed"
|
35
|
+
puts "=========="
|
36
|
+
end
|
37
|
+
if (!syllogism.affirm_from_neg_test)
|
38
|
+
puts "affirm_from_neg_test failed"
|
39
|
+
puts "=========="
|
40
|
+
end
|
41
|
+
if (!syllogism.neg_from_affirms_test)
|
42
|
+
puts "neg_from_affirms_test"
|
43
|
+
puts "=========="
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "../lib/catlogic"
|
4
|
+
|
5
|
+
mood = Mood.new(PropositionType.new("A"), PropositionType.new("A"), PropositionType.new("A"))
|
6
|
+
figure = Figure.new(3)
|
7
|
+
form = Form.new(mood, figure)
|
8
|
+
puts "====================="
|
9
|
+
puts "Testing: #{form.label}"
|
10
|
+
|
11
|
+
syllogism = form.syllogism
|
12
|
+
|
13
|
+
puts "=====Propositional form====="
|
14
|
+
puts form.syllogism.label
|
15
|
+
|
16
|
+
### This is redundant in testSyllogism ##
|
17
|
+
puts "=====Validity===="
|
18
|
+
puts "Validity: #{syllogism.validity}"
|
19
|
+
|
20
|
+
|
21
|
+
if (!syllogism.validity)
|
22
|
+
if (!syllogism.undistributed_middle_test)
|
23
|
+
puts "undistributed_middle_test failed"
|
24
|
+
puts "=========="
|
25
|
+
end
|
26
|
+
if (!syllogism.illicit_major_test)
|
27
|
+
puts "illicit_major_test failed"
|
28
|
+
puts "=========="
|
29
|
+
end
|
30
|
+
if (!syllogism.illicit_minor_test)
|
31
|
+
puts "illicit_minor_test failed"
|
32
|
+
puts "=========="
|
33
|
+
end
|
34
|
+
if (!syllogism.exclusive_premises_test)
|
35
|
+
puts "exclusive_premises_test failed"
|
36
|
+
puts "=========="
|
37
|
+
end
|
38
|
+
if (!syllogism.affirm_from_neg_test)
|
39
|
+
puts "affirm_from_neg_test failed"
|
40
|
+
puts "=========="
|
41
|
+
end
|
42
|
+
if (!syllogism.neg_from_affirms_test)
|
43
|
+
puts "neg_from_affirms_test"
|
44
|
+
puts "=========="
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|