logo

Expression of type Conditional

from the theory of proveit.linear_algebra.linear_maps

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, Lambda, P, Px, V, W, c, x
from proveit.linear_algebra import LinMap, ScalarMult, VecSpaces
from proveit.logic import And, Equals, Forall, InClass, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = VecSpaces(K)
expr = Conditional(Forall(instance_param_or_params = [c], instance_expr = Forall(instance_param_or_params = [P], instance_expr = Equals(ScalarMult(c, P), Lambda(x, Conditional(ScalarMult(c, Px), InSet(x, V)))), domain = LinMap(V, W)), domain = K), And(InClass(V, sub_expr1), InClass(W, sub_expr1)))
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_{c \in K}~\left[\forall_{P \in \mathcal{L}\left(V, W\right)}~\left(\left(c \cdot P\right) = \left[x \mapsto \left\{c \cdot P\left(x\right) \textrm{ if } x \in V\right..\right]\right)\right] \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right) ,  W \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: 17
operand: 6
2Operationoperator: 4
operands: 5
3ExprTuple6
4Literal
5ExprTuple7, 8
6Lambdaparameter: 45
body: 10
7Operationoperator: 12
operands: 11
8Operationoperator: 12
operands: 13
9ExprTuple45
10Conditionalvalue: 14
condition: 15
11ExprTuple47, 16
12Literal
13ExprTuple40, 16
14Operationoperator: 17
operand: 22
15Operationoperator: 43
operands: 19
16Operationoperator: 20
operand: 23
17Literal
18ExprTuple22
19ExprTuple45, 23
20Literal
21ExprTuple23
22Lambdaparameter: 48
body: 25
23Variable
24ExprTuple48
25Conditionalvalue: 26
condition: 27
26Operationoperator: 28
operands: 29
27Operationoperator: 43
operands: 30
28Literal
29ExprTuple31, 32
30ExprTuple48, 33
31Operationoperator: 41
operands: 34
32Lambdaparameter: 50
body: 35
33Operationoperator: 36
operands: 37
34ExprTuple45, 48
35Conditionalvalue: 38
condition: 39
36Literal
37ExprTuple47, 40
38Operationoperator: 41
operands: 42
39Operationoperator: 43
operands: 44
40Variable
41Literal
42ExprTuple45, 46
43Literal
44ExprTuple50, 47
45Variable
46Operationoperator: 48
operand: 50
47Variable
48Variable
49ExprTuple50
50Variable