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 LinDepSets, VecSpaces, VecZero, lin_comb_axn, some_nonzero_a
from proveit.logic import Equals, Exists, Forall, InClass, InSet, Set
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(InSet(Set(x_1_to_n), LinDepSets(V)), Exists(instance_param_or_params = [a_1_to_n], instance_expr = Equals(lin_comb_axn, VecZero(V)), domain = K, condition = some_nonzero_a).with_wrapping()).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} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{LinDepSets}\left(V\right)\right) =  \\ \left[\begin{array}{l}\exists_{a_{1}, a_{2}, \ldots, a_{n} \in K~|~\left(a_{1} \neq 0\right) \lor  \left(a_{2} \neq 0\right) \lor  \ldots \lor  \left(a_{n} \neq 0\right)}~\\
\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) = \vec{0}\left(V\right)\right)\end{array}\right] \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
5ExprTuple63, 7
6Lambdaparameter: 71
body: 9
7Operationoperator: 10
operand: 73
8ExprTuple71
9Conditionalvalue: 12
condition: 13
10Literal
11ExprTuple73
12Operationoperator: 14
operand: 17
13Operationoperator: 67
operands: 16
14Literal
15ExprTuple17
16ExprTuple71, 18
17Lambdaparameters: 36
body: 19
18Literal
19Conditionalvalue: 20
condition: 21
20Operationoperator: 47
operands: 22
21Operationoperator: 49
operands: 23
22ExprTuple24, 25
23ExprTuple26
24Operationoperator: 67
operands: 27
25Operationoperator: 28
operand: 33
26ExprRangelambda_map: 30
start_index: 70
end_index: 71
27ExprTuple31, 32
28Literal
29ExprTuple33
30Lambdaparameter: 85
body: 34
31Operationoperator: 35
operands: 36
32Operationoperator: 37
operand: 63
33Lambdaparameters: 38
body: 39
34Operationoperator: 67
operands: 40
35Literal
36ExprTuple41
37Literal
38ExprTuple42
39Conditionalvalue: 43
condition: 44
40ExprTuple79, 63
41ExprRangelambda_map: 45
start_index: 70
end_index: 71
42ExprRangelambda_map: 46
start_index: 70
end_index: 71
43Operationoperator: 47
operands: 48
44Operationoperator: 49
operands: 50
45Lambdaparameter: 85
body: 79
46Lambdaparameter: 85
body: 80
47Literal
48ExprTuple51, 52
49Literal
50ExprTuple53, 54
51Operationoperator: 55
operands: 56
52Operationoperator: 57
operand: 63
53ExprRangelambda_map: 59
start_index: 70
end_index: 71
54Operationoperator: 60
operands: 61
55Literal
56ExprTuple62
57Literal
58ExprTuple63
59Lambdaparameter: 85
body: 64
60Literal
61ExprTuple65
62ExprRangelambda_map: 66
start_index: 70
end_index: 71
63Variable
64Operationoperator: 67
operands: 68
65ExprRangelambda_map: 69
start_index: 70
end_index: 71
66Lambdaparameter: 85
body: 72
67Literal
68ExprTuple80, 73
69Lambdaparameter: 85
body: 74
70Literal
71Variable
72Operationoperator: 75
operands: 76
73Variable
74Operationoperator: 77
operands: 78
75Literal
76ExprTuple80, 79
77Literal
78ExprTuple80, 81
79IndexedVarvariable: 82
index: 85
80IndexedVarvariable: 83
index: 85
81Literal
82Variable
83Variable
84ExprTuple85
85Variable