Expression of type ExprTuple¶

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.
# import Expression classes needed to build the expression
from proveit import ExprTuple, K, Lambda, V, a, b
from proveit.linear_algebra import InnerProd, Norm, VecAdd, VecSpaces
from proveit.logic import Equals, Forall
from proveit.numbers import Add, Exp, sqrt, two, zero

In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [a, b], instance_expr = Equals(Norm(VecAdd(a, b)), sqrt(Add(Exp(Norm(a), two), Exp(Norm(b), two)))), domain = V, condition = Equals(InnerProd(a, b), zero)), 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_{a, b \in V~|~\left \langle a, b\right \rangle = 0}~\left(\left \|a + b\right \| = \sqrt{\left(\left \|a\right \|^{2} + \left \|b\right \|^{2}\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: 9
operand: 4
3ExprTuple4
4Lambdaparameter: 39
body: 6
5ExprTuple39
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 13
8Operationoperator: 11
operands: 12
9Literal
10ExprTuple13
11Literal
12ExprTuple39, 14
13Lambdaparameters: 48
body: 15
14Operationoperator: 16
operand: 20
15Conditionalvalue: 18
condition: 19
16Literal
17ExprTuple20
18Operationoperator: 34
operands: 21
19Operationoperator: 22
operands: 23
20Variable
21ExprTuple24, 25
22Literal
23ExprTuple26, 27, 28
24Operationoperator: 59
operand: 36
25Operationoperator: 53
operands: 30
26Operationoperator: 32
operands: 31
27Operationoperator: 32
operands: 33
28Operationoperator: 34
operands: 35
29ExprTuple36
30ExprTuple37, 38
31ExprTuple61, 39
32Literal
33ExprTuple62, 39
34Literal
35ExprTuple40, 41
36Operationoperator: 42
operands: 48
37Operationoperator: 43
operands: 44
38Operationoperator: 45
operands: 46
39Variable
40Operationoperator: 47
operands: 48
41Literal
42Literal
43Literal
44ExprTuple49, 50
45Literal
46ExprTuple51, 57
47Literal
48ExprTuple61, 62
49Operationoperator: 53
operands: 52
50Operationoperator: 53
operands: 54
51Literal
52ExprTuple55, 57
53Literal
54ExprTuple56, 57
55Operationoperator: 59
operand: 61
56Operationoperator: 59
operand: 62
57Literal
58ExprTuple61
59Literal
60ExprTuple62
61Variable
62Variable