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, a, b, x, y
from proveit.linear_algebra import VecSpaces, binary_lin_comb_ax_by
from proveit.logic import Forall, InSet
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [K], instance_expr = Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [a, b], instance_expr = Forall(instance_param_or_params = [x, y], instance_expr = InSet(binary_lin_comb_ax_by, 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_{K}~\left[\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{a, b \in K}~\left[\forall_{x, y \in V}~\left(\left(\left(a \cdot x\right) + \left(b \cdot y\right)\right) \in V\right)\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: 21
operand: 2
1ExprTuple2
2Lambdaparameter: 33
body: 3
3Operationoperator: 21
operand: 5
4ExprTuple5
5Lambdaparameter: 47
body: 7
6ExprTuple47
7Conditionalvalue: 8
condition: 9
8Operationoperator: 21
operand: 13
9Operationoperator: 11
operands: 12
10ExprTuple13
11Literal
12ExprTuple47, 14
13Lambdaparameters: 15
body: 16
14Operationoperator: 17
operand: 33
15ExprTuple51, 53
16Conditionalvalue: 19
condition: 20
17Literal
18ExprTuple33
19Operationoperator: 21
operand: 24
20Operationoperator: 35
operands: 23
21Literal
22ExprTuple24
23ExprTuple25, 26
24Lambdaparameters: 27
body: 28
25Operationoperator: 43
operands: 29
26Operationoperator: 43
operands: 30
27ExprTuple52, 54
28Conditionalvalue: 31
condition: 32
29ExprTuple51, 33
30ExprTuple53, 33
31Operationoperator: 43
operands: 34
32Operationoperator: 35
operands: 36
33Variable
34ExprTuple37, 47
35Literal
36ExprTuple38, 39
37Operationoperator: 40
operands: 41
38Operationoperator: 43
operands: 42
39Operationoperator: 43
operands: 44
40Literal
41ExprTuple45, 46
42ExprTuple52, 47
43Literal
44ExprTuple54, 47
45Operationoperator: 49
operands: 48
46Operationoperator: 49
operands: 50
47Variable
48ExprTuple51, 52
49Literal
50ExprTuple53, 54
51Variable
52Variable
53Variable
54Variable