
theorem Th20:
  for f,g being nonpair-yielding FinSequence for n being Nat holds
  InputVertices ((n+1)-BitSubtracterStr(f,g)) =
  (InputVertices (n-BitSubtracterStr(f,g)))\/
  ((InputVertices BitSubtracterWithBorrowStr(f.(n+1),g.(n+1),
  n-BitBorrowOutput(f,g)) \ {n-BitBorrowOutput(f,g)})) &
  InnerVertices (n-BitSubtracterStr(f,g)) is Relation &
  InputVertices (n-BitSubtracterStr(f,g)) is without_pairs
proof
  let f,g be nonpair-yielding FinSequence;
  deffunc Sn(Nat) = $1-BitSubtracterStr(f,g);
  deffunc S(set, Nat)
  = BitSubtracterWithBorrowStr(f.($2+1),g.($2+1), $1);
  deffunc F(Nat) = $1-BitBorrowOutput(f,g);
  consider h being ManySortedSet of NAT such that
A1: for n being Element of NAT holds h.n = F(n) from PBOOLE:sch 5;
A2: for n being Nat holds h.n = F(n)
   proof let n be Nat;
     n in NAT by ORDINAL1:def 12;
    hence thesis by A1;
   end;
  deffunc h(Nat) = h.$1;
  deffunc o(set, Nat) = BorrowOutput(f.($2+1),g.($2+1), $1);
  set k = (0-tuples_on BOOLEAN)-->TRUE;
A3: 0-BitSubtracterStr(f,g) = 1GateCircStr(<*>, k) by Th2;
  then
A4: InnerVertices Sn(0) is Relation by FACIRC_1:38;
A5: InputVertices Sn(0) is without_pairs by A3,FACIRC_1:39;
  h(0) = 0-BitBorrowOutput(f,g) by A2;
  then
A6: h.0 in InnerVertices Sn(0);
A7: for n being Nat, x being set
  holds InnerVertices S(x,n) is Relation by FSCIRC_1:22;
A8: now
    let n be Element of NAT, x be set such that
A9: x = h(n);
A10: h(n) = n-BitBorrowOutput(f,g) by A2;
    then
A11: x <> [<*f.(n+1),g.(n+1)*>, and2a] by A9,Th19;
    x <> [<*f.(n+1),g.(n+1)*>, 'xor'] by A9,A10,Th19;
    hence InputVertices S(x, n) = {f.(n+1), g.(n+1), x} by A11,Th16;
  end;
A12: for n being Nat, x being set st x = h.n holds
  (InputVertices S(x, n)) \ {x} is without_pairs
  proof
    let n be Nat, x be set such that
A13: x = h(n);
    n in NAT by ORDINAL1:def 12;
    then
A14: InputVertices S(x, n) = {f.(n+1), g.(n+1), x} by A8,A13;
    thus (InputVertices S(x, n)) \ {x} is without_pairs
    proof
      let a be pair object;
      assume
A15:  a in (InputVertices S(x, n)) \ {x};
      then a in InputVertices S(x, n) by XBOOLE_0:def 5;
      then
A16:  a = f.(n+1) or a = g.(n+1) or a = x by A14,ENUMSET1:def 1;
      not a in {x} by A15,XBOOLE_0:def 5;
      hence contradiction by A16,TARSKI:def 1;
    end;
  end;
A17: now
    let n be Nat, S be non empty ManySortedSign, x be set;
A18: n in NAT by ORDINAL1:def 12;
    assume that
A19: S = Sn(n) and
A20: x = h.n;
A21: x = n-BitBorrowOutput(f,g) by A2,A20;
A22: h(n+1) = (n+1)-BitBorrowOutput(f,g) by A2;
    thus Sn(n+1) = S +* S(x,n) by A19,A21,Th7;
    thus h.(n+1) = o(x, n) by A21,A22,Th7;
    InputVertices S(x, n) = {f.(n+1), g.(n+1), x} by A8,A18,A20;
    hence x in InputVertices S(x,n) by ENUMSET1:def 1;
A23: InnerVertices S(x, n) =
    {[<*f.(n+1),g.(n+1)*>, 'xor'], 2GatesCircOutput(f.(n+1),g.(n+1),x,'xor')}
    \/ {[<*f.(n+1),g.(n+1)*>,and2a], [<*g.(n+1),x*>,and2],
    [<*f.(n+1),x*>,and2a]} \/ {BorrowOutput(f.(n+1),g.(n+1),x)} by Th17;
    o(x,n) in {o(x,n)} by TARSKI:def 1;
    hence o(x, n) in InnerVertices S(x, n) by A23,XBOOLE_0:def 3;
  end;
A24: for n being Nat holds InputVertices Sn(n+1) =
  (InputVertices Sn(n))\/((InputVertices S(h.(n),n)) \ {h.(n)}) &
  InnerVertices Sn(n) is Relation &
  InputVertices Sn(n) is without_pairs from CIRCCMB2:sch 11(A4,A5,A6,A7
  ,A12,
  A17);
  let n be Nat;
  h.n = n-BitBorrowOutput(f,g) by A2;
  hence thesis by A24;
end;
