reserve x for Int_position,
  n,p0 for Nat;
reserve P,Q,U,V for Instruction-Sequence of SCMPDS;

theorem
  for s being 0-started State of SCMPDS,f,g be FinSequence of INT,p0,
      n being Nat
     st p0 >= 6 & len f=n & len g = n & f is_FinSequence_on s,p0 &
     g is_FinSequence_on IExec(insert-sort(n,p0+1),P,s),p0
      holds f,g are_fiberwise_equipotent & g is_non_decreasing_on 1,n
proof
  set a=GBP;
  let s be 0-started State of SCMPDS,f,g be FinSequence of INT,p0,
      n be Nat;
  assume that
A1: p0 >= 6 and
A2: len f=n & len g = n and
A3: f is_FinSequence_on s,p0 and
A4: g is_FinSequence_on IExec(insert-sort(n,p0+1),P,s),p0;
A5: p0+1 >= 6+1 by A1,XREAL_1:6;
  set i1= GBP:=0, i2= (GBP,1):=0, i3= (GBP,2):=(n-1), i4= (GBP,3):=(p0+1);
  set I4=i1 ';' i2 ';' i3 ';' i4, t1=IExec(I4,P,s),
   t2=IExec(i1 ';' i2 ';' i3,P,s), t3=IExec(i1 ';' i2,P,s), t4=Exec(i1,s);
A6: t4.a=0 by SCMPDS_2:45;
  then
A7: DataLoc(t4.a,1)=intpos (0+1) by SCMP_GCD:1;
A8: t3.a =Exec(i2, t4).a by SCMPDS_5:42
    .=0 by A6,A7,AMI_3:10,SCMPDS_2:46;
  then
A9: DataLoc(t3.a,2)=intpos (0+2) by SCMP_GCD:1;
A10: t2.a =Exec(i3, t3).a by SCMPDS_5:41
    .=0 by A8,A9,AMI_3:10,SCMPDS_2:46;
  then
A11: DataLoc(t2.a,3)=intpos (0+3) by SCMP_GCD:1;
A12: now
    let i be Nat;
    assume
A13: i > 3;
    then
A14: i > 1 by XXREAL_0:2;
    thus t3.intpos i =Exec(i2, t4).intpos i by SCMPDS_5:42
      .=t4.intpos i by A7,A14,AMI_3:10,SCMPDS_2:46
      .=s.intpos i by A13,AMI_3:10,SCMPDS_2:45;
  end;
A15: now
    let i be Nat;
    assume
A16: i > 3;
    then
A17: i > 2 by XXREAL_0:2;
    thus t2.intpos i =Exec(i3, t3).intpos i by SCMPDS_5:41
      .=t3.intpos i by A9,A17,AMI_3:10,SCMPDS_2:46
      .=s.intpos i by A12,A16;
  end;
  now
    let i be Nat;
    assume that
A18: 1 <= i and
A19: i <= len f;
    set pi=p0+i;
    pi >= p0+1 by A18,XREAL_1:6;
    then pi >= 7 by A5,XXREAL_0:2;
    then
A20: pi > 3 by XXREAL_0:2;
    thus (Initialize t1).intpos pi = t1.intpos pi by SCMPDS_5:15
      .=Exec(i4, t2).intpos pi by SCMPDS_5:41
      .=t2.intpos pi by A11,A20,AMI_3:10,SCMPDS_2:46
      .=s.intpos pi by A15,A20
      .=f.i by A3,A18,A19;
  end;
  then
A21: f is_FinSequence_on Initialize t1,p0;
A22: t3.a1 =Exec(i2, t4).a1 by SCMPDS_5:42
    .=0 by A7,SCMPDS_2:46;
A23: t2.a1 =Exec(i3, t3).a1 by SCMPDS_5:41
    .=0 by A22,A9,AMI_3:10,SCMPDS_2:46;
A24: I4 is_closed_on s,P & I4 is_halting_on s,P by SCMPDS_6:20,21;
A25: t1.a =Exec(i4, t2).a by SCMPDS_5:41
    .=0 by A10,A11,AMI_3:10,SCMPDS_2:46;
A26: t2.a2 =Exec(i3, t3).a2 by SCMPDS_5:41
    .=n-1 by A9,SCMPDS_2:46;
A27: t1.a3 =Exec(i4, t2).a3 by SCMPDS_5:41
    .=p0+1 by A11,SCMPDS_2:46;
A28:  t1.a3 = (Initialize t1).a3 by SCMPDS_5:15;
A29:  t1.a1 = (Initialize t1).a1 by SCMPDS_5:15;
A30:  t1.a = (Initialize t1).a by SCMPDS_5:15;
A31:  t1.a2 = (Initialize t1).a2 by SCMPDS_5:15;
A32: t1.a1 =Exec(i4, t2).a1 by SCMPDS_5:41
    .=0 by A23,A11,AMI_3:10,SCMPDS_2:46;
  then t1.a3 >= t1.a1+7 by A27,A5;
  then FR is_closed_on Initialize t1,P & FR is_halting_on Initialize t1,P
     by A25,Lm12,A28,A29,A30;
  then
A33: FR is_closed_on t1,P & FR is_halting_on t1,P by SCMPDS_6:125,126;
  now
    let i be Nat;
    assume
    1 <= i & i <= len g;
    hence g.i=IExec(I4 ';' FR,P,s).intpos(p0+i) by A4
      .=IExec(FR,P,Initialize t1).intpos(p0+i) by A24,A33,SCMPDS_7:30;
  end;
  then
A34: g is_FinSequence_on IExec(FR,P,Initialize t1),p0;
  t1.a2 =Exec(i4, t2).a2 by SCMPDS_5:41
    .=n-1 by A26,A11,AMI_3:10,SCMPDS_2:46;
  hence thesis by A1,A2,A25,A32,A27,A21,A34,Lm15,A28,A29,A30,A31;
end;
