reserve x,y for set,
  i,j,k,l,m,n for Nat,
  K for Field,
  N for without_zero finite Subset of NAT,
  a,b for Element of K,
  A,B,B1,B2,X,X1,X2 for (Matrix of K),
  A9 for (Matrix of m,n,K),
  B9 for (Matrix of m,k,K);

theorem Th6:
  for f be natural-valued FinSequence st rng f is included_in_Seg &
  f is increasing holds Sgm rng f = f
proof
  defpred P[Nat] means
  for f be natural-valued FinSequence,n st len f=$1 & rng f c=
Seg n & for i,j st i in dom f & j in dom f & i < j holds f.i < f.j holds
Sgm rng f = f;
A1: P[0]
  proof
    let f be natural-valued FinSequence,n such that
A2: len f=0 and
    rng f c= Seg n and
    for i,j st i in dom f & j in dom f & i < j holds f.i < f.j;
    f={} by A2;
    hence thesis by FINSEQ_3:43;
  end;
A3: for n st P[n] holds P[n+1]
  proof
    let n such that
A4: P[n];
    set n1=n+1;
    let f be natural-valued FinSequence,k such that
A5: len f=n1 and
A6: rng f c= Seg k and
A8: for i,j st i in dom f & j in dom f & i < j holds f.i < f.j;
    set fn=f|n;
A9: f=fn^<*f.n1*> by A5,FINSEQ_3:55;
    then
A10: rng fn c= rng f by FINSEQ_1:29;
A11: dom fn c= dom f by A9,FINSEQ_1:26;
A12: for i,j st i in dom fn & j in dom fn & i < j holds fn.i < fn.j
    proof
      let i,j such that
A13:  i in dom fn & j in dom fn and
A14:  i < j;
      fn.i=f.i & fn.j=f.j by A9,A13,FINSEQ_1:def 7;
      hence thesis by A8,A11,A13,A14;
    end;
A15: len fn =n by A5,FINSEQ_3:53;
A16: now
A17:  n1 in Seg n1 & dom f=Seg n1 by A5,FINSEQ_1:4,def 3;
      let m9,n9 being Nat such that
A18:  m9 in rng fn and
A19:  n9 in {f.n1};
      consider x being object such that
A20:  x in dom fn and
A21:  fn.x=m9 by A18,FUNCT_1:def 3;
      reconsider x as Element of NAT by A20;
A22:  f.x = fn.x by A9,A20,FINSEQ_1:def 7;
      dom fn=Seg n by A15,FINSEQ_1:def 3;
      then x<=n by A20,FINSEQ_1:1;
      then x < n1 by NAT_1:13;
      then f.x < f.n1 by A8,A11,A20,A17;
      hence m9 < n9 by A19,A21,A22,TARSKI:def 1;
    end;
A23: Sgm rng fn = fn by A4,A6,A15,A10,A12,XBOOLE_1:1;
A24: rng <*f.n1*>={f.n1} by FINSEQ_1:39;
    rng <*f.n1*> c= rng f by A9,FINSEQ_1:30;
    then
A25: {f.n1} c= Seg k by A6,A24;
     then
a25: {f.n1} is included_in_Seg;
A26: rng f = rng fn\/rng<*f.n1*> by A9,FINSEQ_1:31;
A27: f.n1 in {f.n1} by TARSKI:def 1;
    rng fn c= Seg k by A6,A10;
    then rng fn is included_in_Seg;
    hence Sgm rng f = fn ^ Sgm {f.n1} by A26,A24,a25,A23,A16,FINSEQ_3:42
      .= f by A9,A25,A27,FINSEQ_3:44;
  end;
  let f be natural-valued FinSequence such that
A28: rng f is included_in_Seg;
     assume f is increasing;
     then
xxx: for i,j st i in dom f & j in dom f & i < j holds f.i < f.j
     by SEQM_3:def 1;
  for n holds P[n] from NAT_1:sch 2(A1,A3);
  then for g be natural-valued FinSequence,n st len g=len f & rng g c= Seg n &
  for i,j st i in dom g & j in dom g & i < j holds g.i < g.j holds
  Sgm rng g = g;
  hence thesis by A28,xxx;
end;
