reserve A for set, x,y,z for object,
  k for Element of NAT;
reserve n for Nat,
  x for object;
reserve V, C for set;

theorem Th77:
  for X being set, A being finite Subset of X, a being Element of
  X st not a in A for B being finite Subset of X st B = {a} \/ A for R being
Order of X st R linearly_orders B for k being Element of NAT st k in dom(SgmX(R
,B)) & SgmX(R,B)/.k = a for i being Element of NAT st k <= i & i <= len(SgmX(R,
  A)) holds SgmX(R,B)/.(i+1) = SgmX(R,A)/.i
proof
  let X be set, A be finite Subset of X, a be Element of X;
  assume
A1: not a in A;
  let B be finite Subset of X;
  assume
A2: B = {a} \/ A;
  let R be Order of X;
  assume
A3: R linearly_orders B;
  then
A4: R linearly_orders A by A2,Lm6;
  field R = X by ORDERS_1:12;
  then
A5: R is_antisymmetric_in X by RELAT_2:def 12;
  set sgb = SgmX(R,B), sga = SgmX(R,A);
  consider lensga being Nat such that
A6: dom sga = Seg lensga by FINSEQ_1:def 2;
  defpred P[Nat] means sgb/.($1 + 1) = sga/.($1);
  consider lensgb being Nat such that
A7: dom sgb = Seg lensgb by FINSEQ_1:def 2;
  let k be Element of NAT;
  assume that
A8: k in dom(SgmX(R,B)) and
A9: SgmX(R,B)/.k = a;
  k in Seg(len(sgb)) by A8,FINSEQ_1:def 3;
  then
A10: 1 <= k by FINSEQ_1:1;
  then 1 - 1 <= k - 1 by XREAL_1:9;
  then reconsider k9 = k - 1 as Element of NAT by INT_1:3;
  reconsider lensga,lensgb as Element of NAT by ORDINAL1:def 12;
A11: k9 + 1 = k + (0 qua Nat);
A12: lensgb = len sgb by A7,FINSEQ_1:def 3
    .= card B by A3,Th10
    .= card A + 1 by A1,A2,CARD_2:41
    .= len sga + 1 by A2,A3,Lm6,Th10
    .= lensga + 1 by A6,FINSEQ_1:def 3;
A13: for j being Element of NAT st k <= j & j < len sga holds (for j9 being
  Element of NAT st k <= j9 & j9 <= j holds P[j9]) implies P[j+1]
  proof
    let j be Element of NAT;
    assume that
A14: k <= j and
A15: j < len sga;
A16: (j + 1) + 1 = j + (1 + 1);
A17: 1 <= j + 2 by NAT_1:12;
    len sgb = card B by A3,Th10
      .= card A + 1 by A1,A2,CARD_2:41
      .= len sga + 1 by A2,A3,Lm6,Th10;
    then j + 1 < len sgb by A15,XREAL_1:6;
    then j + 2 <= len sgb by A16,NAT_1:13;
    then j + 2 <= lensgb by A7,FINSEQ_1:def 3;
    then
A18: j+2 in dom sgb by A7,A17,FINSEQ_1:1;
    now
      assume sgb/.(j+2) = a;
      then j + 2 = k by A3,A8,A9,A18,Th75;
      hence contradiction by A14,NAT_1:19;
    end;
    then
A19: not sgb/.(j+2) in {a} by TARSKI:def 1;
    sgb/.(j+2) = sgb.(j+2) by A18,PARTFUN1:def 6;
    then sgb/.(j+2) in rng sgb by A18,FUNCT_1:def 3;
    then sgb/.(j+2) in B by A3,Def2;
    then sgb/.(j+2) in A by A2,A19,XBOOLE_0:def 3;
    then sgb/.(j+2) in rng sga by A4,Def2;
    then consider l being object such that
A20: l in dom sga and
A21: sga.l = sgb/.(j+2) by FUNCT_1:def 3;
    reconsider l as Element of NAT by A20;
A22: sga/.l = sga.l by A20,PARTFUN1:def 6;
A23: 1 <= l by A6,A20,FINSEQ_1:1;
    j + 1 <= len sga by A15,NAT_1:13;
    then
A24: j + 1 <= lensga by A6,FINSEQ_1:def 3;
    1 <= j + 1 by NAT_1:12;
    then
A25: j + 1 in dom sga by A6,A24,FINSEQ_1:1;
    then
A26: sga/.(j+1) = sga.(j+1) by PARTFUN1:def 6;
    assume
A27: for j9 being Element of NAT st k <= j9 & j9 <= j holds P[j9];
    l <= lensga by A6,A20,FINSEQ_1:1;
    then
A28: l + 1 <= lensgb by A12,XREAL_1:6;
    1 <= l + 1 by NAT_1:12;
    then
A29: l + 1 in dom sgb by A7,A28,FINSEQ_1:1;
    l <= l + 1 by XREAL_1:29;
    then
A30: l in dom sgb by A23,A29,FINSEQ_3:156;
    assume
A31: sgb/.((j+1)+1) <> sga/.(j+1);
    then
A32: l <> j + 1 by A20,A21,PARTFUN1:def 6;
    per cases;
    suppose
A33:  l <= j + 1;
      then l < j + 1 by A32,XXREAL_0:1;
      then
A34:  l <= j by NAT_1:13;
      now
        per cases;
        case
          k <= l;
          then sgb/.(l+1) = sga/.l by A27,A34;
          then j + 2 = l + 1 by A3,A18,A20,A21,A29,Th75,PARTFUN1:def 6;
          hence thesis by A31,A20,A21,PARTFUN1:def 6;
        end;
        case
          l < k;
          then l <= k9 by A11,NAT_1:13;
          then
A35:      sgb/.l = sga/.l by A1,A2,A3,A8,A9,A23,Th76;
          j + 1 < (j + 1) + 1 by XREAL_1:29;
          hence thesis by A3,A18,A20,A21,A30,A33,A35,Th75,PARTFUN1:def 6;
        end;
      end;
      hence thesis;
    end;
    suppose
A36:  l > j + 1;
A37:  for i9 being Element of NAT st 1 <= i9 & i9 <= j + 2 holds sga/.(j
      +1) <> sgb/.i9
      proof
        let i9 be Element of NAT;
        assume that
A38:    1 <= i9 and
A39:    i9 <= j + 2;
        assume
A40:    sga/.(j+1) = sgb/.i9;
        per cases;
        suppose
          i9 = j + 2;
          hence contradiction by A31,A40;
        end;
        suppose
A41:      i9 <> j + 2;
          then i9 < j + 2 by A39,XXREAL_0:1;
          then
A42:      i9 <= j + 1 by A16,NAT_1:13;
          then i9 <= lensga by A24,XXREAL_0:2;
          then
A43:      i9 in dom sga by A6,A38,FINSEQ_1:1;
          now
            per cases;
            case
A44:          i9 <= k;
              now
                per cases;
                case
                  i9 = k;
                  then sga.(j+1) = a by A9,A25,A40,PARTFUN1:def 6;
                  then a in rng sga by A25,FUNCT_1:def 3;
                  hence contradiction by A1,A4,Def2;
                end;
                case
                  i9 <> k;
                  then i9 < k by A44,XXREAL_0:1;
                  then i9 <= k9 by A11,NAT_1:13;
                  then sgb/.i9 = sga/.i9 by A1,A2,A3,A8,A9,A38,Th76;
                  then
A45:              i9 = j + 1 by A2,A3,A25,A40,A43,Lm6,Th75;
                  i9 <= j by A14,A44,XXREAL_0:2;
                  hence contradiction by A45,XREAL_1:29;
                end;
              end;
              hence contradiction;
            end;
            case
A46:          k < i9;
A47:          i9 - 1 <= (j + 1) - 1 by A42,XREAL_1:9;
A48:          i9 - 1 <= i9 by XREAL_1:146;
              1 <= i9 by A10,A46,XXREAL_0:2;
              then 1 - 1 <= i9 - 1 by XREAL_1:9;
              then
A49:          i9 - 1 is Element of NAT by INT_1:3;
A50:          (i9 - 1) + 1 = i9 + (0 qua Nat);
              then k <= i9 - 1 by A46,A49,NAT_1:13;
              then 1 <= i9 - 1 by A10,XXREAL_0:2;
              then
A51:          i9 - 1 in dom sga by A43,A49,A48,FINSEQ_3:156;
              k <= i9 - 1 by A46,A49,A50,NAT_1:13;
              then sga/.(i9-1) = sga/.(j+1) by A27,A40,A49,A50,A47;
              hence contradiction by A2,A3,A16,A25,A41,A50,A51,Lm6,Th75;
            end;
          end;
          hence thesis;
        end;
      end;
      sga/.(j+1) in rng sga by A25,A26,FUNCT_1:def 3;
      then
A52:  sga/.(j+1) in A by A4,Def2;
      then sga/.(j+1) in B by A2,XBOOLE_0:def 3;
      then sga/.(j+1) in rng sgb by A3,Def2;
      then consider l9 being object such that
A53:  l9 in dom sgb and
A54:  sgb.l9 = sga/.(j+1) by FUNCT_1:def 3;
      reconsider l9 as Element of NAT by A53;
A55:  sgb/.l9 = sgb.l9 by A53,PARTFUN1:def 6;
A56:  1 <= j + 1 by NAT_1:12;
      j + 1 <= len sga by A15,NAT_1:13;
      then j + 1 in Seg(len sga) by A56,FINSEQ_1:1;
      then j + 1 in dom sga by FINSEQ_1:def 3;
      then
A57:  [sga/.(j+1),sga/.l] in R by A4,A20,A36,Def2;
      1 <= l9 by A7,A53,FINSEQ_1:1;
      then l9 > j + 2 by A37,A54,A55;
      then [sga/.l,sga/.(j+1)] in R by A3,A18,A21,A22,A53,A54,A55,Def2;
      then sga/.l = sga/.(j+1) by A5,A57,A52;
      hence thesis by A2,A3,A25,A20,A36,Lm6,Th75;
    end;
  end;
  let i be Element of NAT;
  assume that
A58: k <= i and
A59: i <= len(SgmX(R,A));
  k <= len sga by A58,A59,XXREAL_0:2;
  then
A60: k <= lensga by A6,FINSEQ_1:def 3;
  then
A61: k in dom sga by A10,A6,FINSEQ_1:1;
A62: lensga <= lensgb by A12,NAT_1:11;
A63: P[k]
  proof
A64: sga/.k = sga.k by A61,PARTFUN1:def 6;
    then sga/.k in rng sga by A61,FUNCT_1:def 3;
    then sga/.k in A by A4,Def2;
    then sga/.k in B by A2,XBOOLE_0:def 3;
    then sga/.k in rng sgb by A3,Def2;
    then consider l being object such that
A65: l in dom sgb and
A66: sgb.l = sga/.k by FUNCT_1:def 3;
    reconsider l as Element of NAT by A65;
A67: sgb/.l = sgb.l by A65,PARTFUN1:def 6;
A68: 1 <= l by A7,A65,FINSEQ_1:1;
    assume
A69: not(P[k]);
    then
A70: l <> k + 1 by A65,A66,PARTFUN1:def 6;
    per cases by XXREAL_0:1;
    suppose
      l = k;
      then sga.k = a by A8,A9,A64,A66,PARTFUN1:def 6;
      then a in rng sga by A61,FUNCT_1:def 3;
      hence thesis by A1,A4,Def2;
    end;
    suppose
A71:  l < k;
      then l <= lensga by A60,XXREAL_0:2;
      then
A72:  l in dom sga by A6,A68,FINSEQ_1:1;
      l <= k9 by A11,A71,NAT_1:13;
      then sga/.l = sga/.k by A1,A2,A3,A8,A9,A66,A68,A67,Th76;
      hence thesis by A2,A3,A61,A71,A72,Lm6,Th75;
    end;
    suppose
      k < l;
      then
A73:  k + 1 <= l by NAT_1:13;
A74:  1 <= k + 1 by NAT_1:12;
      then
A75:  k + 1 in dom sgb by A65,A73,FINSEQ_3:156;
      now
        assume sgb/.(k+1) = a;
        then k + 1 = k by A3,A8,A9,A75,Th75;
        hence contradiction;
      end;
      then
A76:  not sgb/.(k+1) in {a} by TARSKI:def 1;
      k + 1 < l by A70,A73,XXREAL_0:1;
      then
A77:  [sgb/.(k+1),sgb/.l] in R by A3,A65,A75,Def2;
      sgb/.l in rng sgb by A65,A67,FUNCT_1:def 3;
      then
A78:  sgb/.l in B by A3,Def2;
      sgb/.(k+1) = sgb.(k+1) by A65,A73,A74,FINSEQ_3:156,PARTFUN1:def 6;
      then sgb/.(k+1) in rng sgb by A75,FUNCT_1:def 3;
      then sgb/.(k+1) in B by A3,Def2;
      then sgb/.(k+1) in A by A2,A76,XBOOLE_0:def 3;
      then sgb/.(k+1) in rng sga by A4,Def2;
      then consider l9 being object such that
A79:  l9 in dom sga and
A80:  sga.l9 = sgb/.(k+1) by FUNCT_1:def 3;
      reconsider l9 as Element of NAT by A79;
A81:  sga/.l9 = sga.l9 by A79,PARTFUN1:def 6;
A82:  1 <= l9 by A6,A79,FINSEQ_1:1;
      l9 <= lensga by A6,A79,FINSEQ_1:1;
      then l9 <= lensgb by A62,XXREAL_0:2;
      then
A83:  l9 in dom sgb by A7,A82,FINSEQ_1:1;
      now
        assume
A84:    l9 < k;
        then l9 <= k9 by A11,NAT_1:13;
        then sgb/.l9 = sga/.l9 by A1,A2,A3,A8,A9,A82,Th76;
        then l9 = k + 1 by A3,A75,A79,A80,A83,Th75,PARTFUN1:def 6;
        hence contradiction by A84,XREAL_1:29;
      end;
      then l9 > k by A69,A80,A81,XXREAL_0:1;
      then [sgb/.l,sgb/.(k+1)] in R by A4,A61,A66,A67,A79,A80,A81,Def2;
      then sgb/.l = sgb/.(k+1) by A5,A77,A78;
      hence thesis by A69,A65,A66,PARTFUN1:def 6;
    end;
  end;
  for j being Element of NAT st k <= j & j <= len sga holds P[j] from
  INT_1:sch 8(A63,A13);
  hence thesis by A58,A59;
end;
