
theorem
  for x,y,c being set st
  x <> [<*y,c*>, and2] & y <> [<*x,c*>, and2a] & c <> [<*x,y*>, and2a] &
  c <> [<*x,y*>, 'xor']
  for s being State of BitSubtracterWithBorrowCirc(x,y,c)
  for a1,a2,a3 being Element of BOOLEAN st a1 = s.x & a2 = s.y & a3 = s.c holds
  (Following(s,2)).BitSubtracterOutput(x,y,c) = a1 'xor' a2 'xor' a3 &
  (Following(s,2)).BorrowOutput(x,y,c)
  = 'not' a1 '&' a2 'or' a2 '&' a3 'or' 'not' a1 '&' a3
proof
  let x,y,c be set such that
A1: x <> [<*y,c*>, and2] and
A2: y <> [<*x,c*>, and2a] and
A3: c <> [<*x,y*>, and2a] and
A4: c <> [<*x,y*>, 'xor'];
  set f = 'xor';
  set S1 = 2GatesCircStr(x,y,c, 'xor'), S2 = BorrowStr(x,y,c);
  set A = BitSubtracterWithBorrowCirc(x,y,c);
  set A1 = BitSubtracterCirc(x,y,c), A2 = BorrowCirc(x,y,c);
  let s be State of A;
  let a1,a2,a3 be Element of BOOLEAN;
  assume that
A5: a1 = s.x and
A6: a2 = s.y and
A7: a3 = s.c;
A8: x in the carrier of S1 by FACIRC_1:60;
A9: y in the carrier of S1 by FACIRC_1:60;
A10: c in the carrier of S1 by FACIRC_1:60;
A11: x in the carrier of S2 by FSCIRC_1:6;
A12: y in the carrier of S2 by FSCIRC_1:6;
A13: c in the carrier of S2 by FSCIRC_1:6;
  reconsider s1 = s|the carrier of S1 as State of A1 by FACIRC_1:26;
  reconsider s2 = s|the carrier of S2 as State of A2 by FACIRC_1:26;
  reconsider t = s as State of A1+*A2;
A14: InputVertices S2 = {x,y,c} by A1,A2,A3,Th15;
A15: InnerVertices S1 misses InputVertices S1 by XBOOLE_1:79;
A16: InnerVertices S2 misses InputVertices S2 by XBOOLE_1:79;
A17: InnerVertices S1 misses InputVertices S2 by A4,A14,A15,FACIRC_1:57;
A18: InnerVertices S2 misses InputVertices S1 by A4,A14,A16,FACIRC_1:57;
A19: dom s1 = the carrier of S1 by CIRCUIT1:3;
  then
A20: a1 = s1.x by A5,A8,FUNCT_1:47;
A21: a2 = s1.y by A6,A9,A19,FUNCT_1:47;
A22: a3 = s1.c by A7,A10,A19,FUNCT_1:47;
  (Following(t,2)).2GatesCircOutput(x,y,c, f) = (Following(s1,2)).
  2GatesCircOutput(x,y,c, f) by A18,FACIRC_1:32;
  hence (Following(s,2)).BitSubtracterOutput(x,y,c) = a1 'xor' a2 'xor' a3
  by A4,A20,A21,A22,FACIRC_1:64;
A23: dom s2 = the carrier of S2 by CIRCUIT1:3;
  then
A24: a1 = s2.x by A5,A11,FUNCT_1:47;
A25: a2 = s2.y by A6,A12,A23,FUNCT_1:47;
A26: a3 = s2.c by A7,A13,A23,FUNCT_1:47;
  (Following(t,2)).BorrowOutput(x,y,c) = (Following(s2,2)).BorrowOutput(x
  ,y,c) by A17,FACIRC_1:33;
  hence thesis by A1,A2,A3,A24,A25,A26,Lm2;
end;
