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, VecZero, lin_comb_axn, some_nonzero_a
from proveit.logic import Equals, Exists, Forall, InSet, Set
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(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(), 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} \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} \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: 56
operands: 5
3Literal
4ExprTuple6
5ExprTuple60, 7
6Lambdaparameters: 25
body: 8
7Literal
8Conditionalvalue: 9
condition: 10
9Operationoperator: 36
operands: 11
10Operationoperator: 38
operands: 12
11ExprTuple13, 14
12ExprTuple15
13Operationoperator: 56
operands: 16
14Operationoperator: 17
operand: 22
15ExprRangelambda_map: 19
start_index: 59
end_index: 60
16ExprTuple20, 21
17Literal
18ExprTuple22
19Lambdaparameter: 74
body: 23
20Operationoperator: 24
operands: 25
21Operationoperator: 26
operand: 52
22Lambdaparameters: 27
body: 28
23Operationoperator: 56
operands: 29
24Literal
25ExprTuple30
26Literal
27ExprTuple31
28Conditionalvalue: 32
condition: 33
29ExprTuple68, 52
30ExprRangelambda_map: 34
start_index: 59
end_index: 60
31ExprRangelambda_map: 35
start_index: 59
end_index: 60
32Operationoperator: 36
operands: 37
33Operationoperator: 38
operands: 39
34Lambdaparameter: 74
body: 68
35Lambdaparameter: 74
body: 69
36Literal
37ExprTuple40, 41
38Literal
39ExprTuple42, 43
40Operationoperator: 44
operands: 45
41Operationoperator: 46
operand: 52
42ExprRangelambda_map: 48
start_index: 59
end_index: 60
43Operationoperator: 49
operands: 50
44Literal
45ExprTuple51
46Literal
47ExprTuple52
48Lambdaparameter: 74
body: 53
49Literal
50ExprTuple54
51ExprRangelambda_map: 55
start_index: 59
end_index: 60
52Variable
53Operationoperator: 56
operands: 57
54ExprRangelambda_map: 58
start_index: 59
end_index: 60
55Lambdaparameter: 74
body: 61
56Literal
57ExprTuple69, 62
58Lambdaparameter: 74
body: 63
59Literal
60Variable
61Operationoperator: 64
operands: 65
62Variable
63Operationoperator: 66
operands: 67
64Literal
65ExprTuple69, 68
66Literal
67ExprTuple69, 70
68IndexedVarvariable: 71
index: 74
69IndexedVarvariable: 72
index: 74
70Literal
71Variable
72Variable
73ExprTuple74
74Variable