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, ExprTuple, Lambda, n
from proveit.core_expr_types import a_1_to_n
from proveit.logic import Forall, InSet, NotEquals
from proveit.numbers import ComplexNonZero, Mult, Natural, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [a_1_to_n], instance_expr = NotEquals(Mult(a_1_to_n), zero), domain = ComplexNonZero), 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}^{\neq 0}}~\left(\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{n}\right) \neq 0\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: 28
body: 3
2ExprTuple28
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 29
operands: 8
6Literal
7ExprTuple9
8ExprTuple28, 10
9Lambdaparameters: 22
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20
18Operationoperator: 21
operands: 22
19Literal
20ExprRangelambda_map: 23
start_index: 27
end_index: 28
21Literal
22ExprTuple24
23Lambdaparameter: 35
body: 25
24ExprRangelambda_map: 26
start_index: 27
end_index: 28
25Operationoperator: 29
operands: 30
26Lambdaparameter: 35
body: 31
27Literal
28Variable
29Literal
30ExprTuple31, 32
31IndexedVarvariable: 33
index: 35
32Literal
33Variable
34ExprTuple35
35Variable