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 lin_comb_axn
from proveit.logic import Forall, InSet
In [2]:
# build up the expression from sub-expressions
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)
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_{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]
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: 9
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple5
4Conditionalvalue: 6
condition: 7
5ExprRangelambda_map: 8
start_index: 35
end_index: 36
6Operationoperator: 9
operand: 12
7Operationoperator: 23
operands: 11
8Lambdaparameter: 48
body: 43
9Literal
10ExprTuple12
11ExprTuple13
12Lambdaparameters: 14
body: 15
13ExprRangelambda_map: 16
start_index: 35
end_index: 36
14ExprTuple17
15Conditionalvalue: 18
condition: 19
16Lambdaparameter: 48
body: 20
17ExprRangelambda_map: 21
start_index: 35
end_index: 36
18Operationoperator: 37
operands: 22
19Operationoperator: 23
operands: 24
20Operationoperator: 37
operands: 25
21Lambdaparameter: 48
body: 44
22ExprTuple26, 40
23Literal
24ExprTuple27
25ExprTuple43, 28
26Operationoperator: 29
operands: 30
27ExprRangelambda_map: 31
start_index: 35
end_index: 36
28Variable
29Literal
30ExprTuple32
31Lambdaparameter: 48
body: 33
32ExprRangelambda_map: 34
start_index: 35
end_index: 36
33Operationoperator: 37
operands: 38
34Lambdaparameter: 48
body: 39
35Literal
36Variable
37Literal
38ExprTuple44, 40
39Operationoperator: 41
operands: 42
40Variable
41Literal
42ExprTuple43, 44
43IndexedVarvariable: 45
index: 48
44IndexedVarvariable: 46
index: 48
45Variable
46Variable
47ExprTuple48
48Variable