def cl_imp(_, n): if n == 0: return op(_[0], take(axiom("p", 0), [_[1], _[0]]), take(axiom("p", 1), [_[0], _[1]]) ) else: C_left, C_right = new_C() return op(_[0], plus( cl_imp([_[0], C_left], n-1), plus( take(axiom("p", 0), [_[1], C_right]), take(axiom("p", n), [C_right, _[0]]) ) ), take(axiom("p", n+1), [_[0], _[1]]) )
def cl_as_cut(_, n, m): if _ is None: _ = [None] * (2*m) if n == 0: return take(axiom("A"), [_[0], _[2*m-1]]) else: left = _.copy() left.insert(0, left.pop(m-1)) left.insert(m, left.pop(-1)) right = left.copy() left[-1], right[0] = new_C() return plus(cl_as_cut(left, n-1, m), cl_as_cut(right, n-1, m))