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 Span, SpanningSets
from proveit.logic import Equals, Forall, InSet, 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, SpanningSets(V)), Equals(V, Span(sub_expr1))), 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(\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{SpanningSets}\left(V\right)\right) = \left(V = \textrm{Span}\left(\left\{x_{1}, x_{2}, \ldots, x_{n}\right\}\right)\right)\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: 28
operands: 5
3Literal
4ExprTuple6
5ExprTuple37, 7
6Lambdaparameters: 33
body: 8
7Literal
8Conditionalvalue: 9
condition: 10
9Operationoperator: 18
operands: 11
10Operationoperator: 12
operands: 13
11ExprTuple14, 15
12Literal
13ExprTuple16
14Operationoperator: 28
operands: 17
15Operationoperator: 18
operands: 19
16ExprRangelambda_map: 20
start_index: 36
end_index: 37
17ExprTuple30, 21
18Literal
19ExprTuple31, 22
20Lambdaparameter: 41
body: 23
21Operationoperator: 24
operand: 31
22Operationoperator: 26
operand: 30
23Operationoperator: 28
operands: 29
24Literal
25ExprTuple31
26Literal
27ExprTuple30
28Literal
29ExprTuple38, 31
30Operationoperator: 32
operands: 33
31Variable
32Literal
33ExprTuple34
34ExprRangelambda_map: 35
start_index: 36
end_index: 37
35Lambdaparameter: 41
body: 38
36Literal
37Variable
38IndexedVarvariable: 39
index: 41
39Variable
40ExprTuple41
41Variable