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, V, n
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra import Bases, LinDepSets, SpanningSets
from proveit.logic import And, Equals, Forall, InSet, NotInSet, Set
from proveit.numbers import NaturalPos
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Set(x_1_to_n)
expr = Conditional(Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(InSet(sub_expr1, Bases(V)), And(InSet(sub_expr1, SpanningSets(V)), NotInSet(sub_expr1, LinDepSets(V))).with_wrapping_at(2)).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{Bases}\left(V\right)\right) =  \\ \left(\begin{array}{c} \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{SpanningSets}\left(V\right)\right) \land  \\ \left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \notin \textrm{LinDepSets}\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: 29
operands: 5
3Literal
4ExprTuple6
5ExprTuple43, 7
6Lambdaparameters: 36
body: 8
7Literal
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operands: 12
10Operationoperator: 18
operands: 13
11Literal
12ExprTuple14, 15
13ExprTuple16
14Operationoperator: 29
operands: 17
15Operationoperator: 18
operands: 19
16ExprRangelambda_map: 20
start_index: 42
end_index: 43
17ExprTuple32, 21
18Literal
19ExprTuple22, 23
20Lambdaparameter: 47
body: 24
21Operationoperator: 25
operand: 40
22Operationoperator: 29
operands: 26
23Operationoperator: 27
operands: 28
24Operationoperator: 29
operands: 30
25Literal
26ExprTuple32, 31
27Literal
28ExprTuple32, 33
29Literal
30ExprTuple44, 40
31Operationoperator: 34
operand: 40
32Operationoperator: 35
operands: 36
33Operationoperator: 37
operand: 40
34Literal
35Literal
36ExprTuple39
37Literal
38ExprTuple40
39ExprRangelambda_map: 41
start_index: 42
end_index: 43
40Variable
41Lambdaparameter: 47
body: 44
42Literal
43Variable
44IndexedVarvariable: 45
index: 47
45Variable
46ExprTuple47
47Variable