Numpy Implementation#
NumpyPosition#
-
class
tau.
NumpyPosition
(pos)# Bases:
tau.base.Position
Methods
are_minimally_compatible
(position1)Checks for minimal compatibility with
position
.Position as
BitarrayPosition
.as_list
()Position as integer list.
as_set
()Position as integer set.
Position as ternary.
Creates subpositions of position that have exactly one element less than position.
domain
()Determines the domain of the position.
from_set
(position, n)Instanciating a
Position
from a set.intersection
(positions)set-theoretic intersection
is_accepting
(sentence)Checks whether
sentence
is in the position.is_in_domain
(sentence)Checks whether
sentence
is in the domain of the position.Checks for minimal consistency.
is_subposition
(pos2)Checks for set-theoretic inclusion.
neighbours
(depth)Generates all neighbours of position that can be reached by at most depth many adjustments of individual sentences.
np_neighbours
(position, depth)Size of sentence pool.
size
()size of the position
subpositions
([n, only_consistent_subpositions])Iterator over subsets of size n.
union
(positions)set-theoretic union
as_np_array
to_numpy_position
-
are_minimally_compatible
(position1)# Checks for minimal compatibility with
position
.Two positions \(\mathcal{A}\) and \(\mathcal{A}'\) are minimally compatible iff \(\mathcal{A} \cup \mathcal{A}'\) is minimally consistent.
- Return type
bool
- Returns
True
iff the position-instance is compatible withposition
- Parameters
position1 (tau.base.Position) –
-
as_bitarray
()# Position as
BitarrayPosition
.A pair of bits represents a sentence: The first bit represents acceptance and the second bit rejection. Suspension of a sentence corresponds to both bits being False/0 and (minimal or flat) contradiction is present if both bits are True/1. For instance, the position \(\{ s_1, s_3, \neg s_4 \}\) is represented by
10001001
.- Return type
bitarray
- Returns
a bitarray representation of the position if possible, otherwise should return
None
-
as_list
()# Position as integer list.
The position \(\mathcal{A}\) represented by a python list of integer values. \(s_i \in \mathcal{A}\) is represented by \(i\) and \(\neg s_i \in \mathcal{A}\) by \(-i\). For instance, the position \(\{ s_1, s_3, \neg s_4 \}\) is represented by
[1, 3, -4]
.Note
The returned order integer values is not specified.
- Return type
List
[int
]- Returns
a representation of the position as a list of integer values
-
static
as_np_array
(position)# - Return type
ndarray
- Parameters
position (tau.base.Position) –
-
as_set
()# Position as integer set.
The position \(\mathcal{A}\) represented by a python set of integer values. \(s_i \in \mathcal{A}\) is represented by \(i\) and \(\neg s_i \in \mathcal{A}\) by \(-i\). For instance, the position \(\{ s_1, s_3, \neg s_4 \}\) is represented by
{1, 3, -4}
.- Return type
Set
[int
]- Returns
a representation of the position as a set of integer values
-
as_ternary
()# Position as ternary.
The position \(\mathcal{A}\) represented by an integer of base 3 (at least). \(s_i \in \mathcal{A}\) is represented by \(1*10^{i-1}\), \(\neg s_i \in \mathcal{A}\) by \(2*10^{i-1}\) and \(s_i, \neg s_i \notin \mathcal{A}\) by zero. For instance, the position \(\{ s_1, s_3, \neg s_4 \}\) is represented by the integer 2101.
Note
Positions that are not minimally consistent cannot be represented in this way.
- Return type
int
- Returns
a ternary representation of the position if possible, otherwise should return
None
-
direct_subpositions
()# Creates subpositions of position that have exactly one element less than position. Used for efficiency in update method.
- Return type
Iterator
[Position
]
-
domain
()# Determines the domain of the position.
The domain of a position \(\mathcal{A}\) is the closure of \(\mathcal{A}\) under negation.
- Return type
Position
- Returns
the domain of the position
-
static
from_set
(position, n)# Instanciating a
Position
from a set.- Returns
- Parameters
position (Set[int]) –
-
static
intersection
(positions)# set-theoretic intersection
- Return type
Position
- Returns
The set-theoretic intersection of the given set of :code:`position`s.
- Parameters
positions (Set[tau.base.Position]) –
-
is_accepting
(sentence)# Checks whether
sentence
is in the position.- Parameters
sentence (
int
) – A sentence \(s_i\) represented by i.- Return type
bool
- Returns
True
iffsentence
is in the position.
-
is_in_domain
(sentence)# Checks whether
sentence
is in the domain of the position.- Parameters
sentence (
int
) – A sentence \(s_i\) represented by i.- Return type
bool
- Returns
True
iffsentence
is in the domain of the position.
-
is_minimally_consistent
()# Checks for minimal consistency.
A position \(\mathcal{A}\) is minimally consistent iff \(\forall s \in S: s\in \mathcal{A} \rightarrow \neg s \notin \mathcal{A}\)
- Return type
bool
- Returns
True
iff the position is minimally consistent
-
is_subposition
(pos2)# Checks for set-theoretic inclusion.
The position \(\mathcal{A}\) is a subposition of \(\mathcal{A}'\) iff \(\mathcal{A} \subset \mathcal{A}'\).
- Return type
bool
- Returns
True
iff the position-instance is a subposition ofposition
- Parameters
self (tau.base.Position) –
pos2 (tau.base.Position) –
-
neighbours
(depth)# Generates all neighbours of position that can be reached by at most depth many adjustments of individual sentences. The number of neighbours is sum(k=0, d, (n over k)*2^k), where n is the number of unnegated sentences and d is the depth of the neighbourhood (the position is itself included).
- Return type
Iterator
[Position
]- Parameters
depth (int) –
-
static
np_neighbours
(position, depth)# - Return type
Iterator
[ndarray
]- Parameters
position (tau.base.Position) –
depth (int) –
-
sentence_pool
()# Size of sentence pool.
- Return type
int
- Returns
the size of the unnegated sentence pool.
-
size
()# size of the position
- Return type
int
- Returns
The amount of sentences in that position (\(|S|\)).
-
subpositions
(n=- 1, only_consistent_subpositions=True)# Iterator over subsets of size n.
- Parameters
n (
int
) – The size of the returned positions. Ifn
is \(-1\), the method returns all subpositions including the empty position and itself.only_consistent_subpositions (
bool
) – IfTrue
only consistent subpositions will be returned.
- Return type
Iterator
[Position
]- Returns
A python iterator over subpositions of size n.
-
static
to_numpy_position
(position)# - Return type
NumpyPosition
- Parameters
position (tau.base.Position) –
-
DAGNumpyDialecticalStructure#
-
class
tau.
DAGNumpyDialecticalStructure
(n, initial_arguments=None)# Bases:
tau.base.DialecticalStructure
Methods
add_argument
(argument)Adds an argument to the dialectical structure.
add_arguments
(arguments)Adds arguments to the dialectical structure.
are_compatible
(position1, position2)Checks for dialectical compatibility of two positions.
axioms
(position[, source])Iterator over all axiomatic bases from source.
Iterator over all dialectically closed positions.
closure
(position)Dialectical closure.
complete_extensions
(position)Returns complete extensions of position by retrieving corresponding node in the graph that stores complete extensions.
Iterator over all dialectically consistent and complete positions.
Iterator over all dialectically consistent positions.
degree_of_justification
(position1, position2)Conditional degree of justification.
entails
(position1, position2)Dialectical entailment.
from_arguments
(arguments, …)Instanciating a
DialecticalStructure
from a list of int lists.The arguments as a list.
is_closed
(position)Checks whether a position is dialectically closed.
is_complete
(position)Checks whether :code:`position’ is complete.
is_consistent
(position)Checks for dialectical consistency.
is_minimal
(position)Checks dialectical minimality.
Iterator over all dialectically minimal positions.
Iterator over all minimally consistent positions.
n_complete_extensions
([position])Number of complete and consistent extension.
Returns the unnegated half of sentence pool
satisfies
-
add_argument
(argument)# Adds an argument to the dialectical structure.
- Parameters
argument (
List
[int
]) – An argument as an integer list. The last element represents the conclusion the others the premises.- Return type
DialecticalStructure
- Returns
The dialectical structure for convenience.
-
add_arguments
(arguments)# Adds arguments to the dialectical structure.
- Parameters
arguments (
List
[List
[int
]]) – A list of arguments as a list of integer lists.- Return type
DialecticalStructure
- Returns
The dialectical structure for convenience.
-
are_compatible
(position1, position2)# Checks for dialectical compatibility of two positions.
Two positions are dialectically compatible iff there is a complete and consistent positition that extends both.
- Return type
bool
- Returns
True
iffposition1
it dialectically compatible toposition2
.- Parameters
position1 (tau.base.Position) –
position2 (tau.base.Position) –
-
axioms
(position, source=None)# Iterator over all axiomatic bases from source. The source defaults to all consistent positions if it is not provided.
A position \(\mathcal{B}\) is an axiomatic basis of another position \(\mathcal{A}\) iff \(\mathcal{A}\) is dialectically entailed by \(\mathcal{B}\) and there is no proper subset \(\mathcal{C}\) of \(\mathcal{B}\) such that \(\mathcal{A}\) is entailed by \(\mathcal{C}\).
This method should throw a
ValueError
if the given position is inconsistent.- Return type
Iterator
[Position
]- Returns
A python-iterator over all axiomatic bases of
position
fromsource
andNone
if there is no axiomatic basis in the source.- Parameters
position (tau.base.Position) –
source (Optional[Iterator[tau.base.Position]]) –
-
closed_positions
()# Iterator over all dialectically closed positions.
This iterator will include the empty position, if it is closed.
- Return type
Iterator
[Position
]- Returns
A python-iterator over all dialectically closed positions.
-
closure
(position)# Dialectical closure.
The dialectical closure of a position \(\mathcal{A}\) is the intersection of all consistent and complete positions that extend \(\mathcal{A}\). Note that in consequence, the empty position can have a non-empty closure.
- Return type
Position
- Returns
The dialectical closure of
position
.- Parameters
position (tau.base.Position) –
-
complete_extensions
(position)# Returns complete extensions of position by retrieving corresponding node in the graph that stores complete extensions.
- Return type
Set
[Position
]- Parameters
position (tau.base.Position) –
-
consistent_complete_positions
()# Iterator over all dialectically consistent and complete positions.
- Return type
Iterator
[Position
]- Returns
A python iterator over all dialectically consistent and complete positions.
-
consistent_positions
()# Iterator over all dialectically consistent positions.
This iterator will include the empty position.
- Return type
Iterator
[Position
]- Returns
A python iterator over all dialectically consistent positions.
-
degree_of_justification
(position1, position2)# Conditional degree of justification.
The conditional degree of justification \(DOJ\) of two positions \(\mathcal{A}\) and \(\mathcal{B}\) is defined by \(DOJ(\mathcal{A}| \mathcal{B}):=\frac{\sigma_{\mathcal{AB}}}{\sigma_{\mathcal{B}}}\) with \(\sigma_{\mathcal{AB}}\) the set of all consistent and complete positions that extend both \(\mathcal{A}\) and \(\mathcal{B}\) and \(\sigma_{\mathcal{B}}\) the set of all consistent and complete positions that extend \(\mathcal{B}\).
- Return type
float
- Returns
The conditional degree of justification of
position1
with respect toposition2
.- Parameters
position1 (tau.base.Position) –
position2 (tau.base.Position) –
-
entails
(position1, position2)# Dialectical entailment.
A position \(\mathcal{A}\) dialectically entails another position \(\mathcal{B}\) iff every consistent and complete position that extends \(\mathcal{A}\) also extends \(\mathcal{B}\).
- Return type
bool
- Returns
True
iffposition2
is dialectically entailed byposition1
.- Parameters
position1 (tau.base.Position) –
position2 (tau.base.Position) –
-
static
from_arguments
(arguments, n_unnegated_sentence_pool)# Instanciating a
DialecticalStructure
from a list of int lists.- Return type
DialecticalStructure
- Returns
- Parameters
arguments (List[List[int]]) –
n_unnegated_sentence_pool (int) –
-
get_arguments
()# The arguments as a list.
- Return type
List
[List
[int
]]- Returns
The arguments as a list of integer lists. The last element of each inner list represents the conclusion, the others the premises.
-
is_closed
(position)# Checks whether a position is dialectically closed.
- Return type
bool
- Returns
True
iffposition
is dialectically closed.- Parameters
position (tau.base.Position) –
-
is_complete
(position)# Checks whether :code:`position’ is complete.
A position \(\mathcal{A}\) is complete iff the domain of \(\mathcal{A}\) is identical with the sentence pool \(S\).
- Return type
bool
- Returns
True
iff thePosition
is complete.- Parameters
position (tau.base.Position) –
-
is_consistent
(position)# Checks for dialectical consistency.
A complete position \(\mathcal{A}\) is dialectically consistent iff it is a minimally consistent and for all arguments \(a=(P_a, c_a) \in A\) holds: If \((\forall p \in P_a:p \in \mathcal{A})\) then \(c_a \in \mathcal{A}\)
A partial position \(\mathcal{A}\) is dialectically consistent iff there is a complete and consistent position that extends \(\mathcal{A}\).
- Return type
bool
- Returns
True
iffposition
it dialectically consistent.- Parameters
position (tau.base.Position) –
-
is_minimal
(position)# Checks dialectical minimality.
A position \(\mathcal{A}\) is dialectically minimal if every subposition \(\mathcal{B}\subseteq\mathcal{A}\) that entails \(\mathcal{A}\) is identical with \(\mathcal{A}\).
- Return type
bool
- Returns
True
iffposition
is dialectically minimal.- Parameters
position (tau.base.Position) –
-
minimal_positions
()# Iterator over all dialectically minimal positions.
- Return type
Iterator
[Position
]- Returns
A python iterator over all dialectically minimal positions.
-
minimally_consistent_positions
()# Iterator over all minimally consistent positions.
A position \(\mathcal{A}\) is minimally consistent iff \(\forall s \in S: s\in \mathcal{A} \rightarrow \neg s \notin \mathcal{A}\)
This iterator will include the empty position.
- Return type
Iterator
[Position
]- Returns
A python iterator over all minimally consistent positions.
-
n_complete_extensions
(position=None)# Number of complete and consistent extension.
- Return type
int
- Returns
The number of complete and consistent positions that extend
position
.- Parameters
position (Optional[tau.base.Position]) –
-
satisfies
(argument, position)# - Return type
bool
- Parameters
argument (tau.base.Position) –
position (tau.base.Position) –
-
sentence_pool
()# Returns the unnegated half of sentence pool
- Return type
Position
-
BDDNumpyDialecticalStructure#
-
class
tau.
BDDNumpyDialecticalStructure
(n, initial_arguments=None)# Bases:
tau.numpy_implementation.DAGNumpyDialecticalStructure
Methods
add_argument
(argument)Adds an argument to the dialectical structure.
add_arguments
(arguments)Adds arguments to the dialectical structure.
are_compatible
(position1, position2)Checks for dialectical compatibility of two positions.
axioms
(position[, source])Iterator over all axiomatic bases from source.
closed_positions
()Iterator over all dialectically closed positions.
closure
(position)Dialectical closure.
complete_extensions
(position)Returns complete extensions of position by retrieving corresponding node in the graph that stores complete extensions.
Iterator over all dialectically consistent and complete positions.
Iterator over all dialectically consistent positions.
degree_of_justification
(position1, position2)Conditional degree of justification.
entails
(position1, position2)Dialectical entailment.
from_arguments
(arguments, …)Instanciating a
DialecticalStructure
from a list of int lists.get_arguments
()The arguments as a list.
is_closed
(position)Checks whether a position is dialectically closed.
is_complete
(position)Checks whether :code:`position’ is complete.
is_consistent
(position)Checks for dialectical consistency.
is_minimal
(position)Checks dialectical minimality.
minimal_positions
()Iterator over all dialectically minimal positions.
Iterator over all minimally consistent positions.
n_complete_extensions
([position])Number of complete and consistent extension.
sentence_pool
()Returns the unnegated half of sentence pool
pos_to_expr
satisfies
-
are_compatible
(position1, position2)# Checks for dialectical compatibility of two positions.
Two positions are dialectically compatible iff there is a complete and consistent positition that extends both.
- Return type
bool
- Returns
True
iffposition1
it dialectically compatible toposition2
.- Parameters
position1 (tau.base.Position) –
position2 (tau.base.Position) –
-
axioms
(position, source=None)# Iterator over all axiomatic bases from source. The source defaults to all consistent positions if it is not provided.
A position \(\mathcal{B}\) is an axiomatic basis of another position \(\mathcal{A}\) iff \(\mathcal{A}\) is dialectically entailed by \(\mathcal{B}\) and there is no proper subset \(\mathcal{C}\) of \(\mathcal{B}\) such that \(\mathcal{A}\) is entailed by \(\mathcal{C}\).
This method should throw a
ValueError
if the given position is inconsistent.- Return type
Iterator
[Position
]- Returns
A python-iterator over all axiomatic bases of
position
fromsource
andNone
if there is no axiomatic basis in the source.- Parameters
position (tau.base.Position) –
source (Optional[Iterator[tau.base.Position]]) –
-
closure
(position)# Dialectical closure.
The dialectical closure of a position \(\mathcal{A}\) is the intersection of all consistent and complete positions that extend \(\mathcal{A}\). Note that in consequence, the empty position can have a non-empty closure.
- Return type
Position
- Returns
The dialectical closure of
position
.- Parameters
position (tau.base.Position) –
-
consistent_complete_positions
()# Iterator over all dialectically consistent and complete positions.
- Return type
Iterator
[Position
]- Returns
A python iterator over all dialectically consistent and complete positions.
-
consistent_positions
()# Iterator over all dialectically consistent positions.
This iterator will include the empty position.
- Return type
Iterator
[Position
]- Returns
A python iterator over all dialectically consistent positions.
-
degree_of_justification
(position1, position2)# Conditional degree of justification.
The conditional degree of justification \(DOJ\) of two positions \(\mathcal{A}\) and \(\mathcal{B}\) is defined by \(DOJ(\mathcal{A}| \mathcal{B}):=\frac{\sigma_{\mathcal{AB}}}{\sigma_{\mathcal{B}}}\) with \(\sigma_{\mathcal{AB}}\) the set of all consistent and complete positions that extend both \(\mathcal{A}\) and \(\mathcal{B}\) and \(\sigma_{\mathcal{B}}\) the set of all consistent and complete positions that extend \(\mathcal{B}\).
- Return type
float
- Returns
The conditional degree of justification of
position1
with respect toposition2
.- Parameters
position1 (tau.base.Position) –
position2 (tau.base.Position) –
-
entails
(position1, position2)# Dialectical entailment.
A position \(\mathcal{A}\) dialectically entails another position \(\mathcal{B}\) iff every consistent and complete position that extends \(\mathcal{A}\) also extends \(\mathcal{B}\).
- Return type
bool
- Returns
True
iffposition2
is dialectically entailed byposition1
.- Parameters
position1 (tau.base.Position) –
position2 (tau.base.Position) –
-
static
from_arguments
(arguments, n_unnegated_sentence_pool)# Instanciating a
DialecticalStructure
from a list of int lists.- Return type
DialecticalStructure
- Returns
- Parameters
arguments (List[List[int]]) –
n_unnegated_sentence_pool (int) –
-
is_consistent
(position)# Checks for dialectical consistency.
A complete position \(\mathcal{A}\) is dialectically consistent iff it is a minimally consistent and for all arguments \(a=(P_a, c_a) \in A\) holds: If \((\forall p \in P_a:p \in \mathcal{A})\) then \(c_a \in \mathcal{A}\)
A partial position \(\mathcal{A}\) is dialectically consistent iff there is a complete and consistent position that extends \(\mathcal{A}\).
- Return type
bool
- Returns
True
iffposition
it dialectically consistent.- Parameters
position (tau.numpy_implementation.NumpyPosition) –
-
minimally_consistent_positions
()# Iterator over all minimally consistent positions.
A position \(\mathcal{A}\) is minimally consistent iff \(\forall s \in S: s\in \mathcal{A} \rightarrow \neg s \notin \mathcal{A}\)
This iterator will include the empty position.
- Return type
Iterator
[Position
]- Returns
A python iterator over all minimally consistent positions.
-
n_complete_extensions
(position=None)# Number of complete and consistent extension.
- Return type
int
- Returns
The number of complete and consistent positions that extend
position
.- Parameters
position (Optional[tau.base.Position]) –
-
pos_to_expr
(position)# - Parameters
position (tau.numpy_implementation.NumpyPosition) –
-