logo

Expression of type ExprTuple

from the theory of proveit.trigonometry

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, a, b, r
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Abs, Exp, Mult, Real, RealNonNeg, e, frac, i, subtract, two
from proveit.trigonometry import Sin
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(r, Conditional(Forall(instance_param_or_params = [a, b], instance_expr = Equals(Abs(subtract(Mult(r, Exp(e, Mult(i, a))), Mult(r, Exp(e, Mult(i, b))))), Mult(two, r, Sin(frac(Abs(subtract(a, b)), two)))), domain = Real), InSet(r, RealNonNeg))))
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(r \mapsto \left\{\forall_{a, b \in \mathbb{R}}~\left(\left|\left(r \cdot \mathsf{e}^{\mathsf{i} \cdot a}\right) - \left(r \cdot \mathsf{e}^{\mathsf{i} \cdot b}\right)\right| = \left(2 \cdot r \cdot \sin{\frac{\left|a - b\right|}{2}}\right)\right) \textrm{ if } r \in \mathbb{R}^{\ge 0}\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: 50
body: 3
2ExprTuple50
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 26
operands: 8
6Literal
7ExprTuple9
8ExprTuple50, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple60, 67
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 47
operand: 28
20Operationoperator: 62
operands: 24
21Operationoperator: 26
operands: 25
22Operationoperator: 26
operands: 27
23ExprTuple28
24ExprTuple44, 50, 29
25ExprTuple60, 30
26Literal
27ExprTuple67, 30
28Operationoperator: 56
operands: 31
29Operationoperator: 32
operand: 36
30Literal
31ExprTuple34, 35
32Literal
33ExprTuple36
34Operationoperator: 62
operands: 37
35Operationoperator: 64
operand: 42
36Operationoperator: 39
operands: 40
37ExprTuple50, 41
38ExprTuple42
39Literal
40ExprTuple43, 44
41Operationoperator: 54
operands: 45
42Operationoperator: 62
operands: 46
43Operationoperator: 47
operand: 52
44Literal
45ExprTuple58, 49
46ExprTuple50, 51
47Literal
48ExprTuple52
49Operationoperator: 62
operands: 53
50Variable
51Operationoperator: 54
operands: 55
52Operationoperator: 56
operands: 57
53ExprTuple66, 60
54Literal
55ExprTuple58, 59
56Literal
57ExprTuple60, 61
58Literal
59Operationoperator: 62
operands: 63
60Variable
61Operationoperator: 64
operand: 67
62Literal
63ExprTuple66, 67
64Literal
65ExprTuple67
66Literal
67Variable