reserve i,j,k,n,m for Nat,
        X for set,
        b,s for bag of X,
        x for object;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
          right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
             right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;

theorem Th64:
  i in n implies count_reps(m |-> (i+1),n) = (EmptyBag n) +* (i,m)
proof
  set E=EmptyBag n, s = count_reps(m |-> (i+1),n);
  assume i in n;
A1: dom s = n = dom (E+* (i,m)) & n = dom E by PARTFUN1:def 2;
  for x st x in n holds s.x = (E+* (i,m)).x
  proof
    let x;
    assume
A2: x in n;
    then x in Segm n;
    then reconsider a=x as Nat;
A3: s.a = card ((m |-> (i+1))"{a+1}) by A2,Def8;
    per cases;
    suppose
A4:   a=i;
      (Seg m --> (i+1))"{a+1}=Seg m by A4,FUNCOP_1:15;
      hence thesis by A3,A4,A1,A2,FUNCT_7:31;
    end;
    suppose
A5:   a<>i;
      then
A6:   (E+* (i,m)).x = E.x by FUNCT_7:32;
      a+1 <>i+1 by A5;
      then not i+1 in {a+1} by TARSKI:def 1;
      then (Seg m --> (i+1))"{a+1}={} by FUNCOP_1:16;
      hence thesis by A6,A3;
    end;
  end;
  hence thesis by A1;
end;
