
theorem Th30:
  for C be Simple_closed_curve for n,k be Nat st n
is_sufficiently_large_for C & Y-SpanStart(C,n) <= k & k <= 2|^(n-'ApproxIndex C
)*(Y-InitStart C-'2)+2 holds cell(Gauge(C,n),X-SpanStart(C,n)-'1,k)\L~Span(C,n)
  c= BDD L~Span(C,n)
proof
  let C be Simple_closed_curve;
  let n,k be Nat;
  set G = Gauge(C,n);
  set f = Span(C,n);
  set AI = ApproxIndex C;
  set YI = Y-InitStart C;
  set XS = X-SpanStart(C,n);
  set YS = Y-SpanStart(C,n);
  assume that
A1: n is_sufficiently_large_for C and
A2: YS <= k and
A3: k <= 2|^(n-'AI)*(YI-'2)+2;
A4: f is_sequence_on G by A1,JORDAN13:def 1;
  reconsider ro = k-YS as Element of NAT by A2,INT_1:5;
A5: ro <= 2|^(n-'AI)*(YI-'2)+2-YS by A3,XREAL_1:9;
A6: k = YS+ro;
  defpred P[Nat] means
$1 <= 2|^(n-'AI)*(YI-'2)+2-YS implies cell(G
  ,XS-'1,YS+$1)\L~f c= BDD L~f;
A7: 1 <= XS-'1 by JORDAN1H:50;
  XS > 2 by JORDAN1H:49;
  then
A8: XS-'1+1 = XS by XREAL_1:235,XXREAL_0:2;
A9: XS-'1 < len G by JORDAN1H:50;
A10: for t being Nat st P[t] holds P[t+1]
  proof
    let t be Nat;
    assume
A11: t <= 2|^(n-'AI)*(YI-'2)+2-YS implies cell(G,XS-'1,YS+t)\L~f c= BDD L~f;
    set Ls = LSeg(G*(XS-'1,YS+(t+1)),G*(XS,YS+(t+1)));
A12: t < t+1 by NAT_1:13;
    set p = (1/2)*(G*(XS-'1,YS+(t+1))+G*(XS,YS+(t+1)));
A13: cell(G,XS-'1,YS+(t+1))\L~f c= (L~f)`
    proof
      let y be object;
      assume
A14:  y in cell(G,XS-'1,YS+(t+1))\L~f;
      then not y in L~f by XBOOLE_0:def 5;
      hence thesis by A14,SUBSET_1:29;
    end;
A15: p in Ls by RLTOPSP1:69;
A16: YS+t+1 = YS+(t+1);
    then
A17: 1 <= YS+(t+1) by NAT_1:11;
A18: YI > 1 by JORDAN11:2;
    then YI >= 1+1+0 by NAT_1:13;
    then YI-2 >= 0 by XREAL_1:19;
    then
A19: YI-'2 = YI-2 by XREAL_0:def 2;
    assume
A20: t+1 <= 2|^(n-'AI)*(YI-'2)+2-YS;
    then
A21: t+1+YS <= 2|^(n-'AI)*(YI-'2)+2 by XREAL_1:19;
    assume not cell(G,XS-'1,YS+(t+1))\L~f c= BDD L~f;
    then consider x be object such that
A22: x in cell(G,XS-'1,YS+(t+1))\L~f and
A23: not x in BDD L~f;
    not x in L~f by A22,XBOOLE_0:def 5;
    then x in (L~f)` by A22,SUBSET_1:29;
    then x in (BDD L~f) \/ (UBD L~f) by JORDAN2C:27;
    then x in UBD L~f by A23,XBOOLE_0:def 3;
    then
A24: cell(G,XS-'1,YS+(t+1))\L~f meets UBD L~f by A22,XBOOLE_0:3;
A25: YI < width Gauge(C,AI) by JORDAN11:def 2;
    AI <= n by A1,JORDAN11:def 1;
    then 2|^(n-'AI)*(YI-2)+2 < width Gauge(C,n) by A18,A25,JORDAN1A:32;
    then
A26: YS+t+1 <= width G by A19,A21,XXREAL_0:2;
A27: YS+t+1 <= 2|^(n-'AI)*(YI-'2)+2 by A21;
A28: now
A29:  YS <= YS+(t+1) by NAT_1:11;
A30:  XS < len G by JORDAN1H:49;
      assume p in L~f;
      then consider i be Nat such that
A31:  1 <= i and
A32:  i+1 <= len f and
A33:  p in LSeg(f,i) by SPPOL_2:13;
A34:  LSeg(f,i) = LSeg(f/.i,f/.(i+1)) by A31,A32,TOPREAL1:def 3;
      consider i1,j1,i2,j2 be Nat such that
A35:  [i1,j1] in Indices G and
A36:  f/.i = G*(i1,j1) and
A37:  [i2,j2] in Indices G and
A38:  f/.(i+1) = G*(i2,j2) and
A39:  i1 = i2 & j1+1 = j2 or i1+1 = i2 & j1 = j2 or i1 = i2+1 & j1 =
      j2 or i1 = i2 & j1 = j2+1 by A4,A31,A32,JORDAN8:3;
A40:  1 <= i1 by A35,MATRIX_0:32;
A41:  i2 <= len G by A37,MATRIX_0:32;
A42:  1 <= i2 by A37,MATRIX_0:32;
A43:  j1 <= width G by A35,MATRIX_0:32;
A44:  1 <= j2 by A37,MATRIX_0:32;
A45:  i1 <= len G by A35,MATRIX_0:32;
A46:  j2 <= width G by A37,MATRIX_0:32;
A47:  1 <= j1 by A35,MATRIX_0:32;
      per cases by A39;
      suppose
        i1 = i2 & j1+1 = j2;
        hence contradiction by A7,A8,A26,A17,A33,A34,A36,A38,A40,A45,A47,A46
,A30,GOBOARD7:27;
      end;
      suppose
A48:    i1+1 = i2 & j1 = j2;
        then
A49:    YS+(t+1) = j1 by A7,A8,A26,A17,A33,A34,A36,A38,A40,A47,A43,A41,A30,
GOBOARD7:26;
A50:    cell(G,XS-'1,YS+(t+1)) c= BDD C by A1,A21,A29,JORDAN11:def 3;
A51:    left_cell(f,i,G) = cell(G,i1,j1) by A4,A31,A32,A35,A36,A37,A38,A48,
GOBRD13:23;
        XS-'1 = i1 by A7,A8,A26,A17,A33,A34,A36,A38,A40,A47,A43,A41,A30,A48,
GOBOARD7:26;
        then cell(G,XS-'1,YS+(t+1)) meets C by A1,A31,A32,A49,A51,Th7;
        hence contradiction by A50,JORDAN1A:7,XBOOLE_1:63;
      end;
      suppose
A52:    i1 = i2+1 & j1 = j2;
        then
A53:    left_cell(f,i,G) = cell(G,i2,j2-'1) by A4,A31,A32,A35,A36,A37,A38,
GOBRD13:25;
A54:    YS+(t+1) = j2 by A7,A8,A26,A17,A33,A34,A36,A38,A45,A47,A43,A42,A30,A52,
GOBOARD7:26;
        XS-'1 = i2 by A7,A8,A26,A17,A33,A34,A36,A38,A45,A47,A43,A42,A30,A52,
GOBOARD7:26;
        then cell(G,XS-'1,YS+(t+1)-'1) meets C by A1,A31,A32,A54,A53,Th7;
        then
A55:    cell(G,XS-'1,YS+t) meets C by A16,NAT_D:34;
A56:    YS <= YS+t by NAT_1:11;
        YS+t <= 2|^(n-'AI)*(YI-'2)+2 by A27,NAT_1:13;
        then cell(G,XS-'1,YS+t) c= BDD C by A1,A56,JORDAN11:def 3;
        hence contradiction by A55,JORDAN1A:7,XBOOLE_1:63;
      end;
      suppose
        i1 = i2 & j1 = j2+1;
        hence contradiction by A7,A8,A26,A17,A33,A34,A36,A38,A40,A45,A43,A44
,A30,GOBOARD7:27;
      end;
    end;
    YS+t < width G by A26,NAT_1:13;
    then Ls c= cell(G,XS-'1,YS+t) by A7,A9,A8,A16,GOBOARD5:21;
    then
A57: p in cell(G,XS-'1,YS+t)\L~f by A28,A15,XBOOLE_0:def 5;
    Ls c= cell(G,XS-'1,YS+(t+1)) by A7,A9,A8,A26,A17,GOBOARD5:22;
    then
A58: p in cell(G,XS-'1,YS+(t+1))\L~f by A28,A15,XBOOLE_0:def 5;
    LeftComp f is_a_component_of (L~f)` by GOBOARD9:def 1;
    then UBD L~f is_a_component_of (L~f)` by GOBRD14:36;
    then cell(G,XS-'1,YS+(t+1))\L~f c= UBD L~f by A4,A9,A26,A24,A13,Th29,
GOBOARD9:4;
    then BDD L~f meets UBD L~f by A11,A20,A12,A57,A58,XBOOLE_0:3,XXREAL_0:2;
    hence contradiction by JORDAN2C:24;
  end;
A59: P[0]
  proof
    assume 0 <= 2|^(n-'AI)*(YI-'2)+2-YS;
A60: f/.(1+1) = G*(XS-'1,YS) by A1,JORDAN13:def 1;
A61: [XS,YS] in Indices Gauge(C,n) by A1,JORDAN11:8;
A62: [XS-'1,YS] in Indices Gauge(C,n) by A1,JORDAN11:9;
A63: len f >= 1+1 by GOBOARD7:34,XXREAL_0:2;
    then
A64: right_cell(f,1,G)\L~f c= RightComp f by A4,JORDAN9:27;
    f/.1 = G*(XS,YS) by A1,JORDAN13:def 1;
    then right_cell(f,1,G) = cell(G,XS-'1,YS) by A4,A8,A63,A60,A61,A62,
GOBRD13:26;
    hence thesis by A64,GOBRD14:37;
  end;
  for t be Nat holds P[t] from NAT_1:sch 2(A59,A10);
  hence thesis by A6,A5;
end;
