logo

Expression of type Forall

from the theory of proveit.linear_algebra.scalar_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 K, V
from proveit.core_expr_types import a_1_to_n, x_1_to_n
from proveit.linear_algebra import VecSpaces, lin_comb_axn
from proveit.logic import Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [a_1_to_n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = InSet(lin_comb_axn, V), domain = V), domain = K), 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())
\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{a_{1}, a_{2}, \ldots, a_{n} \in K}~\left[\forall_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\left(\left(\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right) \in V\right)\right]\right]
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 20
operand: 2
1ExprTuple2
2Lambdaparameter: 51
body: 4
3ExprTuple51
4Conditionalvalue: 5
condition: 6
5Operationoperator: 20
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple51, 11
10Lambdaparameters: 12
body: 13
11Operationoperator: 14
operand: 39
12ExprTuple16
13Conditionalvalue: 17
condition: 18
14Literal
15ExprTuple39
16ExprRangelambda_map: 19
start_index: 46
end_index: 47
17Operationoperator: 20
operand: 23
18Operationoperator: 34
operands: 22
19Lambdaparameter: 59
body: 54
20Literal
21ExprTuple23
22ExprTuple24
23Lambdaparameters: 25
body: 26
24ExprRangelambda_map: 27
start_index: 46
end_index: 47
25ExprTuple28
26Conditionalvalue: 29
condition: 30
27Lambdaparameter: 59
body: 31
28ExprRangelambda_map: 32
start_index: 46
end_index: 47
29Operationoperator: 48
operands: 33
30Operationoperator: 34
operands: 35
31Operationoperator: 48
operands: 36
32Lambdaparameter: 59
body: 55
33ExprTuple37, 51
34Literal
35ExprTuple38
36ExprTuple54, 39
37Operationoperator: 40
operands: 41
38ExprRangelambda_map: 42
start_index: 46
end_index: 47
39Variable
40Literal
41ExprTuple43
42Lambdaparameter: 59
body: 44
43ExprRangelambda_map: 45
start_index: 46
end_index: 47
44Operationoperator: 48
operands: 49
45Lambdaparameter: 59
body: 50
46Literal
47Variable
48Literal
49ExprTuple55, 51
50Operationoperator: 52
operands: 53
51Variable
52Literal
53ExprTuple54, 55
54IndexedVarvariable: 56
index: 59
55IndexedVarvariable: 57
index: 59
56Variable
57Variable
58ExprTuple59
59Variable