reserve f for Function;
reserve p,q for FinSequence;
reserve A,B,C for set,x,x1,x2,y,z for object;
reserve k,l,m,n for Nat;
reserve a for Nat;
reserve D for non empty set;
reserve d,d1,d2,d3 for Element of D;
reserve L,M for Element of NAT;

theorem Th58:
  A is finite implies ex p st rng p = A & p is one-to-one
proof
  defpred P[set] means ex p st rng p = $1 & p is one-to-one;
  rng {} = {};
  then
A1: P[{}];
  now
    let B,C;
    assume that
    B in A and
    C c= A;
    given p such that
A2: rng p = C and
A3: p is one-to-one;
A4: now
      assume
A5:   not B in C;
      take q = p ^ <* B *>;
      thus rng q = rng p \/ rng<* B *> by FINSEQ_1:31
        .= C \/ {B} by A2,FINSEQ_1:38;
      thus q is one-to-one
      proof
        let x,y be object;
        assume that
A6:     x in dom q & y in dom q and
A7:     q.x = q.y;
        reconsider k = x, l = y as Element of NAT by A6;
A8:     now
          assume
A9:       k in dom p;
          given n be Nat such that
A10:      n in dom<* B *> and
A11:      l = len p + n;
          n in {1} by A10,FINSEQ_1:2,38;
          then
A12:      n = 1 by TARSKI:def 1;
          <* B *>.n = q.k by A7,A10,A11,FINSEQ_1:def 7
            .= p.k by A9,FINSEQ_1:def 7;
          then B = p.k by A12;
          hence thesis by A2,A5,A9,FUNCT_1:def 3;
        end;
A13:    now
          assume
A14:      l in dom p;
          given n be Nat such that
A15:      n in dom<* B *> and
A16:      k = len p + n;
          n in {1} by A15,FINSEQ_1:2,38;
          then
A17:      n = 1 by TARSKI:def 1;
          <* B *>.n = q.l by A7,A15,A16,FINSEQ_1:def 7
            .= p.l by A14,FINSEQ_1:def 7;
          then B = p.l by A17;
          hence thesis by A2,A5,A14,FUNCT_1:def 3;
        end;
A18:    now
          given m1 being Nat such that
A19:      m1 in dom<* B *> and
A20:      k = len p + m1;
          m1 in {1} by A19,FINSEQ_1:2,def 8;
          then
A21:      m1 = 1 by TARSKI:def 1;
          given m2 being Nat such that
A22:      m2 in dom<* B *> and
A23:      l = len p + m2;
          m2 in {1} by A22,FINSEQ_1:2,def 8;
          hence thesis by A20,A23,A21,TARSKI:def 1;
        end;
        now
          assume
A24:      k in dom p & l in dom p;
          then q.k = p.k & q.l = p.l by FINSEQ_1:def 7;
          hence thesis by A3,A7,A24;
        end;
        hence thesis by A6,A8,A13,A18,FINSEQ_1:25;
      end;
    end;
    now
      assume
A25:  B in C;
      take q = p;
      thus rng q = C \/ {B} & q is one-to-one by A2,A3,A25,ZFMISC_1:40;
    end;
    hence ex p st rng p = C \/ {B} & p is one-to-one by A4;
  end;
  then
A26: for B,C being set st B in A & C c= A & P[C] holds P[C \/ {B}];
  assume
A27: A is finite;
  thus P[A] from FINSET_1:sch 2(A27,A1,A26);
end;
