reserve SOURCE for non empty finite set,
 p for Probability of Trivial-SigmaField SOURCE,
 Tseq for FinSequence of BoolBinFinTrees IndexedREAL,
 q for FinSequence of NAT;
reserve T for BinHuffmanTree of p;

theorem Th26:
 Tseq,q,p is_constructingBinHuffmanTree implies
 for i be Nat
 for X be non empty finite Subset of BinFinTrees IndexedREAL
 st X=Tseq.i
 for T be finite binary DecoratedTree of IndexedREAL st T in X
 for p be Element of (dom T), r be Element of NAT st r = (T.p) `1
 holds r <= MaxVl(X)
proof
assume A1:Tseq,q,p is_constructingBinHuffmanTree;
defpred P[Nat] means 1 <=$1 & $1 <=len Tseq implies
 for X be non empty finite Subset of BinFinTrees IndexedREAL
 st X=Tseq.$1 holds
 for T be finite binary DecoratedTree of IndexedREAL
 st T in X holds
 for p be Element of (dom T), r be Element of NAT
 st r = (T.p) `1 holds r <= MaxVl(X);
A2: P[0];
A3: for i be Nat st P[i] holds P[i+1]
proof
 let i be Nat;
 assume A4: P[i];
 assume A5: 1 <=i+1 & i+1 <=len Tseq;
 let W be non empty finite Subset of BinFinTrees IndexedREAL;
 assume A6: W=Tseq.(i+1);
 let d be finite binary DecoratedTree of IndexedREAL;
 assume A7: d in W;
 per cases;
 suppose i = 0; then
 consider d0 be Element of FinTrees IndexedREAL such that
 A8: d0=d & d0 is finite binary DecoratedTree of IndexedREAL &
 ex x be Element of SOURCE st
 d0 = root-tree [ (canFS SOURCE)".x, p.{x} ] by A1,A6,A7;
 thus for p be Element of (dom d), r be Element of NAT
 st r = (d.p) `1 holds r <= MaxVl(W)
 proof
 let p be Element of (dom d), r be Element of NAT;
 assume A9: r = (d.p) `1;
 dom d = {{}} by TREES_1:29,A8;
 then A10: r = Vrootl(d) by A9,TARSKI:def 1;
 consider L be non empty finite Subset of NAT such that
 A11: L = {Vrootl p where p
 is Element of BinFinTrees IndexedREAL: p in W }
 & MaxVl(W) = max L by Def9;
 dom d is finite & dom d is binary by BINTREE1:def 3; then
 reconsider px=d as Element of BinFinTrees IndexedREAL by Def2;
 Vrootl px in L by A7,A11;
 hence r <= MaxVl(W) by A10,A11,XXREAL_2:def 8;
 end;
 end;
 suppose A12:i <> 0; then
 A13: 1<= i & i < len Tseq by A5,XXREAL_0:2,NAT_1:16,NAT_1:14;
 then consider X,Y be non empty finite Subset of BinFinTrees IndexedREAL,
    s being MinValueTree of X,
    t being MinValueTree of Y,
    w being finite binary DecoratedTree of IndexedREAL such that
A14: Tseq.i = X &
 Y = X \ {s} &
 w in {MakeTree (t,s,MaxVl(X) + 1),MakeTree (s,t,MaxVl(X) + 1)} &
 Tseq.(i+1) = (X \ {t,s} ) \/ {w} by A1;

A15:
 for T be finite binary DecoratedTree of IndexedREAL st T in X holds
 for p be Element of (dom T), r be Element of NAT st r = (T.p) `1
 holds r <= MaxVl(X)
 by A4,A12,A5,XXREAL_0:2,NAT_1:16,NAT_1:14,A14;
 A16: w = MakeTree (t,s,MaxVl(X) + 1) or
 w = MakeTree (s,t,MaxVl(X) + 1) by A14,TARSKI:def 2;
A17: s in X & t in Y by Def10;
 A18: t in X & not t in {s} by A17,A14,XBOOLE_0:def 5;
 A19: MaxVl(W) = MaxVl(X) + 1 by A13,A14,Th24,A1,A6;
 thus for p be Element of (dom d), r be Element of NAT
 st r = (d.p) `1 holds r <= MaxVl(W)
 proof
 let p be Element of (dom d), r be Element of NAT;
 assume A20: r = (d.p) `1;
 per cases by XBOOLE_0:def 3,A14,A6,A7;
 suppose d in (X \ {t,s} );
 then d in X by XBOOLE_0:def 5;
 then r <= MaxVl(X) by A20,A5,XXREAL_0:2,NAT_1:16,NAT_1:14,A12,A14,A4;
 hence r <= MaxVl(W) by A19,XXREAL_0:2,NAT_1:16;
 end;
 suppose d in {w};
 then d = w by TARSKI:def 1;
 hence r <= MaxVl(W) by A17,A19,A16,A20,A18,Th23,A15;
 end;
 end;
 end;
end;

A21: for i be Nat holds P[i] from NAT_1:sch 2(A2,A3);
 let i be Nat, X be non empty finite Subset of BinFinTrees IndexedREAL
 such that
A22: X=Tseq.i;
 let T be finite binary DecoratedTree of IndexedREAL such that
A23: T in X;
i in dom Tseq by A22,FUNCT_1:def 2;
then 1 <= i & i <= len Tseq by FINSEQ_3:25;
hence thesis by A22,A23,A21;
end;
