bound.py¶
from pymwp import Bound
Bound
¶
Bound(bounds: dict[str, str] = None)
Represents a mwp-bound for a relation. If derivation succeeds, there is one mwp-bound expression for each input variable.
Attributes:
Name | Type | Description |
---|---|---|
bound_dict |
Dict[str, MwpBound]
|
Variable bounds. |
Create a bound.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bounds |
dict[str, str]
|
Dictionary of mwp-bounds. |
None
|
calculate
¶
calculate(relation: SimpleRelation) -> Bound
Calculate bound from a simple-valued matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
relation |
SimpleRelation
|
A simple-valued relation. |
required |
Returns:
Type | Description |
---|---|
Bound
|
The bound for the relation. |
show
¶
show(
compact: bool = False,
significant: bool = False,
variables: Tuple[str] = None,
) -> str
Formatted display-string of a bound.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
compact |
bool
|
reduce whitespace in the output |
False
|
significant |
bool
|
omit bounds that depend only on self |
False
|
variables |
Tuple[str]
|
list of variables to display |
None
|
Returns:
Type | Description |
---|---|
str
|
A formatted string of the bound. |
HonestPoly
¶
HonestPoly(operator: str, *init_vars: str)
Models an honest polynomial.
Attributes:
Name | Type | Description |
---|---|---|
variables |
set[str]
|
List of variables. |
var_fmt(Callable) |
set[str]
|
Variable formatter. |
op |
str
|
Operator. |
Creates a honest polynomial.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
operator |
str
|
Operator. |
required |
*init_vars |
str
|
Arbitrary variables. |
()
|
MwpBound
¶
MwpBound(triple: str = None)
Represents a mwp-bound.
Attributes:
Name | Type | Description |
---|---|---|
x |
Tuple[str]
|
List of m-variables. |
y |
Tuple[str]
|
List of w-variables. |
z |
Tuple[str]
|
List of p-variables. |
Create mwp-bound.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
triple |
str
|
Bound expression as bound_str. |
None
|
bound_str
property
¶
bound_str: str
Alternative bounds representation, as a ;
-separated string.
Returns:
Type | Description |
---|---|
str
|
Current bound as \(m;w;p\) where the first section contains list of variables in m, second contains variables in w, and last in p (if any). Multiple elements in the lists are separated by commas. |
bound_triple
property
¶
bound_triple: B_TRIPLE
Alternative bounds representation, as three tuples.
Returns:
Type | Description |
---|---|
B_TRIPLE
|
Current bound as \((m_1,...m_n), (w_1,...w_n), (p_1,...p_n)\) where the first contains list of variables in m, second contains variables in w, and last in p (if any). |