reserve x,y,P,Q for Integer;
reserve a,b,n for Nat;
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 for object;
reserve z for Element of V;
reserve T for TypeSCNominativeData of V,A;
reserve size for non zero Nat;
reserve x0, y0, p0, q0 for Integer;
reserve n0 for Nat;

theorem Th15:
  V is non empty & A is complex-containing & A is_without_nonatomicND_wrt V &
  d1 in dom Lucas_loop_body(A,loc) & loc is_valid_wrt d1 & Seg 10 c= dom loc &
  (for T holds loc/.1 is_a_value_on T & loc/.2 is_a_value_on T &
    loc/.4 is_a_value_on T & loc/.6 is_a_value_on T &
    loc/.7 is_a_value_on T & loc/.8 is_a_value_on T &
    loc/.9 is_a_value_on T & loc/.10 is_a_value_on T)
  implies
  prg_doms_of loc,d1,
   <*denaming(V,A,loc/.4),denaming(V,A,loc/.5),multiplication(A,loc/.7,loc/.4),
    multiplication(A,loc/.8,loc/.6),subtraction(A,loc/.9,loc/.10),
    addition(A,loc/.1,loc/.2)*>,
   <*6,4,9,10,5,1*>
  proof
    set i = loc/.1, j = loc/.2, n = loc/.3, s = loc/.4, b = loc/.5, c = loc/.6;
    set p = loc/.7, q = loc/.8, ps = loc/.9, qc = loc/.10;
    set B = Lucas_loop_body(A,loc);
    assume that
A1: V is non empty and
A2: A is complex-containing and
A3: A is_without_nonatomicND_wrt V and
A4: d1 in dom B and
A5: loc is_valid_wrt d1 and
A6: Seg 10 c= dom loc and
A7: for T holds i is_a_value_on T & j is_a_value_on T & s is_a_value_on T &
    c is_a_value_on T & p is_a_value_on T & q is_a_value_on T &
    ps is_a_value_on T & qc is_a_value_on T;
    set D = ND(V,A);
    set EN = {i,j,n,s,b,c,p,q,ps,qc};
    set Di = denaming(V,A,i);
    set Dj = denaming(V,A,j);
    set Dn = denaming(V,A,n);
    set Ds = denaming(V,A,s);
    set Db = denaming(V,A,b);
    set Dc = denaming(V,A,c);
    set Dp = denaming(V,A,p);
    set Dq = denaming(V,A,q);
    set Dps = denaming(V,A,ps);
    set Dqc = denaming(V,A,qc);
    set Aij = addition(A,i,j);
    set Mps = multiplication(A,p,s);
    set Mqc = multiplication(A,q,c);
    set Scs = subtraction(A,ps,qc);
    set AS1 = SC_assignment(Ds,c);
    set AS2 = SC_assignment(Db,s);
    set AS3 = SC_assignment(Mps,ps);
    set AS4 = SC_assignment(Mqc,qc);
    set AS5 = SC_assignment(Scs,b);
    set AS6 = SC_assignment(Aij,i);
    set prg = <*Ds,Db,Mps,Mqc,Scs,Aij*>;
    set pos = <*6,4,9,10,5,1*>;
    set PS = PrgLocalOverlapSeq(A,loc,d1,prg,pos);
A8: EN c= dom d1 by A5,A6,Th12;
A9: i in EN by ENUMSET1:def 8;
A10: j in EN by ENUMSET1:def 8;
A11: b in EN by ENUMSET1:def 8;
A12: p in EN by ENUMSET1:def 8;
A13: q in EN by ENUMSET1:def 8;
A14: len prg = 6 by AOFA_A00:20;
A15: len PS = len prg by NOMIN_8:def 14;
A16: prg.1 = Ds & pos.1 = 6;
A17: prg.2 = Db & pos.2 = 4;
A18: prg.3 = Mps & pos.3 = 9;
A19: prg.4 = Mqc & pos.4 = 10;
A20: prg.5 = Scs & pos.5 = 5;
A21: dom AS1 = dom Ds by NOMIN_2:def 7;
A22: dom AS2 = dom Db by NOMIN_2:def 7;
     PP_composition(PP_composition(PP_composition(PP_composition(AS1,AS2),
     AS3),AS4),AS5) = PP_composition(PP_composition(PP_composition(
     AS2*AS1,AS3),AS4),AS5) by PARTPR_2:def 1
     .= PP_composition(PP_composition(AS3*(AS2*AS1),AS4),AS5)
     by PARTPR_2:def 1
     .= PP_composition(AS4*(AS3*(AS2*AS1)),AS5) by PARTPR_2:def 1
     .= AS5*(AS4*(AS3*(AS2*AS1))) by PARTPR_2:def 1;
     then
A23: B = AS6*(AS5*(AS4*(AS3*(AS2*AS1)))) by PARTPR_2:def 1;
A24: AS5*AS4*AS3*AS2*AS1 = AS5*AS4*AS3*(AS2*AS1) by RELAT_1:36
     .= AS5*AS4*(AS3*(AS2*AS1)) by RELAT_1:36
     .= AS5*(AS4*(AS3*(AS2*AS1))) by RELAT_1:36;
A25: AS5*(AS4*(AS3*(AS2*AS1))) = AS5*(AS4*AS3*(AS2*AS1)) by RELAT_1:36
     .= AS5*(AS4*AS3*AS2*AS1) by RELAT_1:36;
A26: AS4*AS3*AS2*AS1 = AS4*AS3*(AS2*AS1) by RELAT_1:36
     .= AS4*(AS3*(AS2*AS1)) by RELAT_1:36;
A27: AS4*(AS3*(AS2*AS1)) = AS4*(AS3*AS2*AS1) by RELAT_1:36;
A28: AS3*AS2*AS1 = AS3*(AS2*AS1) by RELAT_1:36;
     B = AS6*(AS5*AS4*(AS3*(AS2*AS1))) by A23,RELAT_1:36
     .= AS6*(AS5*AS4*AS3*(AS2*AS1)) by RELAT_1:36
     .= AS6*(AS5*AS4*AS3*AS2*AS1) by RELAT_1:36;
     then
A29: d1 in dom(AS5*AS4*AS3*AS2*AS1) by A4,FUNCT_1:11;
     then d1 in dom(AS4*AS3*AS2*AS1) by A24,A25,FUNCT_1:11;
     then d1 in dom(AS3*AS2*AS1) by A26,A27,FUNCT_1:11;
     then
A30: d1 in dom(AS2*AS1) by A28,FUNCT_1:11;
A31: dom Di = {d where d is NonatomicND of V,A: i in dom d}
     by NOMIN_1:def 18;
A32: dom Dj = {d where d is NonatomicND of V,A: j in dom d}
     by NOMIN_1:def 18;
A33: dom Ds = {d where d is NonatomicND of V,A: s in dom d}
     by NOMIN_1:def 18;
A34: dom Db = {d where d is NonatomicND of V,A: b in dom d}
     by NOMIN_1:def 18;
A35: dom Dc = {d where d is NonatomicND of V,A: c in dom d}
     by NOMIN_1:def 18;
A36: dom Dp = {d where d is NonatomicND of V,A: p in dom d}
     by NOMIN_1:def 18;
A37: dom Dq = {d where d is NonatomicND of V,A: q in dom d}
     by NOMIN_1:def 18;
A38: dom Dps = {d where d is NonatomicND of V,A: ps in dom d}
     by NOMIN_1:def 18;
A39: dom Dqc = {d where d is NonatomicND of V,A: qc in dom d}
     by NOMIN_1:def 18;
A40: d1 in dom Ds by A21,A29,FUNCT_1:11;
     then reconsider Ad = Ds.d1 as TypeSCNominativeData of V,A
     by PARTFUN1:4,NOMIN_1:39;
     reconsider L1 = local_overlapping(V,A,d1,Ad,c) as NonatomicND of V,A
     by NOMIN_2:9;
     AS1.d1 = L1 by A21,A40,NOMIN_2:def 7;
     then L1 in dom AS2 by A30,FUNCT_1:11;
     then reconsider DbL1 = Db.L1 as TypeSCNominativeData of V,A
     by A22,PARTFUN1:4,NOMIN_1:39;
     reconsider L2 = local_overlapping(V,A,L1,DbL1,s) as NonatomicND of V,A
     by NOMIN_2:9;
A41: dom L1 = {c} \/ dom d1 by A3,A1,NOMIN_4:4;
A42: dom L2 = {s} \/ dom L1 by A3,A1,NOMIN_4:4;
     s in {s} by TARSKI:def 1;
     then
     s in dom L2 by A42,XBOOLE_0:def 3;
     then
A43: L2 in dom Ds by A33;
     p in dom L1 by A8,A12,A41,XBOOLE_0:def 3;
     then p in dom L2 by A42,XBOOLE_0:def 3;
     then L2 in dom Dp by A36;
     then L2 in dom Ds /\ dom Dp by A43,XBOOLE_0:def 4;
     then
A44: L2 in dom <:Dp,Ds:> by FUNCT_3:def 7;
     then
A45: <:Dp,Ds:>.L2 = [Dp.L2,Ds.L2] by FUNCT_3:def 7;
A46: dom(multiplication(A)) = [:A,A:] by A2,FUNCT_2:def 1;
     p is_a_value_on L2 & s is_a_value_on L2 by A7;
     then [Dp.L2,Ds.L2] in [:A,A:] by ZFMISC_1:87;
     then
A47: L2 in dom Mps by A44,A46,A45,FUNCT_1:11;
     then reconsider MpsL2 = Mps.L2 as TypeSCNominativeData of V,A
     by PARTFUN1:4,NOMIN_1:39;
     reconsider L3 = local_overlapping(V,A,L2,MpsL2,ps) as NonatomicND of V,A
     by NOMIN_2:9;
A48: dom L3 = {ps} \/ dom L2 by A1,A3,NOMIN_4:4;
     q in dom L1 by A8,A13,A41,XBOOLE_0:def 3;
     then q in dom L2 by A42,XBOOLE_0:def 3;
     then
A49: q in dom L3 by A48,XBOOLE_0:def 3;
     c in {c} by TARSKI:def 1;
     then c in dom L1 by A41,XBOOLE_0:def 3;
     then c in dom L2 by A42,XBOOLE_0:def 3;
     then
A50: c in dom L3 by A48,XBOOLE_0:def 3;
A51: L3 in dom Dq by A49,A37;
     L3 in dom Dc by A50,A35;
     then L3 in dom Dq /\ dom Dc by A51,XBOOLE_0:def 4;
     then
A52: L3 in dom <:Dq,Dc:> by FUNCT_3:def 7;
     then
A53: <:Dq,Dc:>.L3 = [Dq.L3,Dc.L3] by FUNCT_3:def 7;
     q is_a_value_on L3 & c is_a_value_on L3 by A7;
     then [Dq.L3,Dc.L3] in [:A,A:] by ZFMISC_1:87;
     then
A54: L3 in dom Mqc by A52,A46,A53,FUNCT_1:11;
     then reconsider MqcL3 = Mqc.L3 as TypeSCNominativeData of V,A
     by PARTFUN1:4,NOMIN_1:39;
     reconsider L4 = local_overlapping(V,A,L3,MqcL3,qc) as NonatomicND of V,A
     by NOMIN_2:9;
A55: dom L4 = {qc} \/ dom L3 by A1,A3,NOMIN_4:4;
     qc in {qc} by TARSKI:def 1;
     then
A56: qc in dom L4 by A55,XBOOLE_0:def 3;
     ps in {ps} by TARSKI:def 1;
     then ps in dom L3 by A48,XBOOLE_0:def 3;
     then
A57: ps in dom L4 by A55,XBOOLE_0:def 3;
A58: b in dom L1 by A8,A11,A41,XBOOLE_0:def 3;
A59: L4 in dom Dps by A57,A38;
     L4 in dom Dqc by A56,A39;
     then L4 in dom Dps /\ dom Dqc by A59,XBOOLE_0:def 4;
     then
A60: L4 in dom <:Dps,Dqc:> by FUNCT_3:def 7;
     then
A61: <:Dps,Dqc:>.L4 = [Dps.L4,Dqc.L4] by FUNCT_3:def 7;
A62: dom(subtraction(A)) = [:A,A:] by A2,FUNCT_2:def 1;
     ps is_a_value_on L4 & qc is_a_value_on L4 by A7;
     then [Dps.L4,Dqc.L4] in [:A,A:] by ZFMISC_1:87;
     then
A63: L4 in dom Scs by A60,A62,A61,FUNCT_1:11;
     then reconsider ScsL4 = Scs.L4 as TypeSCNominativeData of V,A
     by PARTFUN1:4,NOMIN_1:39;
     reconsider L5 = local_overlapping(V,A,L4,ScsL4,b) as NonatomicND of V,A
     by NOMIN_2:9;
A64: dom L5 = {b} \/ dom L4 by A1,A3,NOMIN_4:4;
     i in dom L1 by A8,A9,A41,XBOOLE_0:def 3;
     then i in dom L2 by A42,XBOOLE_0:def 3;
     then i in dom L3 by A48,XBOOLE_0:def 3;
     then i in dom L4 by A55,XBOOLE_0:def 3;
     then i in dom L5 by A64,XBOOLE_0:def 3;
     then
A65: L5 in dom Di by A31;
     j in dom L1 by A8,A10,A41,XBOOLE_0:def 3;
     then j in dom L2 by A42,XBOOLE_0:def 3;
     then j in dom L3 by A48,XBOOLE_0:def 3;
     then j in dom L4 by A55,XBOOLE_0:def 3;
     then j in dom L5 by A64,XBOOLE_0:def 3;
     then
A66: L5 in dom Dj by A32;
     L5 in dom Di /\ dom Dj by A65,A66,XBOOLE_0:def 4;
     then
A67: L5 in dom <:Di,Dj:> by FUNCT_3:def 7;
     then
A68: <:Di,Dj:>.L5 = [Di.L5,Dj.L5] by FUNCT_3:def 7;
A69: dom(addition(A)) = [:A,A:] by A2,FUNCT_2:def 1;
     i is_a_value_on L5 & j is_a_value_on L5 by A7;
     then [Di.L5,Dj.L5] in [:A,A:] by ZFMISC_1:87;
     then
A70: L5 in dom Aij by A69,A67,A68,FUNCT_1:11;
A71: 2=1+1 & 3=2+1 & 4=3+1 & 5=4+1 & 6=5+1;
A72: PS.1 = L1 by A14,A16,NOMIN_8:def 14;
A73: PS.2 = L2 by A71,A14,A15,A17,A72,NOMIN_8:def 14;
A74: PS.3 = L3 by A71,A14,A15,A18,A73,NOMIN_8:def 14;
A75: PS.4 = L4 by A71,A14,A15,A19,A74,NOMIN_8:def 14;
    let y be Nat;
    assume
A76: 1 <= y;
    assume y < len prg;
    then y+1-1 <= 6-1 by A14,NAT_1:13;
    then y = 1+0 or ... or y = 1+4 by A76,NAT_1:62;
    then per cases;
    suppose y = 1;
      hence thesis by A72,A34,A58;
    end;
    suppose y = 2;
      hence thesis by A47,A71,A14,A15,A17,A72,NOMIN_8:def 14;
    end;
    suppose y = 3;
      hence thesis by A54,A71,A14,A15,A18,A73,NOMIN_8:def 14;
    end;
    suppose y = 4;
      hence thesis by A63,A71,A14,A15,A19,A74,NOMIN_8:def 14;
    end;
    suppose y = 5;
      hence thesis by A70,A71,A14,A15,A20,A75,NOMIN_8:def 14;
    end;
  end;
