logo

Temporary notebook for no_1tok_in_Ts of type ExprRange

a not-yet-official common expression from the theory of proveit.physics.quantum.circuits

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored common expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import ExprRange, IndexedVar, T, Variable, k, l, m
from proveit.logic import Disjoint
from proveit.numbers import Interval, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_b", latex_format = r"{_{-}b}")
sub_expr2 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprRange(sub_expr1, ExprRange(sub_expr2, Disjoint(IndexedVar(T, [sub_expr1, sub_expr2]), Interval(one, k)), one, m), one, l)
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: no_1tok_in_Ts matches stored_expr")
Passed sanity check: no_1tok_in_Ts matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\textrm{disjoint}\left(T_{1, 1}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{1, 2}, \{1~\ldotp \ldotp~k\}\right), \ldots, \textrm{disjoint}\left(T_{1, m}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{2, 1}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{2, 2}, \{1~\ldotp \ldotp~k\}\right), \ldots, \textrm{disjoint}\left(T_{2, m}, \{1~\ldotp \ldotp~k\}\right), \ldots\ldots, \textrm{disjoint}\left(T_{l, 1}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{l, 2}, \{1~\ldotp \ldotp~k\}\right), \ldots, \textrm{disjoint}\left(T_{l, m}, \{1~\ldotp \ldotp~k\}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
parameterization'implicit' (default for LaTeX formatting) hides the parameter the ExprRange so the parameterization may be ambiguous (e.g., x_{1+1}, ..., x_{n+1}); 'explicit' (default for string formatting) reveals the parameterization (e.g. x_{1+1}, ..x_{k+1}.., x_{n+1}).NoneNone/False('with_explicit_parameterization', 'with_implicit_parameterization', 'with_default_parameterization_style')
front_expansionThe number of instances to display at the front of the range (e.g., before the ellipsis). Default is 2.22('with_front_expansion', 'get_front_expansion')
back_expansionThe number of instances to display at the back of the range (e.g., after the ellipsis). Default is 1.11('with_back_expansion', 'get_back_expansion')
orderThe default order is 'increasing' (a_1 ... a_3) but to represent a 'decreasing' ExprRange (a_6 ... a_2) the order must be set to 'decreasing'increasingincreasing('with_decreasing_order', 'with_increasing_order')
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
case_simplifyIf 'True', simplify formatted instances that are ConditionalSets under proper index assumptionsFalseFalse('with_case_simplification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprRangelambda_map: 1
start_index: 19
end_index: 2
1Lambdaparameter: 17
body: 4
2Variable
3ExprTuple17
4ExprRangelambda_map: 5
start_index: 19
end_index: 6
5Lambdaparameter: 18
body: 8
6Variable
7ExprTuple18
8Operationoperator: 9
operands: 10
9Literal
10ExprTuple11, 12
11IndexedVarvariable: 13
indices: 14
12Operationoperator: 15
operands: 16
13Variable
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17Variable
18Variable
19Literal
20Variable