Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/adamchalmers/carroll
/ functions
Functions
98 in github.com/adamchalmers/carroll
⨍
Functions
98
◇
Types & classes
10
↓ 59 callers
Method
eval
Evaluates the logic tree rooted at this node against a supplied model. Model is an assignment of truth values to atoms (dict of string -> boo
nodes.py:19
↓ 20 callers
Function
parse
Starts parsing a logical expression (supplied as a string). Returns a tree of Nodes.
parsing.py:8
↓ 12 callers
Function
truth_table
Generates truth table rows from a proposition string.
truthtable.py:38
↓ 11 callers
Function
meaning_of
Returns the type of node this symbol represents.
symbols.py:21
↓ 8 callers
Function
all_equal
(iterable)
truthtable.py:72
↓ 8 callers
Function
equivalent
(exp1, exp2)
truthtable.py:80
↓ 7 callers
Function
print_sat_info
(table)
truthtable.py:84
↓ 5 callers
Function
find_atoms
Returns a list of atoms in a proposition string.
truthtable.py:51
↓ 5 callers
Function
gen_truths
Yields all possible maps of variables to truth values.
truthtable.py:55
↓ 3 callers
Method
atoms
Return a set of characters which are atoms in this expression.
nodes.py:36
↓ 2 callers
Function
serialize_argument_trees
Takes in a list of parse tree expressions [A, B, C, ... Z]. Outputs one parse tree ((A&B&C&...) -> Z). Last expression is the conclusion,
proofs.py:6
↓ 2 callers
Function
to_cnf
(expression)
normal_forms.py:15
↓ 2 callers
Function
to_dnf
Converts a proposition string into a DNF string.
normal_forms.py:5
↓ 2 callers
Function
valid_proof
Takes in a list of parse tree expressions [A, B, C, ... Z]. Outputs one parse tree ((A&B&C&...) -> Z). Last expression is the conclusion,
proofs.py:16
↓ 1 callers
Function
_parse
Recursive-descent parsing algorithm for logic expressions. Returns a tree of Nodes.
parsing.py:18
↓ 1 callers
Method
check_valid
Ensures the children nodes are valid. Raises LogicError if they're not.
nodes.py:25
↓ 1 callers
Method
check_valid_specific
Overridden by children nodes to implement custom child-checking logic. Should raise LogicError if children are invalid.
nodes.py:31
↓ 1 callers
Function
cli
Carroll is a command line tool for analysing propositional logic (also known as boolean functions or expressions).
carroll.py:11
↓ 1 callers
Function
truth_to_str
Produce a nice-formatted string of a truth assignment, e.g. " A ~B C".
truthtable.py:65
Method
__eq__
(self, other)
truthtable.py:19
Method
__init__
(self, model, value)
truthtable.py:12
Method
__init__
(self, *children)
nodes.py:15
Method
__str__
(self)
truthtable.py:16
Method
atoms
(self)
nodes.py:97
Method
check_valid_specific
(self, children)
nodes.py:91
Function
cnf
Converts an expression to conjunctive normal form.
carroll.py:38
Function
dnf
Converts an expression to disjunctive normal form.
carroll.py:32
Function
equiv
Checks whether two expressions are logically equivalent.
carroll.py:19
Method
eval
(self, model)
nodes.py:55
Method
eval
(self, model)
nodes.py:59
Method
eval
(self, model)
nodes.py:63
Method
eval
(self, model)
nodes.py:69
Method
eval
(self, model)
nodes.py:75
Method
eval
(self, model)
nodes.py:80
Method
eval
(self, model)
nodes.py:89
Function
from_tree
Generates a truth table from a parse tree.
truthtable.py:45
Method
l
(self)
nodes.py:44
Function
model_to_clause
(model, truth, symbol)
normal_forms.py:24
Function
print_truth_table
Outputs the truth table for an expression to stdout.
truthtable.py:23
Function
proof
Checks a proof for validity.
carroll.py:43
Method
r
(self)
nodes.py:48
Function
setup_tf_nodes
()
nodes.py:101
Function
table
Outputs a truth table for a logical expression.
carroll.py:26
Function
teardown
()
nodes.py:109
Function
test_all_equal
()
truthtable.py:170
Function
test_atom_parse
()
parsing.py:63
Function
test_atoms_uppercase
()
nodes.py:205
Function
test_basic_cnf
()
normal_forms.py:50
Function
test_basic_dnf
()
normal_forms.py:38
Function
test_check_valid
()
nodes.py:208
Function
test_complex_and_parse
()
parsing.py:80
Function
test_complex_or_parse
()
parsing.py:98
Function
test_complex_parse
()
parsing.py:109
Function
test_compound_node_eval
()
nodes.py:172
Function
test_dnf_parse
()
parsing.py:127
Function
test_equiv_complex
()
truthtable.py:163
Function
test_equiv_simple
()
truthtable.py:154
Function
test_error_parse
()
parsing.py:48
Function
test_find_atoms
()
truthtable.py:128
Function
test_find_atoms
()
nodes.py:217
Function
test_gen_truths_base
()
truthtable.py:100
Function
test_gen_truths_recursive
()
truthtable.py:104
Function
test_gen_truths_recursive_long
()
truthtable.py:114
Function
test_if_nodes
()
nodes.py:128
Function
test_iff_nodes
()
nodes.py:154
Function
test_invalid_proof
()
proofs.py:42
Function
test_longer_cnf
()
normal_forms.py:56
Function
test_longer_dnf
()
normal_forms.py:44
Function
test_many_ands
()
nodes.py:180
Function
test_many_ors
()
nodes.py:189
Function
test_multiple_and_parse
()
parsing.py:87
Function
test_multiple_iff_nodes
()
nodes.py:161
Function
test_multiple_operand_fail
()
parsing.py:132
Function
test_multiple_operand_parse
()
parsing.py:121
Function
test_multiple_or_parse
()
parsing.py:104
Function
test_multiple_xor_nodes
()
nodes.py:142
Function
test_not_all_equal
()
truthtable.py:177
Function
test_not_equiv_complex
()
truthtable.py:167
Function
test_not_equiv_simple
()
truthtable.py:158
Function
test_not_parse
()
parsing.py:68
Function
test_parse_if
()
parsing.py:135
Function
test_parse_iff
()
parsing.py:141
Function
test_parse_xor
()
parsing.py:147
Function
test_sat_info_harder
()
truthtable.py:188
Function
test_sat_info_simple
()
truthtable.py:182
Function
test_serialize_argtree_simple
()
proofs.py:26
Function
test_simple_and_parse
()
parsing.py:74
Function
test_simple_find_atoms
()
nodes.py:212
Function
test_simple_or_parse
()
parsing.py:92
Function
test_single_atom
()
nodes.py:202
Function
test_single_node_eval
()
nodes.py:113
Function
test_single_not
()
nodes.py:197
Function
test_spaces_parse
()
parsing.py:59
Function
test_symbol_mapping
()
symbols.py:25
Function
test_truth_table_and
()
truthtable.py:134
Function
test_truth_table_or
()
truthtable.py:144
Function
test_valid_proof
()
proofs.py:38
Function
test_xor_nodes
()
nodes.py:135