reserve n,i,k,m for Nat;
reserve r,r1,r2,s,s1,s2 for Real;
reserve p,p1,p2,q1,q2 for Point of TOP-REAL n;
reserve P,Q for Subset of TOP-REAL 2,
  f,f1,f2 for FinSequence of the carrier of TOP-REAL 2,
  p,p1,p2,p3,q,q3 for Point of TOP-REAL 2;

theorem Th36:
  f is special alternating & 1<=i & i+2<=len f implies f/.(i+1)
  is_extremal_in LSeg(f,i) \/ LSeg(f,i+1)
proof
  assume that
A1: f is special & f is alternating and
A2: 1<=i and
A3: i+2<=len f;
  set p2=f/.(i+1);
  i+1 <= i+2 by XREAL_1:6;
  then i+1 <= len f by A3,XXREAL_0:2;
  then LSeg(f,i)=LSeg(f/.i,p2) by A2,TOPREAL1:def 3;
  then p2 in LSeg(f,i) by RLTOPSP1:68;
  then
A4: p2 in LSeg(f,i) \/ LSeg(f,i+1) by XBOOLE_0:def 3;
  for p,q st p2 in LSeg(p,q) & LSeg(p,q) c= LSeg(f,i) \/ LSeg(f,i+1) holds
  p2=p or p2=q by A1,A2,A3,Th35;
  hence thesis by A4;
end;
