logo

Expression of type Conditional

from the theory of proveit.linear_algebra.scalar_multiplication

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, a, b, x, y
from proveit.linear_algebra import VecSpaces, binary_lin_comb_ax_by
from proveit.logic import Forall, InClass, InSet
In [2]:
# build up the expression from sub-expressions
expr = Conditional(Forall(instance_param_or_params = [a, b], instance_expr = Forall(instance_param_or_params = [x, y], instance_expr = InSet(binary_lin_comb_ax_by, V), domain = V), domain = K), 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_{a, b \in K}~\left[\forall_{x, y \in V}~\left(\left(\left(a \cdot x\right) + \left(b \cdot y\right)\right) \in V\right)\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
5ExprTuple40, 7
6Lambdaparameters: 8
body: 9
7Operationoperator: 10
operand: 26
8ExprTuple44, 46
9Conditionalvalue: 12
condition: 13
10Literal
11ExprTuple26
12Operationoperator: 14
operand: 17
13Operationoperator: 28
operands: 16
14Literal
15ExprTuple17
16ExprTuple18, 19
17Lambdaparameters: 20
body: 21
18Operationoperator: 36
operands: 22
19Operationoperator: 36
operands: 23
20ExprTuple45, 47
21Conditionalvalue: 24
condition: 25
22ExprTuple44, 26
23ExprTuple46, 26
24Operationoperator: 36
operands: 27
25Operationoperator: 28
operands: 29
26Variable
27ExprTuple30, 40
28Literal
29ExprTuple31, 32
30Operationoperator: 33
operands: 34
31Operationoperator: 36
operands: 35
32Operationoperator: 36
operands: 37
33Literal
34ExprTuple38, 39
35ExprTuple45, 40
36Literal
37ExprTuple47, 40
38Operationoperator: 42
operands: 41
39Operationoperator: 42
operands: 43
40Variable
41ExprTuple44, 45
42Literal
43ExprTuple46, 47
44Variable
45Variable
46Variable
47Variable