reserve H for ZF-formula,
  M,E for non empty set,
  e for Element of E,
  m,m0,m3, m4 for Element of M,
  v,v1,v2 for Function of VAR,M,
  f,f1 for Function of VAR,E,
  g for Function,
  u,u1,u2 for set,
  x,y for Variable,
  i,n for Element of NAT,
  X for set;
reserve W for Universe,
  w for Element of W,
  Y for Subclass of W,
  a,a1,b,c for Ordinal of W,
  L for DOMAIN-Sequence of W;

theorem Th3:
  omega in W & (for a,b st a in b holds L.a c= L.b) & (for a st a
<> {} & a is limit_ordinal holds L.a = Union (L|a)) & (for a holds L.a in Union
L & L.a is epsilon-transitive) & Union L is predicatively_closed implies for H
st {x.0,x.1,x.2} misses Free H holds Union L |= the_axiom_of_substitution_for H
proof
  assume that
A1: omega in W and
A2: for a,b st a in b holds L.a c= L.b and
A3: for a st a <> {} & a is limit_ordinal holds L.a = Union (L|a) and
A4: for a holds L.a in Union L & L.a is epsilon-transitive and
A5: Union L is predicatively_closed;
  set M = Union L;
A6: now
    defpred P[set,set] means $1 in L.$2;
    let H;
    let f be Function of VAR,M such that
A7: {x.0,x.1,x.2} misses Free H and
A8: M,f |= All(x.3,Ex(x.0,All(x.4,H <=> x.4 '=' x.0)));
    consider k being Element of NAT such that
A9: for i st x.i in variables_in H holds i < k by ZFMODEL2:3;
    set p = H/(x.0,x.(k+5));
    k+0 = k;
    then
A10: not x.(k+5) in variables_in H by A9,XREAL_1:7;
    then
A11: M,f |= All(x.3,Ex(x.0,All(x.4,p <=> x.4 '=' x.0))) & def_func'(H,f) =
    def_func'(p,f) by A7,A8,Lm2;
    set F = def_func'(H,f);
A12: for d being Element of M qua non empty set ex a st P[d,a]
    proof
      let d be Element of M qua non empty set;
      consider u such that
A13:  u in dom L and
A14:  d in L.u by Lm1;
      u in On W by A13,ZF_REFLE:def 2;
      then reconsider u as Ordinal of W by ZF_REFLE:7;
      take u;
      thus thesis by A14;
    end;
    consider g being Function such that
A15: dom g = M & for d being Element of M qua non empty set ex a st a
    = g.d & P[d,a] & for b st P[d,b] holds a c= b from ZF_REFLE:sch 1(A12);
A16: rng g c= W
    proof
      let u1 be object;
      assume u1 in rng g;
      then consider u2 being object such that
A17:  u2 in dom g and
A18:  u1 = g.u2 by FUNCT_1:def 3;
      reconsider d = u2 as Element of M by A15,A17;
      ex a st a = g.d & d in L.a & for b st d in L.b holds a c= b by A15;
      hence thesis by A18;
    end;
    card VAR = omega & omega in card W by A1,CARD_1:5,47,CLASSES2:1,ZF_REFLE:17
;
    then
A19: card dom f in card W by FUNCT_2:def 1;
    rng f = f.: dom f by RELAT_1:113;
    then card (rng f) in card W by A19,CARD_1:67,ORDINAL1:12;
    then
A20: card (g.:(rng f)) in card W by CARD_1:67,ORDINAL1:12;
    g.:(rng f) c= rng g by RELAT_1:111;
    then g.:(rng f) c= W by A16;
    then g.:(rng f) in W by A20,CLASSES1:1;
    then reconsider b2 = sup (g.:(rng f)) as Ordinal of W by ZF_REFLE:19;
A21: x.0 in {x.0,x.1,x.2} by ENUMSET1:def 1;
    {x.0,x.1,x.2} misses Free p by A7,A8,A10,Lm2;
    then
A22: not x.0 in Free p by A21,XBOOLE_0:3;
A23: X c= M & sup (g.:X) c= a implies X c= L.a
    proof
      assume that
A24:  X c= M and
A25:  sup (g.:X) c= a;
      let u1 be object;
      assume
A26:  u1 in X;
      then reconsider d = u1 as Element of M by A24;
      consider b such that
A27:  b = g.d and
A28:  d in L.b and
      for a st d in L.a holds b c= a by A15;
      b in g.:X by A15,A26,A27,FUNCT_1:def 6;
      then b in sup (g.:X) by ORDINAL2:19;
      then L.b c= L.a by A2,A25;
      hence thesis by A28;
    end;
    let u be Element of M;
    consider b0 being Ordinal of W such that
    b0 = g.u and
A29: u in L.b0 and
    for b st u in L.b holds b0 c= b by A15;
A30: card u in card W by CLASSES2:1;
    k+0 = k;
    then
A31: 0 <= k & k < k+5 by NAT_1:2,XREAL_1:6;
    then
A32: not x.0 in variables_in p by ZF_LANG1:76,184;
    g.:(F.:u) c= rng g by RELAT_1:111;
    then
A33: g.:(F.:u) c= W by A16;
    card (g.:(F.:u)) c= card (F.:u) & card (F.:u) c= card u by CARD_1:67;
    then card (g.:(F.:u)) in card W by A30,ORDINAL1:12,XBOOLE_1:1;
    then g.:(F.:u) in W by A33,CLASSES1:1;
    then reconsider b1 = sup (g.:(F.:u)) as Ordinal of W by ZF_REFLE:19;
    set b = b0 \/ b1;
    set a = b \/ b2;
A34: F.:u c= L.b by A23,XBOOLE_1:7;
    consider phi being Ordinal-Sequence of W such that
A35: phi is increasing & phi is continuous and
A36: for a st phi.a = a & {} <> a for v being Function of VAR,L.a
holds M,M!v |= p/(x.4,x.0) iff L.a,v |= p/(x.4,x.0) by A1,A2,A3,ZF_REFLE:20;
    consider a1 such that
A37: a in a1 and
A38: phi.a1 = a1 by A1,A35,ZFREFLE1:28;
A39: rng f c= L.a1
    proof
      let u be object;
A40:  b2 c= a by XBOOLE_1:7;
      assume
A41:  u in rng f;
      then consider u1 being object such that
A42:  u1 in dom f and
A43:  u = f.u1 by FUNCT_1:def 3;
      reconsider u1 as Variable by A42;
      consider a2 being Ordinal of W such that
A44:  a2 = g.(f.u1) and
A45:  f.u1 in L.a2 and
      for b st f.u1 in L.b holds a2 c= b by A15;
      a2 in g.:rng f by A15,A41,A43,A44,FUNCT_1:def 6;
      then a2 in b2 by ORDINAL2:19;
      then L.a2 c= L.a1 by A2,A37,A40,ORDINAL1:10;
      hence thesis by A43,A45;
    end;
    set x = x.(k+10);
    k+0 = k;
    then not k+10 < k by XREAL_1:6;
    then not x in variables_in H by A9;
    then
A46: not x in variables_in H \ {x.0} by XBOOLE_0:def 5;
    set q = Ex(x.3,x.3 'in' x '&' (p/(x.4,x.0)));
A47: 10 <= 10+k by NAT_1:11;
    b0 c= b & b c= a by XBOOLE_1:7;
    then b0 c= a;
    then
A48: L.b0 c= L.a1 by A2,A37,ORDINAL1:12;
    then reconsider mu = u as Element of L.a1 by A29;
    dom f = VAR by FUNCT_2:def 1;
    then reconsider v = f as Function of VAR,L.a1 by A39,FUNCT_2:def 1
,RELSET_1:4;
    set w = v/(x.0,v.x.4)/(x,mu);
A49: x <> x.(k+5) implies not x in {x.(k+5)} by TARSKI:def 1;
    variables_in p c= (variables_in H \ {x.0}) \/ {x.(k+5)} & k+5 <> k+
    10 by ZF_LANG1:187;
    then not x in variables_in p by A46,A49,XBOOLE_0:def 3,ZF_LANG1:76;
    then
A50: variables_in (p/(x.4,x.0)) c= (variables_in p \ {x.4}) \/ {x.0} &
    not x in variables_in p \ {x.4} by XBOOLE_0:def 5,ZF_LANG1:187;
A51: 10 > 0;
    then
A52: x <> x.0 by A47,ZF_LANG1:76;
    then not x in {x.0} by TARSKI:def 1;
    then
A53: not x in variables_in (p/(x.4,x.0)) by A50,XBOOLE_0:def 3;
A54: 10 > 3;
    then
A55: x.0 <> x.3 & x <> x.3 by A47,ZF_LANG1:76;
    b in a1 by A37,ORDINAL1:12,XBOOLE_1:7;
    then L.b c= L.a1 by A2;
    then
A56: F.:u c= L.a1 by A34;
A57: F.:u = Section(q,w)
    proof
      now
        per cases;
        suppose
A58:      x.4 in Free H;
          4<>k+5 by NAT_1:11;
          then
A59:      x.(k+5)<>x.4 by ZF_LANG1:76;
A60:      x.(k+10)<>x.0 by A51,A47,ZF_LANG1:76;
          ( not x.(k+5) in variables_in H)& x.(k+5)<>x.0 by A9,A31,ZF_LANG1:76;
          then
A61:      x.0 in Free q by A58,A60,A59,Lm4;
A62:      F.:u c= Section(q,w)
          proof
            let u1 be object;
            assume
A63:        u1 in F.:u;
            then consider u2 being object such that
A64:        u2 in dom F and
A65:        u2 in u and
A66:        u1 = F.u2 by FUNCT_1:def 6;
            reconsider m1 = u1 as Element of L.a1 by A56,A63;
            reconsider u2 as Element of M by A64;
            L.a1 is epsilon-transitive by A4;
            then u c= L.a1 by A29,A48;
            then reconsider m2 = u2 as Element of L.a1 by A65;
A67:        f/(x.3,u2)/(x.0,F.u2) = M!(v/(x.3,m2)/(x.0,m1)) by A66,
ZF_LANG1:def 1,ZF_REFLE:16;
            M,f/(x.3,u2)/(x.4,F.u2) |= p & f/(x.3,u2)/(x.4,F.u2).(x.4)=F
            . u2 by A11,A22,FUNCT_7:128,ZFMODEL2:10;
            then M,f/(x.3,u2)/(x.4,F.u2)/(x.0,F.u2) |= p/(x.4,x.0) by A32,
ZFMODEL2:13;
            then
A68:        M,f/(x.3,u2)/(x.0,F.u2)/(x.4,F.u2) |= p/(x.4,x.0) by FUNCT_7:33
,ZF_LANG1:76;
            not x.4 in variables_in (p/(x.4,x.0)) by ZF_LANG1:76,184;
            then M,f/(x.3,u2)/(x.0,F.u2) |= p/(x.4,x.0) by A68,ZFMODEL2:5;
            then L.a1,v/(x.3,m2)/(x.0,m1) |= p/(x.4,x.0) by A36,A37,A38,A67;
            then
A69:        L.a1,v/(x.3,m2)/(x.0,m1)/(x,mu) |= p/(x.4,x.0) by A53,ZFMODEL2:5;
A70:        w.x = w/(x.0,m1).x & w.x = mu by A51,A47,FUNCT_7:32,128,ZF_LANG1:76
;
            w/(x.0,m1)/(x.3,m2).(x.3) = m2 & w/(x.0,m1)/(x.3,m2).x = w/(
            x.0,m1).x by A54,A47,FUNCT_7:32,128,ZF_LANG1:76;
            then
A71:        L.a1,w/(x.0,m1)/(x.3,m2) |= x.3 'in' x by A65,A70,ZF_MODEL:13;
            w/(x.0,m1) = v/(x,mu)/(x.0,m1) by ZFMODEL2:8;
            then L.a1,w/(x.0,m1)/(x.3,m2) |= p/(x.4,x.0) by A52,A55,A69,
ZFMODEL2:6;
            then L.a1,w/(x.0,m1)/(x.3,m2) |= x.3 'in' x '&' (p/(x.4,x.0)) by
A71,ZF_MODEL:15;
            then L.a1,w/(x.0,m1) |= q by ZF_LANG1:73;
            then u1 in { m where m is Element of L.a1: L.a1,w/(x.0,m) |= q };
            hence thesis by A61,Def1;
          end;
          Section(q,w) c= F.:u
          proof
            let u1 be object;
A72:        L.a1 c= M by ZF_REFLE:16;
            assume u1 in Section(q,w);
            then u1 in { m where m is Element of L.a1: L.a1,w/(x.0,m) |= q }
            by A61,Def1;
            then consider m1 being Element of L.a1 such that
A73:        u1 = m1 and
A74:        L.a1,w/(x.0,m1) |= q;
            consider m2 being Element of L.a1 such that
A75:        L.a1,w/(x.0,m1)/(x.3,m2) |= x.3 'in' x '&' (p/(x.4,x.0))
            by A74,ZF_LANG1:73;
            reconsider u9 = m1, u2 = m2 as Element of M by A72;
A76:        w/(x.0,m1) = v/(x,mu)/(x.0,m1) by ZFMODEL2:8;
            L.a1,w/(x.0,m1)/(x.3,m2) |= p/(x.4,x.0) by A75,ZF_MODEL:15;
            then L.a1,v/(x.3,m2)/(x.0,m1)/(x,mu) |= p/(x.4,x.0) by A52,A55,A76,
ZFMODEL2:6;
            then
A77:        L.a1,v/(x.3,m2)/(x.0,m1) |= p/(x.4,x.0) by A53,ZFMODEL2:5;
A78:        f/(x.3,u2)/(x.0,u9)/(x.4,u9) = f/(x.3,u2)/(x.4,u9)/(x.0,u9)
            & f/(x.3,u2)/(x. 0,u9).(x.0) = u9 by FUNCT_7:33,128,ZF_LANG1:76;
            f/(x.3,u2)/(x.0,u9) = M!(v/(x.3,m2)/(x.0,m1)) by ZF_LANG1:def 1
,ZF_REFLE:16;
            then M,f/(x.3,u2)/(x.0,u9) |= p/(x.4,x.0) by A36,A37,A38,A77;
            then M,f/(x.3,u2)/(x.4,u9)/(x.0,u9) |= p by A32,A78,ZFMODEL2:12;
            then M,f/(x.3,u2)/(x.4,u9) |= p by A32,ZFMODEL2:5;
            then
A79:        F.u2 = u9 by A11,A22,ZFMODEL2:10;
A80:        w.x = w/(x.0,m1).x & w.x = mu by A51,A47,FUNCT_7:32,128,ZF_LANG1:76
;
A81:        L.a1,w/(x.0,m1)/(x.3,m2) |= x.3 'in' x by A75,ZF_MODEL:15;
A82:        dom F = M by FUNCT_2:def 1;
            w/(x.0,m1)/(x.3,m2).(x.3) = m2 & w/(x.0,m1)/(x.3,m2).x = w/(
            x.0,m1).x by A54,A47,FUNCT_7:32,128,ZF_LANG1:76;
            then m2 in u by A81,A80,ZF_MODEL:13;
            hence thesis by A73,A79,A82,FUNCT_1:def 6;
          end;
          hence thesis by A62;
        end;
        suppose
A83:      not x.4 in Free H;
          4<>k+5 by NAT_1:11;
          then
A84:      x.(k+5)<>x.4 by ZF_LANG1:76;
A85:      x.(k+10)<>x.0 by A51,A47,ZF_LANG1:76;
          ( not x.(k+5) in variables_in H)& x.(k+5)<>x.0 by A9,A31,ZF_LANG1:76;
          then not x.0 in Free q by A83,A85,A84,Lm4;
          then Section(q,w)={} by Def1;
          hence thesis by A8,A83,Lm3;
        end;
      end;
      hence thesis;
    end;
    L.a1 in M by A4;
    hence def_func'(H,f).:u in M by A5,A57;
  end;
  Union L is epsilon-transitive
  proof
    let X;
    assume X in Union L;
    then consider u such that
A86: u in dom L and
A87: X in L.u by Lm1;
    reconsider u as Ordinal by A86;
    u in On W by A86,ZF_REFLE:def 2;
    then reconsider u as Ordinal of W by ZF_REFLE:7;
    L.u is epsilon-transitive by A4;
    then
A88: X c= L.u by A87;
    let u1 be object;
A89: L.u c= Union L by ZF_REFLE:16;
    assume u1 in X;
    then u1 in L.u by A88;
    hence thesis by A89;
  end;
  hence thesis by A6,ZFMODEL1:15;
end;
