
theorem Th19:
  for n be Nat for p,q being FinSeqLen of n
  for p1,p2, q1,q2 being FinSequence holds
  n-BitGFA1Str(p^p1, q^q1) = n-BitGFA1Str(p^p2, q^q2) &
  n-BitGFA1Circ(p^p1, q^q1) = n-BitGFA1Circ(p^p2, q^q2) &
  n-BitGFA1CarryOutput(p^p1, q^q1) = n-BitGFA1CarryOutput(p^p2, q^q2)
proof
  let n be Nat;
  let p,q be FinSeqLen of n;
  let p1,p2, q1,q2 be FinSequence;
  set f0 = 1GateCircStr(<*>,(0-tuples_on BOOLEAN)-->TRUE);
  set g0 = 1GateCircuit(<*>,(0-tuples_on BOOLEAN)-->TRUE);
  set h0 = [<*>, (0-tuples_on BOOLEAN)-->TRUE];
  set Sn1 = n-BitGFA1Str(p^p1,q^q1);
  set An1 = n-BitGFA1Circ(p^p1,q^q1);
  set On1 = n-BitGFA1CarryOutput(p^p1, q^q1);
  deffunc S1(non empty ManySortedSign,set, Nat)
  = $1 +* BitGFA1Str((p^p1) .($3+1), (q^q1).($3+1), $2);
  deffunc A1(non empty ManySortedSign,non-empty MSAlgebra over $1,
  set, Nat) = $2 +* BitGFA1Circ((p^p1) .($4+1), (q^q1).($4+1), $3);
  deffunc o1(set, Nat)
  = GFA1CarryOutput((p^p1) .($2+1), (q^q1).($2+1), $1);
  deffunc F1(Nat, set)
  = GFA1CarryOutput((p^p1) .($1+1), (q^q1).($1+1), $2);
  consider f1,g1,h1 being ManySortedSet of NAT such that
A1: Sn1 = f1.n and
A2: An1 = g1.n and
A3: f1.0 = f0 and
A4: g1.0 = g0 and
A5: h1.0 = h0 and
A6: for n being Nat, S being non empty ManySortedSign,
  A being non-empty MSAlgebra over S
  for z be set st S = f1.n & A = g1.n & z = h1.n holds f1.(n+1) = S1(S,z,n) &
  g1.(n+1) = A1(S,A,z,n) & h1.(n+1) = o1(z,n) by Def6;
  set Sn2 = n-BitGFA1Str(p^p2,q^q2);
  set An2 = n-BitGFA1Circ(p^p2,q^q2);
  set On2 = n-BitGFA1CarryOutput(p^p2, q^q2);
  deffunc S2(non empty ManySortedSign,set, Nat)
  = $1 +* BitGFA1Str((p^p2) .($3+1), (q^q2).($3+1), $2);
  deffunc A2(non empty ManySortedSign,non-empty MSAlgebra over $1,
  set, Nat) = $2 +* BitGFA1Circ((p^p2) .($4+1), (q^q2).($4+1), $3);
  deffunc o2(set, Nat)
  = GFA1CarryOutput((p^p2) .($2+1), (q^q2).($2+1), $1);
  deffunc F2(Nat, set)
  = GFA1CarryOutput((p^p2) .($1+1), (q^q2).($1+1), $2);
  consider f2,g2,h2 being ManySortedSet of NAT such that
A7: Sn2 = f2.n and
A8: An2 = g2.n and
A9: f2.0 = f0 and
A10: g2.0 = g0 and
A11: h2.0 = h0 and
A12: for n being Nat, S being non empty ManySortedSign,
  A being non-empty MSAlgebra over S
  for z be set st S = f2.n & A = g2.n & z = h2.n holds f2.(n+1) = S2(S,z,n) &
  g2.(n+1) = A2(S,A,z,n) & h2.(n+1) = o2(z,n) by Def6;
  defpred L[Nat] means
  $1 <= n implies h1.$1 = h2.$1 & f1.$1 = f2.$1 & g1.$1 = g2.$1;
A13: L[ 0 ] by A3,A4,A5,A9,A10,A11;
A14: for i being Nat st L[i] holds L[i+1]
  proof
    let i be Nat such that
A15: i <= n implies h1.i = h2.i & f1.i = f2.i & g1.i = g2.i and
A16: i+1 <= n;
A17: len p = n by CARD_1:def 7;
A18: len q = n by CARD_1:def 7;
A19: dom p = Seg n by A17,FINSEQ_1:def 3;
A20: dom q = Seg n by A18,FINSEQ_1:def 3;
    0+1 <= i+1 by XREAL_1:6;
    then
A21: i+1 in Seg n by A16,FINSEQ_1:1;
    then
A22: (p^p1).(i+1) = p.(i+1) by A19,FINSEQ_1:def 7;
A23: (p^p2).(i+1) = p.(i+1) by A19,A21,FINSEQ_1:def 7;
A24: (q^q1).(i+1) = q.(i+1) by A20,A21,FINSEQ_1:def 7;
A25: (q^q2).(i+1) = q.(i+1) by A20,A21,FINSEQ_1:def 7;
    defpred P[set,set,set,set] means not contradiction;
A26: ex S being non empty ManySortedSign, A being non-empty MSAlgebra over S,
    x being set st S = f1.0 & A = g1.0 & x = h1.0 & P[S, A, x, 0] by A3,A4;
A27: for n being Nat, S being non empty ManySortedSign,
    A being non-empty MSAlgebra over S
    for x being set st S = f1.n & A = g1.n & x = h1.n & P[S,A,x,n]
    holds P[S1(S,x,n), A1(S,A,x,n), o1(x,n), n+1];
A28: for S being non empty ManySortedSign, A being non-empty MSAlgebra over S
    for x being set, n being Nat holds
    A1(S,A,x,n) is non-empty MSAlgebra over S1(S,x,n);
    for n being Nat ex S being non empty ManySortedSign,
    A being non-empty MSAlgebra over S st S = f1.n & A = g1.n & P[S,A,h1.n,n]
    from CIRCCMB2:sch 13(A26,A6,A27,A28);
    then consider S being non empty ManySortedSign,
    A being non-empty MSAlgebra over S such that
A29: S = f1.i and
A30: A = g1.i;
    thus h1.(i+1) = o2(h2.i,i) by A6,A15,A16,A22,A23,A24,A25,A29,A30,NAT_1:13
      .= h2.(i+1) by A12,A15,A16,A29,A30,NAT_1:13;
    thus f1.(i+1) = S2(S,h2.i,i) by A6,A15,A16,A22,A23,A24,A25,A29,A30,NAT_1:13
      .= f2.(i+1) by A12,A15,A16,A29,A30,NAT_1:13;
    thus g1.(i+1) = A2(S,A,h2.i,i) by A6,A15,A16,A22,A23,A24,A25,A29,A30,
NAT_1:13
      .= g2.(i+1) by A12,A15,A16,A29,A30,NAT_1:13;
  end;
A31: for i being Nat holds L[i] from NAT_1:sch 2(A13,A14);
  hence Sn1 = Sn2 & An1 = An2 by A1,A2,A7,A8;
A32: On1 = h1.n by A3,A4,A5,A6,Th15;
  On2 = h2.n by A9,A10,A11,A12,Th15;
  hence thesis by A31,A32;
end;
