reserve x for set,
  C for Ordinal,
  L0 for Sequence;
reserve O1,O2 for Ordinal;

theorem Th22:
  for A being non empty set for L be lower-bounded LATTICE for d
  be BiFunction of A,L for q being QuadrSeq of d for O being Ordinal holds
  ConsecutiveDelta2(q,O) is BiFunction of ConsecutiveSet2(A,O),L
proof
  let A be non empty set;
  let L be lower-bounded LATTICE;
  let d be BiFunction of A,L;
  let q be QuadrSeq of d;
  let O be Ordinal;
  defpred X[Ordinal] means ConsecutiveDelta2(q,$1) is BiFunction of
  ConsecutiveSet2(A,$1),L;
A1: for O1 being Ordinal st X[O1] holds X[succ O1]
  proof
    let O1 be Ordinal;
    assume ConsecutiveDelta2(q,O1) is BiFunction of ConsecutiveSet2(A,O1),L;
    then reconsider
    CD = ConsecutiveDelta2(q,O1) as BiFunction of ConsecutiveSet2(A
    ,O1),L;
A2: ConsecutiveDelta2(q,succ O1) = new_bi_fun2(BiFun(ConsecutiveDelta2( q,
    O1 ) , ConsecutiveSet2(A,O1),L),Quadr2(q,O1)) by Th19
      .= new_bi_fun2(CD,Quadr2(q,O1)) by LATTICE5:def 15;
    ConsecutiveSet2(A,succ O1) = new_set2 ConsecutiveSet2(A,O1) by Th15;
    hence thesis by A2;
  end;
A3: for O1 st O1 <> 0 & O1 is limit_ordinal & for O2 st O2 in O1 holds X[O2
  ] holds X[O1]
  proof
    deffunc U(Ordinal) = ConsecutiveDelta2(q,$1);
    let O1 be Ordinal;
    assume that
A4: O1 <> 0 and
A5: O1 is limit_ordinal and
A6: for O2 be Ordinal st O2 in O1 holds ConsecutiveDelta2(q,O2) is
    BiFunction of ConsecutiveSet2(A,O2),L;
    reconsider o1 = O1 as non empty Ordinal by A4;
    set YY = the set of all
 [:ConsecutiveSet2(A,O2),ConsecutiveSet2(A,O2):] where O2 is
    Element of o1 ;
    consider Ls being Sequence such that
A7: dom Ls = O1 & for O2 being Ordinal st O2 in O1 holds Ls.O2 = U(O2
    ) from ORDINAL2:sch 2;
A8: for O,O2 being Ordinal st O c= O2 & O2 in dom Ls holds Ls.O c= Ls.O2
    proof
      let O be Ordinal;
      defpred X[Ordinal] means O c= $1 & $1 in dom Ls implies Ls.O c= Ls.$1;
A9:   for O1 st O1 <> 0 & O1 is limit_ordinal & for O2 st O2 in O1 holds
      X[O2] holds X[O1]
      proof
        deffunc U(Ordinal) = ConsecutiveDelta2(q,$1);
        let O2 be Ordinal;
        assume that
A10:    O2 <> 0 & O2 is limit_ordinal and
        for O3 be Ordinal st O3 in O2 holds O c= O3 & O3 in dom Ls implies
        Ls.O c= Ls.O3;
        assume that
A11:    O c= O2 and
A12:    O2 in dom Ls;
        consider Lt being Sequence such that
A13:    dom Lt = O2 & for O3 being Ordinal st O3 in O2 holds Lt.O3 =
        U(O3) from ORDINAL2:sch 2;
A14:    Ls.O2 = ConsecutiveDelta2(q,O2) by A7,A12
          .= union rng Lt by A10,A13,Th20;
        per cases;
        suppose
          O = O2;
          hence thesis;
        end;
        suppose
          O <> O2;
          then
A15:      O c< O2 by A11;
          then
A16:      O in O2 by ORDINAL1:11;
          then Ls.O = ConsecutiveDelta2(q,O) by A7,A12,ORDINAL1:10
            .= Lt.O by A13,A15,ORDINAL1:11;
          then Ls.O in rng Lt by A13,A16,FUNCT_1:def 3;
          hence thesis by A14,ZFMISC_1:74;
        end;
      end;
A17:  for O1 being Ordinal st X[O1] holds X[succ O1]
      proof
        let O2 be Ordinal;
        assume
A18:    O c= O2 & O2 in dom Ls implies Ls.O c= Ls.O2;
        assume that
A19:    O c= succ O2 and
A20:    succ O2 in dom Ls;
        per cases;
        suppose
          O = succ O2;
          hence thesis;
        end;
        suppose
          O <> succ O2;
          then O c< succ O2 by A19;
          then
A21:      O in succ O2 by ORDINAL1:11;
A22:      O2 in succ O2 by ORDINAL1:6;
          then O2 in dom Ls by A20,ORDINAL1:10;
          then reconsider Def8 = ConsecutiveDelta2(q,O2) as BiFunction of
          ConsecutiveSet2(A,O2),L by A6,A7;
          Ls.succ O2 = ConsecutiveDelta2(q,succ O2) by A7,A20
            .= new_bi_fun2(BiFun(ConsecutiveDelta2(q,O2), ConsecutiveSet2(A,
          O2),L),Quadr2(q,O2)) by Th19
            .= new_bi_fun2(Def8,Quadr2(q,O2)) by LATTICE5:def 15;
          then ConsecutiveDelta2(q,O2) c= Ls.succ O2 by Th13;
          then Ls.O2 c= Ls.succ O2 by A7,A20,A22,ORDINAL1:10;
          hence thesis by A18,A20,A21,A22,ORDINAL1:10,22;
        end;
      end;
A23:  X[0];
      thus for O being Ordinal holds X[O] from ORDINAL2:sch 1(A23,A17, A9);
    end;
    for x,y being set st x in rng Ls & y in rng Ls holds x,y are_c=-comparable
    proof
      let x,y be set;
      assume that
A24:  x in rng Ls and
A25:  y in rng Ls;
      consider o1 being object such that
A26:  o1 in dom Ls and
A27:  Ls.o1 = x by A24,FUNCT_1:def 3;
      consider o2 being object such that
A28:  o2 in dom Ls and
A29:  Ls.o2 = y by A25,FUNCT_1:def 3;
      reconsider o19 = o1, o29 = o2 as Ordinal by A26,A28;
      o19 c= o29 or o29 c= o19;
      then x c= y or y c= x by A8,A26,A27,A28,A29;
      hence thesis;
    end;
    then
A30: rng Ls is c=-linear;
    set Y = the carrier of L, X = [:
    ConsecutiveSet2(A,O1),ConsecutiveSet2(A,O1):], f = union rng Ls;
    rng Ls c= PFuncs(X,Y)
    proof
      let z be object;
      assume z in rng Ls;
      then consider o being object such that
A31:  o in dom Ls and
A32:  z = Ls.o by FUNCT_1:def 3;
      reconsider o as Ordinal by A31;
      Ls.o = ConsecutiveDelta2(q,o) by A7,A31;
      then reconsider
      h = Ls.o as BiFunction of ConsecutiveSet2(A,o),L by A6,A7,A31;
      o c= O1 by A7,A31,ORDINAL1:def 2;
      then dom h = [:ConsecutiveSet2(A,o),ConsecutiveSet2(A,o):] &
      ConsecutiveSet2(A,o) c= ConsecutiveSet2(A,O1) by Th21,FUNCT_2:def 1;
      then rng h c= Y & dom h c= X by ZFMISC_1:96;
      hence thesis by A32,PARTFUN1:def 3;
    end;
    then f in PFuncs(X,Y) by A30,TREES_2:40;
    then
A33: ex g being Function st f = g & dom g c= X & rng g c= Y by PARTFUN1:def 3;
    Ls is Function-yielding
    proof
      let x be object;
      assume
A34:  x in dom Ls;
      then reconsider o = x as Ordinal;
      Ls.o = ConsecutiveDelta2(q,o) by A7,A34;
      hence thesis by A6,A7,A34;
    end;
    then reconsider LsF = Ls as Function-yielding Function;
A35: rng doms LsF = YY
    proof
      thus rng doms LsF c= YY
      proof
        let Z be object;
        assume Z in rng doms LsF;
        then consider o being object such that
A36:    o in dom doms LsF and
A37:    Z = (doms LsF).o by FUNCT_1:def 3;
A38:    o in dom LsF by A36,FUNCT_6:59;
        then reconsider o9 = o as Element of o1 by A7;
        Ls.o9 = ConsecutiveDelta2(q,o9) by A7;
        then reconsider
        ls = Ls.o9 as BiFunction of ConsecutiveSet2(A,o9),L by A6;
        Z = dom ls by A37,A38,FUNCT_6:22
          .= [:ConsecutiveSet2(A,o9),ConsecutiveSet2(A,o9):] by FUNCT_2:def 1;
        hence thesis;
      end;
      let Z be object;
      assume Z in YY;
      then consider o being Element of o1 such that
A39:  Z = [:ConsecutiveSet2(A,o),ConsecutiveSet2(A,o):];
      Ls.o = ConsecutiveDelta2(q,o) by A7;
      then reconsider ls = Ls.o as BiFunction of ConsecutiveSet2(A,o),L by A6;
      o in dom LsF by A7;
      then
A40:  o in dom doms LsF by FUNCT_6:59;
      Z = dom ls by A39,FUNCT_2:def 1
        .= (doms LsF).o by A7,FUNCT_6:22;
      hence thesis by A40,FUNCT_1:def 3;
    end;
A41: ConsecutiveDelta2(q,O1) = union rng Ls by A4,A5,A7,Th20;
    reconsider f as Function by A33;
    deffunc U(Ordinal) = ConsecutiveSet2(A,$1);
    consider Ts being Sequence such that
A42: dom Ts = O1 & for O2 being Ordinal st O2 in O1 holds Ts.O2 = U(O2
    ) from ORDINAL2:sch 2;
    {} in O1 by A4,ORDINAL3:8;
    then reconsider RTs = rng Ts as non empty set by A42,FUNCT_1:3;
A43: YY = { [:a,a:] where a is Element of RTs : a in RTs }
    proof
      set XX = { [:a,a:] where a is Element of RTs : a in RTs };
      thus YY c= XX
      proof
        let Z be object;
        assume Z in YY;
        then consider o being Element of o1 such that
A44:    Z = [:ConsecutiveSet2(A,o),ConsecutiveSet2(A,o):];
        Ts.o = ConsecutiveSet2(A,o) by A42;
        then reconsider CoS = ConsecutiveSet2(A,o) as Element of RTs by A42,
FUNCT_1:def 3;
        Z = [:CoS,CoS:] by A44;
        hence thesis;
      end;
      let Z be object;
      assume Z in XX;
      then consider a being Element of RTs such that
A45:  Z = [:a,a:] and
      a in RTs;
      consider o being object such that
A46:  o in dom Ts and
A47:  a = Ts.o by FUNCT_1:def 3;
      reconsider o9 = o as Ordinal by A46;
      a = ConsecutiveSet2(A,o9) by A42,A46,A47;
      hence thesis by A42,A45,A46;
    end;
    for x,y being set st x in RTs & y in RTs holds x,y are_c=-comparable
    proof
      let x,y be set;
      assume that
A48:  x in RTs and
A49:  y in RTs;
      consider o1 being object such that
A50:  o1 in dom Ts and
A51:  Ts.o1 = x by A48,FUNCT_1:def 3;
      consider o2 being object such that
A52:  o2 in dom Ts and
A53:  Ts.o2 = y by A49,FUNCT_1:def 3;
      reconsider o19 = o1, o29 = o2 as Ordinal by A50,A52;
A54:  Ts.o29 = ConsecutiveSet2(A,o29) by A42,A52;
A55:  o19 c= o29 or o29 c= o19;
      Ts.o19 = ConsecutiveSet2(A,o19) by A42,A50;
      then x c= y or y c= x by A51,A53,A54,A55,Th21;
      hence thesis;
    end;
    then
A56: dom f = union rng doms LsF & RTs is c=-linear by LATTICE5:1;
    X = [:union rng Ts, ConsecutiveSet2(A,O1):] by A4,A5,A42,Th16
      .= [:union RTs, union RTs :] by A4,A5,A42,Th16
      .= dom f by A35,A56,A43,LATTICE5:3;
    hence thesis by A41,A33,FUNCT_2:def 1,RELSET_1:4;
  end;
  ConsecutiveSet2(A,{}) = A by Th14;
  then
A57: X[0] by Th18;
  for O being Ordinal holds X[O] from ORDINAL2:sch 1(A57,A1,A3);
  hence thesis;
end;
