reserve i,j,k,n,m for Nat,
  x,y,z,y1,y2 for object, X,Y,D for set,
  p,q for XFinSequence;
reserve k1,k2 for Nat;

theorem Th35: ::from FINSEQ_3
  for X,Y being finite natural-membered set holds
X <N< Y iff Sgm0(X \/Y) = Sgm0(X) ^ Sgm0(Y)
proof
  let X,Y be finite natural-membered set;
  set p = Sgm0 X;
  set q = Sgm0 Y;
  set r = Sgm0(X \/ Y);
  thus X <N< Y implies Sgm0(X \/ Y) = Sgm0(X) ^ Sgm0(Y)
  proof
    defpred P[Nat] means $1 in dom p implies r.$1 = p.$1;
    reconsider X1 = X, Y1 = Y as finite set;
    assume
A1: X <N< Y;
    X /\ Y = {}
    proof
      set x =the  Element of X /\ Y;
A2:   X = rng p by Def4;
      assume
A3:   not thesis;
      then x in X by XBOOLE_0:def 4;
      then reconsider m = x as Element of NAT by A2;
A4:   m in Y by A3,XBOOLE_0:def 4;
      m in X by A3,XBOOLE_0:def 4;
      hence thesis by A1,A4;
    end;
    then
A5: X misses Y;
A6: len r = card(X1 \/ Y1) by Th20
      .= card X1 + card Y1 by A5,CARD_2:40
      .= len p + card Y1 by Th20
      .= len p + len q by Th20;
A7: now
      let k;
      assume
A8:   P[k];
      thus P[k+1]
      proof
        set m = r.(k + 1);
        set n = p.(k + 1);
        assume
A9:     k + 1 in dom p;
        then n in rng p by FUNCT_1:def 3;
        then
A10:    n in X by Def4;
        len p <= len r by A6,NAT_1:12;
        then
A11:    Segm(len p) c= Segm(len r) by NAT_1:39;
        then m in rng r by A9,FUNCT_1:def 3;
        then
A12:    m in X \/ Y by Def4;
        assume
A13:    m <> n;
        now
          per cases;
          suppose
A14:        k in dom p;
            set m1 = r.k;
            set n1 = p.k;
            now
              per cases by A13,XXREAL_0:1;
              suppose
A15:            m < n;
                then not m in Y by A1,A10;
                then m in X by A12,XBOOLE_0:def 3;
                then m in rng p by Def4;
                then consider x being object such that
A16:            x in dom p and
A17:            p.x = m by FUNCT_1:def 3;
                reconsider x as Element of NAT by A16;
                x < len p by A16,AFINSQ_1:86;
                then
A18:            x < k + 1 by A15,A17,Th33;
A19:            k < k + 1 by XREAL_1:29;
                k + 1 < len r by A9,A11,AFINSQ_1:86;
                then
A20:            n1 < m by A8,A14,A19,Def4;
                k < len p by A14,AFINSQ_1:86;
                then k < x by A17,A20,Th33;
                hence contradiction by A18,NAT_1:13;
              end;
              suppose
A21:            n < m;
                n in X \/ Y by A10,XBOOLE_0:def 3;
                then n in rng r by Def4;
                then consider x being object such that
A22:            x in dom r and
A23:            r.x = n by FUNCT_1:def 3;
                reconsider x as Element of NAT by A22;
                x < len r by A22,AFINSQ_1:86;
                then
A24:            x < k + 1 by A21,A23,Th33;
A25:            k < k + 1 by XREAL_1:29;
                k + 1 < len p by A9,AFINSQ_1:86;
                then
A26:            m1 < n by A8,A14,A25,Def4;
                k < len r by A11,A14,AFINSQ_1:86;
                then k < x by A23,A26,Th33;
                hence contradiction by A24,NAT_1:13;
              end;
            end;
            hence contradiction;
          end;
          suppose
A27:        not k in dom p;
A28:        k < k + 1 by XREAL_1:29;
            len p <= k by A27,AFINSQ_1:86;
            then len p < k + 1 by A28,XXREAL_0:2;
            hence contradiction by A9,AFINSQ_1:86;
          end;
        end;
        hence contradiction;
      end;
    end;
    0<len p implies X1<>{} by Th20,CARD_1:27;
    then
A29: P[0] by A1,Th34;
A30: for k holds P[k] from NAT_1:sch 2(A29,A7);
    defpred P[Nat] means $1 in dom q implies r.(len p + $1) = q.$1;
A31: now
      let k;
      assume
A32:  P[k];
      thus P[k+1]
      proof
        set n = q.(k + 1);
        set a = len p + (k + 1);
        set m = r.a;
        assume
A33:    k + 1 in dom q;
        then q.(k + 1) in rng q by FUNCT_1:def 3;
        then
A34:    n in Y by Def4;
        k + 1 <len q by A33,AFINSQ_1:86;
        then
A35:    a < len r by A6,XREAL_1:6;
        then
A36:    a in dom r by AFINSQ_1:86;
        then r.a in rng r by FUNCT_1:def 3;
        then
A37:    m in X \/ Y by Def4;
A38:    now
A39:      len p <= len r by A6,NAT_1:12;
          assume m in X;
          then m in rng p by Def4;
          then consider x being object such that
A40:      x in dom p and
A41:      p.x = m by FUNCT_1:def 3;
          reconsider x as Element of NAT by A40;
          x < len p by A40,AFINSQ_1:86;
          then x < len r by A39,XXREAL_0:2;
          then
A42:      x in dom r by AFINSQ_1:86;
          r.x = r.a by A30,A40,A41;
          then x = a by A36,A42,FUNCT_1:def 4;
          then len p + (k + 1) <= len p + (0 qua Element of NAT) by A40,
AFINSQ_1:86;
          hence contradiction by XREAL_1:29;
        end;
        assume
A43:    r.(len p + (k + 1)) <> q.(k + 1);
        now
          per cases;
          suppose
A44:        k in dom q;
            set m1 = r.(len p + k);
            set n1 = q.k;
A45:        k < len q by A44,AFINSQ_1:86;
            now
              per cases by A43,XXREAL_0:1;
              suppose
A46:            m < n;
                m in Y by A37,A38,XBOOLE_0:def 3;
                then m in rng q by Def4;
                then consider x being object such that
A47:            x in dom q and
A48:            q.x = m by FUNCT_1:def 3;
                reconsider x as Element of NAT by A47;
                x < len q by A47,AFINSQ_1:86;
                then
A49:            x < k + 1 by A46,A48,Th33;
                len p + k < len p + k + 1 by XREAL_1:29;
                then
A50:            n1 < m by A32,A35,A44,Def4;
                k < len q by A44,AFINSQ_1:86;
                then k < x by A48,A50,Th33;
                hence contradiction by A49,NAT_1:13;
              end;
              suppose
A51:            n < m;
                n in X \/ Y by A34,XBOOLE_0:def 3;
                then n in rng r by Def4;
                then consider x being object such that
A52:            x in dom r and
A53:            r.x = n by FUNCT_1:def 3;
                reconsider x as Element of NAT by A52;
                x < len r by A52,AFINSQ_1:86;
                then
A54:            x < len p + k + 1 by A51,A53,Th33;
A55:            k < k + 1 by XREAL_1:29;
                k + 1 < len q by A33,AFINSQ_1:86;
                then
A56:            m1 < n by A32,A44,A55,Def4;
                len p + k < len r by A6,A45,XREAL_1:6;
                then len p + k < x by A53,A56,Th33;
                hence contradiction by A54,NAT_1:13;
              end;
            end;
            hence contradiction;
          end;
          suppose
A57:        not k in dom q;
A58:        k < k + 1 by XREAL_1:29;
            len q <= k by A57,AFINSQ_1:86;
            hence contradiction by A33,AFINSQ_1:86,A58,XXREAL_0:2;
          end;
        end;
        hence contradiction;
      end;
    end;
    len q>0 implies Y <>{} by Th20,CARD_1:27;
    then
A59: P[0] by A1,Th32;
    for k holds P[k] from NAT_1:sch 2(A59,A31);
    hence thesis by A6,A30,AFINSQ_1:def 3;
  end;
  assume
A60: Sgm0(X \/ Y) = Sgm0(X) ^ Sgm0(Y);
  let m,n be Nat;
  assume that
A61: m in X and
A62: n in Y;
  n in rng q by A62,Def4;
  then consider y being object such that
A63: y in dom q and
A64: q.y = n by FUNCT_1:def 3;
  reconsider y as Element of NAT by A63;
A65: n = r.(len p + y) by A60,A63,A64,AFINSQ_1:def 3;
  y < len q by A63,AFINSQ_1:86;
  then len p + y < len p + len q by XREAL_1:6;
  then
A66: len p + y < len r by A60,AFINSQ_1:17;
A67: len p<=len p+y by NAT_1:12;
  m in rng(Sgm0 X) by A61,Def4;
  then consider x being object such that
A68: x in dom p and
A69: p.x = m by FUNCT_1:def 3;
  reconsider x as Element of NAT by A68;
  x < len p by A68,AFINSQ_1:86;
  then
A70: x < len p + y by A67,XXREAL_0:2;
  m = r.x by A60,A68,A69,AFINSQ_1:def 3;
  hence thesis by A65,A70,A66,Def4;
end;
