reserve X,x,y,z for set;
reserve n,m,k,k9,d9 for Nat;
reserve d for non zero Nat;
reserve i,i0,i1 for Element of Seg d;
reserve l,r,l9,r9,l99,r99,x,x9,l1,r1,l2,r2 for Element of REAL d;
reserve Gi for non trivial finite Subset of REAL;
reserve li,ri,li9,ri9,xi,xi9 for Real;
reserve G for Grating of d;

theorem Th60:
  for C being Chain of (k + 1 + 1),G holds del (del C) = 0_(k,G)
proof
  let C be Chain of (k + 1 + 1),G;
  per cases;
  suppose
A1: k + 1 + 1 <= d;
    then
A2: k + 1 < d by NAT_1:13;
    then
A3: k < d by NAT_1:13;
A4: for C being Cell of (k + 1 + 1),G, l,r
    st C = cell(l,r) & for i holds l.i <= r.i holds del (del {C}) = 0_(k,G)
    proof
      let C be Cell of (k + 1 + 1),G, l,r;
      assume that
A5:   C = cell(l,r) and
A6:   for i holds l.i <= r.i;
      now
        let A be object;
        assume
A7:     A in del (del {C});
        then reconsider A as Cell of k,G;
        set BB = star A /\ del {C};
A8:     now
          let B be Cell of (k + 1),G;
          B in BB iff B in star A & B in del {C} by XBOOLE_0:def 4;
          hence B in BB iff A c= B & B c= C by A1,Th47,Th50;
        end;
A9:     card BB is odd by A7,Th48;
        consider B being object such that
A10:    B in BB by A9,CARD_1:27,XBOOLE_0:def 1;
        reconsider B as Cell of (k + 1),G by A10;
A11:    A c= B by A8,A10;
        B c= C by A8,A10;
        then
A12:    A c= C by A11;
        set i0 = the Element of Seg d;
        l.i0 <= r.i0 by A6;
        then consider Z being Subset of Seg d such that
A13:    card Z = k + 1 + 1 and
A14:    for i holds i in Z & l.i < r.i & [l.i,r.i] is Gap of G.i or not
        i in Z & l.i = r.i & l.i in G.i
        by A1,A5,Th30;
        consider l9,r9 such that
A15:    A = cell(l9,r9) and
A16:    (ex X being Subset of Seg d st card X = k & for i holds (i in X &
l9.i < r9.i & [l9.i,r9.i] is Gap of G.i) or (not i in X & l9.i = r9.i & l9.i in
        G.i)) or (k = d & for i holds r9.i < l9.i & [l9.i,r9.i] is Gap of G.i)
        by A3,Th29;
        l9.i0 <= r9.i0 by A5,A6,A12,A15,Th25;
        then consider X being Subset of Seg d such that
A17:    card X = k and
A18:    for i holds i in X & l9.i < r9.i & [l9.i,r9.i] is Gap of G.i or
        not i in X & l9.i = r9.i & l9.i in G.i
        by A16;
        ex B1,B2 being set st B1 in BB & B2 in BB & B1 <> B2 &
        for B being set st B in BB holds B = B1 or B = B2
        proof
A19:      X c= Z by A5,A12,A14,A15,A18,Th44;
          then card(Z \ X) = (k + (1 + 1)) - k by A13,A17,CARD_2:44
            .= 2;
          then consider i1,i2 being set such that
A20:      i1 in Z \ X and
A21:      i2 in Z \ X and
A22:      i1 <> i2 and
A23:      for i being set st i in Z \ X holds i = i1 or i = i2 by Th5;
A24:      i1 in Z by A20,XBOOLE_0:def 5;
A25:      i2 in Z by A21,XBOOLE_0:def 5;
A26:      not i1 in X by A20,XBOOLE_0:def 5;
A27:      not i2 in X by A21,XBOOLE_0:def 5;
          reconsider i1,i2 as Element of Seg d by A20,A21;
          set Y1 = X \/ {i1};
A28:      X c= Y1 by XBOOLE_1:7;
          {i1} c= Z by A24,ZFMISC_1:31;
          then
A29:      Y1 c= Z by A19,XBOOLE_1:8;
          defpred S[Element of Seg d,Element of REAL] means
          ($1 in Y1 implies $2 = l.$1) & (not $1 in Y1 implies $2 = l9.$1);
A30:      for i ex xi being Element of REAL st S[i,xi]
          proof
            let i;
A31:           l.i in REAL & l9.i in REAL by XREAL_0:def 1;
            i in Y1 or not i in Y1;
            hence thesis by A31;
          end;
          consider l1 being Function of Seg d,REAL such that
A32:      for i holds S[i,l1.i] from FUNCT_2:sch 3(A30);
          defpred R[Element of Seg d,Element of REAL] means
          ($1 in Y1 implies $2 = r.$1) & (not $1 in Y1 implies $2 = r9.$1);
A33:      for i ex xi being Element of REAL st R[i,xi]
          proof
            let i;
A34:           r.i in REAL & r9.i in REAL by XREAL_0:def 1;
            i in Y1 or not i in Y1;
            hence thesis by A34;
          end;
          consider r1 being Function of Seg d,REAL such that
A35:      for i holds R[i,r1.i] from FUNCT_2:sch 3(A33);
          reconsider l1,r1 as Element of REAL d by Def3;
A36:      for i holds l1.i <= r1.i
          proof
            let i;
l1.i = l.i & r1.i = r.i or l1.i = l9.i & r1.i = r9.i by A32,A35;
            hence thesis by A14,A18;
          end;
A37:      card Y1 = card X + card {i1} by A26,CARD_2:40,ZFMISC_1:50
            .= k + 1 by A17,CARD_1:30;
          for i holds i in Y1 & l1.i < r1.i & [l1.i,r1.i] is Gap of G.i or
          not i in Y1 & l1.i = r1.i & l1.i in G.i
          proof
            let i;
            per cases;
            suppose
A38:          i in Y1;
              then
A39:          l1.i = l.i by A32;
              r1.i = r.i by A35,A38;
              hence thesis by A14,A29,A38,A39;
            end;
            suppose
A40:          not i in Y1;
              then
A41:          l1.i = l9.i by A32;
A42:          r1.i = r9.i by A35,A40;
              not i in X by A28,A40;
              hence thesis by A18,A40,A41,A42;
            end;
          end;
          then reconsider B1 = cell(l1,r1) as Cell of (k + 1),G by A2,A37,Th30;
          set Y2 = X \/ {i2};
A43:      X c= Y2 by XBOOLE_1:7;
          {i2} c= Z by A25,ZFMISC_1:31;
          then
A44:      Y2 c= Z by A19,XBOOLE_1:8;
          defpred P[Element of Seg d,Element of REAL] means
          ($1 in Y2 implies $2 = l.$1) & (not $1 in Y2 implies $2 = l9.$1);
A45:      for i ex xi being Element of REAL st P[i,xi]
          proof
            let i;
A46:           l.i in REAL & l9.i in REAL by XREAL_0:def 1;
            i in Y2 or not i in Y2;
            hence thesis by A46;
          end;
          consider l2 being Function of Seg d,REAL such that
A47:      for i holds P[i,l2.i] from FUNCT_2:sch 3(A45);
          defpred R[Element of Seg d,Element of REAL] means
          ($1 in Y2 implies $2 = r.$1) & (not $1 in Y2 implies $2 = r9.$1);
A48:      for i ex xi being Element of REAL st R[i,xi]
          proof
            let i;
A49:           r.i in REAL & r9.i in REAL by XREAL_0:def 1;
            i in Y2 or not i in Y2;
            hence thesis by A49;
          end;
          consider r2 being Function of Seg d,REAL such that
A50:      for i holds R[i,r2.i] from FUNCT_2:sch 3(A48);
          reconsider l2,r2 as Element of REAL d by Def3;
A51:      card Y2 = card X + card {i2} by A27,CARD_2:40,ZFMISC_1:50
            .= k + 1 by A17,CARD_1:30;
          for i holds i in Y2 & l2.i < r2.i & [l2.i,r2.i] is Gap of G.i or
          not i in Y2 & l2.i = r2.i & l2.i in G.i
          proof
            let i;
            per cases;
            suppose
A52:          i in Y2;
              then
A53:          l2.i = l.i by A47;
              r2.i = r.i by A50,A52;
              hence thesis by A14,A44,A52,A53;
            end;
            suppose
A54:          not i in Y2;
              then
A55:          l2.i = l9.i by A47;
A56:          r2.i = r9.i by A50,A54;
              not i in X by A43,A54;
              hence thesis by A18,A54,A55,A56;
            end;
          end;
          then reconsider B2 = cell(l2,r2) as Cell of (k + 1),G by A2,A51,Th30;
          take B1,B2;
A57:      for i holds l1.i <= l9.i & l9.i <= r9.i & r9.i <= r1.i &
          l.i <= l1.i & l1.i <= r1.i & r1.i <= r.i
          proof
            let i;
            per cases;
            suppose
A58:          i in Y1;
              then
A59:          l1.i = l.i by A32;
              r1.i = r.i by A35,A58;
              hence thesis by A5,A6,A12,A15,A59,Th25;
            end;
            suppose
A60:          not i in Y1;
              then
A61:          l1.i = l9.i by A32;
              r1.i = r9.i by A35,A60;
              hence thesis by A5,A6,A12,A15,A61,Th25;
            end;
          end;
          then
A62:      A c= B1 by A15,Th25;
          B1 c= C by A5,A6,A57,Th25;
          hence B1 in BB by A8,A62;
A63:      for i holds l2.i <= l9.i & l9.i <= r9.i & r9.i <= r2.i &
          l.i <= l2.i & l2.i <= r2.i & r2.i <= r.i
          proof
            let i;
            per cases;
            suppose
A64:          i in Y2;
              then
A65:          l2.i = l.i by A47;
              r2.i = r.i by A50,A64;
              hence thesis by A5,A6,A12,A15,A65,Th25;
            end;
            suppose
A66:          not i in Y2;
              then
A67:          l2.i = l9.i by A47;
              r2.i = r9.i by A50,A66;
              hence thesis by A5,A6,A12,A15,A67,Th25;
            end;
          end;
          then
A68:      A c= B2 by A15,Th25;
          B2 c= C by A5,A6,A63,Th25;
          hence B2 in BB by A8,A68;
          i1 in {i1} by TARSKI:def 1;
          then
A69:      i1 in Y1 by XBOOLE_0:def 3;
A70:      not i1 in X by A20,XBOOLE_0:def 5;
          not i1 in {i2} by A22,TARSKI:def 1;
          then
A71:      not i1 in Y2 by A70,XBOOLE_0:def 3;
A72:      l1.i1 = l.i1 by A32,A69;
A73:      r1.i1 = r.i1 by A35,A69;
A74:      l2.i1 = l9.i1 by A47,A71;
A75:      r2.i1 = r9.i1 by A50,A71;
          l.i1 < r.i1 by A14,A24;
          then l1 <> l2 or r1 <> r2 by A18,A26,A72,A73,A74,A75;
          hence B1 <> B2 by A36,Th28;
          let B be set;
          assume
A76:      B in BB;
          then reconsider B as Cell of (k + 1),G;
A77:      A c= B by A8,A76;
A78:      B c= C by A8,A76;
          consider l99,r99 such that
A79:      B = cell(l99,r99) and
A80:      (ex Y being Subset of Seg d st card Y = k + 1 & for i holds (i in
Y & l99.i < r99.i & [l99.i,r99.i] is Gap of G.i) or (not i in Y & l99.i = r99.i
& l99.i in G.i)) or (k + 1 = d & for i holds r99.i < l99.i & [l99.i,r99.i] is
          Gap of G.i)
          by A2,Th29;
          l99.i0 <= r99.i0 by A5,A6,A78,A79,Th25;
          then consider Y being Subset of Seg d such that
A81:      card Y = k + 1 and
A82:      for i holds i in Y & l99.i < r99.i & [l99.i,r99.i] is Gap of G.i
          or not i in Y & l99.i = r99.i & l99.i in G.i
          by A80;
A83:      X c= Y by A15,A18,A77,A79,A82,Th44;
A84:      Y c= Z by A5,A14,A78,A79,A82,Th44;
          card(Y \ X) = (k + 1) - k by A17,A81,A83,CARD_2:44
            .= 1;
          then consider i9 being object such that
A85:      Y \ X = {i9} by CARD_2:42;
A86:      i9 in Y \ X by A85,TARSKI:def 1;
          then reconsider i9 as Element of Seg d;
A87:      i9 in Y by A86,XBOOLE_0:def 5;
          not i9 in X by A86,XBOOLE_0:def 5;
          then
A88:      i9 in Z \ X by A84,A87,XBOOLE_0:def 5;
A89:      Y = X \/ Y by A83,XBOOLE_1:12
            .= X \/ {i9} by A85,XBOOLE_1:39;
          per cases by A23,A88,A89;
          suppose
A90:        Y = Y1;
            reconsider l99,r99,l1,r1 as Function of Seg d,REAL by Def3;
A91:        now
              let i;
              i in Y or not i in Y;
              then l99.i = l.i & l1.i = l.i & r99.i = r.i & r1.i = r.i or
              l99.i = l9.i & l1.i = l9.i & r99.i = r9.i & r1.i = r9.i
              by A5,A14,A15,A18,A32,A35,A77,A78,A79,A82,A90,Th44;
              hence l99.i = l1.i & r99.i = r1.i;
            end;
            then l99 = l1 by FUNCT_2:63;
            hence thesis by A79,A91,FUNCT_2:63;
          end;
          suppose
A92:        Y = Y2;
            reconsider l99,r99,l2,r2 as Function of Seg d,REAL by Def3;
A93:        now
              let i;
              i in Y or not i in Y;
              then l99.i = l.i & l2.i = l.i & r99.i = r.i & r2.i = r.i or
              l99.i = l9.i & l2.i = l9.i & r99.i = r9.i & r2.i = r9.i
              by A5,A14,A15,A18,A47,A50,A77,A78,A79,A82,A92,Th44;
              hence l99.i = l2.i & r99.i = r2.i;
            end;
            then l99 = l2 by FUNCT_2:63;
            hence thesis by A79,A93,FUNCT_2:63;
          end;
        end;
        then card BB = 2* 1 by Th5;
        hence contradiction by A7,Th48;
      end;
      hence thesis by XBOOLE_0:def 1;
    end;
A94: for C1,C2 being Chain of (k + 1 + 1),G
    st del (del C1) = 0_(k,G) & del (del C2) = 0_(k,G) holds
    del (del(C1 + C2)) = 0_(k,G)
    proof
      let C1,C2 be Chain of (k + 1 + 1),G;
      assume that
A95:  del (del C1) = 0_(k,G) and
A96:  del (del C2) = 0_(k,G);
      thus del (del(C1 + C2)) = del (del C1 + del C2) by Th58
        .= 0_(k,G) + 0_(k,G) by A95,A96,Th58
        .= 0_(k,G);
    end;
    defpred P[Chain of k+1+1,G] means del (del $1) = 0_(k,G);
    del (del 0_(k + 1 + 1,G)) = del 0_(k + 1,G) by Th56
      .= 0_(k,G) by Th56;
    then
A97: P[0_(k+1+1,G)];
    for A being Cell of (k + 1 + 1),G holds del (del {A}) = 0_(k,G)
    proof
      let A be Cell of (k + 1 + 1),G;
      consider l,r such that
A98:  A = cell(l,r) and
A99:  (ex X being Subset of Seg d st card X = k + 1 + 1 & for i holds (
i in X & l.i < r.i & [l.i,r.i] is Gap of G.i) or (not i in X & l.i = r.i & l.i
in G.i)) or (k + 1 + 1 = d & for i holds r.i < l.i & [l.i,r.i] is Gap of G.i)
      by A1,Th29;
      per cases by A99;
      suppose ex X being Subset of Seg d st card X = k + 1 + 1 &
        for i holds i in X & l.i < r.i & [l.i,r.i] is Gap of G.i or
        not i in X & l.i = r.i & l.i in G.i;
        then for i holds l.i <= r.i;
        hence thesis by A4,A98;
      end;
      suppose
A100:    k + 1 + 1 = d & for i holds r.i < l.i & [l.i,r.i] is Gap of G.i;
        then
A101:    A = infinite-cell(G) by A98,Th46;
        set C = {A}`;
A102:    for A being Cell of k+1+1,G st A in C holds P[{A}]
        proof
          let A9 be Cell of (k + 1 + 1),G;
          assume A9 in C;
          then not A9 in {A} by XBOOLE_0:def 5;
          then
A103:      A9 <> infinite-cell(G) by A101,TARSKI:def 1;
          consider l9,r9 such that
A104:     A9 = cell(l9,r9) and
A105:     (ex X being Subset of Seg d st card X = k + 1 + 1 & for i holds (
i in X & l9.i < r9.i & [l9.i,r9.i] is Gap of G.i) or (not i in X & l9.i = r9.i
& l9.i in G.i)) or (k + 1 + 1 = d & for i holds r9.i < l9.i & [l9.i,r9.i] is
          Gap of G.i)
          by A1,Th29;
          per cases by A105;
          suppose ex X being Subset of Seg d st card X = k + 1 + 1 &
            for i holds i in X & l9.i < r9.i & [l9.i,r9.i] is Gap of G.i or
            not i in X & l9.i = r9.i & l9.i in G.i;
            then for i holds l9.i <= r9.i;
            hence thesis by A4,A104;
          end;
          suppose for i holds r9.i < l9.i & [l9.i,r9.i] is Gap of G.i;
            hence thesis by A103,A104,Th46;
          end;
        end;
A106:   for C1,C2 being Chain of k+1+1,G st C1 c= C & C2 c= C &
        P[C1] & P[C2] holds P[C1 + C2] by A94;
        P[C] from ChainInd(A97,A102,A106);
        hence thesis by A100,Th59;
      end;
    end;
    then
A107: for A being Cell of k+1+1,G st A in C holds P[{A}];
A108: for C1,C2 being Chain of k+1+1,G st C1 c= C & C2 c= C &
    P[C1] & P[C2] holds P[C1 + C2] by A94;
    thus P[C] from ChainInd(A97,A107,A108);
  end;
  suppose k + 1 + 1 > d;
    then del C = 0_(k + 1,G) by Th49;
    hence thesis by Th56;
  end;
end;
