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 x_1_to_n
from proveit.linear_algebra import Bases, LinDepSets, SpanningSets, VecSpaces
from proveit.logic import And, Equals, Forall, InClass, 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 = [n], instance_expr = 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(), 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{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}\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: 15
operand: 6
2Operationoperator: 4
operands: 5
3ExprTuple6
4Literal
5ExprTuple52, 7
6Lambdaparameter: 55
body: 9
7Operationoperator: 10
operand: 14
8ExprTuple55
9Conditionalvalue: 12
condition: 13
10Literal
11ExprTuple14
12Operationoperator: 15
operand: 18
13Operationoperator: 41
operands: 17
14Variable
15Literal
16ExprTuple18
17ExprTuple55, 19
18Lambdaparameters: 48
body: 20
19Literal
20Conditionalvalue: 21
condition: 22
21Operationoperator: 23
operands: 24
22Operationoperator: 30
operands: 25
23Literal
24ExprTuple26, 27
25ExprTuple28
26Operationoperator: 41
operands: 29
27Operationoperator: 30
operands: 31
28ExprRangelambda_map: 32
start_index: 54
end_index: 55
29ExprTuple44, 33
30Literal
31ExprTuple34, 35
32Lambdaparameter: 59
body: 36
33Operationoperator: 37
operand: 52
34Operationoperator: 41
operands: 38
35Operationoperator: 39
operands: 40
36Operationoperator: 41
operands: 42
37Literal
38ExprTuple44, 43
39Literal
40ExprTuple44, 45
41Literal
42ExprTuple56, 52
43Operationoperator: 46
operand: 52
44Operationoperator: 47
operands: 48
45Operationoperator: 49
operand: 52
46Literal
47Literal
48ExprTuple51
49Literal
50ExprTuple52
51ExprRangelambda_map: 53
start_index: 54
end_index: 55
52Variable
53Lambdaparameter: 59
body: 56
54Literal
55Variable
56IndexedVarvariable: 57
index: 59
57Variable
58ExprTuple59
59Variable