reserve x,y,z, X,Y,Z for set,
  n for Element of NAT;
reserve A for set,
  D for non empty set,
  a,b,c,l,r for Element of D,
  o,o9 for BinOp of D,
  f,g,h for Function of A,D;
reserve G for non empty multMagma;
reserve A for non empty set,
  a for Element of A,
  p for FinSequence of A,
  m1,m2 for Multiset of A;
reserve p,q for FinSequence of A;
reserve fm for Element of finite-MultiSet_over A;

theorem
  x is Element of finite-MultiSet_over A implies ex p st x = |.p.|
proof
  defpred Z[Nat] means for fm st for V being finite set st V = fm"(
  NAT\{0}) holds card V = $1 ex p st fm = |.p.|;
  assume x is Element of finite-MultiSet_over A;
  then reconsider m = x as Element of finite-MultiSet_over A;
  carr(finite-MultiSet_over A) c= carr(MultiSet_over A) by MONOID_0:23;
  then m is Multiset of A;
  then reconsider V = m"(NAT\{0}) as finite set by Def6;
A1: for V9 being finite set st V9 = m"(NAT\{0}) holds card V9 = card V;
A2: for n being Nat st Z[n] holds Z[n+1]
  proof
    deffunc F(object) = 0;
    let n be Nat such that
A3: for fm st for V being finite set st V = fm"(NAT\{0}) holds card V
    = n ex p st fm = |.p.|;
    let fm such that
A4: for V being finite set st V = fm"(NAT\{0}) holds card V = n+1;
    deffunc G(object) = fm.$1;
    set x = the Element of fm"(NAT\{0});
    carr(finite-MultiSet_over A) c= carr(MultiSet_over A) by MONOID_0:23;
    then reconsider m = fm as Multiset of A;
    reconsider V = m"(NAT\{0}) as finite set by Def6;
A5: card V = n+1 by A4;
A6: dom m = A by Th28;
    then reconsider x as Element of A by A5,CARD_1:27,FUNCT_1:def 7;
    defpred C[object] means x = $1;
    consider f being Function such that
A7: dom f = A & for a being object st a in A holds (C[a] implies f.a = F
    (a)) & (not C[a] implies f.a = G(a)) from PARTFUN1:sch 1;
    rng f c= NAT
    proof
      let y be object;
      assume y in rng f;
      then consider z being object such that
A8:   z in dom f and
A9:   y = f.z by FUNCT_1:def 3;
      reconsider z as Element of A by A7,A8;
      y = 0 or y = m.z by A7,A9;
      hence thesis;
    end;
    then reconsider f as Function of A,NAT by A7,FUNCT_2:def 1,RELSET_1:4;
    reconsider f as Multiset of A by Th27;
A10: f"(NAT\{0}) = (fm"(NAT\{0}))\{x}
    proof
      thus f"(NAT\{0}) c= (fm"(NAT\{0}))\{x}
      proof
        let y be object;
        assume
A11:    y in f"(NAT\{0});
        then reconsider a = y as Element of A by A7,FUNCT_1:def 7;
A12:    f.y in NAT\{0} by A11,FUNCT_1:def 7;
        then not f.a in {0} by XBOOLE_0:def 5;
        then
A13:    f.a <> 0 by TARSKI:def 1;
        then a <> x by A7;
        then
A14:    not a in {x} by TARSKI:def 1;
        f.a = fm.a by A7,A13;
        then a in fm"(NAT\{0}) by A6,A12,FUNCT_1:def 7;
        hence thesis by A14,XBOOLE_0:def 5;
      end;
      let y be object;
      assume
A15:  y in (fm"(NAT\{0}))\{x};
      then
A16:  y in dom fm by FUNCT_1:def 7;
A17:  fm.y in NAT\{0} by A15,FUNCT_1:def 7;
      not y in {x} by A15,XBOOLE_0:def 5;
      then y <> x by TARSKI:def 1;
      then fm.y = f.y by A6,A7,A16;
      hence thesis by A6,A7,A16,A17,FUNCT_1:def 7;
    end;
    then reconsider f9 = f as Element of finite-MultiSet_over A by A5,Def6;
    set g = |.(m.x) .--> x.|;
A18: card {x} = 1 by CARD_1:30;
    reconsider V9 = f9"(NAT\{0}) as finite set by Def6;
    {x} c= fm"(NAT\{0}) by A5,CARD_1:27,ZFMISC_1:31;
    then card V9 = n+1-1 by A5,A10,A18,CARD_2:44
      .= n;
    then for V being finite set st V = f9"(NAT\{0}) holds card V = n;
    then consider p such that
A19: f = |.p.| by A3;
    take q = p^((m.x) .--> x);
    now
      let a;
A20:  0 + m.a = m.a;
A21:  a <> x implies f.a = m.a & g.a = 0 by A7,Th41;
      f.x = 0 & g.x = m.x by A7,Th41;
      hence (f[*]g).a = m.a by A20,A21,Th29;
    end;
    hence fm = f[*]g by Th32
      .= |.q.| by A19,Th40;
  end;
A22: Z[0]
  proof
    set a = the Element of A;
    let fm such that
A23: for V being finite set st V = fm"(NAT\{0}) holds card V = 0;
    carr(finite-MultiSet_over A) c= carr(MultiSet_over A) by MONOID_0:23;
    then reconsider m = fm as Multiset of A;
    reconsider V = m"(NAT\{0}) as finite set by Def6;
    card V = 0 by A23;
    then fm"(NAT\{0}) = {};
    then rng fm misses (NAT\{0}) by RELAT_1:138;
    then
A24: {} = rng fm /\ (NAT\{0})
      .= (rng fm /\ NAT)\{0} by XBOOLE_1:49;
    take p = <*> A;
    rng m c= NAT;
    then rng fm /\ NAT = rng fm by XBOOLE_1:28;
    then
A25: rng fm c= {0} by A24,XBOOLE_1:37;
A26: dom m = A by Th28;
    then
A27: fm.a in rng fm by FUNCT_1:def 3;
    then fm.a = 0 by A25,TARSKI:def 1;
    then {0} c= rng fm by A27,ZFMISC_1:31;
    then rng fm = {0} by A25;
    hence fm = A --> 0 by A26,FUNCOP_1:9
      .= |.p.| by Th37;
  end;
  for n being Nat holds Z[n] from NAT_1:sch 2(A22,A2);
  hence thesis by A1;
end;
