code: def ripple_carry_add(A, B, cin=0):
      
      if len(A) != len(B):
          raise ValueError("expected A and B to be equal length")
      ss, cs = list(), list()
      for i, a in enumerate(A):
          c = (cin if i == 0 else cs[i-1])
          ss.append(a ^ B[i] ^ c)
          cs.append(a & B[i] | a & c | B[i] & c)
      return farray(ss), farray(cs)
docs: Return symbolic logic for an N-bit ripple carry adder.