logo

Expression of type Conditional

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 Conditional, 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, InClass, InSet
In [2]:
# build up the expression from sub-expressions
expr = Conditional(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), InClass(V, 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\{\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] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 16
operand: 6
2Operationoperator: 4
operands: 5
3ExprTuple6
4Literal
5ExprTuple47, 7
6Lambdaparameters: 8
body: 9
7Operationoperator: 10
operand: 35
8ExprTuple12
9Conditionalvalue: 13
condition: 14
10Literal
11ExprTuple35
12ExprRangelambda_map: 15
start_index: 42
end_index: 43
13Operationoperator: 16
operand: 19
14Operationoperator: 30
operands: 18
15Lambdaparameter: 55
body: 50
16Literal
17ExprTuple19
18ExprTuple20
19Lambdaparameters: 21
body: 22
20ExprRangelambda_map: 23
start_index: 42
end_index: 43
21ExprTuple24
22Conditionalvalue: 25
condition: 26
23Lambdaparameter: 55
body: 27
24ExprRangelambda_map: 28
start_index: 42
end_index: 43
25Operationoperator: 44
operands: 29
26Operationoperator: 30
operands: 31
27Operationoperator: 44
operands: 32
28Lambdaparameter: 55
body: 51
29ExprTuple33, 47
30Literal
31ExprTuple34
32ExprTuple50, 35
33Operationoperator: 36
operands: 37
34ExprRangelambda_map: 38
start_index: 42
end_index: 43
35Variable
36Literal
37ExprTuple39
38Lambdaparameter: 55
body: 40
39ExprRangelambda_map: 41
start_index: 42
end_index: 43
40Operationoperator: 44
operands: 45
41Lambdaparameter: 55
body: 46
42Literal
43Variable
44Literal
45ExprTuple51, 47
46Operationoperator: 48
operands: 49
47Variable
48Literal
49ExprTuple50, 51
50IndexedVarvariable: 52
index: 55
51IndexedVarvariable: 53
index: 55
52Variable
53Variable
54ExprTuple55
55Variable