logo

Expression of type Conditional

from the theory of proveit.linear_algebra.vector_sets

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 Span, VecSpaces, lin_comb_axn
from proveit.logic import Equals, Forall, InClass, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [n], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(Span(Set(x_1_to_n)), SetOfAll(instance_param_or_params = [a_1_to_n], instance_element = lin_comb_axn, domain = K)).with_wrapping_at(2), domain = V).with_wrapping(), domain = NaturalPos), 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_{n \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{x_{1}, x_{2}, \ldots, x_{n} \in V}~\\
\left(\begin{array}{c} \begin{array}{l} \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right) =  \\ \left\{\left(a_{1} \cdot x_{1}\right) +  \left(a_{2} \cdot x_{2}\right) +  \ldots +  \left(a_{n} \cdot x_{n}\right)\right\}_{a_{1}, a_{2}, \ldots, a_{n} \in K} \end{array} \end{array}\right)\end{array}\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: 14
operand: 6
2Operationoperator: 4
operands: 5
3ExprTuple6
4Literal
5ExprTuple45, 7
6Lambdaparameter: 57
body: 9
7Operationoperator: 10
operand: 66
8ExprTuple57
9Conditionalvalue: 12
condition: 13
10Literal
11ExprTuple66
12Operationoperator: 14
operand: 17
13Operationoperator: 62
operands: 16
14Literal
15ExprTuple17
16ExprTuple57, 18
17Lambdaparameters: 37
body: 19
18Literal
19Conditionalvalue: 20
condition: 21
20Operationoperator: 22
operands: 23
21Operationoperator: 50
operands: 24
22Literal
23ExprTuple25, 26
24ExprTuple27
25Operationoperator: 28
operand: 33
26Operationoperator: 30
operand: 34
27ExprRangelambda_map: 32
start_index: 56
end_index: 57
28Literal
29ExprTuple33
30Literal
31ExprTuple34
32Lambdaparameter: 70
body: 35
33Operationoperator: 36
operands: 37
34Lambdaparameters: 38
body: 39
35Operationoperator: 62
operands: 40
36Literal
37ExprTuple41
38ExprTuple42
39Conditionalvalue: 43
condition: 44
40ExprTuple64, 45
41ExprRangelambda_map: 46
start_index: 56
end_index: 57
42ExprRangelambda_map: 47
start_index: 56
end_index: 57
43Operationoperator: 48
operands: 49
44Operationoperator: 50
operands: 51
45Variable
46Lambdaparameter: 70
body: 64
47Lambdaparameter: 70
body: 65
48Literal
49ExprTuple52
50Literal
51ExprTuple53
52ExprRangelambda_map: 54
start_index: 56
end_index: 57
53ExprRangelambda_map: 55
start_index: 56
end_index: 57
54Lambdaparameter: 70
body: 58
55Lambdaparameter: 70
body: 59
56Literal
57Variable
58Operationoperator: 60
operands: 61
59Operationoperator: 62
operands: 63
60Literal
61ExprTuple65, 64
62Literal
63ExprTuple65, 66
64IndexedVarvariable: 67
index: 70
65IndexedVarvariable: 68
index: 70
66Variable
67Variable
68Variable
69ExprTuple70
70Variable