reserve i,j,k,n,m for Nat,
        X for set,
        b,s for bag of X,
        x for object;

theorem Th20:
  for X be set
    for b1,b2 be bag of X st 2(#)b1 +* (0,b1.0) = 2(#)b2 +* (0,b2.0)
  holds b1 = b2
proof
  let X be set;
  let b1,b2 be bag of X such that
A1: 2(#)b1 +* (0,b1.0) = 2(#)b2 +* (0,b2.0);
A2:dom b1 = X = dom b2 & dom (2(#)b1) = X =dom (2(#)b2) by PARTFUN1:def 2;
  for x st x in X holds b1.x = b2.x
  proof
    let x such that
A3: x in X;
    per cases;
    suppose
A4:   x=0;
      hence b1.x = (2(#)b1 +* (0,b1.0)).x by A3,A2,FUNCT_7:31
      .= b2.x by A4,A3,A2,A1,FUNCT_7:31;
    end;
    suppose
A5:   x<>0;
      2*(b1.x) = (2(#)b1).x by A2,A3,VALUED_1:def 5
      .= (2(#)b1 +* (0,b1.0)).x by A5,FUNCT_7:32
      .= (2(#)b2).x by A5,A1,FUNCT_7:32
      .= 2*(b2.x) by A3,A2,VALUED_1:def 5;
      hence b1.x = b2.x;
    end;
  end;
  hence thesis by A2;
end;
