
theorem :: Lemma_4_5_ii_iii:
  for R being non empty doubleLoopStr st for B being non empty Subset
of R ex C being non empty finite Subset of R st C c= B & C-Ideal = B-Ideal for
  a being sequence of R ex m being Element of NAT st a.(m+1) in (rng (a|(m+1)))
  -Ideal
proof
  let R be non empty doubleLoopStr;
  assume
A1: for B being non empty Subset of R ex C being non empty finite Subset
  of R st C c= B & C-Ideal = B-Ideal;
  let a being sequence of R;
  reconsider B = rng a as non empty Subset of R;
  consider C being non empty finite Subset of R such that
A2: C c= B and
A3: C-Ideal = B-Ideal by A1;
  defpred P[object,object] means $1 = a.$2;
A4: dom a = NAT by FUNCT_2:def 1;
A5: for e being object st e in C ex u being object st u in NAT & P[e,u]
  proof
    let e be object;
    assume e in C;
    then consider u being object such that
A6: u in dom a and
A7: e = a.u by A2,FUNCT_1:def 3;
    take u;
    thus u in NAT by A6;
    thus thesis by A7;
  end;
  consider f being Function of C, NAT such that
A8: for e being object st e in C holds P[e,f.e] from FUNCT_2:sch 1(A5);
  set Rf = rng f;
  reconsider Rf as non empty finite Subset of NAT;
  reconsider m = max Rf as Element of NAT by ORDINAL1:def 12;
  set D = rng (a | Segm(m+1));
A9: dom f = C by FUNCT_2:def 1;
A10: C c= D
  proof
    let X be object;
    set fx = f.X;
    assume
A11: X in C;
    then f.X in Rf by A9,FUNCT_1:def 3;
    then fx <= m by XXREAL_2:def 8;
    then fx < m+1 by NAT_1:13;
    then fx in Segm(m+1) by NAT_1:44;
    then a.fx in rng (a | Segm(m+1)) by A4,FUNCT_1:50;
    hence thesis by A8,A11;
  end;
  then reconsider D as non empty Subset of R;
A12: D-Ideal c= B-Ideal by Th57,RELAT_1:70;
  B-Ideal c= D-Ideal by A3,A10,Th57;
  then
A13: D-Ideal = B-Ideal by A12;
  take m;
  B c= B-Ideal & a.(m+1) in B by Def14,FUNCT_2:4;
  hence thesis by A13;
end;
