logo

Expression of type ExprTuple

from the theory of proveit.numbers.multiplication

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 expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import Conditional, ExprRange, ExprTuple, IndexedVar, Lambda, Variable, a, n
from proveit.core_expr_types import a_1_to_n
from proveit.logic import Equals, Forall, InSet, Or
from proveit.numbers import Complex, Mult, Natural, ZeroSet, one, zero
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [a_1_to_n], instance_expr = InSet(Mult(a_1_to_n), ZeroSet), domain = Complex, condition = Or(ExprRange(sub_expr1, Equals(IndexedVar(a, sub_expr1), zero), one, n))), InSet(n, Natural))))
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: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left(n \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{n} \in \mathbb{C}~|~\left(a_{1} = 0\right) \lor  \left(a_{2} = 0\right) \lor  \ldots \lor  \left(a_{n} = 0\right)}~\left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{n}\right) \in \left\{0\right\}\right) \textrm{ if } n \in \mathbb{N}\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 36
body: 3
2ExprTuple36
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 32
operands: 8
6Literal
7ExprTuple9
8ExprTuple36, 10
9Lambdaparameters: 22
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 32
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17Operationoperator: 21
operands: 22
18Operationoperator: 23
operand: 42
19ExprRangelambda_map: 25
start_index: 35
end_index: 36
20Operationoperator: 26
operands: 27
21Literal
22ExprTuple28
23Literal
24ExprTuple42
25Lambdaparameter: 45
body: 29
26Literal
27ExprTuple30
28ExprRangelambda_map: 31
start_index: 35
end_index: 36
29Operationoperator: 32
operands: 33
30ExprRangelambda_map: 34
start_index: 35
end_index: 36
31Lambdaparameter: 45
body: 41
32Literal
33ExprTuple41, 37
34Lambdaparameter: 45
body: 38
35Literal
36Variable
37Literal
38Operationoperator: 39
operands: 40
39Literal
40ExprTuple41, 42
41IndexedVarvariable: 43
index: 45
42Literal
43Variable
44ExprTuple45
45Variable