import proveit
from proveit import defaults
from proveit import m, x, y, A, B, S
from proveit.numbers import one, two
from proveit.logic import InSet, Intersect
from proveit.logic.sets.inclusion import subset_eq_def
from proveit.logic.sets.intersection import intersection_def
theory = proveit.Theory() # the theorem's theory
%proving intersection_is_subset_eq
defaults.assumptions = [intersection_is_subset_eq.condition]
intersection_is_subset_eq.condition.instantiate()
subset_eq_def
subset_eq_def_inst = subset_eq_def.instantiate({A:Intersect(A, B), B:A})
defaults.assumptions = [*defaults.assumptions, subset_eq_def_inst.rhs.condition]
intersection_def_inst = intersection_def.instantiate({m:two, x:x, A:[A, B]})
intersection_def_inst.derive_right_via_equality()
subset_eq_def_inst.rhs.prove()
subset_eq_def_inst.derive_left_via_equality()
%qed