import proveit
from proveit import defaults
from proveit import m, x, A, B
from proveit.numbers import two
from proveit.logic import Union, Intersect
from proveit.logic.sets.inclusion import subset_eq_def
from proveit.logic.sets.unification import union_def
from proveit.logic.sets.intersection import intersection_def
theory = proveit.Theory() # the theorem's theory
%proving intersection_subset_eq_union
subset_eq_def
subset_eq_def_inst = subset_eq_def.instantiate({A:Intersect(A, B), B:Union(A, B)})
defaults.assumptions = [subset_eq_def_inst.rhs.condition]
intersection_def_inst = intersection_def.instantiate({m:two, x:x, A:[A, B]}, auto_simplify=False)
intersection_def_inst.derive_right_via_equality()
union_def_inst = union_def.instantiate({m:two, x:x, A:[A, B]}, auto_simplify=False)
union_def_inst.rhs.prove()
union_def_inst.derive_left_via_equality()
subset_eq_def_inst.rhs.prove()
subset_eq_def_inst.derive_left_via_equality()
%qed