
theorem Th19:
  for I being finite non empty set for b1,b2 being ManySortedSet
of I for i being Element of I st b1.i<>b2.i holds diff(b1,b2) = diff(b1,b2+*(i,
  b1.i)) + 1
proof
  let I be finite non empty set;
  let b1,b2 be ManySortedSet of I;
  let j be Element of I;
  set b3=b2+*(j,b1.j);
  {i where i is Element of I: b1.i <> b2.i} c= I
  proof
    let a be object;
    assume a in {i where i is Element of I: b1.i <> b2.i};
    then ex i being Element of I st a=i & b1.i<>b2.i;
    hence thesis;
  end;
  then reconsider
  F={i where i is Element of I: b1.i <> b2.i} as finite set by FINSET_1:1;
  {i where i is Element of I: b1.i <> b3.i} c= I
  proof
    let a be object;
    assume a in {i where i is Element of I: b1.i <> b3.i};
    then ex i being Element of I st a=i & b1.i<>b3.i;
    hence thesis;
  end;
  then reconsider
  G={i where i is Element of I: b1.i <> b3.i} as finite set by FINSET_1:1;
  assume
A1: b1.j<>b2.j;
A2: F = G \/ {j}
  proof
    thus F c= G \/ {j}
    proof
      let o be object;
      assume o in F;
      then consider i being Element of I such that
A3:   o=i and
A4:   b1.i <> b2.i;
      per cases;
      suppose
        i=j;
        then o in {j} by A3,TARSKI:def 1;
        hence thesis by XBOOLE_0:def 3;
      end;
      suppose
        i<>j;
        then b3.i=b2.i by FUNCT_7:32;
        then i in G by A4;
        hence thesis by A3,XBOOLE_0:def 3;
      end;
    end;
    let o be object;
    assume
A5: o in G \/ {j};
    per cases by A5,XBOOLE_0:def 3;
    suppose
      o in G;
      then consider i being Element of I such that
A6:   o=i and
A7:   b1.i <> b3.i;
      now
        assume
A8:     b1.i = b2.i;
        then i=j by A7,FUNCT_7:32;
        hence contradiction by A1,A8;
      end;
      hence thesis by A6;
    end;
    suppose
      o in {j};
      then o=j by TARSKI:def 1;
      hence thesis by A1;
    end;
  end;
  now
    assume j in G;
    then
A9: ex jj being Element of I st jj=j & b1.jj <> b3.jj;
    dom b2=I by PARTFUN1:def 2;
    hence contradiction by A9,FUNCT_7:31;
  end;
  hence thesis by A2,CARD_2:41;
end;
