reserve m,n,s for non zero Element of NAT;

theorem Th8:
  m <= n implies
  ex A be FinSequence of n-tuples_on BOOLEAN st len A = m &
  A is one-to-one & card (rng A) = m & (for i,j be Nat st i in Seg m &
  j in Seg n holds (i = j implies (A.i).j = TRUE) &
  (i <> j implies (A.i).j = FALSE))
proof
  assume
A1: m <= n;
  defpred P[Nat,Function] means for j be Nat st j in Seg n
  holds ($1 = j implies $2.j = TRUE) & ($1 <> j implies $2.j = FALSE);
A2: for k be Nat st k in Seg m ex x being Element of n-tuples_on BOOLEAN
  st P[k,x]
  proof
    let k be Nat;
    assume k in Seg m;
    defpred P1[Nat,set] means (k = $1 implies $2 = TRUE) &
    (k <> $1 implies $2 = FALSE);
A3: for j be Nat st j in Seg n ex y being Element of BOOLEAN st P1[j,y]
    proof
      let j be Nat;
      assume j in Seg n;
      per cases;
      suppose
A4:     k = j;
        take TRUE;
        thus P1[j,TRUE] by A4;
      end;
      suppose
A5:     k <> j;
        take FALSE;
        thus P1[j,FALSE] by A5;
      end;
    end;
    consider x being FinSequence of BOOLEAN such that
A6: dom x = Seg n & for j be Nat st j in Seg n holds P1[j,x.j]
    from FINSEQ_1:sch 5 (A3);
    reconsider x as Element of (BOOLEAN)* by FINSEQ_1:def 11;
    len x = n by A6,FINSEQ_1:def 3;
    then x in {s where s is Element of BOOLEAN*: len s = n};
    then reconsider x as Element of n-tuples_on BOOLEAN;
    take x;
    thus P[k,x] by A6;
  end;
  consider A being FinSequence of n-tuples_on BOOLEAN such that
A7: dom A = Seg m &
  for k be Nat st k in Seg m holds P[k,A.k] from FINSEQ_1:sch 5 (A2);
  take A;
  thus len A = m by A7,FINSEQ_1:def 3;
A8: for x,y be object st x in dom A & y in dom A & A.x = A.y holds x = y
  proof
    let x,y be object;
    assume
A9: x in dom A & y in dom A & A.x = A.y;
    then reconsider i1 = x, i2 = y as Nat;
      assume
A10:  x <> y;
A11:  Seg m c= Seg n by A1,FINSEQ_1:5;
      (A.i2).i1 = FALSE by A10,A9,A7,A11;
      hence contradiction by A9,A7,A11;
  end;
  hence A is one-to-one by FUNCT_1:def 4;
A12: card (dom A) = m by FINSEQ_1:57,A7;
  dom A, rng A are_equipotent by A8,FUNCT_1:def 4,WELLORD2:def 4;
  hence card (rng A) = m by A12,CARD_1:5;
  thus thesis by A7;
end;
