reserve x,y for object,
        D,D1,D2 for non empty set,
        i,j,k,m,n for Nat,
        f,g for FinSequence of D*,
        f1 for FinSequence of D1*,
        f2 for FinSequence of D2*;
reserve f for complex-valued Function,
        g,h for complex-valued FinSequence;

theorem Th37:
  for D be finite set,
      o be DoubleReorganization of D,
      F be one-to-one FinSequence st
    i in dom o & rng F /\ D c= rng (o.i)
  holds
   o+*(i,F) is DoubleReorganization of rng F \/ (D\rng (o.i))
proof
  let D be finite set,
      o be DoubleReorganization of D,
      F be one-to-one FinSequence such that
  A1: i in dom o & rng F /\ D c= rng (o.i);
  set rF=rng F,oi=o.i,roi=rng oi,oF=o+*(i,F);
  A2:dom oF=dom o by FUNCT_7:30;
  A3:oF.i=F by A1,FUNCT_7:31;
  A4:Values o=D by Def7;
  rng oF c= (rF\/(D\roi))*
  proof
    let y be object;
    assume y in rng oF;
    then consider x be object such that
    A5: x in dom oF & oF.x=y by FUNCT_1:def 3;
    per cases;
    suppose x=i;
      then A6:y=F by A5,A1,FUNCT_7:31;
      F is FinSequence of rF \/ (D\roi) by XBOOLE_1:7,FINSEQ_1:def 4;
      hence thesis by A6,FINSEQ_1:def 11;
    end;
    suppose A7:x<>i;
      then A8:oF.x = o.x by FUNCT_7:32;
      o.x in rng o by A2,A5,FUNCT_1:def 3;
      then reconsider ox=o.x as FinSequence of D by FINSEQ_1:def 11;
      rng ox misses roi
      proof
        assume rng ox meets roi;
        then consider z be object such that
        A9: z in rng ox & z in roi by XBOOLE_0:3;
        consider a be object such that
        A10: a in dom ox & ox.a = z by A9,FUNCT_1:def 3;
        consider b be object such that
        A11: b in dom oi & oi.b = z by A9,FUNCT_1:def 3;
        o_(x,a) = o_(i,b) by A10,A11;
        hence thesis by A10,A11,A5,A2,A1,Def6,A7;
      end;
      then A12: rng ox c= D\roi by XBOOLE_1:86;
      D\roi c= rF\/(D\roi) by XBOOLE_1:7;
      then rng ox c= rF\/(D\roi) by A12;
      then ox is FinSequence of rF\/(D\roi) by FINSEQ_1:def 4;
      hence thesis by A8,A5,FINSEQ_1:def 11;
    end;
  end;
  then reconsider oF as FinSequence of (rF\/(D\roi))* by FINSEQ_1:def 4;
  A13:oF is double-one-to-one
  proof
    let x1,x2,y1,y2 be object such that
    A14:x1 in dom oF & y1 in dom  (oF.x1) &
    x2 in dom oF & y2 in dom (oF.x2) & oF_(x1,y1)=oF_(x2,y2);
    per cases;
    suppose x1 = i & x2=i;
      hence thesis by A3,A14,FUNCT_1:def 4;
    end;
    suppose A15: x1 = i & x2<>i;
      then A16: oF.x1.y1 in rF by A3,A14,FUNCT_1:def 3;
      A17: oF.x2 = o.x2 by A15,FUNCT_7:32;
      then o.x2.y2 in D by A14,A2,Th1,A4;
      then o.x2.y2 in D/\rF by A14,A17,A16,XBOOLE_0:def 4;
      then consider y3 be object such that
      A18:y3 in dom oi & oi.y3 = o.x2.y2 by A1,FUNCT_1:def 3;
      o_(x2,y2)=o_(i,y3) by A18;
      hence thesis by Def6,A2,A18,A14,A17,A15;
    end;
    suppose A19: x1 <> i & x2=i;
      then A20: oF.x2.y2 in rF by A3,A14,FUNCT_1:def 3;
      A21: oF.x1 = o.x1 by A19,FUNCT_7:32;
      then o.x1.y1 in D by A14,A2,Th1,A4;
      then o.x1.y1 in D/\rF by A14,A21,A20,XBOOLE_0:def 4;
      then consider y3 be object such that
      A22:y3 in dom oi & oi.y3 = o.x1.y1 by A1,FUNCT_1:def 3;
      o_(x1,y1) = o_(i,y3) by A22;
      hence thesis by Def6,A2,A22,A14,A21,A19;
    end;
    suppose x1 <> i & x2<>i;
      then A23:o.x1 = oF.x1 & o.x2=oF.x2 by FUNCT_7:32;
      then o_(x1,y1)=o_(x2,y2) by A14;
      hence thesis by A23,A14,A2,Def6;
    end;
  end;
  A24: Values oF c= rF\/(D\roi)
  proof
    let z be object;
    assume z in Values oF;
    then consider x,y be object such that
    A25:x in dom oF & y in dom (oF.x) & z = oF.x.y by Th1;
    per cases;
    suppose x=i;
      then oF.x = F by A1,FUNCT_7:31;
      then z in rF by A25,FUNCT_1:def 3;
      hence thesis by XBOOLE_0:def 3;
    end;
    suppose A26:x<>i;
      then A27:oF.x = o.x by FUNCT_7:32;
      then A28:z in D by A4,A2,A25,Th1;
      not z in roi
      proof
        assume z in roi;
        then consider a be object such that
        A29:a in dom oi & oi.a = z by FUNCT_1:def 3;
        o_(i,a)=o_(x,y) by A26,FUNCT_7:32,A25,A29;
        hence thesis by A27,A25,A29,A1,A2,Def6,A26;
      end;
      then z in D\roi by A28,XBOOLE_0:def 5;
      hence thesis by XBOOLE_0:def 3;
    end;
  end;
  A30: D\roi c= Values oF
  proof
    let d be object;
    assume A31:d in D\roi;
    then A32:d in D & not d in roi by XBOOLE_0:def 5;
    consider x,y be object such that
    A33:x in dom o & y in dom (o.x) & d = o.x.y by A31,Th1,A4;
    x<>i by A33,FUNCT_1:def 3,A32;
    then o.x = oF.x by FUNCT_7:32;
    hence thesis by Th1,A2,A33;
  end;
  rF c= Values oF
  proof
    let d be object;
    assume d in rF;
    then ex x be object st x in dom F & F.x = d by FUNCT_1:def 3;
    hence thesis by A1,A2,A3,Th1;
  end;
  then Values oF = rF\/(D\roi) by A30,XBOOLE_1:8,A24;
  hence thesis by A13,Def7;
end;
