logo
In [1]:
import proveit
from proveit import ExprTuple, IndexedVar, Function, Variable
from proveit import a, k, l, n, x, y, z, A, B, P, Q, Px, Qx
# from proveit.logic import iter_q1k_x_iter1l, x_iter1l
from proveit.numbers import zero, one, two, Natural, NaturalPos
from proveit.logic import And, Equals, Forall, InSet, TRUE, FALSE, Or, Boolean
from proveit.core_expr_types import x_1_to_n
from proveit.logic.sets.inclusion  import subset_eq_def
from proveit.logic.booleans.quantification.universality  import forall_in_bool
theory = proveit.Theory() # the theorem's theory
In [2]:
%proving subset_eq_is_bool
With these allowed/disallowed theorem/theory presumptions (e.g., to avoid circular dependencies), we begin our proof of
subset_eq_is_bool:
(see dependencies)
In [3]:
subset_eq_def
In [4]:
subset_eq_def_inst = subset_eq_def.instantiate()
subset_eq_def_inst:  ⊢  
In [5]:
subset_eq_def_inst_rhs = subset_eq_def_inst.rhs
subset_eq_def_inst_rhs:
In [6]:
# this somehow loses the domain A for x
#subset_eq_def_inst_rhs.deduce_in_bool()
In [7]:
# addition 20200730 by wdc
InSet(Forall(x, InSet(x, B), domain=A), Boolean)
In [8]:
# addition 20200730 by wdc
# still loses the domain A for x
#Forall(x, InSet(x, B), domain=A).deduce_in_bool()
In [9]:
# subset_eq_def_spec_r_h_s.deduce_in_bool()
In [10]:
forall_in_bool
In [11]:
forall_in_bool_inst = forall_in_bool.instantiate(
        {n:one, Px:InSet(x, B), x:ExprTuple(x)})
forall_in_bool_inst:  ⊢  
In [12]:
# from the original, kept here temporarily to guide update
# forall_in_bool_spec = forall_in_bool.instantiate({k:one, l:one, Px:InSet(x, B), QQ:[Q]}, relabel_map={xx:[x]})
In [13]:
# in proof.py we would likely use the same check_param_var method used in lambda_expr.py
In [14]:
forall_piece = forall_in_bool_inst.operands[0]
forall_piece:
In [15]:
x_1 = IndexedVar(x, one)
x_1:
In [16]:
# updated/adapted from original; not clear why this is being done
forall_piece.instantiate({x_1:ExprTuple(x)}, assumptions=[forall_piece])
In [17]:
# recall:
forall_in_bool_inst
In [18]:
# updated this from original; not clear why this is being done
the_inner_expr = forall_in_bool_inst.inner_expr()
the_inner_expr:
In [19]:
forall_in_bool_inst_expr = forall_in_bool_inst.expr
forall_in_bool_inst_expr:
In [20]:
# from original, but this no longer works:
# the_inner_expr.operands[1]
In [21]:
# from original, but no longer works:
# forall_in_bool_spec_expr.expr_info()
In [22]:
forall_in_bool_inst_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 9
operands: 1
1ExprTuple2, 3
2Operationoperator: 4
operand: 6
3Literal
4Literal
5ExprTuple6
6Lambdaparameter: 11
body: 8
7ExprTuple11
8Operationoperator: 9
operands: 10
9Literal
10ExprTuple11, 12
11Variable
12Variable
In [23]:
# original
# Q1 = Variable('Q1');
# Q2 = Variable('Q2');
# forall_in_bool_spec_testing = forall_in_bool.instantiate({k:one, l:one, Px:InSet(x, B), QQ:[Q1]})
In [24]:
forall_in_bool
In [25]:
# new version?
Q1 = Variable('Q1');
Q2 = Variable('Q2');
forall_in_bool_spec_testing = forall_in_bool.instantiate({n:one, Px:InSet(x, B), x:(Q1)})
forall_in_bool_spec_testing:  ⊢  
In [26]:
# original; can't seem to relabel now in this way? Even using
# a defined IndexedVar(Q1, one)
# forall_in_bool_spec_testing.relabel({Q1:Q2})
In [27]:
# forall_in_bool_spec_spec = forall_in_bool_spec.instantiate({xx:[x]})
In [28]:
# forall_in_bool_spec_spec_spec = forall_in_bool_spec_spec.instantiate({x_iter1l:[x]})
In [29]:
# original
# subset_eq_def_spec_r_h_s
In [30]:
# new
subset_eq_def_inst_rhs
In [31]:
# original
# subset_eq_def_spec_r_h_s.all_instance_vars()
In [32]:
# new
subset_eq_def_inst_rhs.all_instance_vars()
In [33]:
# original
# PxNew = Operation(P, [y, *subset_eq_def_spec_r_h_s.all_instance_vars(), z])
In [34]:
# new
PxNew = Function(P, [y, *subset_eq_def_inst_rhs.all_instance_vars(), z])
PxNew:
In [35]:
# original
# subset_eq_def_spec_r_h_s.instance_expr
In [36]:
# new
subset_eq_def_inst_rhs.instance_expr
In [37]:
# subset_eq_def_spec_r_h_s.deduce_in_bool()
In [38]:
#subset_eq_def_inst_rhs.deduce_in_bool()
In [39]:
# %qed