reserve D for non empty set;
reserve f1,f2,f3,f4,f5,f6,f7,f8,f9,f10 for BinominativeFunction of D;
reserve p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11 for PartialPredicate of D;
reserve q1,q2,q3,q4,q5,q6,q7,q8,q9,q10 for total PartialPredicate of D;
reserve n,m,N for Nat;
reserve fD for PFuncs(D,D)-valued FinSequence;
reserve fB for PFuncs(D,BOOLEAN)-valued FinSequence;
reserve V,A for set;
reserve val for Function;
reserve loc for V-valued Function;
reserve d1 for NonatomicND of V,A;
reserve p for SCPartialNominativePredicate of V,A;
reserve d,v for object;
reserve size for non zero Nat;
reserve inp,pos for FinSequence;
reserve prg for non empty FPrg(ND(V,A))-valued FinSequence;

theorem
  for val being size-element FinSequence
  for p being SCPartialNominativePredicate of V,A holds
  3 <= size &
  loc,val,size are_correct_wrt d1 &
  local_overlapping(V,A,LocalOverlapSeq(A,loc,val,d1,size).(size-1),
   denaming(V,A,val.len val).(LocalOverlapSeq(A,loc,val,d1,size).(size-1)),
   loc/.len val) in dom p
  &
  local_overlapping(V,A,d1,denaming(V,A,val.1).d1,loc/.1)
   in dom(SC_Psuperpos_Seq(loc,val,p).(size-1))
  implies
  (SC_Psuperpos_Seq(loc,val,p).len SC_Psuperpos_Seq(loc,val,p)).d1 =
  SC_Psuperpos(SC_Psuperpos_Seq(loc,val,p).(size-2),denaming(V,A,val.2),
  loc/.2).(LocalOverlapSeq(A,loc,val,d1,size).1)
  proof
    let val be size-element FinSequence;
    let p be SCPartialNominativePredicate of V,A;
    set SE = SC_Psuperpos_Seq(loc,val,p);
    set F = LocalOverlapSeq(A,loc,val,d1,size);
    set dd = F.(size-1);
    set D1 = denaming(V,A,val.1);
    set D2 = denaming(V,A,val.2);
    set P = SE.(size-2);
    assume that
A1: 3 <= size and
A2: loc,val,size are_correct_wrt d1 and
A3: local_overlapping(V,A,dd,denaming(V,A,val.len val).dd,loc/.len val)
    in dom p and
A4: local_overlapping(V,A,d1,D1.d1,loc/.1) in dom(SE.(size-1));
A5: len val = size by CARD_1:def 7;
A6: len SE = len val by Def9;
A7: len F = size by NOMIN_7:def 4;
A8: 2 < size by A1,XXREAL_0:2;
    reconsider nn = size-2 as Element of NAT by A1,XXREAL_0:2,INT_1:5;
    set N = nn+1;
A9: 3-2 <= nn by A1,XREAL_1:9;
    then
A10: 1+1 <= nn+1 by XREAL_1:6;
A12: size-1 < size by XREAL_1:44;
A13: nn < size by XREAL_1:44;
A15: len val-N = 1 by A5;
A16: F.1 = local_overlapping(V,A,d1,D1.d1,loc/.1) by NOMIN_7:def 4;
A11: 1 <= N by A9,XREAL_1:29; then
A14: 1 < len F by A7,A12,XXREAL_0:2; then
A17: F.1 is NonatomicND of V,A by NOMIN_7:def 6;
A18: SE.(N+1) = SC_Psuperpos(SE.N,D1,loc/.1) by A6,A11,A12,A15,Def9;
A19: F.(1+1) =
    local_overlapping(V,A,F.1,denaming(V,A,val.(1+1)).(F.1),loc/.(1+1))
    by A14,NOMIN_7:def 4;
A20: dom SC_Psuperpos(P,D2,loc/.2) =
     {d where d is TypeSCNominativeData of V,A:
     local_overlapping(V,A,d,D2.d,loc/.2) in dom P & d in dom D2}
     by NOMIN_2:def 11;
A21: local_overlapping(V,A,F.(size-nn-1),denaming(V,A,val.(len val-nn)).
    (F.(size-nn-1)),loc/.(len val-nn)) in dom(P) by A2,A10,A3,XREAL_1:44,Th16;
A22: dom D2 = {d where d is NonatomicND of V,A: val.2 in dom d}
    by NOMIN_1:def 18;
    val.2 in dom(F.1) by A7,A2,A8,A14,NOMIN_7:10;
    then F.1 in dom D2 by A17,A22;
    then
A23: F.1 in dom(SC_Psuperpos(P,D2,loc/.2)) by A5,A17,A20,A21;
A24: dom SC_Psuperpos(SE.N,D1,loc/.1) =
     {d where d is TypeSCNominativeData of V,A:
     local_overlapping(V,A,d,D1.d,loc/.1) in dom(SE.N) & d in dom D1}
     by NOMIN_2:def 11;
A25: dom D1 = {d where d is NonatomicND of V,A: val.1 in dom d}
      by NOMIN_1:def 18;
A26: val is_valid_wrt d1 by A2;
    1 in dom val by A5,A7,A14,FINSEQ_3:25;
    then val.1 in rng val by FUNCT_1:def 3;
    then d1 in dom D1 by A25,A26;
    then d1 in dom(SC_Psuperpos(SE.N,D1,loc/.1)) by A24,A4;
    hence (SE.len SE).d1 = SE.N.(F.(size-N)) by A5,A6,A18,A16,NOMIN_2:35
    .= SE.nn.(F.(size-nn)) by A2,A3,A11,A12,A9,A13,Th17
    .= SC_Psuperpos(P,D2,loc/.2).(F.1) by A17,A23,A19,NOMIN_2:35;
  end;
