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 Th29:
 Tseq,q,p is_constructingBinHuffmanTree implies
 for i be Nat
 for T,S be finite binary DecoratedTree of IndexedREAL
 st T in Tseq.i & S in Tseq.i & T <> S
 holds rng T /\ rng S = {}
proof
assume A1:Tseq,q,p is_constructingBinHuffmanTree;
defpred P[Nat] means 1 <=$1 & $1 <=len Tseq implies
 for T,S be finite binary DecoratedTree of IndexedREAL
 st T in Tseq.$1 & S in Tseq.$1 & T <> S
 holds rng T /\ rng S = {};
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 d,h be finite binary DecoratedTree of IndexedREAL;
 assume A6: d in Tseq.(i+1) & h in Tseq.(i+1) & d <> h;
 per cases;
 suppose A7: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;
 consider x be Element of SOURCE such that
 A9: d0 = root-tree [ (canFS SOURCE)".x, p.{x} ] by A8;
 consider h0 be Element of FinTrees IndexedREAL
 such that
 A10: h0=h & h0 is finite binary DecoratedTree of IndexedREAL &
 ex y be Element of SOURCE st
 h0 = root-tree [ (canFS SOURCE)".y, p.{y} ] by A7,A1,A6;
 consider y be Element of SOURCE such that
 A11: h0 = root-tree [ (canFS SOURCE)".y, p.{y} ] by A10;
 thus rng d /\ rng h = {}
 proof
 assume rng d /\ rng h <> {};
 then consider z be object
 such that A12: z in rng d /\ rng h by XBOOLE_0:def 1;
 A13: z in rng d & z in rng h by XBOOLE_0: def 4,A12;
 A14: rng d = {[ (canFS SOURCE)".x, p.{x} ]} by A8,A9,FUNCOP_1:8;
 A15: rng h = {[ (canFS SOURCE)".y, p.{y} ]} by A10,A11,FUNCOP_1:8;
 [ (canFS SOURCE)".x, p.{x} ]
 = z by TARSKI:def 1,A14,A13
 .= [ (canFS SOURCE)".y, p.{y} ] by TARSKI:def 1,A15,A13;
 hence contradiction by A6,A8,A10,A9,A11;
 end;
 end;
 suppose A16:i <> 0; then
 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
A17: 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;
 A18: 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 A1,A17,Th26;
 A19: w = MakeTree (t,s,MaxVl(X) + 1) or
 w = MakeTree (s,t,MaxVl(X) + 1) by A17,TARSKI:def 2;
A20: s in X & t in Y by Def10;
 then t in X & not t in {s} by A17,XBOOLE_0:def 5;
 then
 A21: t in X & t <> s by TARSKI:def 1;
 per cases by XBOOLE_0:def 3,A17,A6;
 suppose d in (X \ {t,s} ) & h in (X \ {t,s} );
 then
 d in Tseq.i & h in Tseq.i by A17,XBOOLE_0:def 5;
 hence rng d /\ rng h = {} by A16,A5,XXREAL_0:2,NAT_1:16,NAT_1:14,A4,A6;
 end;
 suppose d in {w} & h in (X \ {t,s} );
 then
 d= w & h in (X \ {t,s} ) by TARSKI:def 1;
 hence rng d /\ rng h = {}
 by A20,A19,A17,A16,A5,XXREAL_0:2,NAT_1:16,NAT_1:14,A4,A18,A21,Th28;
 end;
 suppose d in (X \ {t,s} ) & h in {w}; then
 d in (X \ {t,s} ) & h = w by TARSKI:def 1;
 hence rng d /\ rng h = {} by A20,A19,A16,A5,XXREAL_0:2,NAT_1:16,
NAT_1:14,A4,A18,A17,A21,Th28;
 end;
 suppose d in {w} & h in {w}; then
 d=w & h =w by TARSKI:def 1;
 hence rng d /\ rng h = {} by A6;
 end;
 end;
end;

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