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, lin_comb_axn
from proveit.logic import Equals, Forall, InSet, Set, SetOfAll
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Conditional(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(), 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\{\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} \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: 3
operand: 6
2Operationoperator: 51
operands: 5
3Literal
4ExprTuple6
5ExprTuple46, 7
6Lambdaparameters: 26
body: 8
7Literal
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operands: 12
10Operationoperator: 39
operands: 13
11Literal
12ExprTuple14, 15
13ExprTuple16
14Operationoperator: 17
operand: 22
15Operationoperator: 19
operand: 23
16ExprRangelambda_map: 21
start_index: 45
end_index: 46
17Literal
18ExprTuple22
19Literal
20ExprTuple23
21Lambdaparameter: 59
body: 24
22Operationoperator: 25
operands: 26
23Lambdaparameters: 27
body: 28
24Operationoperator: 51
operands: 29
25Literal
26ExprTuple30
27ExprTuple31
28Conditionalvalue: 32
condition: 33
29ExprTuple53, 34
30ExprRangelambda_map: 35
start_index: 45
end_index: 46
31ExprRangelambda_map: 36
start_index: 45
end_index: 46
32Operationoperator: 37
operands: 38
33Operationoperator: 39
operands: 40
34Variable
35Lambdaparameter: 59
body: 53
36Lambdaparameter: 59
body: 54
37Literal
38ExprTuple41
39Literal
40ExprTuple42
41ExprRangelambda_map: 43
start_index: 45
end_index: 46
42ExprRangelambda_map: 44
start_index: 45
end_index: 46
43Lambdaparameter: 59
body: 47
44Lambdaparameter: 59
body: 48
45Literal
46Variable
47Operationoperator: 49
operands: 50
48Operationoperator: 51
operands: 52
49Literal
50ExprTuple54, 53
51Literal
52ExprTuple54, 55
53IndexedVarvariable: 56
index: 59
54IndexedVarvariable: 57
index: 59
55Variable
56Variable
57Variable
58ExprTuple59
59Variable