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, n
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
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [K], instance_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))), InSet(n, NaturalPos))
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_{K}~\left[\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]\right] \textrm{ if } n \in \mathbb{N}^+\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: 27
operand: 5
2Operationoperator: 55
operands: 4
3ExprTuple5
4ExprTuple54, 6
5Lambdaparameter: 46
body: 7
6Literal
7Operationoperator: 27
operand: 9
8ExprTuple9
9Lambdaparameter: 58
body: 11
10ExprTuple58
11Conditionalvalue: 12
condition: 13
12Operationoperator: 27
operand: 17
13Operationoperator: 15
operands: 16
14ExprTuple17
15Literal
16ExprTuple58, 18
17Lambdaparameters: 19
body: 20
18Operationoperator: 21
operand: 46
19ExprTuple23
20Conditionalvalue: 24
condition: 25
21Literal
22ExprTuple46
23ExprRangelambda_map: 26
start_index: 53
end_index: 54
24Operationoperator: 27
operand: 30
25Operationoperator: 41
operands: 29
26Lambdaparameter: 66
body: 61
27Literal
28ExprTuple30
29ExprTuple31
30Lambdaparameters: 32
body: 33
31ExprRangelambda_map: 34
start_index: 53
end_index: 54
32ExprTuple35
33Conditionalvalue: 36
condition: 37
34Lambdaparameter: 66
body: 38
35ExprRangelambda_map: 39
start_index: 53
end_index: 54
36Operationoperator: 55
operands: 40
37Operationoperator: 41
operands: 42
38Operationoperator: 55
operands: 43
39Lambdaparameter: 66
body: 62
40ExprTuple44, 58
41Literal
42ExprTuple45
43ExprTuple61, 46
44Operationoperator: 47
operands: 48
45ExprRangelambda_map: 49
start_index: 53
end_index: 54
46Variable
47Literal
48ExprTuple50
49Lambdaparameter: 66
body: 51
50ExprRangelambda_map: 52
start_index: 53
end_index: 54
51Operationoperator: 55
operands: 56
52Lambdaparameter: 66
body: 57
53Literal
54Variable
55Literal
56ExprTuple62, 58
57Operationoperator: 59
operands: 60
58Variable
59Literal
60ExprTuple61, 62
61IndexedVarvariable: 63
index: 66
62IndexedVarvariable: 64
index: 66
63Variable
64Variable
65ExprTuple66
66Variable