def type_da(etangle: ETangle) -> TypeDA: components = [ type_da_in_left_grading(etangle, r) for r in range(0, len(etangle.left_points()) + 1) ] return TypeDA.direct_sum(components)
def type_da_in_left_grading(etangle: ETangle, i: int) -> TypeDA: out = TypeDA(etangle.ring, etangle.left_algebra, etangle.right_algebra, etangle.left_scalar_action, etangle.right_scalar_action) strands = [ ETangleStrands(etangle, left_strands, right_strands) for left_strands, right_strands in enumerate_gens([ etangle.left_points(), etangle.middle_points(), etangle.right_points() ], i) ] for x in strands: out.add_generator(x.to_generator(out), (x.to_strand_diagram().maslov(), x.to_strand_diagram().twoalexander())) for x in strands: out.add_structure_map(x.to_generator(out), delta1_1(out, x)) for a in etangle.right_algebra.left_gens(list( x.right_strands.values())): out.add_structure_map(x.to_generator(out)**a, delta1_2(out, x, a)) return out
def valid_dictionaries(et: ETangle, ls: Dict, rs: Dict): for key in ls.keys(): if key not in et.left_points(): return False for val in rs.values(): if val not in et.right_points(): return False return set(ls.values()).union(set(rs.keys())) == set(et.middle_points())