
theorem Th15:
  for x,y being FinSequence, f,g,h being ManySortedSet of NAT st
  f.0 = 1GateCircStr(<*>,(0-tuples_on BOOLEAN)-->TRUE) &
  g.0 = 1GateCircuit(<*>,(0-tuples_on BOOLEAN)-->TRUE) &
  h.0 = [<*>, (0-tuples_on BOOLEAN)-->TRUE] &
  for n being Nat, S being non empty ManySortedSign,
  A being non-empty MSAlgebra over S
  for z being set st S = f.n & A = g.n & z = h.n holds
  f.(n+1) = S +* BitGFA1Str(x .(n+1), y.(n+1), z) &
  g.(n+1) = A +* BitGFA1Circ(x .(n+1), y.(n+1), z) &
  h.(n+1) = GFA1CarryOutput(x .(n+1), y.(n+1), z)
  for n being Nat holds
  n-BitGFA1Str(x,y) = f.n & n-BitGFA1Circ(x,y) = g.n &
  n-BitGFA1CarryOutput(x,y) = h.n
proof
  let x,y be FinSequence, f,g,h be ManySortedSet of NAT;
  set f0 = 1GateCircStr(<*>,(0-tuples_on BOOLEAN)-->TRUE);
  set g0 = 1GateCircuit(<*>,(0-tuples_on BOOLEAN)-->TRUE);
  set h0 = [<*>, (0-tuples_on BOOLEAN)-->TRUE];
  deffunc S(non empty ManySortedSign,set,Nat)
  = $1 +* BitGFA1Str(x .($3+1), y.($3+1), $2);
  deffunc A(non empty ManySortedSign,non-empty MSAlgebra over $1,
  set, Nat) = $2 +* BitGFA1Circ(x .($4+1), y.($4+1), $3);
  deffunc o(set, Nat) = GFA1CarryOutput(x .($2+1), y.($2+1), $1);
  deffunc F(Nat, set) = GFA1CarryOutput(x .($1+1), y.($1+1), $2);
  assume that
A1: f.0 = f0 & g.0 = g0 and
A2: h.0 = h0 and
A3: for n being Nat, S being non empty ManySortedSign,
  A being non-empty MSAlgebra over S
  for z being set st S = f.n & A = g.n & z = h.n holds f.(n+1) = S(S,z,n) &
  g.(n+1) = A(S,A,z,n) & h.(n+1) = o(z,n);
  let n be Nat;
  consider f1,g1,h1 being ManySortedSet of NAT such that
A4: n-BitGFA1Str(x,y) = f1.n and
A5: n-BitGFA1Circ(x,y) = g1.n and
A6: f1.0 = f0 and
A7: g1.0 = g0 and
A8: h1.0 = h0 and
A9: for n being Nat, S being non empty ManySortedSign,
  A being non-empty MSAlgebra over S
  for z being set st S = f1.n & A = g1.n & z = h1.n holds
  f1.(n+1) = S(S,z,n) & g1.(n+1) = A(S,A,z,n) & h1.(n+1) = o(z,n) by Def6;
A10: ex S being non empty ManySortedSign, A being non-empty MSAlgebra over S
  st S = f.0 & A = g.0 by A1;
A11: f.0 = f1.0 & g.0 = g1.0 & h.0 = h1.0 by A1,A2,A6,A7,A8;
A12: for S being non empty ManySortedSign, A being non-empty MSAlgebra over S
  for z being set, n being Nat holds
  A(S,A,z,n) is non-empty MSAlgebra over S(S,z,n);
  f = f1 & g = g1 & h = h1 from CIRCCMB2:sch 14(A10,A11,A3,A9,A12
  );
  hence n-BitGFA1Str(x,y) = f.n & n-BitGFA1Circ(x,y) = g.n by A4,A5;
A13: for n being Nat, S being non empty ManySortedSign, z being set
  st S = f.n & z = h.n holds f.(n+1) = S(S,z,n) &
  h.(n+1) = o(z,n) from CIRCCMB2:sch 15(A1,A3,A12);
A14: f.0 = f0 by A1;
A15: dom h = NAT by PARTFUN1:def 2;
A16: h.0 = h0 by A2;
  for n being Nat, z being set st z = h.n
  holds h.(n+1) = o(z,n) from CIRCCMB2:sch 3(A14,A13);
  then
A17: for n being Nat holds h.(n+1) = F(n,h.n);
  consider h1 being ManySortedSet of NAT such that
A18: n-BitGFA1CarryOutput(x,y) = h1.n and
A19: h1.0 = h0 and
A20: for n being Nat holds h1.(n+1) = GFA1CarryOutput(x .(n+1), y.(n+1), h1.n)
  by Def7;
A21: dom h1 = NAT by PARTFUN1:def 2;
A22: h1.0 = h0 by A19;
A23: for n being Nat holds h1.(n+1) = F(n,h1.n) by A20;
  h = h1 from NAT_1:sch 15(A15,A16,A17,A21,A22,A23);
  hence thesis by A18;
end;
