model-checker 0.2.2__tar.gz → 0.2.4__tar.gz

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.
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.1
2
+ Name: model-checker
3
+ Version: 0.2.4
4
+ Summary: A hyperintensional model checker for counterfactual conditionals
5
+ Author-email: Benjamin Brast-McKie <benbrastmckie@gmail.com>, Miguel Buitrago <mbuit82@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/benbrastmckie/ModelChecker
8
+ Project-URL: Issues, https://github.com/benbrastmckie/ModelChecker/issues
9
+ Keywords: semantics,Z3,counterfactuals,model checker
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENCE
15
+ Requires-Dist: z3-solver
16
+
17
+ # Model Checker
18
+
19
+ This project aims to develop tools for proving theorems and finding countermodels for counterfactual conditional and modal claims.
20
+
21
+ ## Installation
22
+
23
+ Install [Python 3](https://www.python.org/downloads/) and run the following commands in the terminal:
24
+
25
+ ```
26
+ pip install z3-solver
27
+ pip install model-checker
28
+ ```
29
+
30
+ ## Examples
31
+
32
+ To generate a test file run `model-checker`.
33
+ Alternatively, run `model-checker path/to/test_file.py` if `test_file.py` already exists.
34
+ The `examples.py` file contains a number of valid and invalid arguments that can be tested.
35
+
36
+ ## GitHub
37
+
38
+ More information can be found in the GitHub [repository](https://github.com/benbrastmckie/ModelChecker).
@@ -0,0 +1,22 @@
1
+ # Model Checker
2
+
3
+ This project aims to develop tools for proving theorems and finding countermodels for counterfactual conditional and modal claims.
4
+
5
+ ## Installation
6
+
7
+ Install [Python 3](https://www.python.org/downloads/) and run the following commands in the terminal:
8
+
9
+ ```
10
+ pip install z3-solver
11
+ pip install model-checker
12
+ ```
13
+
14
+ ## Examples
15
+
16
+ To generate a test file run `model-checker`.
17
+ Alternatively, run `model-checker path/to/test_file.py` if `test_file.py` already exists.
18
+ The `examples.py` file contains a number of valid and invalid arguments that can be tested.
19
+
20
+ ## GitHub
21
+
22
+ More information can be found in the GitHub [repository](https://github.com/benbrastmckie/ModelChecker).
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.1
2
+ Name: model-checker
3
+ Version: 0.2.4
4
+ Summary: A hyperintensional model checker for counterfactual conditionals
5
+ Author-email: Benjamin Brast-McKie <benbrastmckie@gmail.com>, Miguel Buitrago <mbuit82@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/benbrastmckie/ModelChecker
8
+ Project-URL: Issues, https://github.com/benbrastmckie/ModelChecker/issues
9
+ Keywords: semantics,Z3,counterfactuals,model checker
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENCE
15
+ Requires-Dist: z3-solver
16
+
17
+ # Model Checker
18
+
19
+ This project aims to develop tools for proving theorems and finding countermodels for counterfactual conditional and modal claims.
20
+
21
+ ## Installation
22
+
23
+ Install [Python 3](https://www.python.org/downloads/) and run the following commands in the terminal:
24
+
25
+ ```
26
+ pip install z3-solver
27
+ pip install model-checker
28
+ ```
29
+
30
+ ## Examples
31
+
32
+ To generate a test file run `model-checker`.
33
+ Alternatively, run `model-checker path/to/test_file.py` if `test_file.py` already exists.
34
+ The `examples.py` file contains a number of valid and invalid arguments that can be tested.
35
+
36
+ ## GitHub
37
+
38
+ More information can be found in the GitHub [repository](https://github.com/benbrastmckie/ModelChecker).
@@ -1,4 +1,5 @@
1
1
  LICENCE
2
+ README.md
2
3
  pyproject.toml
3
4
  model_checker.egg-info/PKG-INFO
4
5
  model_checker.egg-info/SOURCES.txt
@@ -11,6 +12,4 @@ package/model_definitions.py
11
12
  package/model_structure.py
12
13
  package/semantics.py
13
14
  package/syntax.py
14
- package/test.py
15
- package/test_complete.py
16
- package/top_test.py
15
+ package/test_complete.py
@@ -1,5 +1,9 @@
1
1
  """
2
- module for user inputs.
2
+ Example module for user inputs.
3
+ Premises are conjoined and conclusions are disjoined.
4
+ To save the output, change 'save_bool' to 'True' below.
5
+ The examples below can be turned on and off by (un)commenting the premises an conclusions.
6
+ The final pair of premises and conclusions to be defined will be run when the file is tested.
3
7
  """
4
8
  import os
5
9
  parent_directory = os.path.dirname(__file__)
@@ -8,7 +12,7 @@ parent_directory = os.path.dirname(__file__)
8
12
  ########## SETTINGS ############
9
13
  ################################
10
14
 
11
- # length of bitvectors
15
+ # number of atomic states included in the models
12
16
  N = 3
13
17
 
14
18
  # print all Z3 constraints if a model is found
@@ -18,33 +22,21 @@ print_cons_bool = False
18
22
  print_unsat_core_bool = True
19
23
 
20
24
  # present option to append output to file
21
- save_bool = True
25
+ save_bool = False
22
26
 
23
27
 
24
28
  ################################
25
- ########### WORKING ############
29
+ ######## COUNTER MODELS ########
26
30
  ################################
27
31
 
28
-
29
32
  ### INVALID ###
30
33
 
31
- # premises = []
32
- # conclusions = []
33
-
34
- # premises = ['A']
35
- # conclusions = []
36
-
37
- # premises = ['\\neg A','(A \\boxright (B \\vee C))']
38
- # conclusions = ['(A \\boxright B)','(A \\boxright C)']
34
+ premises = ['\\neg A','(A \\boxright (B \\vee C))']
35
+ conclusions = ['(A \\boxright B)','(A \\boxright C)']
39
36
 
40
- # # NOTE: if null verifiers are permitted, then null state verifies A
41
- # # but possible state c does not?
42
37
  # premises = ['A','B']
43
38
  # conclusions = ['(A \\boxright B)']
44
39
 
45
- # premises = ['A',]
46
- # conclusions = ['\\neg A']
47
-
48
40
  # premises = ['\\neg A']
49
41
  # conclusions = ['(A \\boxright B)','(A \\boxright \\neg B)']
50
42
 
@@ -69,40 +61,23 @@ save_bool = True
69
61
  # premises = ['\\neg (\\top \\boxright \\neg (A \\wedge B))','((A \\wedge B) \\boxright C)']
70
62
  # conclusions = ['(A \\boxright (B \\boxright C))']
71
63
 
72
- # premises = ['A','(A \\boxright (B \\boxright (C \\boxright D)))']
73
- # conclusions = []
74
-
75
64
  # premises = ['(\\Box A \\vee \\Box B)']
76
65
  # conclusions = ['(A \\wedge B)']
77
66
 
78
- # # NOTE: slow
79
- # premises = ['(A \\boxright B)', '\\neg ((A \\wedge C) \\boxright B)', '(((A \\wedge C) \\wedge D) \\boxright B)']
80
- # conclusions = []
81
-
82
- premises = ['\\Diamond A', '\\Diamond B']
83
- conclusions = ['\\Diamond (A \\wedge B)']
67
+ # premises = ['\\Diamond A', '\\Diamond B']
68
+ # conclusions = ['\\Diamond (A \\wedge B)']
84
69
 
85
- # # NOTE: ssh finds a model
86
70
  # premises = ['(A \\boxright B)']
87
71
  # conclusions = ['\\Box (A \\rightarrow B)']
88
72
 
89
73
 
74
+ ################################
75
+ ############ LOGIC #############
76
+ ################################
90
77
 
91
-
92
-
93
-
94
-
95
-
96
-
97
-
98
-
99
- ### VALID ###
100
-
101
- # # NOTE: unsat_core seems satisfiable
102
78
  # premises = []
103
79
  # conclusions = ['(A \\vee \\neg A)']
104
80
 
105
- # # NOTE: unsat_core seems satisfiable
106
81
  # premises = []
107
82
  # conclusions = ['\\neg (A \\wedge \\neg A)']
108
83
 
@@ -182,65 +157,3 @@ conclusions = ['\\Diamond (A \\wedge B)']
182
157
 
183
158
  # premises = ['\\Box (A \\rightarrow B)']
184
159
  # conclusions = ['(A \\boxright B)']
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
- ################################
203
- ######### NOT WORKING ##########
204
- ################################
205
-
206
-
207
- ### HIGH PRIORITY: NEGATION PROBLEM ###
208
-
209
- # # NOTE: only works without \neg B
210
- # premises = ['\\neg B','(A \\boxright B)']
211
- # conclusions = ['(\\neg B \\boxright \\neg A)']
212
-
213
- # # NOTE: only works without \neg A
214
- # premises = ['\\neg A','(A \\boxright C)']
215
- # conclusions = ['((A \\wedge B) \\boxright C)']
216
-
217
- # # NOTE: only works without \neg A and \neg B
218
- # premises = ['\\neg A','\\neg B','(A \\boxright B)','(B \\boxright C)']
219
- # conclusions = ['(A \\boxright C)']
220
-
221
- # # NOTE: only works without \neg A
222
- # premises = ['\\neg A', '(A \\boxright B)', '\\neg ((A \\wedge C) \\boxright B)']
223
- # conclusions = []
224
-
225
- ### MEDIUM PRIORITY: NESTED COUNTERFACTUALS ###
226
-
227
- # # NOTE: this does not find models for N = 3
228
- # # NOTE: N = 4 ran for minutes on ssh
229
- # premises = ['(A \\boxright (B \\boxright C))']
230
- # conclusions = ['((A \\wedge B) \\boxright C)']
231
-
232
- # # NOTE: ssh killed process
233
- # premises = ['(A \\boxright C)','(B \\boxright C)']
234
- # conclusions = ['((A \\wedge B) \\boxright C)']
235
-
236
- ### LOW PRIORITY: MODAL EQUIVALENCE ###
237
-
238
- # # NOTE: killed in ssh
239
- # # K axiom (top)
240
- # premises = ['(\\top \\boxright (A \\rightarrow B))']
241
- # conclusions = ['((\\top \\boxright A) \\rightarrow (\\top \\boxright B))']
242
-
243
- # # NOTE: killed in ssh
244
- # # top-to-box equivalence
245
- # premises = ['(\\top \\boxright A)']
246
- # conclusions = ['\\Box A']
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "model-checker"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "A hyperintensional model checker for counterfactual conditionals"
9
9
  authors = [
10
10
  { name = "Benjamin Brast-McKie", email = "benbrastmckie@gmail.com" },
@@ -27,4 +27,4 @@ Homepage = "https://github.com/benbrastmckie/ModelChecker"
27
27
  Issues = "https://github.com/benbrastmckie/ModelChecker/issues"
28
28
 
29
29
  [tool.poetry.scripts]
30
- package = "package.test_complete:main"
30
+ model-checker = "package.test_complete:main"
@@ -1,15 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: model-checker
3
- Version: 0.2.2
4
- Summary: A hyperintensional model checker for counterfactual conditionals
5
- Author-email: Benjamin Brast-McKie <benbrastmckie@gmail.com>, Miguel Buitrago <mbuit82@gmail.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/benbrastmckie/ModelChecker
8
- Project-URL: Issues, https://github.com/benbrastmckie/ModelChecker/issues
9
- Keywords: semantics,Z3,counterfactuals,model checker
10
- Classifier: Programming Language :: Python :: 3.8
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Description-Content-Type: text/markdown
14
- License-File: LICENCE
15
- Requires-Dist: z3-solver
@@ -1,15 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: model-checker
3
- Version: 0.2.2
4
- Summary: A hyperintensional model checker for counterfactual conditionals
5
- Author-email: Benjamin Brast-McKie <benbrastmckie@gmail.com>, Miguel Buitrago <mbuit82@gmail.com>
6
- License: MIT
7
- Project-URL: Homepage, https://github.com/benbrastmckie/ModelChecker
8
- Project-URL: Issues, https://github.com/benbrastmckie/ModelChecker/issues
9
- Keywords: semantics,Z3,counterfactuals,model checker
10
- Classifier: Programming Language :: Python :: 3.8
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Description-Content-Type: text/markdown
14
- License-File: LICENCE
15
- Requires-Dist: z3-solver
@@ -1,137 +0,0 @@
1
- # TITLE: test
2
-
3
- """
4
- There is a 3-model of:
5
-
6
- \Diamond A
7
- \Diamond B
8
- \neg \Diamond (A \wedge B)
9
-
10
- Possible states:
11
- #b000 = □
12
- #b001 = a (world)
13
- #b010 = b (world)
14
- #b100 = c (world)
15
-
16
- The evaluation world is c:
17
- A (True in c)
18
- B (Not true in c)
19
-
20
- 1. \Diamond A (True in c)
21
- |A| = < {b, c}, {a} > (False in a)
22
- |A| = < {b, c}, {a} > (True in b)
23
- |A| = < {b, c}, {a} > (True in c)
24
-
25
- 2. \Diamond B (True in c)
26
- |B| = < {a}, {b, c} > (True in a)
27
- |B| = < {a}, {b, c} > (False in b)
28
- |B| = < {a}, {b, c} > (False in c)
29
-
30
- 3. \neg \Diamond (A \wedge B) (True in c)
31
- \Diamond (A \wedge B) (False in c)
32
- (A \wedge B) (False in a)
33
- |A| = < {b, c}, {a} > (False in a)
34
- |B| = < {a}, {b, c} > (True in a)
35
- (A \wedge B) (False in b)
36
- |A| = < {b, c}, {a} > (True in b)
37
- |B| = < {a}, {b, c} > (False in b)
38
- (A \wedge B) (False in c)
39
- |A| = < {b, c}, {a} > (True in c)
40
- |B| = < {a}, {b, c} > (False in c)
41
-
42
- Run time: 0.1222 seconds
43
- """
44
-
45
- # path to parent directory
46
- import os
47
- parent_directory = os.path.dirname(__file__)
48
-
49
- # input sentences
50
- premises = ['\\Diamond A', '\\Diamond B', '\\neg \\Diamond (A \\wedge B)']
51
- conclusions = ['\\Diamond (A \\wedge B)']
52
-
53
- # number of atomic states
54
- N = 3
55
-
56
- # print all Z3 constraints if a model is found
57
- print_cons_bool = False
58
-
59
- # print core unsatisfiable Z3 constraints if no model exists
60
- print_unsat_core_bool = True
61
-
62
- # present option to save output
63
- save_bool = False
64
-
65
- # use constraints to find models in stead of premises and conclusions
66
- use_constraints_bool = False
67
-
68
-
69
- # satisfiable constraints
70
- all_constraints = [ForAll([frame_dummy_x, frame_dummy_y],
71
- Implies(And(possible(frame_dummy_y),
72
- frame_dummy_x | frame_dummy_y ==
73
- frame_dummy_y),
74
- possible(frame_dummy_x))), ForAll([frame_dummy_x, frame_dummy_y],
75
- Exists(frame_dummy_z,
76
- frame_dummy_x | frame_dummy_y == frame_dummy_z)), And(possible(w),
77
- ForAll(max_dummy,
78
- Implies(possible(max_dummy | w),
79
- max_dummy | w == w))), Not(verify(0, A)), Not(falsify(0, A)), ForAll([prop_dummy_x, prop_dummy_y],
80
- Implies(And(verify(prop_dummy_x, A),
81
- verify(prop_dummy_y, A)),
82
- verify(prop_dummy_x | prop_dummy_y, A))), ForAll([prop_dummy_x, prop_dummy_y],
83
- Implies(And(falsify(prop_dummy_x, A),
84
- falsify(prop_dummy_y, A)),
85
- falsify(prop_dummy_x | prop_dummy_y, A))), ForAll([prop_dummy_x, prop_dummy_y],
86
- Implies(And(verify(prop_dummy_x, A),
87
- falsify(prop_dummy_y, A)),
88
- Not(possible(prop_dummy_x | prop_dummy_y)))), ForAll([prop_dummy_x, prop_dummy_y],
89
- Implies(And(possible(prop_dummy_x),
90
- assign(prop_dummy_x, A) == prop_dummy_y),
91
- And(possible(prop_dummy_x | prop_dummy_y),
92
- Or(verify(prop_dummy_y, A),
93
- falsify(prop_dummy_y, A))))), Not(verify(0, B)), Not(falsify(0, B)), ForAll([prop_dummy_x, prop_dummy_y],
94
- Implies(And(verify(prop_dummy_x, B),
95
- verify(prop_dummy_y, B)),
96
- verify(prop_dummy_x | prop_dummy_y, B))), ForAll([prop_dummy_x, prop_dummy_y],
97
- Implies(And(falsify(prop_dummy_x, B),
98
- falsify(prop_dummy_y, B)),
99
- falsify(prop_dummy_x | prop_dummy_y, B))), ForAll([prop_dummy_x, prop_dummy_y],
100
- Implies(And(verify(prop_dummy_x, B),
101
- falsify(prop_dummy_y, B)),
102
- Not(possible(prop_dummy_x | prop_dummy_y)))), ForAll([prop_dummy_x, prop_dummy_y],
103
- Implies(And(possible(prop_dummy_x),
104
- assign(prop_dummy_x, B) == prop_dummy_y),
105
- And(possible(prop_dummy_x | prop_dummy_y),
106
- Or(verify(prop_dummy_y, B),
107
- falsify(prop_dummy_y, B))))), Exists(t_dummy_u,
108
- And(And(possible(t_dummy_u),
109
- ForAll(max_dummy,
110
- Implies(possible(max_dummy | t_dummy_u),
111
- max_dummy | t_dummy_u ==
112
- t_dummy_u))),
113
- Exists(t_dummy_x,
114
- And(t_dummy_x | t_dummy_u == t_dummy_u,
115
- verify(t_dummy_x, A))))), Exists(t_dummy_u,
116
- And(And(possible(t_dummy_u),
117
- ForAll(max_dummy,
118
- Implies(possible(max_dummy | t_dummy_u),
119
- max_dummy | t_dummy_u ==
120
- t_dummy_u))),
121
- Exists(t_dummy_x,
122
- And(t_dummy_x | t_dummy_u == t_dummy_u,
123
- verify(t_dummy_x, B))))), ForAll(f_dummy_u,
124
- Implies(And(possible(f_dummy_u),
125
- ForAll(max_dummy,
126
- Implies(possible(max_dummy |
127
- f_dummy_u),
128
- max_dummy | f_dummy_u ==
129
- f_dummy_u))),
130
- Or(Exists(f_dummy_x,
131
- And(f_dummy_x | f_dummy_u ==
132
- f_dummy_u,
133
- falsify(f_dummy_x, A))),
134
- Exists(f_dummy_x,
135
- And(f_dummy_x | f_dummy_u ==
136
- f_dummy_u,
137
- falsify(f_dummy_x, B))))))]
@@ -1,73 +0,0 @@
1
-
2
- '''
3
- Model Checker: top_test.py
4
- '''
5
- import os
6
- parent_directory = os.path.dirname(__file__)
7
- from model_structure import make_model_for
8
-
9
- ################################
10
- ########## SETTINGS ############
11
- ################################
12
-
13
- # length of bitvectors
14
- N = 3
15
-
16
- # print all Z3 constraints if a model is found
17
- print_cons_bool = False
18
-
19
- # print core unsatisfiable Z3 constraints if no model exists
20
- print_unsat_core_bool = True
21
-
22
- # present option to append output to file
23
- save_bool = False
24
-
25
- # use constraints to find models in stead of premises and conclusions
26
- use_constraints_bool = False
27
-
28
- ################################
29
- ########### ARGUMENT ###########
30
- ################################
31
-
32
- ### INVALID ###
33
-
34
- # premises = ['neg A','(A boxright (B vee C))']
35
- # conclusions = ['(A boxright B)','(A boxright C)']
36
-
37
- ### VALID ###
38
-
39
- premises = ['(\\top \\boxright (A \\boxright B))', 'A']
40
- conclusions = ['\\neg B']
41
-
42
- # premises = ['(\\top \\boxright A)', '((A \\wedge B) \\boxright C)', '\\neg (\\top \\boxright \\neg D)']
43
- # conclusions = ['\\neg A']
44
-
45
- # premises = ['(\\top \\boxright A)']
46
- # # conclusions = ['\\neg A'] # exists model, as desired
47
- # conclusions = ['A'] # no models, as desired
48
- # conclusions = ['\\neg (\\top \\boxright \\neg A)'] # no models, as desired
49
-
50
- # should this be valid? to me it seems intuitively it should be, but not sure
51
- # premises = ['(\\top \\boxright A)', '((A \\wedge B) \\boxright C)']
52
- # conclusions = ['(B \\boxright C)']
53
-
54
- # premises = ['\\Box A'] # no models, as desired
55
- # premises = ['\\Diamond A'] # model, as desired
56
- # conclusions = ['A']
57
-
58
- # premises = ['\\Box A']
59
- # conclusions = ['(\\top \\boxright A)'] # works; flipped takes a while, and Diamond case takes a while too
60
-
61
- premises = ['(\\Box A \\vee \\Box B)']
62
- conclusions = ['(A \\wedge B)']
63
-
64
-
65
-
66
- mod = make_model_for(N)(premises, conclusions)
67
- # mod.print_inputs_recursively()
68
- # mod.print_evaluation()
69
- mod.print_to(print_cons_bool, print_unsat_core_bool)
70
- # print(mod.sentence_letters)
71
- # print(mod.all_subsentences)
72
- # for sent_let in mod.sentence_letters:
73
- # print(sent_let, type(sent_let))
File without changes
File without changes