logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.addition

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 ExprTuple, K, Lambda, V, x
from proveit.linear_algebra import VecAdd, VecSpaces, VecZero
from proveit.logic import Equals, Forall
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecZero(V)
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [x], instance_expr = Equals(VecAdd(x, sub_expr1), sub_expr1), domain = V), domain = VecSpaces(K))))
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(K \mapsto \left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{x \in V}~\left(\left(x + \vec{0}\left(V\right)\right) = \vec{0}\left(V\right)\right)\right]\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: 20
body: 2
2Operationoperator: 8
operand: 4
3ExprTuple4
4Lambdaparameter: 32
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 12
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12
10Literal
11ExprTuple32, 13
12Lambdaparameter: 28
body: 15
13Operationoperator: 16
operand: 20
14ExprTuple28
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20Variable
21Literal
22ExprTuple25, 29
23Literal
24ExprTuple28, 32
25Operationoperator: 26
operands: 27
26Literal
27ExprTuple28, 29
28Variable
29Operationoperator: 30
operand: 32
30Literal
31ExprTuple32
32Variable