reserve x,y,z,c for object,
  f for Function of 2-tuples_on BOOLEAN, BOOLEAN;
reserve s for State of 2GatesCircuit(x,y,c,f);

theorem
  for x,y,c being non pair object for s being State of
BitAdderWithOverflowCirc(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)).BitAdderOutput(x,y,c) = a1
'xor' a2 'xor' a3 & (Following(s,2)).MajorityOutput(x,y,c) = a1 '&' a2 'or' a2
  '&' a3 'or' a3 '&' a1
proof
  let x,y,c be non pair object;
  set S1 = 2GatesCircStr(x,y,c, 'xor'), S2 = MajorityStr(x,y,c);
  set A = BitAdderWithOverflowCirc(x,y,c);
  set A1 = BitAdderCirc(x,y,c), A2 = MajorityCirc(x,y,c);
  let s be State of A;
  reconsider t = s as State of A1+*A2;
  reconsider s1 = s|the carrier of S1 as State of A1 by Th26;
  set f = 'xor';
  let a1,a2,a3 be Element of BOOLEAN;
  assume that
A1: a1 = s.x and
A2: a2 = s.y and
A3: a3 = s.c;
A4: dom s1 = the carrier of S1 by CIRCUIT1:3;
  y in the carrier of S1 by Th60;
  then
A5: a2 = s1.y by A2,A4,FUNCT_1:47;
  InputVertices S1 is without_pairs by Th59;
  then InnerVertices S2 misses InputVertices S1 by Th5,Th67;
  then
A6: (Following(t,2)).2GatesCircOutput(x,y,c, f) = (Following(s1,2)).
  2GatesCircOutput(x,y,c, f) by Th32;
  c in the carrier of S1 by Th60;
  then
A7: a3 = s1.c by A3,A4,FUNCT_1:47;
  reconsider s2 = s|the carrier of S2 as State of A2 by Th26;
A8: dom s2 = the carrier of S2 by CIRCUIT1:3;
  x in the carrier of S1 by Th60;
  then a1 = s1.x by A1,A4,FUNCT_1:47;
  hence (Following(s,2)).BitAdderOutput(x,y,c) = a1 'xor' a2 'xor' a3 by A5,A7
,A6,Th64;
  InputVertices S2 is without_pairs by Th68;
  then InnerVertices S1 misses InputVertices S2 by Th5,Th58;
  then
A9: (Following(t,2)).MajorityOutput(x,y,c) = (Following(s2,2)).
  MajorityOutput(x,y,c) by Th33;
  c in the carrier of S2 by Th72;
  then
A10: a3 = s2.c by A3,A8,FUNCT_1:47;
  y in the carrier of S2 by Th72;
  then
A11: a2 = s2.y by A2,A8,FUNCT_1:47;
  x in the carrier of S2 by Th72;
  then a1 = s2.x by A1,A8,FUNCT_1:47;
  hence thesis by A11,A10,A9,Lm3;
end;
