theorem Th7: ((I-TermEval)*
((((l,tt0) ReassignIn ((S,X)-freeInterpreter),tt0)-TermEval).n))|
(S-termsOfMaxDepth.n)=
((((l,I-TermEval.tt0) ReassignIn I,I-TermEval.tt0)-TermEval).n)|
(S-termsOfMaxDepth.n) ::# to be replaced by Th11
proof
set II=U-InterpretersOf S;
reconsider u=(I-TermEval).tt0 as Element of U;
set F=S-firstChar, FI=(S,X)-freeInterpreter, H=(l,tt0) ReassignIn FI,
TT=AllTermsOf S, TI=(I,u)-TermEval, TF=(FI,tt0)-TermEval,
TH=(H,tt0)-TermEval,TII=I-TermEval, J=(l,TII.tt0) ReassignIn I,
TJ=(J,u)-TermEval, C=S-multiCat, SS=AllSymbolsOf S, T=S-termsOfMaxDepth;
reconsider t0=tt0 as termal string of S; set k=Depth t0;
reconsider t00=t0 as k-termal string of S by FOMODEL1:def 40;
A1: l in {l} & dom (l.-->({}.-->tt0))={l} & dom (l.-->({}.-->(TII.tt0)))={l}
by TARSKI:def 1; then H.l=(l.-->({}.-->tt0)).l &
J.l=(l.-->({}.-->(TII.tt0))).l by FUNCT_4:13; then
A2: H.l = {}.-->tt0 & J.l={}.-->(TII.tt0) by A1, FUNCOP_1:7;
defpred P[Nat] means (TII*(TH.$1)) | (T.$1) = (TJ.$1)|(T.$1);
A3: P[0]
proof
A4: dom (TT -->u)=TT & dom (TT-->tt0) = TT & dom TII=TT by FUNCT_2:def 1;
TI.0=TT-->u & TH.0=TT-->tt0 by FOMODEL2:def 8; then (TII*(TH.0)) =
 TT --> (TII.tt0) by FUNCOP_1:17,A4
.= TJ.0 by FOMODEL2:def 8; hence thesis;
end;
A5: for m st P[m] holds P[m+1]
proof
let m; reconsider mm=m, MM=m+1 as Element of NAT by ORDINAL1:def 12; assume
A6: P[m];
reconsider TM=T.MM, Tm=T.mm as Subset of TT by FOMODEL1:2;
TJ.mm is Element of Funcs(TT,U) & TI.MM is Element of Funcs(TT,U)
& TJ.MM is Element of Funcs(TT,U) & TI.mm is Element of Funcs(TT,U); then
reconsider Jm=TJ.mm, JM=TJ.MM, IM=TI.MM, Imm=TI.mm as Function of TT,U;
TH.mm is Element of Funcs(TT,TT) & TH.MM is Element of Funcs(TT,TT); then
reconsider Hm=TH.mm, HM=TH.MM as Function of TT,TT;
set LH=(TII*HM)|TM, RH=JM|TM;
A7: dom LH=TM & dom RH=TM by PARTFUN1:def 2;
now
let x be object; assume
A8: x in dom LH; then reconsider tt=x as Element of TT by A7;
reconsider t=x as (mm+1)-termal string of S
by A7,  FOMODEL1:def 33, A8; reconsider ttt=x as Element of TM
by A8; set ST=SubTerms t, o=F.t, n=|.ar o.|;
((IM*HM)|TM).ttt \+\ (IM*HM).ttt = {} & (JM|TM).ttt \+\ JM.ttt={}
& ((TII*HM)|TM).ttt \+\ (TII*HM).ttt={}; then
A9:((IM*HM)|TM).x= (IM*HM).x & (JM|TM).x=JM.x &
((TII*HM)|TM).x = (TII*HM).x by FOMODEL0:29; (IM*HM).tt \+\ IM.(HM.tt)={}
& (TII*HM).tt\+\ TII.(HM.tt)={}; then
A10: (IM*HM).t=IM.(HM.t) & (TII*HM).tt=TII.(HM.tt)  by FOMODEL0:29;
reconsider newterms=Hm*ST as n-element FinSequence of TT by FOMODEL0:26;
reconsider newtermss=newterms as Element of n-tuples_on TT by FOMODEL0:16;
reconsider newtermsss=newterms as FinSequence of SS*\{{}} by FOMODEL0:26;
(o-compound|(n-tuples_on TT)).newtermss \+\ (o-compound.newtermss) = {};
then
A11: (o-compound|(n-tuples_on TT)).newterms = o-compound.newterms
by FOMODEL0:29;
per cases;
suppose o=l; then o=l & t is 0-termal by FOMODEL1:16; then
(TII*HM).t=TII.(({}.-->tt0).{}) & JM.t=({}.-->(TII.tt0)).{} & {} in {{}}
by FOMODEL2:3, TARSKI:def 1, A10, A2; then
(TII*HM).t=TII.tt0 & JM.t=TII.tt0 by FUNCOP_1:7;
hence LH.x=RH.x by A9;
end;
suppose o<>l; then
A12: not o in dom (l .--> ({}.-->tt0)) &
not o in dom (l.-->({}.-->(TII.tt0))) by TARSKI:def 1;
then FI.o = H.o by FUNCT_4:11; then
H.o = X-freeInterpreter o by Def4 .=
o-compound|(n-tuples_on TT) by Def3; then
A13: (H.o).newterms = o-compound newtermsss by A11, Def2;
reconsider newtermssss=newterms as n-element Element of TT*;
reconsider t1=o-compound newtermssss as termal string of S;
set p=Depth t1;
reconsider pp=p as Element of NAT by ORDINAL1:def 12;
reconsider t111=t1 as p-termal string of S by FOMODEL1:def 40;
reconsider t11=t1 as Element of TT by FOMODEL1:def 32;
TI.pp is Element of Funcs(TT,U); then
reconsider Ip=TI.pp as Function of TT,U;
A14: F.t1 = t1.1 by FOMODEL0:6 .= o by FINSEQ_1:41; then
A15: SubTerms t1=newtermssss by FOMODEL1:def 37;
A16: dom (Hm|Tm)=Tm & dom (Jm|Tm)=Tm & rng ST c= Tm by
RELAT_1:def 19, PARTFUN1:def 2;
(TII*HM).t = TII.t1 by A13, FOMODEL2:3, A10
.= (I.o).(TII*(SubTerms t1)) by A14, FOMODEL2:21
.= (I.o).(TII*((Hm|Tm)*ST)) by A16, RELAT_1:165, A15
.= (I.o).((TII*(Hm|Tm))*ST) by RELAT_1:36 .=
(I.o) . (((TII*Hm)|Tm)*ST) by RELAT_1:83 .=
(I.o).(Jm*ST) by A6, A16, RELAT_1:165 .= (J.o).(Jm*ST) by FUNCT_4:11, A12
.= JM.t by FOMODEL2:3;
hence LH.x=RH.x by A9;
end;
end;
hence thesis by A7, FUNCT_1:2;
end;
for m holds P[m] from NAT_1:sch 2(A3,A5); hence thesis;
end;
