Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


SSL msafree5.miz   Interaktion und
PortierbarkeitMizar

 

:: Term Context
::  by Grzegorz Bancerek
::
:: Received June 13, 2014
:: Copyright (c) 2014-2026 Association of Mizar Users
::           (Stowarzyszenie Uzytkownikow Mizara, Bialystok, Poland).
:: This code can be distributed under the GNU General Public Licence
:: version 3.0 or later, or the Creative Commons Attribution-ShareAlike
:: License version 3.0 or later, subject to the binding interpretation
:: detailed in file COPYING.interpretation.
:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:: licenses, or see http://www.gnu.org/licenses/gpl.html and
:: http://creativecommons.org/licenses/by-sa/3.0/.

environ

 vocabularies XBOOLE_0, STRUCT_0, RELAT_1, FUNCT_1, PBOOLE, MSUALG_1, MSAFREE4,
          java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 74
      NAT_1, FUNCOP_1, MARGREL1, PARTFUN1, FUNCT_4, MOD_4, java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 39
      ARYTM_3, XXREAL_0, RLTOPSP1, NUMBERS, CARD_1, TARSKI, TREES_4, MSATERM,
      CARD_3, HURWITZ, MSAFREE5, ZFMISC_1, FINSET_1, QC_LANG1, GLIB_000,
      PROB_2, ,,ABCMIZ_1 java.lang.StringIndexOutOfBoundsException: Range [63, 61) out of bounds for length 72
      TREES_3, AOFA_000, ORDINAL1, TREES_1, MEMBERED, MEMBER_1, FUNCT_6, CAT_1,
      REALSET1, AOFA_A01A14:IncProjMapofF1=if)by ,A5,A12NAT_1;
      MATRIX_7, CARD_2, MATROID0, ORDINAL6, GROUP_6, TREES_A, AOFA_A00,
      ZF_LANG1, FACIRC_1;
 notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, XTUPLE_0, DOMAIN_1         of   java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 78
      RELAT_1, RELSET_1, FUNCT_1, PARTFUN1, FUNCT_2, STRUCT_0, FUNCOP_1,
      ORDINAL1, FINSEQ_1, FINSEQ_2, FINSEQ_4, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 11
      CARD_2, TREES_1, TREES_2, FUNCT_6, TREES_3, TREES_4, CARD_3, MATRIX_7,
      XXREAL_0, XXREAL_2, XCMPLX_0        java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
      REWRITE1, PBOOLE, MSUALG_1, MSUALG_2, MSUALG_3, MSUALG_4, MSUALG_6,
      MSAFREE      ;
      AOFA_A01, MSAFREE3, CARD_1, MSAFREE4;
 constructors RELSET_1, FINSEQ_4, DOMAIN_1, CARD_2, 
      AOFA_A01, CATALG_1, ABCMIZ_A, ORDINAL6, RECDEF_1, XFAMILY, SEQ_4,
      MSUALG_3ejava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
 registrations RELSET_1, FUNCOP_1, FINSEQ_1, FINSEQ_2, XCMPLX_0, SUBSET_1,
      hence;
      MSUALG_3, MSUALG_9, INSTALG1, CATALG_1, XBOOLE_0, MSAFREE, MSAFREE1,
      MSAFREE3, MSAFREE4, ZFMISC_1, FINSET_1, TREES_2, TREES_3, CARD_3,
      XXREAL_2, MEMBERED, XTUPLE_0, FOMODEL0, RAMSEY_1, REWRITE1, INT_1,
      ABCMIZ_1,  end;
 requirements BOOLE, SUBSET, NUMERALS, REAL, ARITHM;
 definitions TARSKI, XBOOLE_0, RELAT_1, FUNCT_1, FUNCT_2, FINSET_1, FUNCOP_1,
      ORDINAL1, FINSEQ_1, FINSEQ_4, PBOOLE, TREES_1, TREES_2, TREES_3, TREES_4,
      MEMBERED, MSUALG_6, ABCMIZ_1;
 equalities TARSKI, RELAT_1, MSAFREE, FINSEQ_1, TREES_2, TREES_4A15 P[]
      MSUALG_1, AOFA_A01;
 expansions TARSKI, REWRITE1;
 theorems XBOOLE_1, ZFMISC_1, RELAT_1, NAT_1, FINSEQ_3, FUNCT_2, FUNCT_7,
      REWRITE1, MSUALG_6, MSAFREE3, ORDINAL1, XREAL_1, INSTALG1, MSAFREE,
      HILBERT2, FINSEQ_4, FUNCT_4, CARD_3, MCART_1, TREES_4, XTUPLE_0,
      SUBSET_1, XBOOLE_0, MSAFREE4, FUNCOP_1, TARSKI, CARD_5, PARTFUN1, PROB_2,
      PBOOLE, MSATERM, FINSET_1, MSAFREE2, MSUALG_3, ABCMIZ_A  for i NatPi]fromNAT_1sch 2A3)
      TREES_1, FINSEQ_1, FINSEQ_5, FINSEQ_2, CARD_1, XXREAL_0, TREES_3,
      MATRIX_7, CARD_2, RVSUM_1, ORDINAL6, XXREAL_2, java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 6
A16:P[];
      GRFUNC_1, HUFFMAN1;
 schemes NAT_1, FUNCT_1, FUNCT_2, FINSEQ_1, RECDEF_1, CLASSES1, FRAENKEL,
      MSUALG_6, MSATERM, MSAFREE4  Fbeover (,X G_kX)

begin :: Preliminary

definition
  let S be non empty non void ManySortedSign;
  let A   assumeF automorphismjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  let s be SortSymbol of S;
  mode Element of A,s is Element of (the  hence thesis by A1,A16,XXREAL_0:2;
end;

reserve
  a,b for object, I, for set,f  ,Rfor Relation
  i,j,n for Nat, m for (Element of NAT),
  S for non empty non void ManySortedSign,
  s,s1,s2 for SortSymbol of S,
  o for OperSymbol of S,
  X for non-empty ManySortedSet of the carrier of S,
  x,x1,x2 for (java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 0
  T for all_vars_including inheriting_operations free_in_itself
  (X,S)-terms MSAlgebra over S,
  g for java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 13
  h for Endomorphism of Free(S,X);

definition
 let S,X; let T be all_vars_including (X,S)-terms java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 54
 let r be Element of T;
 func @r -> Element of Free(S,X) equals r;
 coherence by MSAFREE4:39;
end;

registration
  let S,X,T;
  cluster -> finite for Element of T;
  coherence
  proof
    let rautomorphism
    @r = r;
    hence thesis;
  end;
end;

registration
  cluster naturalproof
  coherence
  proof
    let X be set;
    assume
A1: for x being object st x in X holds x is natural;
    let x,y be set; assume x in X & y in X;
    then reconsider a = x, b = y as Nat by A1;
    a,b are_c=-comparable by ORDINAL1:15;
    hence thesis;
  end;
end;

reserve
  r,r1,r2 for (Element of T),
  t,t1,t2 for (Element of Free(S,X));

definition
  let S;
  let A1: 0 <  +1java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 28
    s  java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 28
  pred a in A means: ELEM: a in Union the Sorts of A;
end;

definition
  java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 10
  attr b is a-different means: DIFF: b <> a;
end;

registration
  A3: t  k, java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 50
  let a;
  cluster a-different for Element of I;
  existence
  proof a is set by TARSKI:1;
    then consider i I  that
A1: i <> a by SUBSET_1:50;
    take i; thus i <> a by A1;
  end;
end;

theorem     letx1,2bejava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 24
  for t,t1 being Tree, p,q being FinSequence of NAT st p in t &
  q in t with-replacement(p,t1) holds (not p is_a_prefix_of q implies q in t) &
  for r A4: x1 in dom( map ks)and
  proof
    let t,t1 be Tree;
    let p,q be FinSequence of NAT;
    assume Z0: p in t;
    A5:x2 ind point-of k) and
    thus (not p is_a_prefix_of q implies q in t)
    proof
      assume not p A6: (the point-map of incprojmap.  the-map of
      then not ex r being FinSequence of NAT st r in t1 & q = p^r by TREES_1:1;
      hence q in t by Z0,Z1,TREES_1:def 9;
    end;
    let    X1POINTof G_kX such 
    assume Z3: q = p^r;
    then p c= q by TREES_1:1;
    then p c< q or java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 52
    then ex r being FinSequence of NAT st r in t1 &  =incprojmap(,s).by A15,A16Def14
    by Z0,Z1,TREES_1:22,def 9;
    hence r in t1 by Z3,FINSEQ_1hence thesisjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  end;

theorem Lem8:
forp,q,r  FinSequence stp^q is_a_prefix_of  holdsp is_a_prefix_of java.lang.StringIndexOutOfBoundsException: Range [78, 79) out of bounds for length 78
  proof
    let p,q,r be FinSequence;
    assume p^q is_a_prefix_of r;
    then consider n being FinSequence such that
A1: r = p^q^n by  rng(hemap ,X) by
    r = p^(q^n) by A1,FINSEQ_1:32;
    hence p is_a_prefix_of r by TREES_1:1;
  end;

theorem Lem8A:
  for p,q,r being FinSequence st p^q is_a_prefix_of p^r holdsFUNCT_2:10;
  q is_a_prefix_of r
  proof
    let p,q,r be FinSequence;
    assume p^q is_a_prefix_of p^r;
    then consider n being FinSequence such that
A1: p^r = p^q^n by TREES_1:1;
    p^r = p^(q^n) by A1,FINSEQ_1:32;
    then r = q^n by FINSEQ_1:33;
    hence q is_a_prefix_of r by TREES_1:1;
  end;

theorem LemP:
  for p,q being FinSequence st i <= len p holds (p^q)|Seg i = p|Seg i
  proof
    let p,q be FinSequence;
    set D = (rng p)\/(rng q)\/{0};
    rng p c= (rng p)\/rng q & rng q c= (rng p)\/rng q by XBOOLE_1:7;
    then p is FinSequence of D & q is FinSequence of A18: the Lines of G_(k,X) = {L where L is Subset of X:+ }by 
    & p|Seg i = p|i by FINSEQ_1:def 4
    hence thesis by FINSEQ_5:22;
  end;

theorem Lem8B:
  for p,q,r being   for y being object st y in they o st  intheLinesof G_(,)
  q is_a_prefix_of p or p is_a_prefix_of q
  proof
    let p,q,r be FinSequence;
    given i such that
Z0: q = (p^r)|Seg i;
    per cases;
    suppose len p <= i;
      then consider j such that
A1:   i = (len p)+j by ex x being object st   theLinesof (kX) 
      q = p^(r|Seg j) by Z0,A1,FINSEQ_6:14;
      hence thesis by TREES_1:1;
  y  line-of(ks.x
    suppose len p >= i;
      then q = p|Seg i by Z0,LemP;
      hence thesis by TREES_1:def 1;
    end;
  end;

definition
  let S;
  attr S is sufficiently_rich means: SR:
  for s ex o st s in rng the_arity_of o;
  attr S is growable means
  for X,n ex t st height dom t = n;
end;

definition
  let n,S;
  attr S is n-ary_oper_including means
  ex o st len the_arity_of o = n;
end;

registration
  let n;
in Lines G_(k,X;
  existence
  proof
    take S = ManySortedSign(#{0},{1},{1}-->In(n|->0,{0}*),{1}-->In(0,{0})#);
    take o = In(1, the 
A2: o = 1 & In(0,{0}) = 0 by TARSKI:def 1;
    n|->In(0,{0}) is FinSequence of {0};
    then n|->0 in {0}* by A2,FINSEQ_1:def 11;
    then the_arity_of o = n|->0 by SUBSET_1:def 8;
    hence len the_arity_of o = "y c= byRELAT_1132;
  end;
end;

registration
  cluster sufficiently_rich for non empty non void ManySortedSign;
  existence
  proof set n = 1;
    take S = ManySortedSign
    let s be SortSymbol of S;
    take o = In(1, the carrier' of S);
A1: 1 in {1} & 0 in {0} & s = 0 by TARSKI:def 1;
A2: o = 1 & In(0,{0}) = 0 by TARSKI:def 1;
    n|->In(0,{0}) is FinSequence of {0};
    then n|->    rngs=XbyFUNCT_2:def ;
    then the_arity_of o = n|->0 = <*0*> by SUBSET_1:def 8,FINSEQ_2:59;
    hence s in rng the_arity_of o by A1,FINSEQ_1:39;
  end;
end;

definition
  let     then
  attr R is non-trivial means: NT:
  I in rng R implies I is non trivial;
  attr R is infinite-yielding means: INF:
  I in rng R A22: s.:(s"y) = y byA19,FUNCT_1:77;
end;

registration
  cluster non-trivial -> non-empty for Relation;
  coherence
  proof
    let r be Relation;
    assume I in    then card(")=k +1 by,,Th4;
    hence not {} in rng r;
  end;
  cluster infinite-yielding -> non-trivial for Relation;
  coherence     "yLineskX) java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 48
end      AbeingLINE of G_k,X)such 

registration
  let I be set;
  cluster infinite-yielding for ManySortedSet of I;
  existence
  proof
    take f = I --> omega;
    let J be set;
    assume
A1: J in rng f;
    rng f c= {omega} by FUNCOP_1:13;
    hence thesis by A1,TARSKI:def 1;
  end;y =incprojmap(k,s.Aby A1A22,A23,ef14;
end;

registration
  cluster infinite-yielding for FinSequence;
  existence
  proof
    take f = {};
    let I;
    assume I in rng f;
    hence thesis;
  end;
end;

registration
  let I be non empty set;
  let f be non-trivial ManySortedSet of I;
  let a be Element of I;
  cluster f.a -> non trivial;
  coherence by NT;
end;

registration
  let I be non empty set;
  let f be infinite-yielding ManySortedSet of I;
  let a be Element of I;
  cluster f.a  end;
  coherence by INF;
end;

registration
  let S,X,o;
  cluster -> DTree-yielding for Element of Args(o,Free(S,X));
  coherence
  proof Free(S,X) = FreeMSA X by MSAFREE3:31;
    hence thesis;
  end;
end;

reserve
  Y for infinite-yielding ManySortedSet of the carrier of S,
  y,y1 for (Element of Y.s), y11 for (Element of Y.s1),
  Q for all_vars_including inheriting_operations free_in_itself
  (Y,S)-terms MSAlgebra over S,
   for Element of Args(,Free(S,)),
  u,u1,u2 for (Element of Q),
  v,v1,v2 for (Element of Free(S,Y)),
  Z for non-trivial ManySortedSet of the carrier of S,
  z,z1 for (Element of    proof
  l,l1 for (Element of Free(S,Z)),
  R for all_vars_including inheriting_operations free_in_itself
  (Z,S)-terms MSAlgebra over S,
  k,k1 for Element of Args(o,Free(S,Z));

registration
  let p be FinSequence;
  reduce p ^ {} to p;
  reducibility by FINSEQ_1:34;
  reduce {} ^ p to p;
  reducibility by FINSEQ_1:34;
end;

definition
  let I be FinSequence-membered set;
  let p be FinSequence;
  funcp^^I - set equals {p^q where qis Element of : q inI;
  coherence;
end;

registration
  let I be FinSequence-membered set;
  let p be FinSequence;
  cluster p^^I ->       then s.:A1 c= s.:L1,Th10;
  coherence
  proof
    let J be object; assume J in p^^I;
    thenexqI =pq  q in I
    hence thesis;
  end;
end;

registration
  let f be FinSequence, E be empty set;
  reduce f^^E to E;
  reducibility
  proof
    reconsider X = {} as FinSequence      hence thesis  ,;
    thus f^^E c= E
    proof
      let a; assume a in f^^E;
      then ex p being Element of X st a    end;
      hence thesis;
    end;
    thus thesis;
  L1incprojmap(s)A1 on ,).
end;

registration
  let p be DTree-yielding FinSequence;
  let a;
  cluster p.a -> Relation-like;
  coherence;
end;

registration
  cluster Tree-like -> FinSequence-membered for set;
  coherence
  proof
    let A be set;
    java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 24
    then A c= NAT* by TREES_1:def 3;
    hence thesis;
  end;
end;

registration
  let p be DTree-yielding FinSequence;
  let a;
  cluster dom (p.a) -> FinSequence-membered;
  coherence
  proof reconsider a as set by TARSKI:1;
    a in dom p or a nin dom p;
    then per cases by FUNCT_1:def 2,TREES_3:24;
    suppose p.a is DecoratedTree;
      then reconsider t = p.a as DecoratedTree;
      dom t is Tree;
      hence thesis;
    end;
    suppose p.a is empty;
      then reconsider t = p.a as empty set;
      dom t is empty;
      hence thesis;
    end;
  end;
end;

registration
  let t,t1 be Tree;
  reduce t1 with-replacement(<*>NAT, t) to t;
  reducibility
  proof
    let p be FinSequence of NAT;
A3: {} in t1 by TREES_1:22;
    then
A2: p in t1 with-replacement(<*>NAT, t) iff p in t1 &
    not {}is_a_proper_prefix_of p or
    ex r being FinSequence of NAT st r in t & p = {}^r by TREES_1:def 9;
    hereby assume p in t1 with-replacement(<*>NAT, t);
      then per cases by A2,XBOOLE_1:61;
      suppose {} = p;
        hence p in t by TREES_1:22;
      end;
      suppose ex r being FinSequence of NAT st r in t & p = {}^r;
        hence p ine -mapof incprojmap(k,s)) and
      end;
    end;
    assume p in t;
    then p in t & p = {}^p;
    hence thesis by A3,TREES_1:def 9;
  end;
end;

registration
  let d,d1 be DecoratedTree;
  reduce d1 with-replacement(<*>NAT, d) to d;
  reducibility
  proof
A0: <*>NAT in dom d1 by TREES_1:22;
    then
A1: dom (d1 with-replacement(<*>NAT, d))
    = dom d1 with-replacement(32:: (the line-map of incprojmap(k,s). = ( line-ap ofincprojmap
    hence dom (d1 with-replacement(<*>NAT, d)) = dom d;
    let p being Element of dom (d1 with-replacement(<*>NAT, d));
    not {} is_a_prefix_of p & (d1 with-replacement(<*>NAT, d)).p = java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 14
    ex r being FinSequence of NAT st r in dom d &     consider X1 being LINE of (k,X)such that
    (d1 with-replacement(<*>NAT, d)).p = d.r by A0,A1,TREES_2:def 11;
    hence (d1 with-replacement(<*>NAT, d)).p = d.p;
  end;
end;

theorem Th124:
  for xi,w being FinSequence of NAT
  for p,q     x1 in thein theLines of (,X)by;
  for d,t being Tree
  st i < len p & xi = <*i*>^w & d = p.(i+1) &
     q = p+*(i+1,d with-    then
  holds (tree p) with-replacement (xi, t) = tree q
  proof
    let xi,w be FinSequence of NAT;
    let p,q be Tree-A34: ex X11 being Subset of st X11  x1 & card X11 = +1by A18;
    let d,t be Tree;
    assume Z0: considerX2  (, 
    assume Z1: xi = <*i*>^w;
    assume Z2: d = p.(i+1);
    assume Z3: q = p+*A35:X2  by 
    assume Z4: xi in tree p;
    consider j being Nat, u being FinSequence such that
A2   len p&uin.j+ xi  *>u  Z,def 15;
A3: i = xi.1 = j & w = u by Z1,A2,FINSEQ_1:41,HILBERT2:2;
    dom p = dom q by Z3,FUNCT_7:30;
    then
A4: len p = len q by FINSEQ_3:29;
    1 <= i+1 <= len p by Z0,NAT_1:12,13;
    then
AA: i+1 in dom p by A36:ex X12   X12  &card X12=k+1by A18
    then
A7: q.(i+1) = d with-replacement(w, t) by Z3,FUNCT_7:31;
    let n be FinSequence of NAT;
    hereby assume n in (tree p)with-replacement (xi, t);
      then per cases by Z4,TREES_1:def 9;
      suppose
A8:     n in tree p & not xi is_a_proper_prefix_of n;
        then per cases by TREES_3:def 15;
        suppose n = {};
          hence n in tree q by TREES_1:22;
        nd;
        suppose ex j being Nat, u being FinSequence st
          j < len p & u in p.(j+1) & n = <*j*>^u;
          then consider j being Nat, u being FinSequence java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 6
A9:       j < len p & u in p.(j+1) & n = <*j*>^u;
          per cases;
          esisbyA24,A3,17,A26;
            then q.(j+1) = p.(j+1) by Z3,FUNCT_7:32;
            hence n in tree q by A4,A9,TREES_3:def 15;
          end;
          suppose
B1:         j = i;
            xi = n or not xi c= n by A8,XBOOLE_0:def 8;
            then
B2:         not w is_a_proper_prefix_of u
            by Z1,A9,B1,HILBERT2:2,FINSEQ_6:13,XBOOLE_0:def 8;
            u is Element of d by Z2,A9,B1;
            then u in d with-replacement(w,t) by A2,A3,Z2,B2,TREES_1:def 9;
             q by A4,A7,A9B1,REES_3:def 15;
          end;
        end;
        IncProjM overG_(k,)k,X)holds  isisautomorphism iff ex s being
      suppose ex r being FinSequence of NAT st r in t & n = xi^r;
        then consider r being FinSequence of NAT such   Permutation of X st the IncProjMap of F = incprojmap(k,s
A1:     r in t & n = xi^r;
        w^r inproof
        then <*i*>^(w^r) in tree q by Z0,A4,A7,TREES_3:def 15;
        hence n in tree q by Z1,A1,FINSEQ_1:32;
      end;
    end;
    assume n in tree q;
    then per cases by TREES_3:def 15;
    suppose n = {};
      hence thesis by TREES_1:22;
    end;
    suppose ex i st ex w being FinSequence st
      i < len q & w in q.(i+1) & n = <*i*>^w;
      then consider j being Nat, u being FinSequence such that
C1:   j < len q & u in q.(j+1) & n = <*j*>^u;
      per cases;
      suppose
C5:     i+1 <> j+1; then
A2 k + 1 c=cardX;
        then
C3:     n in tree p by A4,C1,TREES_3:def 15;
        not <*i*> c= <*j*>^u by C5,TREES_1:50;
        then not xi c< n by Z1,C1,Lem8,XBOOLE_0:def java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 44
          byZ4C3,REES_1:def 9java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
      end;
      suppose
C4:     i = j;
        then reconsider u as Element of d with-replacement(w,t)
        by AA,C1,Z3,FUNCT_7:31;
        per cases by A2,A3,Z2,TREES_1:def 9;
        suppose u in d & not w c< u;
          then java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 7
          by Z1,Z2,A4,C1,C4,TREES_1:49,TREES_3:def 15;
          hence thesis by Z4,TREES_1:def 9;
        end
        suppose ex r being FinSequence of NAT st r in t & u = w^r;
          then consider r being FinSequence of NAT such that
C5:       r in t & u = w^r;
          n = xi^r by Z1,C1,C4,C5,FINSEQ_1:32;
          hence thesis by Z4,C5,TREES_1:def 9;
        end;
      end;
    end;
  end;

registration
  let F be Function-yielding Function;
  let f be Function;
  leta;
  cluster F+*(a,f) -> Function-yielding;
  coherence
  proof
    let b; assume b in dom(F+*(a,f));
    then
A1: b in dom F by FUNCT_7:30;
    per cases;
    suppose a = b;
      hence thesis by A1,FUNCT_7:31;
    endjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    suppose a <> b;
      then (F+*(a,f)).b = F.b by FUNCT_7:32;
      hence thesis;
    end;
  end;
end;

theorem Lem12:
  for F being Function-yielding Function, f being Function holds
  doms(F+*(a,f)) = (doms F)+*(a, dom f)
  proof
    let F be Function-yielding Function;
    let f be Function;
A1: dom doms(F+*(a,f)) = dom (F+*(a,f)) = dom F = dom doms F
    = dom((doms F)+*(a, dom f)) by FUNCT_6:def 2,FUNCT_7:30;
    hence dom doms(F+*(a,f)) = dom((doms F)+*(a, dom f));
    let b; assume
A2: b in dom doms(F+*(a,f));
    then
A3: doms(F+*(a,f)).b = dom ((F+*(a,f)).b) by A1,FUNCT_6:def 2;
    per cases;
    suppose
A4:   a = b;
      hence doms(F+*(a,f)).b = dom f by A1,A2,A3,FUNCT_7:31
      .= ((doms F)+*(a, dom f)).b by A1,A2,A4,FUNCT_7:31;
    end;
    suppose
A4:   a <> b;
      hence doms(F+*(a,f)).b = dom (F.b) by A3,FUNCT_7:32
      .= (doms F).b by A1,A2,FUNCT_6:def 2
      .= ((doms F)+*(a, dom f)).b by A4,FUNCT_7:32;
    end;
  end;

theorem Th123:
  for xi,w being FinSequence of NAT
  for p,q being DTree-yielding FinSequence
  for d,t being DecoratedTree
  st i < len p & xi = <*i*>^w & d = p.(i+1) &
     q = p+*(i+1,d with-replacement (w, t)) & xi in tree doms p
  holds (a-tree p) with-replacement (xi, t) = a-tree q
  proof
    let xi,w beA7: card1=1java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
    let p,be DTree- FinSequence;
    let d,t be DecoratedTree;
    assume Z0: i < len p;
    assume Z1: xi = <*i*>^w;
    assume Z2: d = p.(i+1);
     Z3 q =+(+,d with- (, t);
    assume Z4: xi in tree doms p;
A1: dom(a-tree p) = tree doms p & dom(a-tree q) = tree doms q by TREES_4:10;
AA: doms q = (doms p)+* 1 1in Segm by ORDINAL18;
    consider j being Nat, u being FinSequence such that
A2: j < len doms p & u in (doms p).(j+1) & xi = <*j*>^u
    by Z1,Z4,TREES_3:def 15;
A3: i = xi.1 = j & w = u by Z1,A2,FINSEQ_1:41,HILBERT2:2;
    1 <= i+1 <= len pA8 1  k  1<k & Segmc=Segmkby A7,A4,NAT_1:,ORDINAL1:java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
    then i+1 in dom p by FINSEQ_3:25;
    then
A4: w in dom d = (doms p).(i+1) by Z2,A2,A3,FUNCT_6:def 2;
    then dom(d with-replacement(w,t)) = dom d with-replacement(w,dom t)
    by TREES_2:def 11;
    then
A5: dom((a-tree p) with-replacement (xi, t))
    = (tree doms p) with-replacement (xi, dom t) = tree doms q
    by Z4,A1,AA     Segm(k +1) (k  1 +) byNAT_1:38;
    hence dom((a-tree p) with-replacement (xi, t)) = dom (a-tree q)
    by TREES_4:10;
A8:domdoms q =  q=  =dom doms pby ,FUNCT_6def 2FUNCT_730;
    then
A7: len doms q = len q = len p = len doms p by FINSEQ_3:29;
    let nu be Element of dom((a-tree p) with-replacement (xi, t));
    per cases by A5,TREES_3:def 15;
    suppose
A6:   nu = {};
      then not ex r being FinSequence of NAT st
      r in dom t & nu = xi^r & ((a-tree p) with-replacement (xi, t)).nu = t.r
      by Z1;
      hence ((a-tree    hence thesis by AA9,,Th25Th33;
      by Z4,A1,A5,TREES_2:def 11
      .= a by A6,TREES_4:def 4
      .= (a-tree q).u by A6,TREES_4:def 4;
    end;
    suppose ex j st ex r being FinSequence st j < len doms q &
      r in (doms q).(j+1 (xs of the of   incprojmapk,s)
      then consider j being Nat,r being FinSequence such that
A6:   j < len doms q & r in (doms q).(j+1) & nu = <*j*>^r;
AB:   1 <= j+1 <= len p by A6,A7,NAT_1:12,13;
      then
A9:   j+1 in dom p by FINSEQ_3:25;
      per cases;
      suppose
A10:    j <> i;
        then j+1 <> i+1; then
A11:    dom (q.(j+1)) = (doms q).(j+1) = (doms p).(j+1) = dom (p.(j+1)) &
        q.(j+1) = p.(j+1) by Z3,AA,A8,AB,FINSEQ_3:25,FUNCT_7:32,FUNCT_6:def 2;
        reconsider t1 = p.(j+1) as DecoratedTree by A9,TREES_3:24;
        not xi c= nu by A6,Z1,Lem8,A10,TREES_1:50;
        then not ex r being FinSequence of NAT st
        rin dom t &nu  xi^r&(a-treep) -eplacement xi t).u =t
        by TREES_1:1;
        hence ((a-tree p) with-replacement (xi, t)).nu = (a-tree p).nu
        by Z4,A1,A5,TREES_2:def 11
        .= t1. by A6,A7,A11,REES_4:12
        .= (a-tree q).nu by A6,A7,A11,TREES_4:12;
      end;
      suppose
A10:    j = i;
        then
A11:    dom (q.(j+1)) = (doms q).(j+1) & (doms p).(j+1) = dom (p.(j+1)) &
        q.j+1)   with-replacement(wt
        by Z3,A8,AB,FINSEQ_3:25,FUNCT_7:31,FUNCT_6:def 2;
        then reconsider r as Element of dom d with-replacement(w,dom t)
        byA6,,,A3A10,TREES_2:def ;
        per cases;
        suppose
A12:      w c= r;
          then consider r2 being FinSequence of NAT such that
A13:      r2 in dom t & r = w^r2 & (d with-replacement(w,t)).r = t.r2
          by Z2,A2,A3,A10,A11,TREES_2:def 11;
          xiA12: k,s)is ;
          then consider r3 being FinSequence of NAT such that
A15:      r3 in dom t & nu = xi^r3 & ((a-tree p) with-replacement(xi,t)).nu
          = t.r3 by Z4,A5,A1,TREES_2:def 11;
          nu = xi^r2 by Z1,A6,A10,A13,FINSEQ_1:32;
          then((a-tree p) with-replacement (i,t)).u =t.2
          by A15,FINSEQ_1:33;
          hence thesis by A13,A6,A7,A11,TREES_4:12;
        end;
        suppose
A12:      not w c= r;
          then
A13:      not ex r2 being FinSequence of NAT     proof
          r2 in dom t & r = w^r2 & (d with-replacement (w, t)).r = t.r2
          by TREES_1:1;
xr2 FinSequence  NAT st r2in dom t&r = ^r2
          by A12,TREES_1:1;
          then
A15:      r in dom d by Z2,A2,A3,A10,A11,TREES_1:def 9;
          not       let    ofG_(,)
          nu = xi^r & ((a-tree p) with-replacement (xi, t)).nu = t.r
          by A12,A10,A6,Z1,Lem8A,TREES_1:1;
          hence ((a-tree pA =incprojmapk,.  FL=incprojmap(ks.Lby A10;
          by Z4,A1,A5,TREES_2:def 11
          .= d.r by Z2,A15,A6,A7,A10,TREES_4:12
          .= (d with-replacement(w,t)).r by A13,A4,TREES_2:java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 24
          .= (a-tree q).nu by A6,A7,A11,TREES_4:12;
        end;
      end;
    end;  thesisby java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  end;

theorem
  for a being set, w being DTree-yielding FinSequence holds
  dom (a-tree w) = {{}} \/ union {<*i*>^^dom (w.(i+1)): i < len w}
  proof let a be set;
    let w be DTree-yielding FinSequence;
    set A = {<*i*>^^dom (w.(i+1)): i < len w};
    thus dom (a-tree w) c= {{}} \/ union A
    proof
      let b; reconsider x = b as set by TARSKI:1;
      assume b in dom (a-tree w);
      then per cases by TREES_4:11;
      suppose x = {};
        then x in {{}} by TARSKI:def 1;
        hence thesis by XBOOLE_0:def 3;
      end;
      suppose ex i st ex T being DecoratedTree, q being Node of T st
        i < len w & T = w.(i+1) & x = <*i*>^q;
        then consider i being Nat, T being DecoratedTree, q being Node of T
        such that
A1:     i < len w & T = w.(i+1) & x = <*i*>^q;
        x in <*i*>^^dom T & <*i*>^^dom T in A by A1;
        then x in union A by TARSKI:def 4;
        hence thesis by XBOOLE_0:def 3;
      end;
    end;
    let b; reconsider x = b as set by TARSKI:1;
    assume b in {{}} \/ union A;
    then per cases by XBOOLE_0:def 3;
    suppose x in {{}};
      then x = {};
      hence thesis by TREES_4:11;
    end;
    suppose x in union A;
      then consider I such that
A2:   x in I & I in A by TARSKI:def 4;
      consider i such that
A3:   I = <*i*>^^dom (w.(i+1)) & i < len w by A2;
      consider q being Element of dom (w.(i+1)) such that
A4:   x = <*i*>^q & q in dom (w.(i+1)) by A2,A3;
      1 <= i+1 <= len w by A3,NAT_1:11,13;
      then i+1 in dom w by FINSEQ_3:25;
      then w.(i+1) in rng w by FUNCT_1:def 3;
      then reconsider T = w.(i+1) as DecoratedTree;
      q in dom T;
      hence thesis by A3,A4,TREES_4:11;
    end;
  end;

registration
  let p be DTree-yielding FinSequence;
  let a,I;
  cluster (p.a)"I -> FinSequence-membered;
  coherence
  proof
    (p.a)"I c= dom (p.a) by RELAT_1:132;
    hence thesis;
  end;
end;

theorem Th1:
  for I being FinSequence-membered set, p being FinSequence holds
  card (p^^I) = card I
  proof
    let I be FinSequence-membered set;
    let p be FinSequence;
    deffunc F(Element of I) = p^ $1;
    consider f such that
A1: dom f = I & for q being Element of I st q in I holds f.q = F(q)
    from CLASSES1:sch 2;
A2: rng f = p^^I
    proof
      thus rng f c= p^^I
      proof let a; reconsider x = a as set by TARSKI:1;
        assume a in rng f;
        then consider b being object such that
A3:     b in dom f & x = f.b by FUNCT_1:def 3;
        reconsider b as Element of I by A1,A3;
        a = F(b) by A1,A3;
        hence thesis by A1,A3;
      end;
      let a; reconsider x = a as set by TARSKI:1;
      assume a in p^^I;
      then consider q being Element of I such that
A4:   a = p^q & q in I;
      x = f.q by A1,A4;
      hence thesis by A1,A4,FUNCT_1:def 3;
    end;
    f is one-to-one
    proof
      let a,b be object;
      assume
A5:   a in dom f & b in dom f;
      then reconsider a,b as Element of I by A1;
      f.a = p^a & f.b = p^b by A1,A5;
      hence thesis by FINSEQ_1:33;
    end;
    hence card (p^^I) = card I by A1,A2,CARD_1:70;
  end;

registration
  let I be finite FinSequence-membered set;
  let p be FinSequence;
  cluster p^^I -> finite;
  coherence
  proof
    card (p^^I) = card I by Th1;
    hence thesis;
  end;
end;

theorem Th2:
  for I,J being FinSequence-membered set, p,q being FinSequence
  st len p = len q & p <> q holds p^^I misses q^^J
  proof
    let I,J be FinSequence-membered set;
    let p,q be FinSequence;
    assume Z0: len p = len q;
    assume Z1: p <> q;
    assume p^^I meets q^^J;
    then consider a being object such that
A1: a in p^^I & a in q^^J by XBOOLE_0:3;
    consider p1 being Element of I such that
A2: a = p^p1 & p1 in I by A1;
    consider q1 being Element of J such that
A3: a = q^q1 & q1 in J by A1;
    dom p = Seg len p & dom q = Seg len q by FINSEQ_1:def 3;
    then p = (p^p1)|dom p = q by A2,A3,Z0,FINSEQ_1:21;
    hence thesis by Z1;
  end;

registration
  let i;
  reduce card i to i;
  reducibility;
  let j;
  identify i +` j with i+j;
  compatibility
  proof
    card i = i & card j = j & card(i+j) = i+j;
    hence thesis by CARD_2:38;
  end;
end;

scheme CardUnion {I(object) -> set, f() -> FinSequence of NAT}:
  card union {I(i): i < len f()} = Sum f()
  provided
A1: for i,j st i < len f() & j < len f() & i <> j holds I(i) misses I(j) and
A2: for i st i < len f() holds card I(i) = f().(i+1)
  proof
    set A = {I(i): i < len f()};
    defpred P[Nat] means
    $1 <= len f() implies for f being FinSequence of NAT st len f = $1 &
    for i st i < $1 holds card I(i) = f.(i+1)
    holds card union {I(i): i < $1} = Sum f;
A3: P[0]
    proof assume 0 <= len f();
      let f be FinSequence of NAT;
      assume len f = 0;
      then reconsider f as empty FinSequence of NAT;
      {I(i): i < 0} c= {}
      proof let a; assume a in {I(i): i < 0};
        then ex i st a = I(i) & i < 0;
        hence thesis;
      end;
      then {I(i): i < 0} = {} = union {} & Sum f = 0
      by ZFMISC_1:2,RVSUM_1:72;
      hence thesis;
    end;
A4: P[n] implies P[n+1]
    proof assume
A5:   P[n];
      assume
B0:   n+1 <= len f();
      then
B1:   n < len f() by NAT_1:13;
      let f be FinSequence of NAT; assume
A6:   len f = n+1 &
      for i st i < n+1 holds card I(i) = f.(i+1);
      then consider f1 being FinSequence of NAT, j being Element of NAT
      such that
A8:   f = f1^<*j*> by FINSEQ_2:19;
B5:   n < n+1 by NAT_1:13;
B6:   len f = len f1 + 1 by A8,FINSEQ_2:16;
B2:   for i st i < n holds card I(i) = f1.(i+1)
      proof let i; assume
D1:     i < n; then
        1 <= i+1 <= n by NAT_1:11,13;
        then i+1 in dom f1 by B6,A6,FINSEQ_3:25;
        then f.(i+1) = f1.(i+1) & i < n+1
        by D1,A8,NAT_1:13,FINSEQ_1:def 7;
        hence thesis by A6;
      end;
A7:   j = f.(n+1) = card I(n) by B6,B5,A6,A8,FINSEQ_1:42;
B3:   union {I(i) where i: i < n} misses I(n)
      proof
        assume union {I(i) where i: i < n} meets I(n);
        then consider a being object such that
C1:     a in union {I(i) where i: i < n} & a in I(n) by XBOOLE_0:3;
        consider J such that
C2:     a in J & J in {I(i) where i: i < n} by C1,TARSKI:def 4;
        consider i such that
C3:     J = I(i) & i < n by C2;
        i < len f() by B1,C3,XXREAL_0:2;
        hence thesis by A1,B1,C1,C2,C3,XBOOLE_0:3;
      end;
      {I(i) where i: i < n+1} = {I(i) where i: i < n} \/ {I(n)}
      proof
        thus {I(i) where i: i < n+1} c= {I(i) where i: i < n} \/ {I(n)}
        proof
          let a; assume a in {I(i) where i: i < n+1};
          then consider i such that
C4:       a = I(i) & i < n+1;
          i <= n by C4,NAT_1:13;
          then i < n or i = n by XXREAL_0:1;
          then a in {I(j) where j: j < n} or a in {I(n)} by C4,TARSKI:def 1;
          hence thesis by XBOOLE_0:def 3;
        end;
        let a;
        assume a in {I(i) where i: i < n} \/ {I(n)};
        then per cases by XBOOLE_0:def 3;
        suppose a in {I(i) where i: i < n};
          then consider i such that
C5:       a = I(i) & i < n;
          i < n+1 by NAT_1:13,C5;
          hence thesis by C5;
        end;
        suppose a in {I(n)};
          then a = I(n) by TARSKI:def 1;
          hence thesis by B5;
        end;
      end;
      then union {I(i) where i: i < n+1}
      = union {I(i) where i: i < n} \/ union {I(n)} by ZFMISC_1:78
      .= union {I(i) where i: i < n} \/ I(n);
      hence card union {I(i) where i: i < n+1}
      = card union {I(i) where i: i < n} +` card I(n) by B3,CARD_2:35
      .= Sum f1 +` j by A7,A5,B0,B2,B6,A6,NAT_1:13
      .= Sum f by A8,RVSUM_1:74;
    end;
    P[n] from NAT_1:sch 2(A3,A4);
    hence thesis by A2;
  end;

registration
  let f be FinSequence;
  cluster {f} -> FinSequence-membered;
  coherence
  proof
    let a; assume a in {f};
    hence thesis by TARSKI:def 1;
  end;
end;

theorem Th6:
  for f,g being FinSequence holds f^^{g} = {f^g}
  proof
    let f,g be FinSequence;
    thus f^^{g} c= {f^g}
    proof
      let a; assume a in f^^{g};
      then consider p being Element of {g} such that
A2:   a = f^p & p in {g};
      p = g by TARSKI:def 1;
      hence thesis by A2,TARSKI:def 1;
    end;
    let a; assume a in {f^g};
    then a = f^g & g in {g} by TARSKI:def 1;
    hence thesis;
  end;

theorem Th18:
  for I,J being FinSequence-membered set
  for f being FinSequence holds I c= J iff f^^I c= f^^J
  proof
    let I,J be FinSequence-membered set;
    let f be FinSequence;
    thus I c= J implies f^^I c= f^^J
    proof assume
A1:   I c= J;
      let a; assume a in f^^I;
      then ex b being Element of I st a = f^b & b in I;
      hence a in f^^J by A1;
    end;
    assume
A2: f^^I c= f^^J;
    let a; assume
A3: a in I;
    then reconsider a as FinSequence;
    f^a in f^^I by A3;
    then f^a in f^^J by A2;
    then consider b being Element of J such that
A4: f^a = f^b & b in J;
    thus thesis by A4,FINSEQ_1:33;
  end;

reserve c,c1,c2 for set, d,d1 for DecoratedTree;

theorem
  Leaves elementary_tree 0 = {{}} by TREES_1:29,HUFFMAN1:15;

registration
  sethood of Tree
  proof
    take bool (NAT*);
    let d be Tree;
    d c= NAT* by TREES_1:def 3;
    hence thesis;
  end;
end;

theorem ThL0:
  for p being non empty Tree-yielding FinSequence holds
  Leaves tree p = {<*i*>^q where i where q is FinSequence of NAT,
  d is Tree: q in Leaves d & i+1 in dom p & d = p.(i+1)}
  proof
    let p be non empty Tree-yielding FinSequence;
    set i0 = the Element of dom p;
    reconsider d0 = p.i0 as Tree by TREES_3:22;
    consider j such that
A0: i0 = 1+j by NAT_1:10,FINSEQ_3:25;
    i0 <= len p by FINSEQ_3:25;
    then
A3: j < len p & <*>NAT in d0 by A0,NAT_1:13,TREES_1:22;
A2: <*j*>^({} qua FinSequence) in tree p by A0,A3,TREES_3:def 15;
    thus Leaves tree p c= {<*i*>^q where i where q is FinSequence of NAT,
    d is Tree: q in Leaves d & i+1 in dom p & d = p.(i+1)}
    proof let a; reconsider x = a as set by TARSKI:1;
      assume
A1:   a in Leaves tree p; then reconsider x = a as Element of tree p;
      per cases by TREES_3:def 15;
      suppose x = {};
        then not {} is_a_proper_prefix_of <*j*> by A1,A2,TREES_1:def 5;
        hence thesis by XBOOLE_1:61;
      end;
      suppose
        ex i st ex q being FinSequence st i < len p & q in p.(i+1) &
        x = <*i*>^q;
        then consider i being Nat, q being FinSequence such that
A2:     i < len p & q in p.(i+1) & x = <*i*>^q;
        1 <= i+1 <= len p by A2,NAT_1:11,13;
        then
AB:     i+1 in dom p & p is Tree-yielding by FINSEQ_3:25;
        then p.(i+1) in rng p & rng p is constituted-Trees
        by FUNCT_1:def 3,TREES_3:def 9;
        then reconsider p1 = p.(i+1) as Tree;
        reconsider q0 = q as Element of p1 by A2;
        now assume
AA:       q0 nin Leaves p1;
          consider r being FinSequence of NAT such that
A3:       r in p1 & q0 is_a_proper_prefix_of r by AA,TREES_1:def 5;
          consider w being FinSequence such that
A5:       r = q^w by A3,XBOOLE_0:def 8,TREES_1:1;
          <*i*>^r = <*i*>^q^w by A5,FINSEQ_1:32;
          then <*i*>^q is_a_prefix_of <*i*>^r & <*i*>^q <> <*i*>^r
          by A3,FINSEQ_1:33,TREES_1:1;
          then x is_a_proper_prefix_of <*i*>^r & <*i*>^r in tree p
          by A2,A3,XBOOLE_0:def 8,TREES_3:def 15;
          hence contradiction by A1,TREES_1:def 5;
        end;
        hence thesis by A2,AB;
      end;
    end;
    let x be object; assume
    x in {<*i*>^q where i where q is FinSequence of NAT,
    d is Tree: q in Leaves d & i+1 in dom p & d = p.(i+1)};
    then consider i being Nat, q being FinSequence of NAT, d being Tree
    such that
B1: x = <*i*>^q & q in Leaves d & i+1 in dom p & d = p.(i+1);
    i+1 <= len p by B1,FINSEQ_3:25;
    then i < len p by NAT_1:13;
    then reconsider r = x as Element of tree p by B1,TREES_3:48;
    assume x nin Leaves tree p;
    then consider q0 being FinSequence of NAT such that
B4: q0 in tree p & r is_a_proper_prefix_of q0 by TREES_1:def 5;
    consider w being FinSequence such that
B6: q0 = <*i*>^q^w by B1,B4,XBOOLE_0:def 8,TREES_1:1;
B7: q0 = <*i*>^(q^w) by B6,FINSEQ_1:32;
    then
B9: q^w is FinSequence of NAT by FINSEQ_1:36;
    q^w in d & q is_a_proper_prefix_of q^w
    by B1,B4,B7,TREES_3:48,TREES_1:49;
    hence contradiction by B1,B9,TREES_1:def 5;
  end;

theorem
  Leaves root-tree c = {c}
  proof
    thus Leaves root-tree c = (root-tree c).:Leaves elementary_tree 0
    .= ({{}}-->c).:dom({{}}-->c) by TREES_1:29,HUFFMAN1:15
    .= rng ({{}}-->c) by RELAT_1:113 .= {c} by FUNCOP_1:8;
  end;

theorem
  dom d c= dom((d,c)<-d1) by TREES_4:def 7;

registration
  let c,d;
  reduce (root-tree c,c)<-d to d;
  reducibility
  proof
AA: dom((root-tree c,c)<-d) = dom d
    proof
      let x be FinSequence of NAT;
      hereby  assume
        x in dom((root-tree c,c)<-d);
        then reconsider p = x as Element of dom((root-tree c,c)<-d);
        per cases by TREES_4:def 7;
        suppose p in dom root-tree c;
          then p in elementary_tree 0;
          then p = {} by TREES_1:29;
          hence x in dom d by TREES_1:22;
        end;
        suppose
          ex q being Node of root-tree c, r being Node of d st
          q in Leaves dom root-tree c & (root-tree c).q = c & p = q^r;
          then consider q being Node of root-tree c, r being Node of d such
          that
A2:       q in Leaves dom root-tree c & (root-tree c).q = c & p = q^r;
          q in {{}} by TREES_1:29;
          then q = {};
          hence x in dom d by A2;
        end;
      end;
      assume x in dom d;
      then reconsider r = x as Node of d;
      reconsider q = {} as Node of root-tree c by TREES_1:22;
      q in Leaves dom root-tree c & (root-tree c).q = c & r = q^r
      by HUFFMAN1:15;
      hence x in dom((root-tree c,c)<-d) by TREES_4:def 7;
    end;
    now let x be object; assume x in dom d;
      then reconsider r = x as Node of d;
      reconsider q = {} as Node of root-tree c by TREES_1:22;
      q in Leaves dom root-tree c & (root-tree c).q = c & r = q^r
      by HUFFMAN1:15;
      hence ((root-tree c,c)<-d).x = d.x by TREES_4:def 7;
    end;
    hence thesis by AA,FUNCT_1:2;
  end;
end;

theorem ThL7:
  c1 <> c2 implies (root-tree c1,c2)<-d = root-tree c1
  proof
    assume
A0: c1 <> c2;
AA: dom ((root-tree c1,c2)<-d) = dom root-tree c1
    proof
      let x be FinSequence of NAT;
      hereby assume
        x in dom((root-tree c1,c2)<-d);
        then reconsider p = x as Element of dom((root-tree c1,c2)<-d);
        per cases by TREES_4:def 7;
        suppose p in dom root-tree c1;
          hence x in dom root-tree c1;
        end;
        suppose
          ex q being Node of root-tree c1, r being Node of d st
          q in Leaves dom root-tree c1 & (root-tree c1).q = c2 & p = q^r;
          then consider q being Node of root-tree c1, r being Node of d such
          that
A2:       q in Leaves dom root-tree c1 & (root-tree c1).q = c2 & p = q^r;
          thus x in dom root-tree c1 by A2,A0;
        end;
      end;
      assume x in dom root-tree c1;
      hence x in dom((root-tree c1,c2)<-d) by TREES_4:def 7;
    end;
    now let x be object;
      assume x in dom root-tree c1;
      then reconsider p = x as Node of root-tree c1;
      (root-tree c1).p = c1;
      hence ((root-tree c1,c2)<-d).x = (root-tree c1).x by A0,TREES_4:def 7;
    end;
    hence thesis by AA,FUNCT_1:2;
  end;

registration
  let f be non empty Function-yielding Function;
  cluster doms f -> non empty;
  coherence
  proof
    dom doms f = dom f <> {} by FUNCT_6:def 2;
    hence thesis;
  end;
  cluster rngs f -> non empty;
  coherence
  proof
    dom rngs f = dom f <> {} by FUNCT_6:def 3;
    hence thesis;
  end;
end;

theorem ThL8:
  for p,q being non empty DTree-yielding FinSequence st
  dom q = dom p & (for i,d1 st i in dom p & d1 = p.i holds q.i = (d1,c)<-d)
  holds (b-tree p,c)<-d = b-tree q
  proof
    let p,q be non empty DTree-yielding FinSequence such that
A1: dom q = dom p and
A2: for i,d1 st i in dom p & d1 = p.i holds q.i = (d1,c)<-d;
A3: dom(b-tree p) = tree doms p & dom (b-tree q) = tree doms q by TREES_4:10;
A4: Leaves tree doms p = {<*i*>^q where i where q is FinSequence of NAT,
    d is Tree: q in Leaves d & i+1 in dom doms p & d = (doms p).(i+1)} by ThL0;
A5: dom doms p = dom p & dom doms q = dom q by FUNCT_6:def 2; then
A6: len doms p = len p = len q = len doms q by A1,FINSEQ_3:29;
AA: dom ((b-tree p,c)<-d) = dom(b-tree q)
    proof
      let x be FinSequence of NAT;
      hereby assume x in dom ((b-tree p,c)<-d);
        then reconsider r = x as Node of (b-tree p,c)<-d;
        per cases by TREES_4:def 7;
        suppose r in dom (b-tree p);
          then per cases by A3,TREES_3:def 15;
          suppose r = {};
            hence x in dom(b-tree q) by TREES_1:22;
          end;
          suppose ex n being Nat,q being FinSequence st
            n < len doms p & q in (doms p).(n+1) & x = <*n*>^q;
            then consider n being Nat, w being FinSequence such that
A7:         n < len doms p & w in (doms p).(n+1) & x = <*n*>^w;
A9:         1 <= n+1 <= len doms p by A7,NAT_1:11,13;
            reconsider pn = p.(n+1) as DecoratedTree
            by A5,A9,FINSEQ_3:25,TREES_3:24;
            reconsider qn = q.(n+1) as DecoratedTree
            by A1,A9,A5,FINSEQ_3:25,TREES_3:24;
            qn = (pn,c)<-d by A2,A5,A9,FINSEQ_3:25;
            then (doms p).(n+1) = dom pn c= dom qn = (doms q).(n+1)
            by A1,A5,A9,TREES_4:def 7,FINSEQ_3:25,FUNCT_6:def 2;
            hence x in dom (b-tree q) by A3,A6,A7,TREES_3:def 15;
          end;
        end;
        suppose ex q being Node of b-tree p, s being Node of d st
          q in Leaves dom (b-tree p) & (b-tree p).q = c & r = q^s;
          then consider w being Node of b-tree p, s being Node of d such that
A8:       w in Leaves dom (b-tree p) & (b-tree p).w = c & r = w^s;
          consider i being Nat, u being FinSequence of NAT, d2 being Tree such
          that
A9:       w = <*i*>^u & u in Leaves d2 & i+1 in dom doms p &
          d2 = (doms p).(i+1) by A8,A3,A4;
          reconsider p1 = p.(i+1) as DecoratedTree by A5,A9,TREES_3:24;
B1:       w^s = <*i*>^(u^s) by A9,FINSEQ_1:32;
B2:       q.(i+1) = (p1,c)<-d by A2,A5,A9;
B3:       dom p1 = d2 by A5,A9,FUNCT_6:def 2;
          reconsider u as Node of p1 by A5,A9,FUNCT_6:def 2;
B6:       i+1 <= len doms p by A9,FINSEQ_3:25;
          then
B4:       i < len doms p by NAT_1:13;
          p1.u = c by B6,A6,A8,A9,NAT_1:13,TREES_4:12;
          then
B5:       u^s in dom((p1,c)<-d) = (doms q).(i+1)
          by B3,A1,A5,A9,B2,TREES_4:def 7,FUNCT_6:def 2;
          thus x in dom (b-tree q)
          by B1,B4,B5,A3,A6,A8,TREES_3:def 15;
        end;
      end;
      assume x in dom (b-tree q);
      then reconsider r = x as Node of b-tree q;
      per cases by A3,TREES_3:def 15;
      suppose r = {};
        hence x in dom((b-tree p,c)<-d) by TREES_1:22;
      end;
      suppose ex i st ex w being FinSequence st
        i < len doms q & w in (doms q).(i+1) & x = <*i*>^w;
        then consider n being Nat, w being FinSequence such that
C1:     n < len doms q & w in (doms q).(n+1) & x = <*n*>^w;
C4:     1 <= n+1 <= len doms q by C1,NAT_1:11,13;
        then
C2:     n+1 in dom doms q by FINSEQ_3:25;
        reconsider qi = q.(n+1) as DecoratedTree
        by C4,A5,FINSEQ_3:25,TREES_3:24;
        reconsider p1 = p.(n+1) as DecoratedTree
        by A1,A5,C4,FINSEQ_3:25,TREES_3:24;
C3:     dom qi = (doms q).(n+1) & dom p1 = (doms p).(n+1)
        by A1,A5,C4,FINSEQ_3:25,FUNCT_6:def 2;
        qi = (p1,c)<-d by C4,A1,A2,A5,FINSEQ_3:25;
        then per cases by C1,C3,TREES_4:def 7;
        suppose w in dom p1;
          then x in dom(b-tree p) c= dom((b-tree p,c)<-d)
          by A3,A6,C1,C3,TREES_4:def 7,TREES_3:def 15;
          hence x in dom((b-tree p,c)<-d);
        end;
        suppose ex u being Node of p1, s being Node of d st
          u in Leaves dom p1 & p1.u = c & w = u^s;
          then consider u being Node of p1, s being Node of d such that
C4:       u in Leaves dom p1 & p1.u = c & w = u^s;
C5:       <*n*>^u in Leaves tree doms p by A4,C4,A5,A1,C2,C3;
          (b-tree p).(<*n*>^u) = c by C1,A6,C4,TREES_4:12;
          then <*n*>^u^s in dom((b-tree p,c)<-d) by A3,C5,TREES_4:def 7;
          hence x in dom((b-tree p,c)<-d) by C1,C4,FINSEQ_1:32;
        end;
      end;
    end;
    now
      let x be object;
      assume x in dom (b-tree q);
      then reconsider r = x as Node of b-tree q;
      per cases by A3,TREES_3:def 15;
      suppose
C1:     r = {};
        reconsider r = {} as Node of b-tree p by TREES_1:22;
        not ex i being Nat, q being FinSequence of NAT, d being Tree st
        r = <*i*>^q & q in Leaves d & i+1 in dom doms p & d = (doms p).(i+1);
        then r nin Leaves dom (b-tree p) by A4,A3;
        hence ((b-tree p,c)<-d).x = (b-tree p).r  by C1,TREES_4:def 7
        .= b by TREES_4:def 4 .= (b-tree q).x by C1,TREES_4:def 4;
      end;
      suppose ex i st ex w being FinSequence st
        i < len doms q & w in (doms q).(i+1) & x = <*i*>^w;
        then consider n being Nat, w being FinSequence such that
C1:     n < len doms q & w in (doms q).(n+1) & x = <*n*>^w;
C5:     1 <= n+1 <= len doms q by C1,NAT_1:11,13;
        then
C2:     n+1 in dom doms q by FINSEQ_3:25;
        reconsider qi = q.(n+1) as DecoratedTree
        by C5,A5,FINSEQ_3:25,TREES_3:24;
        reconsider p1 = p.(n+1) as DecoratedTree
        by A1,A5,C5,FINSEQ_3:25,TREES_3:24;
C3:     dom qi = (doms q).(n+1) & dom p1 = (doms p).(n+1)
        by A1,A5,C5,FINSEQ_3:25,FUNCT_6:def 2;
C4:     qi = (p1,c)<-d by C5,A1,A2,A5,FINSEQ_3:25;
        then per cases by C1,C3,TREES_4:def 7;
        suppose
D1:       w in dom p1 & (w nin Leaves dom p1);
D4:       qi.w = p1.w & dom p1 c= dom qi by D1,C4,TREES_4:def 7;
D5:       x is Node of b-tree p by C1,A6,A3,C3,D1,TREES_3:def 15;
          now given i being Nat, q being FinSequence of NAT, d being Tree such
            that
D2:         r = <*i*>^q & q in Leaves d & i+1 in dom doms p &
            d = (doms p).(i+1);
            i = r.1 = n & q = w by C1,D2,FINSEQ_1:41,HILBERT2:2;
            hence contradiction by D1,A5,D2,FUNCT_6:def 2;
          end;
          then r nin Leaves dom (b-tree p) by A4,A3;
          hence ((b-tree p,c)<-d).x = (b-tree p).r  by D5,TREES_4:def 7
          .= p1.w by C1,A6,D1,TREES_4:12
          .= (b-tree q).x by C1,A6,D1,D4,TREES_4:12;
        end;
        suppose
D1:       w in dom p1 & (p1.w <> c);
D4:       qi.w = p1.w & dom p1 c= dom qi by D1,C4,TREES_4:def 7;
D5:       x is Node of b-tree p by C1,A6,A3,C3,D1,TREES_3:def 15;
          (b-tree p).r <> c by C1,A6,D1,TREES_4:12;
          hence ((b-tree p,c)<-d).x = (b-tree p).r  by D5,TREES_4:def 7
          .= p1.w by C1,A6,D1,TREES_4:12
          .= (b-tree q).x by C1,A6,D1,D4,TREES_4:12;
        end;
        suppose
C7:       w in dom p1 & w in Leaves dom p1 & p1.w = c;
          then reconsider u = w as Node of p1;
          reconsider s = {} as Node of d by TREES_1:22;
C71:      w = u^s;
C5:       <*n*>^u in Leaves tree doms p by A4,C7,A5,A1,C2,C3;
C6:       (b-tree p).(<*n*>^u) = c by C1,A6,C7,TREES_4:12;
          ((b-tree p,c)<-d).(<*n*>^u^s) = d.s by A3,C5,C6,TREES_4:def 7
          .= qi.w by C4,C7,C71,TREES_4:def 7
          .= (b-tree q).x by C1,A6,C3,TREES_4:12;
          hence ((b-tree p,c)<-d).x = (b-tree q).x by C1;
        end;
        suppose ex u being Node of p1, s being Node of d st
          u in Leaves dom p1 & p1.u = c & w = u^s;
          then consider u being Node of p1, s being Node of d such that
C7:       u in Leaves dom p1 & p1.u = c & w = u^s;
C5:       <*n*>^u in Leaves tree doms p by A4,C7,A5,A1,C2,C3;
C6:       (b-tree p).(<*n*>^u) = c by C1,A6,C7,TREES_4:12;
          ((b-tree p,c)<-d).(<*n*>^u^s) = d.s by A3,C5,C6,TREES_4:def 7
          .= qi.w by C4,C7,TREES_4:def 7
          .= (b-tree q).x by C1,A6,C3,TREES_4:12;
          hence ((b-tree p,c)<-d).x = (b-tree q).x by C1,C7,FINSEQ_1:32;
        end;
      end;
    end;
    hence thesis by AA,FUNCT_1:2;
  end;

definition
  let S,s;
  let A be non empty MSAlgebra over S;
  let a be Element of A;
  attr a is s-sort means: AS:
  a in (the Sorts of A).s;
end;

registration
  let S,s;
  let A be non-empty MSAlgebra over S;
  cluster s-sort for Element of A;
  existence
  proof
    set a = the Element of (the Sorts of A).s;
    take a;
    thus a in (the Sorts of A).s;
  end;
  cluster -> s-sort for Element of (the Sorts of A).s;
  coherence;
end;

definition
  let S;
  let A be non empty MSAlgebra over S such that
A: A is disjoint_valued;
  let a be Element of A;
  func the_sort_of a -> SortSymbol of S means: SORT:
  a in (the Sorts of A).it;
  existence
  proof
    consider I being object such that
A1: I in dom the Sorts of A & a in (the Sorts of A).I by CARD_5:2;
    reconsider I as SortSymbol of S by A1;
    take I; thus thesis by A1;
  end;
  uniqueness by A,XBOOLE_0:3,PROB_2:def 2;
end;

theorem
  for A being disjoint_valued non-empty MSAlgebra over S
  for a being s-sort Element of A
  holds the_sort_of a = s
  proof
    let A be disjoint_valued non-empty MSAlgebra over S;
    let a be s-sort Element of A;
    a in (the Sorts of A).s by AS;
    hence the_sort_of a = s by SORT;
  end;

theorem
  for A being disjoint_valued non empty MSAlgebra over S
  for a being Element of A
  holds a is (the_sort_of a)-sort by SORT;

theorem Lem00:
  the_sort_of @r = the_sort_of r
  proof
    the Sorts of T is MSSubset of Free(S,X) by MSAFREE4:def 6;
    then @r in (the Sorts of T).the_sort_of r
    c= (the Sorts of Free(S,X)).the_sort_of r by SORT,PBOOLE:def 2,def 18;
    hence thesis by SORT;
  end;

theorem
  for r being Element of (the Sorts of T).s holds the_sort_of r = s by SORT;

theorem Th5:
  for u being Term of S,X st t = u holds the_sort_of t = the_sort_of u
  proof let u be Term of S,X;
    assume t = u;
    then t in FreeSort(X, the_sort_of u) by MSATERM:def 5;
    then t in (the Sorts of FreeMSA X).the_sort_of u by MSAFREE:def 11;
    then t in (the Sorts of Free(S,X)).the_sort_of u by MSAFREE3:31;
    hence thesis by SORT;
  end;

registration
  let S,X,o,T;
  cluster -> (Union the Sorts of T)-valued for Element of Args(o,T);
  coherence
  proof let w be Element of Args(o,T);
    let a; reconsider b = a as set by TARSKI:1;
    assume a in rng w;
    then consider i being object such that
A1: i in dom w & b = w.i by FUNCT_1:def 3;
    reconsider i as Nat by A1;
    dom w = dom the_arity_of o by MSUALG_6:2;
    then a is Element of (the Sorts of T).((the_arity_of o)/.i)
    by A1,MSUALG_6:2;
    hence thesis;
  end;
end;

theorem Th4A:
  for q being Element of Args(o,T) holds
  i in dom q implies the_sort_of (q/.i) = (the_arity_of o)/.i
  proof
    let q be Element of Args(o,T);
    assume Z0: i in dom q;
    then i in dom the_arity_of o by MSUALG_3:6;
    then q/.i = q.i in (the Sorts of T).((the_arity_of o)/.i)
    by Z0,PARTFUN1:def 6,MSUALG_6:2;
    hence the_sort_of (q/.i) = (the_arity_of o)/.i by SORT;
  end;

definition
  let S;
  let A,B be non-empty MSAlgebra over S;
  let f be ManySortedFunction of A,B such that
A: A is disjoint_valued;
  let a be Element of A;
  func f.a -> Element of B equals: ABBR: f.(the_sort_of a).a;
  coherence
  proof
    a in (the Sorts of A).the_sort_of a by A,SORT;
    then f.(the_sort_of a).a is Element of (the Sorts of B).the_sort_of a
    by FUNCT_2:5;
    hence thesis;
  end;
end;

theorem Th9:
  for A being disjoint_valued non-empty MSAlgebra over S
  for B being non-empty MSAlgebra over S
  for f being ManySortedFunction of A,B
  for a being Element of (the Sorts of A).s holds f.a = f.s.a
  proof
    let A be disjoint_valued non-empty MSAlgebra over S;
    let B be non-empty MSAlgebra over S;
    let f be ManySortedFunction of A,B;
    let a be Element of (the Sorts of A).s;
    thus f.a = f.(the_sort_of a).a  by ABBR .= f.s.a  by SORT;
  end;

theorem
  for A being disjoint_valued non-empty MSAlgebra over S
  for B being non-empty MSAlgebra over S
  for f being ManySortedFunction of A,B
  for a being Element of (the Sorts of A).s holds
  f.a is Element of (the Sorts of B).s
  proof
    let A be disjoint_valued non-empty MSAlgebra over S;
    let B be non-empty MSAlgebra over S;
    let f be ManySortedFunction of A,B;
    let a be Element of (the Sorts of A).s;
    f.a = f.s.a in (the Sorts of B).s by Th9,FUNCT_2:5;
    hence thesis;
  end;

theorem Lem0:
  for A,B being disjoint_valued non-empty MSAlgebra over S
  for f being ManySortedFunction of A,B
  for a being Element of A holds
  the_sort_of (f.a) = the_sort_of a
  proof
    let A,B be disjoint_valued non-empty MSAlgebra over S;
    let f be ManySortedFunction of A,B;
    let a be Element of A;
    a in (the Sorts of A).the_sort_of a by SORT;
    then f.a = f.(the_sort_of a).a in (the Sorts of B).the_sort_of a
    by ABBR,FUNCT_2:5;
    hence the_sort_of (f.a) = the_sort_of a by SORT;
  end;

theorem Th14:
  for A,B being disjoint_valued non-empty MSAlgebra over S
  for C being non-empty MSAlgebra over S
  for f being ManySortedFunction of A,B
  for g being ManySortedFunction of B,C
  for a being Element of A
  holds (g**f).a = g.(f.a)
  proof
    let A,B be disjoint_valued non-empty MSAlgebra over S;
    let C be non-empty MSAlgebra over S;
    let f be ManySortedFunction of A,B;
    let g be ManySortedFunction of B,C;
    let a be Element of A;
A1: a in (the Sorts of A).the_sort_of a &
    f.(the_sort_of a) is Function of (the Sorts of A).(the_sort_of a),
    (the Sorts of B).(the_sort_of a) by SORT;
    thus (g**f).a = (g**f).(the_sort_of a).a by ABBR
    .= ((g.the_sort_of a)*(f.(the_sort_of a))).a by MSUALG_3:2
    .= (g.the_sort_of a).(f.(the_sort_of a).a) by A1,FUNCT_2:15
    .= (g.the_sort_of (f.a)).(f.(the_sort_of a).a) by Lem0
    .= (g.the_sort_of (f.a)).(f.a) by ABBR
    .= g.(f.a) by ABBR;
  end;

theorem
  for A being disjoint_valued non-empty MSAlgebra over S
  for B being non-empty MSAlgebra over S
  for f1,f2 being ManySortedFunction of A,B st
    for a being Element of A holds f1.a = f2.a
    holds f1 = f2
  proof
    let A be disjoint_valued non-empty MSAlgebra over S;
    let B be non-empty MSAlgebra over S;
    let f1,f2 be ManySortedFunction of A,B;
    assume Z0: for a being Element of A holds f1.a = f2.a;
    let s;
    now
      thus f1.s is Function of (the Sorts of A).s, (the Sorts of B).s &
      f2.s is Function of (the Sorts of A).s, (the Sorts of B).s;
      let a be Element of (the Sorts of A).s;
      thus f1.s.a = f1.a by Th9 .= f2.a by Z0 .= f2.s.a by Th9;
    end;
    hence thesis by FUNCT_2:def 8;
  end;

definition
  let S;
  let A,B be MSAlgebra over S such that
A: ex h being ManySortedFunction of A,B st h is_homomorphism A,B;
  mode Homomorphism of A,B -> ManySortedFunction of A,B means: HOMO:
  it is_homomorphism A,B;
  existence by A;
end;

theorem
  for h being ManySortedFunction of Free(S,X), T holds
  h is Homomorphism of Free(S,X),T iff h is_homomorphism Free(S,X), T
  proof
    let h be ManySortedFunction of Free(S,X), T;
    canonical_homomorphism T is_homomorphism Free(S,X), T by MSAFREE4:def 10;
    hence thesis by HOMO;
  end;

definition
  let S,X,T;
  redefine func canonical_homomorphism T -> Homomorphism of Free(S,X), T;
  coherence
  proof
    canonical_homomorphism T is_homomorphism Free(S,X), T by MSAFREE4:def 10;
    hence thesis by HOMO;
  end;
end;

registration
  let S,X,T,r;
  reduce (canonical_homomorphism T).@r to r;
  reducibility
  proof
    the_sort_of @r = the_sort_of r by Lem00;
    then r in (the Sorts of T).the_sort_of @r by SORT;
    then (canonical_homomorphism T).(the_sort_of @r).@r = r by MSAFREE4:47;
    hence thesis by ABBR;
  end;
end;

theorem
  for t1,t2 st t2 = (canonical_homomorphism T).t1 holds
  (canonical_homomorphism T).t1 = (canonical_homomorphism T).t2
  proof set H = canonical_homomorphism T;
    let t1,t2;
    assume Z0: t2 = H.t1;
    reconsider t = t1 as Element of (the Sorts of Free(S,X)).the_sort_of t1
    by SORT;
A1: the_sort_of @(H.t1) = the_sort_of (H.t1) &
    H.the_sort_of t1 is Function of (the Sorts of Free(S,X)).the_sort_of t1,
    (the Sorts of T).the_sort_of t1 by Lem00;
A2: dom(H**H) = (dom H)/\dom H = dom H = the carrier of S
    by PARTFUN1:def 2,PBOOLE:def 19;
    H**H = H by MSAFREE4:48;
    hence H.t1 = (H**H).(the_sort_of t1).t1 by ABBR
    .= ((H.the_sort_of t1)*(H.the_sort_of t1)).t by A2,PBOOLE:def 19
    .= (H.the_sort_of t1).((H.the_sort_of t1).t1) by FUNCT_2:15
    .= (H.the_sort_of t1).(H.t1) by ABBR
    .= (H.the_sort_of t2).(H.t1) by Z0,A1,Lem0
    .= H.t2 by Z0,ABBR;
  end;

begin :: Constructing terms

reserve
  w for (Element of Args(o,T)),
  p,p1 for Element of Args(o,Free(S,X));

definition
  let S,X,s,x;
  func x-term -> Element of (the Sorts of Free(S,X)).s equals root-tree [x,s];
  coherence
  proof
    reconsider t = root-tree [x,s] as Term of S,X by MSATERM:4;
    the_sort_of t = s by MSATERM:14;
    then t is Element of (the Sorts of FreeMSA X).s by MSAFREE3:7;
    hence thesis by MSAFREE3:31;
  end;
end;

definition
  let S,X,o,p;
  func o-term p -> Element of Free(S,X), the_result_sort_of o equals
  [o,the carrier of S]-tree p;
  coherence
  proof
A1: Free(S,X) = FreeMSA X = MSAlgebra(#FreeSort X, FreeOper X#)
    by MSAFREE3:31;
    then
A2: p is ArgumentSeq of Sym(o,X) by INSTALG1:1;
    then reconsider t = Sym(o,X)-tree p as Term of S,X by MSATERM:1;
    the_sort_of t = the_result_sort_of o by A2,MSATERM:20;
    then t in FreeSort (X, the_result_sort_of o) by MSATERM:def 5;
    hence thesis by A1,MSAFREE:def 11;
  end;
end;

theorem
  the_sort_of (x-term) = s by SORT;

theorem Th8:
  the_sort_of (o-term p) = the_result_sort_of o
  proof
    reconsider t = o-term p as Term of S,X by MSAFREE4:42;
    [o,the carrier of S] = t.{} by TREES_4:def 4;
    then the_sort_of t = the_result_sort_of o by MSATERM:17;
    hence thesis by Th5;
  end;

theorem Th119:
  for i being object holds i in (FreeGen T).s iff ex x st i = x-term
  proof let i be object;
A3: (FreeGen T).s = FreeGen(s,X) & i is set by TARSKI:1,MSAFREE:def 16;
    hereby assume i in (FreeGen T).s;
      then consider x being set such that
A2:   x in X.s & i = root-tree[x,s] by A3,MSAFREE:def 15;
      reconsider x as Element of X.s by A2;
      take x; thus i = x-term by A2;
    end;
    thus thesis by A3,MSAFREE:def 15;
  end;

registration
  let S,X,s,x;
  cluster x-term -> non compound;
  coherence
  proof
    set t = x-term;
    s in the carrier of S; then s <> the carrier of S;
    then t.{} = [x,s] & s nin {the carrier of S} by TARSKI:def 1,TREES_4:3;
    hence t.{} nin [:the carrier' of S, {the carrier of S}:] by ZFMISC_1:87;
  end;
end;

registration
  let S,X,o,p;
  cluster o-term p -> compound (the_result_sort_of o)-sort;
  coherence
  proof
    set t = o-term p;
    t.{} = [o,the carrier of S] & the carrier of S in {the carrier of S}
    by TARSKI:def 1,TREES_4:def 4;
    hence t.{} in [:the carrier' of S, {the carrier of S}:] by ZFMISC_1:87;
    thus thesis;
  end;
end;

theorem Th16:
  (ex s,x st t = x-term) or ex o,p st t = o-term p
  proof
    reconsider u = t as Term of S,X by MSAFREE4:42;
    per cases by MSATERM:2;
    suppose ex s, x st u.{} = [x,s];
      then consider s,x such that
A0:   u.{} = [x,s];
      u = root-tree [x,s] = x-term by A0,MSATERM:5;
      hence thesis;
    end;
    suppose u.{} in [:the carrier' of S,{the carrier of S}:];
      then consider a,b being object such that
A1:   a in the carrier' of S & b in {the carrier of S} & u.{} = [a,b]
      by ZFMISC_1:def 2;
      reconsider a as OperSymbol of S by A1;
      b = the carrier of S by A1,TARSKI:def 1;
      then consider p being ArgumentSeq of Sym(a,X) such that
A2:   u = [a,the carrier of S]-tree p by A1,MSATERM:10;
      Free(S,X) = FreeMSA X by MSAFREE3:31;
      then reconsider p as Element of Args(a,Free(S,X)) by INSTALG1:1;
      u = a-term p by A2;
      hence thesis;
    end;
  end;

theorem
  t is not compound implies ex s,x st t = x-term
  proof reconsider d = t as Term of S,X by MSAFREE4:42;
    assume t.{} nin [:the carrier' of S, {the carrier of S}:];
    then consider s,x such that
A1: d.{} = [x,s] by MSATERM:2;
    take s,x;
    thus thesis by A1,MSATERM:5;
  end;

theorem Th17:
  t is compound implies ex o,p st t = o-term p
  proof reconsider d = t as Term of S,X by MSAFREE4:42;
    assume t.{} in [:the carrier' of S, {the carrier of S}:];
    then consider a,b being object such that
A1: a in the carrier' of S & b in {the carrier of S} & d.{} = [a,b]
    by ZFMISC_1:def 2;
    reconsider a as OperSymbol of S by A1;
    b = the carrier of S by A1,TARSKI:def 1;
    then consider p being ArgumentSeq of Sym(a,X) such that
A2: d = [a, the carrier of S]-tree p by A1,MSATERM:10;
    Free(S,X) = FreeMSA X by MSAFREE3:31;
    then reconsider p as Element of Args(a,Free(S,X)) by INSTALG1:1;
    take a,p;
    thus thesis by A2;
  end;

theorem
  x-term <> o-term p;

registration
  let S;
  let X be non-empty ManySortedSet of the carrier of S;
  cluster compound for Element of Free(S,X);
  existence
  proof
    set o = the OperSymbol of S;
    set p = the Element of Args(o,Free(S,X));
    take o-term p;
    thus thesis;
  end;
end;

definition
  let S,X;
  let e be compound Element of Free(S,X);
  redefine func main-constr e -> OperSymbol of S;
  coherence
  proof
    consider o,p such that
A1: e = o-term p by Th17;
    e.{} = [o, the carrier of S] & main-constr e = (e.{})`1
    by A1,TREES_4:def 4,ABCMIZ_A:def 9;
    hence thesis;
  end;
end;

definition
  let S,X;
  let e be compound Element of Free(S,X);
  redefine func args e -> Element of Args(main-constr e, Free(S, X));
  coherence
  proof
    consider o,p such that
A1: e = o-term p by Th17;
    [o,the carrier of S]-tree p = e = (e.{})-tree args e
    by A1,ABCMIZ_A:def 10;
    then args e = p & [o, the carrier of S]`1 = (e.{})`1 = main-constr e
    by TREES_4:15,ABCMIZ_A:def 9;
    hence thesis;
  end;
end;

theorem
  args (x-term) = {}
  proof
    (x-term).{} = [x,s] & x-term = [x,s]-tree {} by TREES_4:3,20;
    hence thesis by ABCMIZ_A:def 10;
  end;

theorem
  for t being compound Element of Free(S,X) holds
  t = (main-constr t)-term args t
  proof let t be compound Element of Free(S,X);
    consider o,p such that
A1: t = o-term p by Th17;
    [o,the carrier of S]-tree p = t = (t.{})-tree args t
    by A1,ABCMIZ_A:def 10;
    then args t = p & [o, the carrier of S]`1 = (t.{})`1 = main-constr t
    by TREES_4:15,ABCMIZ_A:def 9;
    hence thesis by A1;
  end;

theorem Th24:
  x-term in T
  proof
    x-term in FreeGen(s,X) = (FreeGen T).s c= (the Sorts of T).s
    by PBOOLE:def 2,def 18,MSAFREE:def 15,def 16;
    then x-term is Element of (the Sorts of T).s;
    hence x-term in Union the Sorts of T;
  end;

registration
  let S,X,T,s,x;
  reduce (canonical_homomorphism T).(x-term) to x-term;
  reducibility
  proof
    x-term in T by Th24;
    then reconsider xt = x-term as Element of T;
    the_sort_of xt = the_sort_of @xt by Lem00;
    hence (canonical_homomorphism T).(x-term) = x-term;
  end;
end;

scheme TermInd{P[set], S() -> non empty non void ManySortedSign,
  X() -> non-empty ManySortedSet of the carrier of S(),
  t() -> Element of Free(S(),X())}:
  P[t()]
  provided
A1: for s being SortSymbol of S(), x being Element of X().s holds P[x-term] and
A2: for o being OperSymbol of S(), p being Element of Args(o,Free(S(),X())) st
      for t being Element of Free(S(),X()) st t in rng p holds P[t]
    holds P[o-term p]
proof
AA: t() is Term of S(),X() by MSAFREE4:42;
A3: now let s be SortSymbol of S(), x be Element of X().s;
      P[x-term] by A1;
      hence P[root-tree [x,s]];
    end;
A4: now
      let o be OperSymbol of S(), p be ArgumentSeq of Sym(o,X());
      Free(S(),X()) = FreeMSA X() by MSAFREE3:31;
      then reconsider q = p as Element of Args(o,Free(S(),X())) by INSTALG1:1;
      assume
A5:   for t being Term of S(),X() st t in rng p holds P[t];
      now let u be Element of Free(S(),X());
        u is Term of S(),X() by MSAFREE4:42;
        hence u in rng q implies P[u] by A5;
      end;
      then P[o-term q] by A2;
      hence P[[o,the carrier of S()]-tree p];
    end;
    for t being Term of S(),X() holds P[t] from MSATERM:sch 1(A3,A4);
    hence thesis by AA;
end;

scheme TermAlgebraInd{P[set], S() -> non empty non void ManySortedSign,
  X() -> non-empty ManySortedSet of the carrier of S(),
  A() -> all_vars_including inheriting_operations free_in_itself
  (X(),S())-terms MSAlgebra over S(),
  t() -> Element of A()}:
  P[t()]
  provided
A1: for s being SortSymbol of S(), x being Element of X().s
    for r being Element of A() st r = x-term holds P[r] and
A2: for o being OperSymbol of S(), p being Element of Args(o,Free(S(),X()))
    for r being Element of A() st r = o-term p &
      for t being Element of A() st t in rng p holds P[t]
    holds P[r]
proof
  defpred Q[set] means $1 in A() implies P[$1];
A3: now let s be SortSymbol of S(); let x be Element of X().s;
      x-term in A() by Th24;
      hence Q[x-term] by A1;
    end;
A4: now let o be OperSymbol of S(), p be Element of Args(o,Free(S(),X()));
      assume
A5:   for t being Element of Free(S(),X()) st t in rng p holds Q[t];
      thus Q[o-term p]
      proof assume
A7:     o-term p in A();
        now let t be Element of A();
          assume
AA:       t in rng p;
          t in A() & Q[@t] by A5,AA;
          hence P[t];
        end;
        hence P[o-term p] by A2,A7;
      end;
    end;
    Q[@t()] from TermInd(A3,A4);
    hence thesis by ELEM;
end;

begin :: Construction Degree

definition
  let S,X,T,r;
  func construction_degree r -> Nat equals
  card (r"[:the carrier' of S, {the carrier of S}:]);
  coherence;
  func height r -> Nat equals height dom r;
  coherence;
end;

notation
  let S,X,T,r;
  synonym deg r for construction_degree r;
end;

theorem deg @r = deg r;

theorem height @r = height r;

theorem
  height (x-term) = 0 by TREES_1:42;

registration
  cluster natural-membered -> ordinal-membered finite-membered for set;
  coherence
  proof
    let I; assume
A1: for a st a in I holds a is natural;
    now
      let J; assume J in I;
      then J is natural by A1;
      hence J is ordinal;
    end;
    hence I is ordinal-membered by ORDINAL6:1;
    let J; assume J in I;
    then J is natural by A1;
    hence thesis;
  end;
end;

registration
  let I be finite natural-membered set;
  cluster union I -> natural;
  coherence;
end;

registration
  let I be non empty finite natural-membered set;
  identify max I with union I;
  compatibility
  proof
A1: for x,y being set st x in I & y in I holds x c= y or y c= x
    by XBOOLE_0:def 9,ORDINAL1:15;
    now let x be ext-real object;
      assume
A3:   x in I;
      then reconsider a = x as Nat;
      Segm a = x & Segm union I = union I;
      hence x <= union I by A3,ZFMISC_1:74,NAT_1:39;
    end;
    hence thesis by A1,XXREAL_2:def 8,CARD_2:62;
  end;
end;

theorem Th25:
  for S,X,o,p holds {height t1: t1 in rng p} is natural-membered finite &
  union {height t: t in rng p} is Nat
  proof let S,X,o,p;
    set I = {height t: t in rng p};
    thus
A2: I is natural-membered
    proof
      let a; assume a in I;
      then ex t1 st a = height t1 & t1 in rng p;
      hence thesis;
    end;
    deffunc F(Element of Free(S,X)) = height $1;
A3: rng p is finite;
    thus {F(t1): t1 in rng p} is finite from FRAENKEL:sch 21(A3);
    then reconsider I as finite natural-membered set by A2;
    union I is Nat;
    hence thesis;
  end;

theorem Th26:
  the_arity_of o <> {} & n = union {height t1: t1 in rng p}
  implies height (o-term p) = n+1
  proof set I = {height t1: t1 in rng p};
    assume
A1: the_arity_of o <> {} & n = union I;
    set i0 = the Element of dom p;
A4: dom p = dom the_arity_of o by MSUALG_6:2;
    reconsider i0 as Nat;
    reconsider t0 = p.i0 as Element of
    (the Sorts of Free(S,X)).((the_arity_of o)/.i0) by A4,A1,MSUALG_6:2;
    t0 in rng p by A4,A1,FUNCT_1:def 3;
    then
A5: height t0 in I;
A2: I is natural-membered
    proof
      let a; assume a in I;
      then ex t1 st a = height t1 & t1 in rng p;
      hence thesis;
    end;
    deffunc F(Element of Free(S,X)) = height $1;
A3: rng p is finite;
    {F(t1): t1 in rng p} is finite from FRAENKEL:sch 21(A3);
    then reconsider I as non empty finite natural-membered set by A2,A5;
    n = max I in I by A1,XXREAL_2:def 8;
    then consider t1 such that
A7: max I = height t1 & t1 in rng p;
    consider a being FinSequence of NAT such that
A8: a in dom t1 & len a = max I by A7,TREES_1:def 12;
    consider i1 being object such that
A9: i1 in dom p & t1 = p.i1 by A7,FUNCT_1:def 3;
    reconsider i1 as Nat by A9;
    consider i such that
A10:i1 = 1+i by NAT_1:10,A9,FINSEQ_3:25;
    i1 <= len p by A9,FINSEQ_3:25;
    then
A11:<*i*>^a in dom (o-term p) by A8,A9,A10,NAT_1:13,TREES_4:11;
A12:len(<*i*>^a) = 1+n by A1,A8,FINSEQ_5:8;
    now let q be FinSequence of NAT;
      assume q in dom (o-term p);
      then per cases by TREES_4:11;
      suppose q = {};
        hence len q <= n+1;
      end;
      suppose ex i being Nat, T being DecoratedTree, w being Node of T st
        i < len p & T = p.(i+1) & q = <*i*>^w;
        then consider i being Nat, t being DecoratedTree, w being Node of t
        such that
B1:     i < len p & t = p.(i+1) & q = <*i*>^w;
B0:     1 <= i+1 <= len p by B1,NAT_1:12,13;
        then
B2:     i+1 in dom p by FINSEQ_3:25;
        reconsider t as Element of
        (the Sorts of Free(S,X)).((the_arity_of o)/.(i+1))
        by B0,B1,A4,MSUALG_6:2,FINSEQ_3:25;
        t in rng p by B2,B1,FUNCT_1:def 3;
        then height t in I;
        then len w <= height t <= max I by XXREAL_2:def 8,TREES_1:def 12;
        then len w <= n by A1,XXREAL_0:2;
        then 1+len w <= n+1 by XREAL_1:6;
        hence len q <= n+1 by B1,FINSEQ_5:8;
      end;
    end;
    hence thesis by A12,A11,TREES_1:def 12;
  end;

theorem Th20:
  the_arity_of o = {} implies height (o-term p) = 0
  proof
    assume the_arity_of o = {};
    then dom p = dom {} by MSUALG_3:6;
    then p = {};
    then o-term p = root-tree [o,the carrier of S] by TREES_4:20;
    hence thesis by TREES_1:42;
  end;

theorem Th21:
  deg (x-term) = 0
  proof set t = x-term;
    assume deg t <> 0;
    then t"[:the carrier' of S,{the carrier of S}:] is not empty;
    then consider a being object such that
A1: a in t"[:the carrier' of S,{the carrier of S}:] by XBOOLE_0:7;
    reconsider ta = t.a as set;
A4: ta in [:the carrier' of S,{the carrier of S}:] & a in dom t
    by A1,FUNCT_1:def 7;
    ta in rng t = {[x,s]} by A4,FUNCT_1:def 3,FUNCOP_1:8;
    then ta = [x,s] by TARSKI:def 1;
    then s in the carrier of S = s by A4,ZFMISC_1:106;
    hence contradiction;
  end;

theorem Th22:
  deg t <> 0 iff ex o,p st t = o-term p
  proof
    defpred P[Element of Free(S,X)] means
    deg $1 <> 0 iff ex o,p st $1 = o-term p;
A1: P[x-term] by Th21;
A2: now
      let o,p; assume for t st t in rng p holds P[t];
      [o,the carrier of S] in [:the carrier' of S, {the carrier of S}:] &
      {} in dom (o-term p) & (o-term p).{} = [o,the carrier of S]
      by TREES_1:22,ZFMISC_1:106,TREES_4:def 4;
      then {} in (o-term p)"[:the carrier' of S, {the carrier of S}:]
      by FUNCT_1:def 7;
      then {{}} c= (o-term p)"[:the carrier' of S, {the carrier of S}:];
      then 1 = card{{}} = Segm card{{}} c= Segm deg (o-term p) by CARD_1:11,30;
      hence P[o-term p];
    end;
    thus P[t] from TermInd(A1,A2);
  end;

registration
  let t be DecoratedTree;
  let I;
  cluster t"I -> FinSequence-membered;
  coherence
  proof
    t"I is Subset of dom t by RELAT_1:132;
    hence thesis;
  end;
end;

definition
  let a,I;
  let J,K be set;
  redefine func IFIN(a,I,J,K) -> set;
  coherence by TARSKI:1;
end;

theorem Th80:
  J = [o,the carrier of S] implies (o-term p)"I = IFIN(J,I,{{}},{}) \/
  union {<*i*>^^((p.(i+1))"I): i < len p}
  proof set X = {<*i*>^^((p.(i+1))"I): i < len p};
    assume
A0: J = [o,the carrier of S];
    dom doms p = dom p by FUNCT_6:def 2;
    then
A4: len doms p = len p by FINSEQ_3:29;
    thus (o-term p)"I c= IFIN(J,I,{{}},{}) \/ union X
    proof
      let x be object;
      assume x in (o-term p)"I;
      then
A1:   x in dom (o-term p) & (o-term p).x in I by FUNCT_1:def 7;
      then x in tree doms p by TREES_4:10;
      then per cases by TREES_3:def 15;
      suppose x = {};
        then (o-term p).x = J & x in {{}} by A0,TARSKI:def 1,TREES_4:def 4;
        then x in IFIN(J,I,{{}},{}) by A1,MATRIX_7:def 1;
        hence thesis by XBOOLE_0:def 3;
      end;
      suppose ex i being Nat, q being FinSequence st
        i < len doms p & q in (doms p).(i+1) & x = <*i*>^q;
        then consider i being Nat, q being FinSequence such that
A2:     i < len doms p & q in (doms p).(i+1) & x = <*i*>^q;
        1 <= i+1 <= len p by A4,A2,NAT_1:11,13;
        then
A5:     i+1 in dom p by FINSEQ_3:25;
        then reconsider px = p.(i+1) as DecoratedTree by TREES_3:24;
A6:     dom px = (doms p).(i+1) by A5,FUNCT_6:def 2;
        then (o-term p).x = px.q by A2,A4,TREES_4:12;
        then q in px"I by A1,A2,A6,FUNCT_1:def 7;
        then <*i*>^q in <*i*>^^(px"I) in X by A2,A4;
        then x in union X by A2,TARSKI:def 4;
        hence thesis by XBOOLE_0:def 3;
      end;
    end;
    let x be object;
    assume x in IFIN(J,I,{{}},{}) \/ union X;
    then per cases by XBOOLE_0:def 3;
    suppose x in IFIN(J,I,{{}},{});
      then J in I & x in {{}} or J nin I & x in {} by MATRIX_7:def 1;
      then x = {} & J in I & (o-term p).{} = J & {} in dom (o-term p)
      by A0,TREES_1:22,TREES_4:def 4;
      hence x in (o-term p)"I by FUNCT_1:def 7;
    end;
    suppose x in union X;
      then consider Y being set such that
A7:   x in Y in X by TARSKI:def 4;
      consider i such that
A8:   Y = <*i*>^^((p.(i+1))"I) & i < len p by A7;
      consider q being Element of (p.(i+1))"I such that
A9:   x = <*i*>^q & q in (p.(i+1))"I by A7,A8;
      1 <= i+1 <= len p by A8,NAT_1:11,13;
      then
AA:   i+1 in dom p by FINSEQ_3:25;
      then reconsider px = p.(i+1) as DecoratedTree by TREES_3:24;
      q in dom px = (doms p).(i+1) & dom (o-term p) = tree doms p
      by AA,A9,FUNCT_1:def 7,FUNCT_6:def 2,TREES_4:10;
      then (o-term p).x = px.q & px.q in I & x in dom (o-term p)
      by A4,A8,A9,FUNCT_1:def 7,TREES_3:def 15,TREES_4:12;
      hence thesis by FUNCT_1:def 7;
    end;
  end;

theorem Th29:
  (ex f being FinSequence of NAT st i = Sum f & dom f = dom the_arity_of o &
  for i,t st i in dom the_arity_of o & t = p.i holds f.i = deg t)
  implies deg (o-term p) = i+1
  proof
    given f being FinSequence of NAT such that
A1: i = Sum f & dom f = dom the_arity_of o &
    for i,t st i in dom the_arity_of o & t = p.i holds f.i = deg t;
    dom f = dom p by A1,MSUALG_3:6;
    then
A2: len f = len p by FINSEQ_3:29;
    set t = o-term p;
    set I = [:the carrier' of S, {the carrier of S}:];
    set A = {<*i*>^^((p.(i+1))"I) where i: i < len p};
A4: {} nin union A
    proof
      assume {} in union A;
      then consider J such that
A1:   {} in J & J in A by TARSKI:def 4;
      consider i such that
A2:   J = <*i*>^^((p.(i+1))"I) & i < len p by A1;
      consider q being Element of (p.(i+1))"I such that
A3:   {} = <*i*>^q & q in (p.(i+1))"I by A1,A2;
      thus thesis by A3;
    end;
    reconsider J = [o,the carrier of S] as set;
    J in I by ZFMISC_1:106;
    then IFIN(J,I,{{}},{}) = {{}} by MATRIX_7:def 1;
    then t"I = {{}} \/ union A by Th80;
    then
A5: card (t"I) = card {{}}+`card union{<*i*>^^((p.(i+1))"I) where i: i < len p}
    by A4,CARD_2:35,ZFMISC_1:50
    .= 1 +` card union {<*i*>^^((p.(i+1))"I) where i: i < len p} by CARD_1:30;
    deffunc J(Nat) = <*$1*>^^((p.($1+1))"I);
A6: for i,j st i < len f & j < len f & i <> j holds J(i) misses J(j)
    proof let i,j;
B1:   len <*i*> = 1 = len <*j*> & <*i*>.1 = i & <*j*>.1 = j by FINSEQ_1:40;
      thus thesis by B1,Th2;
    end;
A7: for i st i < len f holds card J(i) = f.(i+1)
    proof let i;
      assume i < len f;
      then
A9:   1 <= i+1 <= len f by NAT_1:12,13;
      reconsider t = p.(i+1) as Element of
      (the Sorts of Free(S,X)).((the_arity_of o)/.(i+1))
      by A1,A9,FINSEQ_3:25,MSUALG_6:2;
      f.(i+1) = deg t by A1,A9,FINSEQ_3:25;
      hence thesis by Th1;
    end;
    card union {J(i) where i: i < len f} = Sum f from CardUnion(A6,A7);
    then card (t"I) = 1+` Sum f by A2,A5;
    hence deg t = i+1 by A1;
  end;

definition
  let S,X,T,i;
  func T deg<= i -> Subset of T equals
  {r: deg r <= i};
  coherence
  proof
    {r: deg r <= i} c= Union the Sorts of T
    proof
      let a; assume a in {r: deg r <= i};
      then ex r st a = r & deg r <= i;
      hence a in Union the Sorts of T;
    end;
    hence thesis;
  end;
end;

definition
  let S,X,T,i;
  func T height<= i -> Subset of T equals
  {t: t in T & height t <= i};
  coherence
  proof
    {t: t in T & height t <= i} c= Union the Sorts of T
    proof
      let a; assume a in {t: t in T & height t <= i};
      then ex t st a = t & t in T & height t <= i;
      hence a in Union the Sorts of T;
    end;
    hence thesis;
  end;
end;

theorem
  r in T deg<= i iff deg r <= i
  proof
    r in T deg<= i iff ex r1 st r = r1 & deg r1 <= i;
    hence thesis;
  end;

theorem Th11:
  T deg<= 0 = the set of all x-term
  proof
    thus T deg<= 0 c= the set of all x-term
    proof
      let a; assume a in T deg<= 0;
      then consider r such that
A1:   a = r & deg r <= 0;
A2:   deg @r = deg r = 0 by A1;
      reconsider t = r as Element of Free(S,X) by MSAFREE4:39;
      (ex s,x st t = x-term) or ex o,p st t = o-term p by Th16;
      hence thesis by A1,A2,Th22;
    end;
    let a; assume a in the set of all x-term;
    then consider s,x such that
A3: a = x-term;
    deg (x-term) = 0 <= 0 & x-term in T by Th21,Th24;
    then reconsider r = x-term as Element of T;
    deg r = deg @r = 0 by Th21;
    hence thesis by A3;
  end;

theorem Th12:
  T height<= 0 = (the set of all x-term) \/
  {o-term p: o-term p in T & the_arity_of o = {}}
  proof set I = the set of all x-term;
    set J = {o-term p: o-term p in T & the_arity_of o = {}};
    thus T height<= 0 c= I \/ J
    proof let a;
      assume a in T height<= 0;
      then consider t such that
A1:   a = t & t in T & height t <= 0;
      per cases by Th16;
      suppose ex s,x st t = x-term;
        then t in I;
        hence thesis by A1,XBOOLE_0:def 3;
      end;
      suppose ex o,p st t = o-term p;
        then consider o,p such that
A2:     t = o-term p;
        reconsider n = union {height t1: t1 in rng p} as Nat by Th25;
        per cases;
        suppose the_arity_of o = {};
          then t in J by A1,A2;
          hence thesis by A1,XBOOLE_0:def 3;
        end;
        suppose the_arity_of o <> {};
          then height t = n+1 by A2,Th26;
          hence thesis by A1;
        end;
      end;
    end;
    let a; assume a in I \/ J;
    then per cases by XBOOLE_0:def 3;
    suppose a in I;
      then consider s,x such that
A3:   a = x-term;
      height (x-term) = 0 & x-term in T by Th24,TREES_1:42;
      hence thesis by A3;
    end;
    suppose a in J;
      then consider o,p such that
A4:   a = o-term p & o-term p in T & the_arity_of o = {};
      height (o-term p) = 0 by A4,Th20;
      hence thesis by A4;
    end;
  end;

theorem Th44:
  T deg<= 0 = Union FreeGen T
  proof
A0: T deg<= 0 = the set of all x-term by Th11;
    thus T deg<= 0 c= Union FreeGen T
    proof
      let x be object; assume x in T deg<= 0;
      then consider s being SortSymbol of S, y being Element of X.s such that
A1:   x = y-term by A0;
      x in FreeGen(s,X) by A1,MSAFREE:def 15;
      then x in (FreeGen T).s & s in the carrier of S = dom FreeGen T
      by PARTFUN1:def 2,MSAFREE:def 16;
      hence thesis by CARD_5:2;
    end;
    let a being object; assume a in Union FreeGen T;
    then consider b such that
A2: b in dom FreeGen T & a in (FreeGen T).b by CARD_5:2;
    reconsider b as SortSymbol of S by A2;
    a in FreeGen(b,X) by A2,MSAFREE:def 16;
    then consider y being set such that
A3: y in X.b & a = root-tree [y,b] by MSAFREE:def 15;
    reconsider y as Element of X.b by A3;
    a = y-term by A3;
    hence a in T deg<= 0 by A0;
  end;

theorem Th10a:
  r in T height<= i iff height r <= i
  proof
A1: r in T & height @r = height r;
    r in T height<= i iff ex t st r = t & t in T & height t <= i;
    hence thesis by A1;
  end;

registration
  let S,X,T,i;
  cluster T deg<= i -> non empty;
  coherence
  proof
    set s = the SortSymbol of S;
    set x = the Element of X.s;
    deg (x-term) = 0 <= i & x-term in T by Th24,Th21;
    then reconsider r = x-term as Element of T;
    deg r = deg @r = 0 <= i by Th21;
    then x-term in {r1: deg r1 <= i};
    hence thesis;
  end;
  cluster T height<= i -> non empty;
  coherence
  proof
    set s = the SortSymbol of S;
    set x = the Element of X.s;
    height (x-term) = 0 <= i & x-term in T by Th24,TREES_1:42;
    then x-term in {t: t in T & height t <= i};
    hence thesis;
  end;
end;

theorem Th10b:
  i <= j implies T deg<= i c= T deg<= j
  proof
    assume Z0: i <= j;
    let a be object;
    assume a in T deg<= i;
    then consider r such that
A2: a = r & deg r <= i;
    deg r <= j by Z0,A2,XXREAL_0:2;
    hence thesis by A2;
  end;

theorem Th10c:
  i <= j implies T height<= i c= T height<= j
  proof
    assume Z0: i <= j;
    let a be object;
    assume a in T height<= i;
    then consider t such that
A2: a = t & t in T & height t <= i;
    height t <= j by Z0,A2,XXREAL_0:2;
    hence thesis by A2;
  end;

theorem
  T deg<= (i+1) = T deg<= 0 \/ {o-term p:
    ex f being FinSequence of NAT st i >= Sum f & dom f = dom the_arity_of o &
    for i,t st i in dom the_arity_of o & t = p.i holds f.i = deg t}
    /\ Union the Sorts of T
    proof
      set I = {o-term p: ex f being FinSequence of NAT st i >= Sum f &
      dom f = dom the_arity_of o &
      for i,t st i in dom the_arity_of o & t = p.i holds f.i = deg t};
      thus T deg<= (i+1) c= T deg<= 0 \/ I /\ Union the Sorts of T
      proof
        let a be object; assume a in T deg<= (i+1);
        then consider r such that
A2:     a = r & deg r <= i+1;
        reconsider t = r as Element of Free(S,X) by MSAFREE4:39;
        per cases by Th16;
        suppose ex s,x st t = x-term;
          then t in the set of all x-term;
          then t in T deg<= 0 by Th11;
          hence thesis by A2,XBOOLE_0:def 3;
        end;
        suppose ex o,p st t = o-term p;
          then consider o,p such that
A3:       t = o-term p;
          deffunc F(object) = deg (p/.$1);
          consider f being Function such that
A4:       dom f = dom p & for a being object st a in dom p holds f.a = F(a)
          from FUNCT_1:sch 3;
          dom f = Seg len p by A4,FINSEQ_1:def 3;
          then reconsider f as FinSequence by FINSEQ_1:def 2;
          rng f c= NAT
          proof
            let y be object;
            assume y in rng f;
            then consider x being object such that
A5:         x in dom f & y = f.x by FUNCT_1:def 3;
            y = F(x) by A4,A5;
            hence thesis;
          end;
          then reconsider f as FinSequence of NAT by FINSEQ_1:def 4;
A6:       dom f = dom the_arity_of o by A4,MSUALG_3:6;
A8:       now let i,t; assume
A7:         i in dom the_arity_of o & t = p.i;
            then t = p/.i by A4,A6,PARTFUN1:def 6;
            hence f.i = deg t by A4,A6,A7;
          end;
          then deg t = Sum f + 1 by A3,A4,Th29,MSUALG_3:6;
          then Sum f <= i by A2,XREAL_1:6;
          then t in I & t in Union the Sorts of T by A3,A6,A8;
          then t in I /\ Union the Sorts of T by XBOOLE_0:def 4;
          hence thesis by A2,XBOOLE_0:def 3;
        end;
      end;
A10:  T deg<= 0 c= T deg<= (i+1) by Th10b;
      I /\ Union the Sorts of T c= T deg<= (i+1)
      proof
        let a be object;
        assume
A14:    a in I /\ Union the Sorts of T;
        then
A11:    a in I & a in Union the Sorts of T by XBOOLE_0:def 4;
        reconsider r = a as Element of T by A14,XBOOLE_0:def 4;
        consider o,p such that
A12:    a = o-term p & ex f being FinSequence of NAT st i >= Sum f &
        dom f = dom the_arity_of o &
        for i,t st i in dom the_arity_of o & t = p.i holds f.i = deg t by A11;
        consider f being FinSequence of NAT such that
A13:    i >= Sum f & dom f = dom the_arity_of o &
        for i,t st i in dom the_arity_of o & t = p.i holds f.i = deg t by A12;
        i+1 >= Sum f + 1 = deg (o-term p) & a in T & deg r = deg (o-term p)
        by A14,A12,A13,Th29,XREAL_1:6,XBOOLE_0:def 4;
        hence a in T deg<= (i+1);
      end;
      hence thesis by A10,XBOOLE_1:8;
    end;

theorem
  T height<= (i+1) = T height<= 0 \/ {o-term p:
    union {height t: t in rng p} c= i}
  /\ Union the Sorts of T
  proof
    set I = {o-term p: union {height t: t in rng p} c= i};
    thus T height<= (i+1) c= T height<= 0 \/ I /\ Union the Sorts of T
    proof
      let a be object; assume a in T height<= (i+:: Similarity ::  by Agata Darmochwa{\l} and Andrzej Trybulec
      then :: detailed in file COPYING.interpretation:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:   =t&t  T &height t =i+1java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
      per cases by       DOMAIN_1, MCART_1, RELAT_1FUNCT_1 ,BINOP_1
      suppose ex  ,SEQ_4;
        thenzx->y A1
thent (he set of llx) \/
        {- p:oterm pin  &  o= {}  XBOOLE_0def3
 t < 0  Th12;
        hence thesis by A2,XBOOLE_0:def 3;
      end;
      suppose ex o,p st t = o-term p;
then  op  that
:     t=o-erm p;
        reconsider n = union {height t1end;
        per cases;
        java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 36
 uinKand
          java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
           all x- \java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
          {o-term p where       
                 z
          t  <0byjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
          hence thesis by A2,XBOOLE_0:  g+ x-->y))( \ {x}) cg:A\{x)
       ;
        supposethe_arity_of <{}java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
          then height t = n
           nc=Segm  by,XREAL_16NAT_139java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
          then t in I & t in Union   end;
          then and
hencethesis by A2,XBOOLE_0:def 3;
        end
          *x.--y) ,UNCT_4:java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    end;
: T height<=0 c Theight< (+1)by Th10c;
      I /\ Union the Sorts of T c= T height<= (i+1)
      proof
        let a be object;
        assume
A15:    a in I /\ Union the Sorts of T;
        then a in I & a in Union the Sorts of T by XBOOLE_0:def 4;
        then consider o,p such that
A12:    a = o-term p & union {height t: t in rng p} c= i;
        reconsider n = union {height t: t in rng p} as Nat by Th25;
A13:    Segm n c= Segm i by A12;
A14:    a in T by A15,XBOOLE_0:def 4;
        per cases;
        suppose the_arity_of o <> {};
          then height(o-term p) = n+1 <= i+1 by A13,Th26,NAT_1:39,XREAL_1:6;
          hence a in T height<= (i+1) by A12,A14;
        end;
        suppose the_arity_of o = {};
          then height(o-term p) = 0 <= i+1 by Th20;
          hence a in T height<= (i+1) by A12,A14;
        end;
      end;
      hence thesis by A10,XBOOLE_1:8;
  end;

theorem
  deg t >= height t
  proof
    defpred P[Element of Free(S,X)] means deg $1 >= height $1;
A1: for s being SortSymbol of S, x being Element of X.s holds P[x-term]
    by TREES_1:42;
A2: for o being OperSymbol of S, p being Element of Args(o,Free(S,X)) st
      for t being Element of Free(S,X) st t in rng p holds P[t]
    holds P[o-term p]
    proof let o,p;
      assume
A3:   for t being Element of Free(S,X) st t in rng p holds P[t];
      per cases;
      suppose the_arity_of o = {};
        hence thesis by Th20;
      end;
      suppose
A4:     the_arity_of o <> {};
        set i = the Element of dom the_arity_of o;
        dom the_arity_of o <> {} by A4;
        then
A9:     i in dom the_arity_of o = dom p by MSUALG_3:6;
        then p/.i = p.i in rng p by PARTFUN1:def 6,FUNCT_1:def 3;
        then height(p/.i) in {height t1: t1 in rng p};
        then reconsider I = {height t1: t1 in rng p} as
        non empty finite natural-membered set by Th25;
        reconsider n = union I as Nat;
        union I in I by SIMPLEX0:9;
        then consider t1 such that
A7:     n = height t1 & t1 in rng p;
        consider i being object such that
A8:     i in dom p & t1 = p.i by A7,FUNCT_1:def 3;
        reconsider i as Element of NAT by A8;
A5:     height(o-term p) = n+1 by A4,Th26;
        deffunc G(object) = deg(p/.$1);
        consider g being Function such that
A6:     dom g = dom the_arity_of o &
        for i being object st i in dom the_arity_of o holds g.i = G(i)
        from FUNCT_1:sch 3;
        dom g = Seg len the_arity_of o by A6,FINSEQ_1:def 3;
        then reconsider g as FinSequence by FINSEQ_1:def 2;
java.lang.StringIndexOutOfBoundsException: Range [14, 11) out of bounds for length 20
  java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30
          java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 28
          then consider  inxbyA5XBOOLE_05java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
B2:       b in domthen
         =(  A6;
          hence;
        end;
        then reconsider g as java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 15
        now let i,t;
          assumethenu {} TARSKI 1
          then =p. & .i=Gi byA,PARTFUN1:def java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
          hence
        end;
        
reserve   -  Ajava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
        Sum g >= g.i = G(i) =java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        by A3,QC-ariable_list of ,such java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
theng> by XXREAL_0:;
        hence dego-p =height(-term p  ,A5XREAL_1;
endjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    end;
);
  end;

theorem
  Union the Sorts of T = union {T deg<  forlb java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 69
  proof
    thus  theSortsofTc union { <=i notcontradiction
    proof
        assume in the Sortsof ;
sider=aas Element of;
      a beobject
      hencethesis  def 4
    end
    a;assumeain union{T<i notcontradiction
      QCFuncExNAl( -QCalphabet () -  set
 a  I I {T deg= :not contradictionby :ef 4java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
    consider i such that
 I = deg=i by;
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 25
  end;

theorem
  Union the means for p being of
  
nTheight=i }
    proof
      let a; assume a in Union the Sorts of T;
      thenreconsider t = a as Element of T;
      t in T<= height t &
      T height<=  defpred PfgpElement of D(), Function of QC-WFF(Al()), D(),
      hence thesis by TARSKI:def 4;
    end;
let; assumea inunion {T height<= i: not contradiction};
    then consider I such that
A1: a in I & I in {T height<= i: not contradiction} by TARSKI:def 4;
    consider i suchSn holds [+]
A2: I = T height<= i by:[F njava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
    thus     $2 = F.$1) len@$1 =+1  impliesPfgp$2, F 1]);
  end;

theorem
  i holds T < i c=Free(,X deg< i
  proof
    defpred P[Nat] means T deg<= $1 c= Free(S,X) deg<= $1;
    T deg<= 0 = Union FreeGen T & Free(S,X) deg<= 0 = Union FreeGen Free(S,X)
    by Th44;
    then
A0: P[0];
A1: now let i; assume P[i];
      thus P[i+1]
      proof
        let x be object; assume x in T deg<= (i+1);
        then consider r such that
A3:     x = r & deg r <= i+1;
        reconsider t = r as Element of Free(S,X) by MSAFREE4:39;
        deg t = deg r;
        hence thesis by A3;
      end;
    end;
    thus for i holds P[i] from NAT_1:sch 2(A0,A1);
  end;

begin :: Context

definition
  let S,X,T,s,x,r;
  attr r is x-context means: CONTEXT:
  card Coim(r,[x,s]) = 1;
  attr r is x-omitting means: OMIT:
  Coim(r,[x,s]) = {};
end;

definition
  let S,X,T,r;
  func vf r -> set equals proj1(rng r /\ [:Union X,the carrier of S:]);
  coherence;
end;

theorem ThR1:
  vf r = Union (X variables_in r)
  proof
    thus vf r c= Union (X variables_in r)
    proof
      let a; assume a in vf r;
      then consider b such that
A1:   [a,b] in rng r /\ [:Union X, the carrier of S:] by XTUPLE_0:def 12;
A2:   [a,b] in rng r & [a,b] in [:Union X, the carrier of S:]
      by A1,XBOOLE_0:def 4;
      then a in Union X & b in the carrier of S by ZFMISC_1:87;
      then consider c being object such that
A4:   c in dom X & a in X.c by CARD_5:2;
      reconsider b,c as SortSymbol of S by A4,A2,ZFMISC_1:87;
      consider d being object such that
A5:   d in dom r & [a,b] = r.d by A2,FUNCT_1:def 3;
      reconsider d as Element of dom r by A5;
      reconsider t = r|d as Element of T by MSAFREE4:44;
A7:   (X variables_in r).b = (X.b)/\{a`1 where a is Element of rng r: a`2 = b}
      by MSAFREE3:9;
      t is Element of Free(S,X) by MSAFREE4:39;
      then per cases by Th16;
      suppose ex s,x st t = x-term;
        then consider s,x such that
A6:     t = x-term;
        <*>NAT in (dom r)|d by TREES_1:22;
        then r.(d^{}) = t.{} by TREES_2:def 10
        .= [x,s] by A6,TREES_4:3;
        then
A8:     a = x & b = s by A5,XTUPLE_0:1;
        [a,b]`1 = a & [a,b
        then a in {a`1           thus Pfgp[y, F, p
then in(variables_in )s&
        dom(X variables_in r) = the carrier end
byA7A8XBOOLE_0:def 4PARTFUN1def2;
        hence thesis by CARD_5:2;
      end;
      supposeex ,pst=oterm pjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
nsider, suchthat
 p;
        <          per casesjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
       then .(d{})=t{}by TREES_2: 10
        .= [o,the carrier of S] by A6T_1:8;
        then
e carrierof  =b  A5,XTUPLE_0:;
        hence thesis;
      end;
    end;
 in Union(variables_in)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
    then  b such that
A14        . =Fpby A9;
b    S by B1
A16H.the_argument_ofp F.he_argument_of  byA9java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
    by MSAFREE3:9;
    then
B2: a in X  endjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
    by B1,XBOOLE_0:def 4
          pis conjunctive  .p =C(.the_left_argument_of p, H.
B3: a = A19:    isconjunctive;
    dom =the ofSby: 2java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
     a in Union X by ,CARD_52
    
B6: [a,b] in [:Union X,B6: [a,b] in [:Union X, 
    considerlen@ =n+;
B4: xi in dom
reconsider xi   of dom r  B4
    reconsider t = r|xi java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 23
    t is Element of Free        H. p =F. p by A9;
    A26:        len @p <> n+1;
    suppose ex s,x st t = x-term;
      then consider s,x such that
A6:   t = x-term;
*NAT domr|  TREES_1;
      then r.(xi^{}) = t.{} by TREES_2:def 10
.[,]byA6TREES_43java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
      then [a,b] in rng r /\   ;
      by B6,B3A30  x being  xinQC-FFAl(  ybeing  stQfn[,java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
hencethesis XTUPLE_0 ;
    end;
,t= 
      then consider o,p suchthat
A6:   t = o-term p;
TREES_1:22;
      then r.(xi^{}) =     $1
      .= [ thuspis  Prop[]
      then
binthe carrier S=b by B3;
      java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 10
    endhenceF.Al))=V()by A31
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

theorem
  vf x-erm) x}
  proof
:rng(-) ={[x,]}
    rng (x-term) c= [:Union X, the carrier of S:] by A1,ZFMISC_1:31,87;
(x-erm) / [: X the  of S] = rng (-termjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
    by XBOOLE_1: Prop  java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
thesisjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 33
  end;

theorem

  proof
B1: dom (X variables_in (o-term p))      
    thus vf (o-term :   Prop[the_scope_of p] and
    proof
       aa assume a in vf (o-term p);
then  UnionXvariables_in(o-erm) java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
considersuch
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
      by A48: dom F -FF()and
      reconsider b as SortSymbol of S by A1;
      consider tjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
 t).b by A1,MSAFREE3:13;
      reconsider t as Element of Free(: y=F. byA48,FUNCT_1def  3;
A3:   :  g being Function  QC-WFFAl(),D) st Pfn[, len @ holds y =
      a in Union(    g.by ,A50,A51;
      by A2,A3,ThR1,CARD_5:2;
      hence a in union {vf t1:    hence thesis;
    ;
    let a; assume a in union {vf    ofWFF(( suchjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
  
A4  in   {f:  rng p}by :def 4;
    consider t such that
 =vf  & inrngp byA4;
   in(  tby A4,5,ThR1
      such that
A6: b in  set p9 = p;
    reconsider b as SortSymbol of S by   QC-WFF(Al()), D() st Pfn[g, len @p1] holp9 =gp1 by A49;
    a in (X variables_in:F  G. by ,,A59
    then a inA62:kbeing Element of NAT  k <len p holds Pfn[,k]
    hence thesis by  assume
  end;

registration
  let     isnegative F.  (.the_argument_of ,p
 cluster fr>finite;
  oherence
end;

theorem Th92
  x nin 
proof
assumenin vf rjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
A1: [x,s] nin rng r /\ [:Union X, the carrier of S:] by XTUPLE_0    assume
    x,] in: X thecarrier of S:] by ZFMISC_1:87;
thens]ninrngrby A1,XBOOLE_0:def 4;
{} java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 43
  end;

definition
  Sst
     
 isx-;
end;

registration
  let S,Xscheme
  cluster x-ontext> s-context for  ofFree(X;
  coherencejava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
end;

registration
  S,,,;
  cluster x-term -> x-context;

  proof set t'r  Frr  .r' s)=CF.,F.s,, java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
    ,] [x,] byTARSKI:ef;
java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 56
CARD_1:30java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
  end;
end;

registration
letXx
  cluster x-context non compound for Element of   is impliesF.  (. pF
  
  proof
    take t = x-term;
    thus thesis;
  end;
x- >non x- for  (S,)
  : the_arit   byjava.lang.StringIndexOutOfBoundsException: Range [37, 34) out of bounds for length 38
end;

theorem ThC1. APl)  A1,,A5,;
  for s1let r,beElement  CQCWFFAl),x be Element  -variablesAl())
  for lementofX.s1
  for x2 being Element of X.s2
  holds s1 <> s2 or x1 <> x2 iff x1-term is x2-omitting
  proof
    let s1,s2 be SortSymbol of Sjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
    let x1 be  ofX.;
     Element of X.s2java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    hereby
      assume s1 <> s2 or x1 < then
       the_scope_ofx,) = by A13QC_LANG128java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
      then [x1,;
      hence x1-termis x2-omittingby FUNCOP_1:16;
    end;
    assume Coim(1term,x2,] ={};
    then [x1,s1] nin {[x2,s2]} by FUNCOP_1:14;
    s1< s2orx1 >x2 byTARSKIdef ;
  ;

registration
  let S,s,s1,Z,z
let  beZjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

  coherence
  proof
    z9 <> z     for x be E of bound_QC-variables(Al()
   thesis ThC1java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  ;
end;

registration
  let S,s,Z,z;
  cluster z-omitting for Element of Free(S,Z);
  existence
  roof
    considery being Element  Z. suchthat
A1: y <> z by SUBSET_1:50;
    take y-term;
    thus     forPbeing QC-red_symbol ofkAl(
  end;
end;

registration
,,z;
 let z1 be z-different Element of Z.s1;
  cluster z-omitting z1-context for Element of Freereconsider kjava.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 54
      hence.ll (.java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 42
 proof
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
     thesisjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
  end;
end;

definition
 Sx;
  mode java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 13
end;

theorem A3
  for r being java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 8
  - is context ofy  r =s&x == y
  proof
letrbe  of S y  Element of X.r;
A0: ([x,s]  
   (-erm[,] =dom(-erm) {}& {}in{{java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
1:132;
    (leteElement Djava.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
    byA0Z:;
    then card Coim(x-term, [y,r    ;
    by CARD_2:42;
       thesis by A0,CONTEXT,XTUPLE_0:1,FUNCT_1:def 7;
  end;

definition
  let  java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 46
  :for  Element  holds for p being Element ofCQC-FF() st p
end;

reserve C for (java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 10
  C11 for (context of x11), C12 for    f.holds .  not p;


C sX

end;
  r f Element of Funcs-(),-ariables(A))java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
  proof
 (,x] =1 
    then consider a such that
A1: Coim(C,[x,sA) variables)): CQCWFF(A)) means
    a   for ,,,qst  .,h) q =g .+)holdsit.t,)=p '' qjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
    then a in dom java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 57
    
A2: [x,s] = A1  , exu  Element of CQC-WFF(A)st P[th,]
[s]in[Union ,the carrier of :  ZFMISC_1:87;
    then [x,s] in rng C /\ [:Union X, thetakejava.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 19
    hence thesis by XTUPLE_0:def 12;
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

definition
  let S, (-ariablesA bound_QCvariablesA),-(A))
  attr p is x-context_including meanslet t,hp;
  A5:p .,
  for j,t   java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 6
  holds t is x-omitting;
end;


  let S,o,s,X,x;
  cluster  letbeElement:symbols()Funcs-(A)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
  coherence;
end;

Th53:
  p context_includingo- isjava.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 55
  proof
    set I =     =byFUNCT_263;
    reconsider J
    s in the carrier of S;
    then[the carrier of S]< [s by
    then [o,the carrier of S] nin I by TARSKI:def 1;
}})={ by MATRIX_7 1;
    then
:(term)I = } \/ {*>^(.i+)I)   len  Th80;
x term is x
    proof
      given i such that
A6:   i in dom k & k.i is context java.lang.StringIndexOutOfBoundsException: Range [0, 36) out of bounds for length 22
      for j for t being Element of Free(S,X) st j in   func UNIVERSAL(x,f) -> Element of Funcs([:QC-symbols(A
holds tx-;
      reconsider ofQC-(), of Funcsbound_QC()java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
      card Coim(C,[x,s]) = 1 by CONTEXTA1  t  ubeing Element CQC-FF()st Pt,,u]
     thenconsidera that
:  }CARD_2:42;
      a in C"I by A9,TARSKIbound_QCvariables))byFUNCT_2:;
      then reconsider a as;
      consider j such that
A7     1+bA6,FINSEQ_325NAT_1;
      1+j <= len k by A6,A7,FINSEQ_3:25;

A8:   j < len k by     assumepf(t+h+( .-->x.);
      

        thus A3: for t,h,p st p,*(x .--> x.t)) holds F.(t,h)=All(x.t ,p);
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
          
          then consider J such that
B1:       b in J in {<*i*>^^((k.(i+1))"I) where      bound_QC(),ound_QCvariablesA  that

k.n1)")& <len k by B1;
B4:       1 <= n+1 <= len k by B2,NAT_1:11,13 p.k+,) Element CQC-();
          then n+1 in dom k by FINSEQ_3:25      hence A5java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
          then java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          per cases;
          supposerng java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 51
            hence thesis by B1,B2,A9A;
        end;
           <>j;
            thenn1<>j1java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
            then t is x-omitting by A6coherence
hencethesis  B1,B2;
          end;
        end;
let b; bin{**^}java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
        then b in <*j*>^^(C"I) in {<*i*>^^((k.(i+1))"I)   end;
  ,,A9Th6
h thesisby : 4
      java.lang.StringIndexOutOfBoundsException: Range [10, 11) out of bounds for length 10
      then card Coim(o-term k,[ :ef5
      hence thesis by CONTEXT;
    end;
    assume o-term k is context of x;
thencard (-erm, [xs)= 1 by CONTEXT
    hen consider a  that
D1: Coim(o-term k, [x,s]) = {a} by CARD_2:42;
    a in (o-term k)"I by D1,TARSKI:def 1;
    then consider J    hence thesis by ;
n Jin {**>^(k.i1)I) <len}by A5,ARSKIdef 4;
     i suchthat
D3: J = <*i*     a being Element of[:Csymbols(A)Funcs(ound_QC-ariables()java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
     pbeing Element of k.(i+1))"I such that
D4: a = <*i*>^p & p in (k.(i+1)                            bound_QCvariables(A:;
    take = i+;
1<n < len k  D3,NAT_11113;
    hence n in dom k by FINSEQ_3:25;
    then reconsider kn = k.n as Element of Free(S,X) by FUNCT_1:102;
D6: {p} c= kn"I by D4,ZFMISC_1:31;
        hence Gby FUNCT_2:;
    then kn"I c= {p} by D3,Th18deffuncAsetsetset) ;
    then kn"I = {p} by D6,XBOOLE_0:def 10;
    then
    hence k.n is context of x by CONTEXT;
    let j;
    let t be Element of Free(S,X); assume
D7: j in dom k & j <> n & t = k.j;
    assume Coim(t,[x,s]) <> {};
thenconsider  eingobjectsuch that
D8: c in Coim(t,[x,s]) by  proof
    reconsider c as Node of t by D8,FUNCT_1:  NAT st d= F.  F.VERUM(A) = 0 &
      x bound_QCvariable  java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36
D9: j = 1+m by D7,FINSEQ_3:25,NAT_1:10;
    1 <=lenkby ,D9,FINSEQ_3:25
   thenm len k byNAT_1;
    then <*m*>^c in <*m*>^^(t"I) in
    {<*i*>^^((k.(i+1   r, being Element of CQCWFF)
    then <*m*>^c in {a}    lbeing CQC-ariable_list of k A
    then <*m*^  <i*>p by ,TARSKI:def 1;
c). =iby 
    hencecontradiction by D7D9;
  endjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

theorem Th54:
  k

    I={[xs};set k=p;
     J =[othecarrier of S] as set;
    end;;
    then [o,the carrier java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 0
then [,the  of S nin I by TARSKI:def 1;
 IFIN,I,,{}}{})= {  MATRIX_7def 1;
    then
A5: o-term)"  {}\ union{**>^(.i+))I)  <lenk by Th80java.lang.StringIndexOutOfBoundsException: Range [73, 74) out of bounds for length 73
    hereby java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 11
A6:   for i st i in dom p holds p/.i is x-omitting;
      thus o-term p is x-
proof
        java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
        then consider a such that
A7:     a in Coim(o-term p,[x,s]) by XBOOLE_0:7;
       consider J such that
A8:     a in J in {<*i*>^^((k.(i+1))"I): i < len k} by A5,A7,TARSKI:def 4;
        consider i such that
A9:     J  deffuncA,QCpred_symbol of $,A,
        1 <= i+1 <= len p by A9,NAT_1:11,13;
thenpp(i+)&p/.i+)is-mitting
by A6,:25,ARTFUN1:def 6;
        hence contradiction by A8,A9;
      end;
;
       
B1: Coim(o-term p,[x,s]) = {};
     i assume
:iin dom;
    then consider j such that
i =+NAT_110,FINSEQ_325java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    1+j <= len p by B2,B3A3:for rs holds .('not'  (Frr)&Fr'& )  CF.,F,java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
    then j < len p by     thesisby A1A2;
    then <*j*>^^((p.i)"I) in uniqueness
     <j>^((.i") c= {} = <j*^{ by A5,1ZFMISC_1:74java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
    then (p.i)"I c= {} &     =[:-ymbols(A,Funcs(bound_QC-(A)bound_QC-(A):];
hence Coim(p/i[,] = {;
 end;

theorem Th54A:
for  stt in rngp holdstisx-) iffo-term p is x-omitting
java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 7
:nowassume
A1:    i st i in dom p holds p/.i is x-omitting;
let t assume t in rng ;
      then i beingobject suchthat
A2:   i in dom p & t = p.i by=A(k,P,) and
      reconsider i as Nat by A2;
      t = p/1 ford  NAT  F(p)  F beingFunctionjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
      hence t is x-omitting by A1,A2;
    end;
    now   & F.('not' r) = N(F.r) & F.(r '&' s) = C(F.r,F.s) & F.All(x,r) = Q(x,F.r) by
A3:   for t st t in rng p holds t is x-java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 4
      let i; assume i in dom p;
then/i=p. inrng p  FUNCT_1def3PARTFUN1:6;
hencep/.  x by A3
    end;
      & F.('not.' ) (.r&Fr& )=(java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 78
  end;

java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  let S,s,o;
  attr o is s  being of-(A,NAT =F.  F.A)   java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
end;


  let S be sufficiently_rich non void non empty ManySortedSign;
   QuantNbrpp+QuantNbrqjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  A1 pbeing  CQCWFFA,d ElementofNAT
  existence
  proof
    o beOperSymbol  such 
: rngthe_arity_of SR
    take o;
    thus s in rng the_arity_of o by A1;
  end;
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4

reserve
  S9 for sufficiently_rich non empty nonP beingQCpred_symbol k, java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
  s9 for SortSymbol of S9,
,
  X9 for non-trivial ManySortedSet of the carrier of S9,
  x9for (  X9.)

registration
  letconjunctive [ p] &Pt p]
  cluster x9-context_including p A
  existence
  
    s9 in rng the_arity_of o9 by       (the_arguments_of p).$1 in bound_QC-variables(A);
    then consider i       e 
A1: i in dom the_arity_of o9 &hence thesis;
    reconsider i as Nat by A1;
A2: s9 = (the_arity_of o9)/. . variables_inthe_arguments_of,bound_QC-variablesA)by 2
           p. in-A }
    (the x9-different Element of X9.((java.lang.StringIndexOutOfBoundsException: Range [0, 50) out of bounds for length 19
    consider f being FinSequence such that
A3: len f = len the_arity_of o9 & for i st i in dom f:;
    from FINSEQ_1:sch 2;
    now
      let j; assume j in dom f;
      then A3   p  conjunctive and
      then i = j & f.j = x9-term or
 X9.((the_arity_ofo9).j)-term
      by FUNCOP_1:def 8;
      hence f.j in (the Sorts of Free(S9,X9)).((the_arity_of o9)/.      hence  by A4,A5;
    end;
    then reconsider f as Element of Args(o9,Free(S9,X9)) by A3,MSAFREE2:5;
    take f,i;
    thus     hence  java.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
    then f.i = F(i) by A3 .= x9-term by FUNCOP_1:def 8;
    hence f.i is context of x9;
  et; t be Element of FreeS9,X9;
    assumejin f&j < ijava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
    thenA1:( finite& ( >{  ( =() and
    = (the x9-different Element of X9.((the_arity_of o9)/.j))-term
    by A3,FUNCOP_1:def 8;
    hence t = f.j implies t is x9- defpredo,object]means $1  X $2X &P[,2];
  end;
end;


  let S9x;
  let p9 be x9-context_includinglet   Elementof D
  cluster o9-term p9 -> x9-context;
e ;
java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 4

definition
  let S,o,java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
: -context_including;
   java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 23
B: java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
   for j for t being Element of Free(S,X) st j in dom java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 25
   holds t is x-omitting by A;
  func x-context_pos_in p -> Nat meansr
  p.it is context of x;
  existence by B;
  uniqueness
  proof let i1,i2 be Nat    proof
A1: java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
          then0A<u  not x.uinstill_not- p;
    reconsider           then
    i1 in dom p & i2 in dom p by A1,A2,FUNCT_1:def 2;
    then        java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 44
    hence i1 = i2;
  end;
  func x-context_in p -> context of x means: CIn:
  it           
  existence
proof
    reconsider t = p.i as context of x by B;
    take t;
    thus t in rng p by B,FUNCT_1:def 3;
  end;
         : 6(A3)
  
    let t1,t2 be context of x such that
A3: t1 in rng p and
A4: t2 in rng p;
 i1  objectsuchthat
 i1 in  &=.1by Fdef 3;
     thus  by A1A6java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
:i2 in  p&t2= p. byA4,:def ;
    reconsider i1,i2 as Nat by A5,A6;
A7: i1 <> i implies t1 is x-omitting by B,A5;
    i2 <> i implies t2 is x-omitting by B,A6;
    hence thesis by            Z(bound_QC- ofA) =.$1
  end;
end;

theorem Th71:
is-xjava.lang.StringIndexOutOfBoundsException: Range [54, 51) out of bounds for length 64
  x-context_in p = p.(            for s being  java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 60
          s in;
    assume
:is-;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
A1               by A12java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    thus x-context_pos_in              beingobject holds s  impliess  java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
p)in  p FUNCT_1 3
    hence thesis by A0,A1,CIn;
  end;

theorem Th72:
  p is x-context_including  c symbolsA) by ,7;
  p/.i           in{w .win -bound_inp} and
  proof
    assume
A1: p is x-context_includingthus=+java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    then consider j java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 40
A2: j in dom p & p. z in {:xwin - }byA17java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
    for n being Nat for t st n in dom p & n  v  +by :5;
    holds t is x-omitting;
A3: x-context_pos_in p = j by A1,A2,CPI;
    p/.i = p. hence thesis;
    hence p/.i is x-omitting by A1,A2,A3;
  end;

Th73:
  p is x-java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  proof set k = p, z = x;
    assume
A0: k is z-context_including;
    Coim(k, z-context_in k) = {z-context_pos_in k}
    proof
      thus Coim(k, z-context_in k) c= {z      assume
      
        let a; reconsider x = a as set by TARSKI:1;
        assume ain(k, -context_in k)
        then x in dom k & k.x in {z-context_in k} by FUNCT_1:def 7;
  x context_inkTARSKI1java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
    x=- A0;
        hence a in {z-context_pos_in k} by TARSKI:def 1A4:0(  NBI p
      end;
      let a   roof
      assume ider  tjava.lang.StringIndexOutOfBoundsException: Range [29, 30) out of bounds for length 29
      then a = z-context_pos_in k by TARSKI:def 1;
      then k.    then not0A < t QC_LANG1:;
      then a in dom k &end;
      hence   hence thesis;
    end;
    hence card Coim(k, z-context_in kjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  end;

A2: ex stu minNBI p&  st<=holdsxt java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  p is x-context_including implies p<-(x-context_in p) =     hence contradiction by A1A2;
  
    assume
:p is x-;
    p  x-ontext_in by java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 20
    then p<-now
   .(-(x- p) =- p  FINSEQ_4:def 3;
    henceA8t=;
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

theorem
  C = x-term or
  ex o,p st p is x-context_including & C =java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  proof
    per cases by Th16;
    suppose
      then consider s0 being SortSymbol of S, y being proof
:C  -java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
      s0 =     --> VERUA)[A,bound_QC(]by  =VERUM)
      hence thesis by A1;
    end;
    suppose ex o,p st C = o-term:P[(
      then consider o,p such that
2   C =o-java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 19
      thus thesis by A2,Th53;
    end;
  end;

registration
  let S9,X9,s9,x9;
 ofFree(S9,)java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
  
  
     o9   s9-dependentOperSymbol of S9;
    set p9 = the x9-context_including Element ofend
    take t = o9-term p9;
    thus t is x9-context;
    thus tis compoundjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  end;
end;

scheme ContextInd{P[set],
  S() -> nonjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  s() -> SortSymbol of S(),
 ( ->empty ofthe java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 55
  x() -> (Elementjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  () >context ofx()}
  P[C()]
  provided
A0: P[x()-term] and
 S()
    for w being    =(NEGATIVEFP).[index p,(id-variablesA) byby 
    st w isp isnegative& =the_argument_of  SepVar p =''  q
    holds P[x()-context_in w] implies
java.lang.StringIndexOutOfBoundsException: Range [23, 4) out of bounds for length 57
proof
   ;
:   S,x   X(.holds [term
   java.lang.StringIndexOutOfBoundsException: Range [9, 10) out of bounds for length 9
      be S) beingElementX);
      assume x-term is context of x();
     =s)&x=x)by;
      hence P[x-term] by A0;
    java.lang.StringIndexOutOfBoundsException: Range [8, 9) out of bounds for length 8
A3: for o being OperSymbol of S(), p being Element of Args(o,Free(Sendjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
tof((X(   rngp[t
holds oterm ]

      let o be OperSymbolitis_Sepclosed_onp& D  of[CQCWFF),QCsymbols(),
that
A4:   for t beingA)QCsymbols(,Fin -)
A5:   o-term p is context of x();
      
thenx) p in rng by CIn;
      then P[x()-context_in p] by A4;
      hence thesis by A1,A5,Th53;
    end;
    Qtake  A2;
    henceB-closed_on java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
end;

theorem Th23:
  t is x-omitting implies (t,[x,s])<-t1 = t
  java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 14
Coimtx,)=}java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    reconsider dt = dom t as set;
:dom(t[x<  
   
      thus dom ((t,[x,s])<-t1) c= dt
      proof let a; assume a in dom ((t,[x,s])<-t1);
r=a as   (t[x,]-;
cases byTREES_4:ef7;
        suppose r in dom t;
          hence thesis;
        end;
        suppose ex q being Node of t, p being Node of t1 st
          q in Leaves dom t & t.q = [x,s] & r = q^p;
          java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 12
A2:       q in Leaves     bound_QC-variables(A) Y
          [x,s] in {[x,s]} by TARSKI:def 1;
                 Y inA2java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        end;
      end;
      thus dt  hence
end;
    now let a; assume a in dom t;
     then reconsiderr=a  Nodeof t;
      [x,s] in {[x,s]} by TARSKI:def 1;
      then A6   'not'qt,K,]in ;
hence((,[x,s)<-). =tabyTREES_4:def 7;
    end;
    hence thesis by AA,FUNCT_1:java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 21
  end;

aaa1:
  the_sort_of t1 = s implies
  (t,[x,s])<-t1 in (the Sorts of Free(S,X)).the_sort_of t
  proof assume
A the_sort_of t1 =sjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    defpred P     for q,r,t,K,f holds [q '' r,tKf] in  implies [q,,,f] in X & [,
    ($1,[x,s])<-t1 in  proof
A0: for s1 for y being Element of X.s1 holds P[y-term]
    proof
      let s1; let y be Element of X.s1;
      per cases by XTUPLE_0:1;
 s1 = s&y=;
        then
        hence (y-term,[x,s])<-t1 in
        (        hence A11java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
      end;
      suppose [y,s1] <> [x,s      java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
        then (y-term,[x,s])<-t1 = java.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 12
,hL7java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        hence (y-term,[x,s])< java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 40
( of(X) termjava.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54
      end;
    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
A1: for o for p st for t2 st t2 in rng p holds P[t2] holds P[o-term p]
    proof let o; let p; assume
A3:   for t2 st t2    assume  is_Sepclosed_on p;
      per cases;
      suppose p = {};
        then
A2:     o-term p = root-tree [oTh30
        s in the carrier of S; then s <> the carrier of S;
        then [x,s] <> [o, the carrier of S] by XTUPLE_0:1;java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
theno- ,x,s]<t1  - p A2ThL7;
   in  p
       ( is_Sepclosed_on p Def13
      suppose
A2:     p <> {};
deffunc (Nat) = (p/$,[x,s)-t1;
        consider q being FinSequence such that
A4:     len q = len p & for i st i in dom q holds q.i = F(i)
        from FINSEQ_1:sch 2;
A5:     dom
:  empty&q nonempty byA2,4
A8:     dom p = dom the_arity_of o by MSUALG_6:2;
        then
A9:     len q = len the_arity_of o by A4,FINSEQ_3:29;
         letijava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
          assume
B1:       i in dom q;
          then
       p,java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 42
          then p/.i in   -) Fin bound_QCA,Funcs(ound_QCvariablesA,
          then
B3:       P[    let s,u,L,h;
          p.i in (the Sorts of Free(S,X)).((the_arity_of o)/then < oorf<  by A3XBOOLE_0def 5;

          hence q.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
          by B3,B2,SORT;
end
        then reconsider q as Element of Args(o,Free(S,X)) by A9,MSAFREE2    then
        now let iA12 [ ''r,Lh  SepQuadruples  by XBOOLE_0:ef 5java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
          then q.i = F(i) & p/.i = d1 by A4,A5,PARTFUN1:def 6;
          hence q.i = (d1,[x,s])<-t1;
        end;
        then
A7:     (o-term p,[x,s]<-1=o-term q byA6,hL8A4,FINSEQ_3:;
        the_sort_of(term p)=the_result_sort_of = the_sort_of (o-term java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
        by Th8;
        hence thesis by A7;
      end;
    end;
    thus P[t] from TermInd(A0,A1);
  

definition
  let S,X,s,x,C,t such that
A: the_sort_of t = s;
  func C-sub(t) -> Element of (the Sorts of Free(S,X)).the_sort_of C equals:
SUB:
  (C,[x,s])<-t;
  coherence
  proof
    defpred P[Element of Free(S,X)] means
    ($1,[x,s])<-t is Element of (the Sorts of Free(S,X)).the_sort_of $1;
    (    (x-term,java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 8
    then
A0: P[x-term] by A,SORT;
A1: for o     All(,)uLh   pbyA17,:def;
s P[-ontext_in ]implies
    for C being context of x st C = o-term p holds P[C]
    proof let o; let p; assume that
A2:   p is x-context_including and
A3:   P[x-context_in p];
      deffunc then SepQuadruplesc=Y by Def13;
      hence contradiction by A1,ZFMISC_1:57;
A4java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
A5:  dom q=dom  <>{}by ,A4,:29;
A6:   p is non empty & q is non empty by A2,A4;
A8:   dom p    oby MSUALG_6:;
      then
A9:   len q = len the_arity_of o by A4,FINSEQ_3:29;
      let i;
        assume
B1:     i in dom q;
        then
B2:     p/notqtKfin(  ['qtK
        per cases;
        suppose x- being Element of Fin bound_QC(()being 
          
B3:       x- p =pi&qi = F()by ,A4,2Th71java.lang.StringIndexOutOfBoundsException: Range [61, 62) out of bounds for length 61
java.lang.StringIndexOutOfBoundsException: Range [56, 10) out of bounds for length 63
          byB1,,M:;
          (- p  the_arity_of).  B3,ORT;
          hence q.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
          by B2,java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 5
        end;
        suppose x-context_pos_in p <> i;
          then q.i = F(i) = p.i by A4,B1,B2,A2,A5,Th72,java.lang.StringIndexOutOfBoundsException: Range [0, 59) out of bounds for length 16
          hence q.i in (the Sorts of Free(S,X)).((  QC-symbols(A()),Fin bound_QC-variables(A()), Funcs(bound_QC((), -(() (variables())
          A5  p)is_Sep- p( byDef13
        end;
      : [(, (),{}-((),d bound_QCvariablesA))]in
      then reconsider q as Element of Args(o,Free(S,X)) by A9,MSAFREE2    [p(,index (,{.bound_QC-variables((),(bound_QC-ariables(A))) in
      now    hence [(),index p), }.bound_QC-variables(A()java.lang.StringIndexOutOfBoundsException: Range [53, 54) out of bounds for length 53
        then q.i = F(i) & p/.i = d1 by A4,A5,    thus for q being Element of CQC-WFF(A()), tQCsymbol of A
        hence q.i = (d1,[x,s])<-t;
      end;
      ,ThL8,A4FINSEQ_329java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
      hence thesis by Th8;
    end;
C from ContextInd(0A1);
end;
end;

theorem Th41:
  the_sort_of t = s implies (x-[not' qtKf] Y by A7,XBOOLE_0:def 4;
  proof assume the_sort_of t = s;
    hence (x-term)-sub(t) = (x-term,[x,s])<-t by SUB .= t;
  end;

A10:  P[p,u,L,h];
  let:t   ,TUPLE_05
  reduce C-sub(x-term) to C;
  reducibility
  proof
    defpred P[Element of Free(A14  [q,,,f]in Y;
A1:P[-erm];
  hence thesis by A14,BOOLE_0:def4;
    holds P[x-context_in p] implies
    for C being context of x st C = o-term p holds P[C]
    proof let o; let p; assume that
A2:   p is x-context_including and
A3:   P[x-context_in p];
      set t = x-term;
      deffunc F(Nat) =         be-symbol  A),  bound_QC-ariables(A()java.lang.StringIndexOutOfBoundsException: Range [74, 75) out of bounds for length 74
      now let i,d1; assume
A15: [ ''r,,f] in X;
        then
B2:     p/.i = d1 by PARTFUN1:def 6;
        per cases;
        suppose x-context_pos_in p = i;
          then x-context_in p = p.i by A2,Th71;
           p. =(d1,x,]<t by A3,1java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

        suppose        bound_QC-variables(()ubeing QC-symbol of A(,h  Element of
          hence p.i = (d1,[x,s])<-t by B1,B2,A2,Th72,Th23;
        end;
      end;
      henceA:t =uby A18XTUPLE_05;
    end;
A23:  & =pbyA18X:;
          thenP,,,]by A3,,A19,,A
    hence thesis by AA,A24:  [,,Kf]inY;
  end;


theorem Th42:
  for w being Element of Args(     q be  CQCWFF(A),x be bound_QC-variable of A(),
  st w is z-context_including &
  the_sort_of t = (the_arity_of o).(z-context_pos_in w)
  holds w+*(z-context_pos_in w,t) in Args(o,Free(S,Z))
  proof
    let w be Element of Args(o,Free(S,Z));
    let t be Element of Free(S,Z);
    assume
A1: w is z-context_including &
    the_sort_of t = (the_arity_of o).(z-context_pos_in w);
A2: dom (w+*(z-context_pos_in w,t)) = dom     t beQCsymbolof (), K be Element of Finbound_QC-variables((),
byFUNCT_7:0,MSUALG_62;
    then
A3: len (w+*(z-context_pos_in w,t)) = len the_arity_of o by FINSEQ_3:29;
    
      let i; assume
A4:   i in dom w;
      per cases;
      suppose i = z-context_pos_in w;
        then (w+*(z-context_pos_in w,t)).i = t &
 t  the_arity_of o)/.
        by A1,A2A28:[(,,Kf  pu,] and
        hence (w+*(z-context_pos_in w,t)).i in
        (the Sorts of Free(S,Z)).((the_arity_of o)/.i) by SORT;
      endjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
      suppose i <> z-context_pos_in w;
        then (w+*(    hence thesis by,d 4;
        hence (w+*(z-context_pos_in w,t)).i in
        (the Sorts of Free(S,Z)).((the_arity_of o)/.i) by    t be QC-symbol of A(), K be Element of Fin bound_QC-varia
end
    end;
    hence w+*( thenconsiderpbeingElementCQCWFFA), beingElementof Fin
  end;

theorem Th94:
  the_sort_of C9 = s1 implies
  for z1   q = p by A35XTUPLE_0:;
  for C1 being z-omitting context of z1 holds C1-sub(C9) is context of z
  proof
    assume
A1: the_sort_of C9 = s1;
    let z1 be z-different Element of Z.s1;
defpred[Element of FreeS,) means
    $1 is z-omitting implies ($1,[z1,s1])<-C9 is context of z;
A2: P[z1-term];
3 for o  k st k is z1-context_including
    holds P[z1-context_in k] implies
    for C being context of z1 st    enceP'ot t,]implies Pqt,f] by QC_LANG2:57java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
    proof let o; let k; set p = k;     [All(x,q),t,K,f] in SepQuadruples
A2:   k is z1-context_includinghence P[ll(x,)t,,]implies Pqt+, \/{}+( .->x.]by
   [1-ontext_in]
          let q qrt, such
      assume
AA:   C=o-term k;
      assume c: C is z-omitting;
      set t = C9;
      deffunc F(Nat) = (p/.$1,[z1,s1])<-t;
 qbeingFinSequence  that
A4:   len q = len p & for i st i in dom q holds q.i = F(i) from FINSEQ_1:sch 2;
A5:   dom q = dom p <> {} by A2,A4,FINSEQ_3:29;
      then
A6:   p is non empty & q is non empty;
A8:   dom p = dom the_arity_of o by MSUALG_6:2;
      then
A9:   len q = len the_arity_of o by A5,FINSEQ_3:29;
      nowthen (A  universal by QC_LANG1:def java.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54
        assume
B1:     i in dom q;
        then
B2:     p/.i = p.i by A5,        then r '&' q = VERUM(A) by QC_LANG2:79;
        per cases;
        suppose z1-context_pos_in p = i;
          then
B3:       z1-context_in p = p.i & q.i = Fgivenr suchthat
          by c,AA,A5,A4,A2,Th71,Th54q''r ) ,;
          p.i in (the Sorts of Free(:java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56
          end;
          then the_sort_of (z1-context_in p) = (the_arity_of o)/.i by B3,SORT assume ['ot q,,K,]in SepQuadruplesVERUM();
          hence q.i in (the Sorts of Free(S,Z)).((the_arity_of o)/.i)
          by A1,B2,B3,aaa1;
        end;
        suppose z1-context_pos_in p <end
          then p/.i is z1-omitting by A2,A5,B1,Th72;
          then q.i = F(i) = p.i by A4,B1,B2,Th23;
          hence q.i in (the Sorts of Free(S,Z)).((the_arity_of o)/.i)
          byB1,5A8,MSUALG_6:;

      end;
      then reconsider q as Element of Args(o,Free(S,Z)) by A9,MSAFREE2:5;
      now let i,d1; assume i in dom p & d1 = p.i;
        then q.i = F(i) & p/.i = d1 by A4,A5,PARTFUN1:def 6;
        q.i =(d1,[1s1)<t;
      end;
      then
A7:   (o-term p,[z1,s1])<-t = [o,the carrier of S]-tree q by A5,A6,ThL8
      .= o-term q;
      q is z-context_including
      proof
        take i = z1-context_pos_in p;
        thus i in dom q by A2,A5,Th71;
        then
B2:     p/.i = p.i by A5,PARTFUN1:def 6;
        z1-context_in p = p.i & q.i = F(i) & p/.i is z-omitting
        by c,AA,A5,A4,A2,Th71,Th54;
        hence   let Pbe QC-pred_symbol of k,;
        let j; let q1 be Element of Free(S,Z);
        assume
B4:     j in dom q & java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 9
        then
:/  . PARTFUN16java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
        p/.j is z1-omitting by A2,        +=tand
        then q1 = F(j)A5     All,qu,  (Pl or[(,)u,K\.
        hence q1 is        (,)is_subformula_of P!by A5,h35;
      end;
      hence thesis by AA,A7,Th53;
    end;
    let C1 be z-omitting context of z1;
    P[C1] from ContextInd(A2,A3);
    hence thesis by A1,SUB;
  end;

theorem Th43:
  for w,p being Element      end;
  st w is z  st w is z-context_including
  p = w+*(z-context_pos_in w, (z-context_in w)-sub(t)) &
  the_sort_of t = s
  holds C9-        then P isconjunctive by QC_LANG1:ef ;
  proof
     w, be Element  Args(,Free(S,));
    let t be Element of Free(S,Z);
    assume that
A1:wis z-ontext_including and
A2: C9 = o-term w and
A3: p = w+*(then ! negative by QC_LANG1: 19;
A4: the_sort_of t = s;
A5: dom     set p= Pl;
     v  ,q   as nonemptyDTree- FinSequencejava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
    now let i,d1; assume
6   i dom  & d1  .i
A7:   (z-context_in w)-sub(t) = (z-context_in w,[z,s])<-t by A4,SUB;
      per cases;
      suppose
A8:     i = hence thesis byA3,8,AAjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
d1  z-ontext_in w A1,A6Th71;
        hence q.i = (d1,[z,s])<-t by A3,A6,A7,A8,FUNCT_7:31;
      end;
      suppose
A8:     i <>   qt,Kf [,tKf   pholds
        then w/.i is z-omitting & w/.i = java.lang.StringIndexOutOfBoundsException: Range [0, 43) out of bounds for length 5
        then (d1,[z,s])<-t = d1 by Th23;
        hence q.i = (d1,[z,s])<-tA2:now
      end;
    end;
then(o,the carrier of S]treev[s]<t
    = [o,the carrier of S]-,  still_notbound_in  \{}byQC_LANG312;
    hence C9-sub(t) = o-term p by A2,A4,SUB;
  end;

theorem
  the_sort_of (C-sub t) = the_sort_of C by SORT;

theorem Lem13:
  t.a = [x,s] implies a java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 4
  proof
    assume Z0: t.a = [x,s];
      defpredP[lement  CQC-WFF()QCsymbol of A, Element of Fin
    reconsider v = t|q as Element of Free(S,X) by MSAFREE4:44;
    {} in (dom t)|q A1:forq,,K,  [not'qvK]  SepQuadruples p  P['ot'q,K,]
    then
A2: v.{} = t.(q^<*>NAT) by TREES_2:def 10;
    per cases by Th16;
    suppose ex o,p st v = o-term p;
      then considerthus[r,v+QuantNbrq,,f]
A1:   v = o-term p;
he of S]=v{ = [x,s] by Z0,A1,A2TREES_4:def 4;
      then s in the carrier of S = s by XTUPLE_0:1;
      hence a in Leaves dom t;
    end;
    suppose ex s1,x11    d;
      then consider s1,x11 such that
A1:   v = x11-term;
      reconsider r = <*0*> as FinSequence of NAT;
**> in dom t;
        then r in (dom t)|q = dom v by TREES_1:def 6,TREES_2:def     thus P,v++K\/{x.},+(x -- x.)]
        then <*0*> in {{}} by A1,TREES_1:29;
        hence contradiction;
      end;
      hence a in Leaves dom t by TREES_1:54;
    end
  end;

theorem Th45A:
 s0  SortSymbol of,x0 beingElementof .s0holds
  the_sort_of t = s & C is x0-omitting & t is x0-omitting implies
  C-sub t is x0-omitting
  proof
    lets0 SortSymbol of S
    let x0 be Element of X.s0;
    end;
    then
A1: C-sub t = (C,[x,s])<-t by SUB;
    assume Z1: Coim(C,[x0,s0]) = {};
    assume Z2: Coim(t,[x0,s0]) = {};
    assume Coim(C-sub t [0,0) < {};
    then consider a such that
A2: a in Coim(C-sub t, [x0,s0]) by XBOOLE_0:7;
A3: a in dom(C-sub t) & (C-theorem Th41:
    reconsider a as Element of dom(C-sub t) by A2,FUNCT_1:def 7;
:nowgiven  being Nodeof C,r being Node of t such that
B1      domC &C. =[,s]& a =q;
     Csub t)a= t. by A1,1TREES_4:def 7;
      hence contradiction by Z2,A3,FUNCT_1:def 7;
    end;
    per cases by A1,TREES_4:def 7;
    suppose
B3:   a inA2 Pq'' r, v, K];
C )=.a byTREES_47;
      hence contradiction by Z1,A3,B3,FUNCT_1:def 7;
    end;
    suppose
B2:   a in dom C       thesis by A2,3QC_LANG1:;
      then reconsider q = a as Node of C;
      reconsider r = {} as Node of t by TREES_1:22;
      q^r = a & q in Leaves dom C by B2,Lem13;
      hence contradiction by A5,B2;
    end;
    suppose ex q being Node of C, r being Node of t st
      q in Leaves dom C & C.q = [x,s] & a = q^r;
      hence contradiction by A5;
    end;
  end;

theorem Th46:
     
  the_sort_of (-ontext_in p  t )(x-context_pos_in )
  proof
    assume p is x-context_including;
thenxcontext_pos_in in dom p  the_arity_ofo &
    x-context_in p = p.(x-context_pos_in p) by Th71,      then  <v u=vby :1java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
    then (the_arity_of o)/.(x-context_pos_in p) =
    (the_arity_of o).(x-context_pos_in p) & x-context_in p in
    (the Sorts of Free(S,X)).((the_arity_of 
by :ef 6MSUALG_6:2;
    hence the_sort_of (x-context_in p) = (the_arity_of o).(x  ence ;
    by SORT;
th Th42:

theorem Th47:
  for A being disjoint_valued nonA1:[,tKf]in SepQuadruples and
  for B being non-empty MSAlgebraf:till_notbound_inq=f. s-bound_in  /K) by ,h38,
  for o being OperSymbol of S, p,q being Element of Args(o,A)
  for h being java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 12
  for i st i in dom p &   then x.u in f.:still_no orxin:   3java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
  proof
    let A be disjoint_valued non-empty MSAlgebra over S;
    let B be non-empty MSAlgebra over S;
    let o be OperSymbol of S;
    let p,q be Element of java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 8
 A,B;
    let a be Element of A;
    let i;
    assume Z0: i in dom p;
    assume Z1: q = p+*(  -   -bound_inSepVarp
A1: dom (h#q) = dom the_arity_of o = dom (h#p) = dom((h#p)+*(i,h.a))  -WFF(A)]meansjava.lang.StringIndexOutOfBoundsException: Range [44, 41) out of bounds for length 64
    dom q = dom the_arity_of o = dom p by   (((SepFunc(A)).$1 qua Element of Funcs([:QCA)java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
     letjbe ;
      assumeFuncs-A,bound_QCvariablesA)] quaElementof
A2:   j in dom (h#q);
      then reconsider k = j as Nat;
A3:   (h#q).k = h.((the_arity_of o)/.k).(q.k) &
      (h#p).k = h.((the_arity_of o)/.k).(p.k) by A1,A2,MSUALG_3:def 6;
      q.i = a by Z0,Z1A3:Pr;
so )(the_arity_ofo).),MSUALG_6:;
      then the_sort_of a = (the_arity_of o)/.i java.lang.StringIndexOutOfBoundsException: Range [0, 49) out of bounds for length 9
      then
A5:   h.((the_arity_of o)/.i).a = h.a by ABBR;
      per cases;
      suppose
A4:     j = i;
        hencehence thesis A4,3,7,,java.lang.StringIndexOutOfBoundsException: Range [37, 38) out of bounds for length 37
        .= ((h#p)+*(i,h.a)).j by A4,A5,A1,A2,java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 10
      end;
      suppose
: >;
        hence A9   .{.   =  i<l . bound_QC(A   java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
        .      
      end;
    end;
    hence h#q = (h#p)+*(i,h.a) by A1,FUNCT_1:2;
 java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6


  for t being Element of Free(S,Z) holds
  the_sort_of t = s implies
  (canonical_homomorphism R).(C9-sub(t))
  = (canonical_homomorphism R).(C9-sub @          . bound_QC( A11;
  proof let t be Element of Free(S,Z); assume
A1: the_sort_of t = s;
    set H =           hence thesis by A10,A11,A12,A13,A14,A15;
    defpred P[context of z] means
    H.($1-sub(t)) =         assume x in {i 1= & i< fl&f.in-A ;
1:the_sort_of (.) = (.)byLem00
    .= the_sort_of t by A18:   < len
B3iindomlby ,AFINSEQ_325;
    .= s by SORT;
A2: P[z-term]
    proof
B5:   dom(H**H) = (dom H)/\dom H = dom H = the carrier of S
      by PARTFUN1:def 2,PBOOLE:def 19;
        then
      H.s is Function of (the Sorts of Free(S,Z)).s, (the Sorts of R        . in{ljl .  bound_QC-variables()}
      by A1,SORT;
B4:   (z-term)-sub t = t & (z-term)-sub @(H.t) = H.t = H.s.t
B,ABBR
      hence H.((z-term)-sub t) = (H**H).s.t by MSAFREE4:48
      .= ((H.s)*(H.s)).t by B5,PBOOLE:def 19
      .= (H.s).((z-term)-sub @(H.t)) by B4,B6,FUNCT_2:15
      .=A23 
    end;
A3: now
      let       g=(SepFunc(). asFunctionof
      assume
A4:   p is z-context_including;
      assume
A5:   P[z-context_in p];
h
A6:   C = o-term p;
C2:   the_sort_of ((A27 UNIVERSALxg.uf  x,99 Def4java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
      the_sort_of (z-context_in p) = (the_arity_of o).(z-thus f.:(still_not-bound_in All(x, r)) = fu.:(still_not-bound_in
      by A4. fu:still_notbound_in)  x.}byA29Th4
      then reconsider w = p+*(z-context_pos_in p,(z-context_in p)-sub t) as
(SZ)byT
      Args(o,R) c= Args(o, Free(S,Z)) CQCWFFA).uf Element[(,
      then reconsider q = H#w, r = H#p as Element of Args(o,Free(S,Z));
C1:   the_sort_of       Element -FF() by ,;
C3:   the_sort_of ((z-context_in p)-sub @(H.t))
        (z-ontext_in )by SORT;
      reconsider m = p+*(z-    let ,ssuch that
      Element of Args(o,Free(S,Z)) by A4, [s;
A9:   q = r+*    
      by A5,A4,Th71,Th47
      .= H#m by A4,Th71,Th47;
      C-sub t = o-term w by A1,A4,A6,Th43;
      then
m w)by ABBR
       o.o-w)byTh8
      .= H.(the_result_sort_of o).(Den(o,Free(S,Z)).w) by MSAFREE4:13
      .DenoR.H)  : 10MSUALG_3:ef 7
      .= H.(the_result_sort_of o).-java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 63
      by A9,MSAFREE4. bound_in\ s A35A36R1
      .= H.(the_result_sort_of o).(o-term m) by MSAFREE4:13
      .= H.(the_sort_of (o-term m)).(o-term m) by Th8
      .= H.   CQC-(A).[f Element [QCsymbolsA,
      .= H.(C-sub @(H.t)) by C1,A4,A6,Th43;
      hence P[C];
    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    thus P[C9] from ContextInd(A2,A3);
;

definition
,sx
  let h be ManySortedFunction of Free(S,X), T;
  attr h is x-constant means: CNST:
  h.(x-term) = x-term &
  for s1 for x1 being Element of X.s1 st x1 <> x or     indexSepVarp)
  holds h.(x1-term) is x-omitting;
end;

theorem Th51:
 canonical_homomorphism T is x-constant
  proof set H = canonical_homomorphism T;
    thus H.(x-term) = x-term;
    let s1; let x1 be Element of X.s1;
    assume x1 <> x or s <> s1;
    then x1-term is x-omitting by ThC1;
    hence thesis;
  end;

registration
  let S,X,T,s,x;
  cluster x-constant for Homomorphism of Free(S,X), T;
  existence
  proof
    take canonical_homomorphism T;
    thus thesis by Th51;
  end;
end;

reserve h1 for x-constant Homomorphism of Free(S,X), T,
  h2 for y-constant Homomorphism of Free(S,Y), Q;

definition
  let x,y be object;
  func x<->y -> Function equals
  {[x,y],[y,x]};
  coherence
  proof set f = {[x,y],[y,x]};
    f is Function-like
    proof
      let a,b,c be object;
      assume [a,b] in f & [a,c] in f;
      then ([a,b] = [x,y] or [a,b] = [y,x]) & ([a,c] = [x,y] or [a,c] = [y,x])
      by TARSKI:def 2;
      then (a = x & b = y or a = y & b = x) & (a = x & c = y or a = y & c = x)
      by XTUPLE_0:1;
      hence thesis;
    end;
    hence thesis;
  end;
  commutativity;
end;

theorem LemS:
  dom (a<->b) = {a,b} & (a<->b).a = b & (a<->b).b = a & rng (a<->b) = {a,b}
  proof
    [a,b] in a<->b & [b,a] in a<->b by TARSKI:def 2;
    hence thesis by RELAT_1:10,FUNCT_1:1;
  end;

registration
  let A be non empty set;
  let a,b be Element of A;
  cluster a<->b -> A-valued A-defined;
  coherence
  proof
A1: {a,b} c= A;
    hence rng (a<->b) c= A by LemS;
    thus dom (a<->b) c= A by A1,LemS;
  end;
end;

definition
  let A be set, B be non empty set;
  let f be Function of A,B;
  let g be A-defined B-valued Function;
  redefine func f+*g -> Function of A,B;
  coherence
  proof
A1: dom g c= A & rng g c= B & dom f = A & rng f c= B
    by RELAT_1:def 19,FUNCT_2:def 1;
    then
A2: dom (f+*g) = dom f\/dom g = A by XBOOLE_1:12,FUNCT_4:def 1;
    rng (f+*g) c= rng f \/ rng g c= B \/ B by A1,XBOOLE_1:13,FUNCT_4:17;
    then rng (f+*g) c= B;
    hence thesis by A2,FUNCT_2:2;
  end;
end;

definition
  let I be non empty set;
  let A,B be ManySortedSet of I;
  let f be ManySortedFunction of A,B;
  let x be Element of I;
  let g be Function of A.x,B.x;
  redefine func f+*(x,g) -> ManySortedFunction of A,B;
  coherence
  proof
A3: dom f = I by PARTFUN1:def 2;
    reconsider h = f+*(x,g) as ManySortedSet of I;
    h is ManySortedFunction of A,B
    proof
      let a be object; assume a in I;
      per cases;
      suppose a = x;
        hence h.a is Function of A.a,B.a by A3,FUNCT_7:31;
      end;
      suppose a <> x;
        then h.a = f.a by FUNCT_7:32;
        hence thesis;
      end;
    end;
    hence thesis;
  end;
end;

definition
  let S,X, T;
  let s,x1,x2;
  func Hom(T,x1,x2) -> Endomorphism of T means: HOM:
  it.s.(x1-term) = x2-term & it.s.(x2-term) = x1-term &
  for s1 for y being Element of X.s1 st s1 <> s or y <> x1 & y <> x2
  holds it.s1.(y-term) = y-term;
  existence
  proof
    reconsider y1 = x1-term, y2 = x2-term as Element of (FreeGen T).s by Th119;
    set f = (id FreeGen T)+*(s,((id FreeGen T).s)+*(y1<->y2));
A8: dom id FreeGen T = the carrier of S by PARTFUN1:def 2;
    then
A5: f.s = ((id FreeGen T).s)+*(y1<->y2) by FUNCT_7:31;
A6: dom (y1<->y2) = {y1,y2} & y1 in {y1,y2} & y2 in{y1,y2}
    by LemS,TARSKI:def 2;
    f is ManySortedFunction of FreeGen T, the Sorts of T &
    FreeGen X = FreeGen T by MSAFREE4:22;
    then consider h being ManySortedFunction of T,T such that
A1: h is_homomorphism T,T & h || FreeGen T = f by MSAFREE4:def 9;
    reconsider h as Endomorphism of T by A1,MSUALG_6:def 2;
    take h;
    thus h.s.(x1-term) = ((h.s)|((FreeGen T).s)).(x1-term) by Th119,FUNCT_1:49
    .= (h||FreeGen T).s.(x1-term) by MSAFREE:def 1
    .= (y1<->y2).y1 by A1,A5,A6,FUNCT_4:13
    .= x2-term by LemS;
    thus h.s.(x2-term) = ((h.s)|((FreeGen T).s)).(x2-term) by Th119,FUNCT_1:49
    .= (h||FreeGen T).s.(x2-term) by MSAFREE:def 1
    .= (y1<->y2).y2 by A1,A5,A6,FUNCT_4:13
    .= x1-term by LemS;
    let s1; let y be Element of X.s1;
B5: y-term in (FreeGen T).s1 by Th119;
B6: h.s1.(y-term) = ((h.s1)|((FreeGen T).s1)).(y-term) by Th119,FUNCT_1:49
    .= (h||FreeGen T).s1.(y-term) by MSAFREE:def 1;
    assume s1 <> s or y <> x1 & y <> x2;
    then per cases;
    suppose s1 <> s;
      hence h.s1.(y-term) = ((id FreeGen T).s1).(y-term)
      by A1,B6,FUNCT_7:32
      .= (id ((FreeGen T).s1)).(y-term) by MSUALG_3:def 1
      .= y-term by B5,FUNCT_1:17;
    end;
    suppose
A7:   s1 = s & y <> x1 & y <> x2;
      then [y,s1] <> [x1,s] & [y,s1] <> [x2,s] by XTUPLE_0:1;
      then y-term <> x1-term & y-term <> x2-term by TREES_4:4;
      then
A9:   y-term nin {y1,y2} by TARSKI:def 2;
      thus h.s1.(y-term) = (((id FreeGen T).s1)+*(y1<->y2)).(y-term)
      by A1,A8,B6,A7,FUNCT_7:31
      .= ((id FreeGen T).s1).(y-term) by A6,A9,FUNCT_4:11
      .= (id ((FreeGen T).s1)).(y-term) by MSUALG_3:def 1
      .= y-term by B5,FUNCT_1:17;
    end;
  end;
  uniqueness
  proof let h1,h2 be Endomorphism of T such that
A1: h1.s.(x1-term) = x2-term & h1.s.(x2-term) = x1-term &
    for s1 for y being Element of X.s1 st s1 <> s or y <> x1 & y <> x2
    holds h1.s1.(y-term) = y-term and
A2: h2.s.(x1-term) = x2-term & h2.s.(x2-term) = x1-term &
    for s1 for y being Element of X.s1 st s1 <> s or y <> x1 & y <> x2
    holds h2.s1.(y-term) = y-term;
    set s0 = s;
A3: h1 is_homomorphism T,T & h2 is_homomorphism T,T by MSUALG_6:def 2;
    h1||FreeGen T = h2||FreeGen T
    proof
      let s;
      thus (h1||FreeGen T).s = (h2||FreeGen T).s
      proof
A6:     (h1||FreeGen T).s = (h1.s)|((FreeGen T).s) &
        (h2||FreeGen T).s = (h2.s)|((FreeGen T).s) by MSAFREE:def 1;
        let t being Element of (FreeGen T).s;
        t in (FreeGen T).s;
        then t in FreeGen(s,X) by MSAFREE:def 16;
        then consider x being set such that
A5:     x in X.s & t = root-tree [x,s] by MSAFREE:def 15;
        reconsider x as Element of X.s by A5;
A7:     (h1.s)|((FreeGen T).s).t = h1.s.t & (h2.s)|((FreeGen T).s).t = h2.s.t
        by FUNCT_1:49;
        per cases;
        suppose
A9:       x = x1 & s0 = s;
          hence (h1||FreeGen T).s.t = x2-term by A1,A5,A7,MSAFREE:def 1
          .= (h2||FreeGen T).s.t by A2,A5,A7,A9,MSAFREE:def 1;
        end;
        suppose
A9:       x = x2 & s0 = s;
          hence (h1||FreeGen T).s.t = x1-term by A1,A5,A7,MSAFREE:def 1
          .= (h2||FreeGen T).s.t by A2,A5,A7,A9,MSAFREE:def 1;
        end;
        suppose
A9:       x <> x1 & x <> x2 or s0 <> s;
          hence (h1||FreeGen T).s.t = x-term by A1,A5,A6,A7
          .= (h2||FreeGen T).s.t by A2,A5,A6,A7,A9;
        end;
      end;
    end;
    hence h1 = h2 by A3,EXTENS_1:19;
  end;
end;

theorem Th52:
  for h being Endomorphism of T st
  (for s,x holds h.s.(x-term) = x-term) holds h = id the Sorts of T
  proof
    let h be Endomorphism of T;
A1: id the Sorts of T is_homomorphism T,T by MSUALG_3:9;
A2: h is_homomorphism T,T by MSUALG_6:def 2;
    assume Z0: for s,x holds h.s.(x-term) = x-term;
    h||FreeGen T = (id the Sorts of T)||FreeGen T
    proof
      let s be SortSymbol of S;
      thus (h||FreeGen T).s = ((id the Sorts of T)||FreeGen T).s
      proof
        let t be Element of (FreeGen T).s;
A6:     (FreeGen T).s c= (the Sorts of T).s by PBOOLE:def 2,def 18;
        (FreeGen T).s = FreeGen(s,X) by MSAFREE:def 16;
        then consider x being set such that
A4:     x in X.s & t = root-tree [x,s] by MSAFREE:def 15;
        reconsider x as Element of X.s by A4;
        thus (h||FreeGen T).s.t = ((h.s)|((FreeGen T).s)).t by MSAFREE:def 1
        .= h.s.(x-term) by A4,FUNCT_1:49
        .= x-term by Z0
        .= (id ((the Sorts of T).s)).t by A4,A6,FUNCT_1:18
        .= ((id the Sorts of T).s).t by MSUALG_3:def 1
        .= (((id the Sorts of T).s)|((FreeGen T).s)).t by FUNCT_1:49
        .= ((id the Sorts of T)||FreeGen T).s.t by MSAFREE:def 1;
      end;
    end;
    hence h = id the Sorts of T by A1,A2,EXTENS_1:19;
  end;

theorem
  Hom(T,x,x) = id the Sorts of T
  proof
    set h = Hom(T,x,x);
    for s,x holds h.s.(x-term) = x-term
    proof
      let s1,x11;
      per cases;
      suppose s1 = s & x11 = x;
        hence h.s1.(x11-term) = x11-term by HOM;
      end;
      suppose s1 <> s or x11 <> x;
        hence thesis by HOM;
      end;
    end;
    hence thesis by Th52;
  end;

theorem Th56:
  Hom(T,x1,x2) = Hom(T,x2,x1)
  proof
    Hom(T,x2,x1).s.(x1-term) = x2-term & Hom(T,x2,x1).s.(x2-term) = x1-term &
    for s1 for y being Element of X.s1 st s1 <> s or y <> x1 & y <> x2
    holds Hom(T,x2,x1).s1.(y-term) = y-term by HOM;
    hence thesis by HOM;
  end;

theorem Th157:
  Hom(T,x1,x2)**Hom(T,x1,x2) = id the Sorts of T
  proof
    set h = Hom(T,x1,x2);
    for s,x holds (h**h).s.(x-term) = x-term
    proof
      let s1,x11;
A2:   (FreeGen T).s1 c= (the Sorts of T).s1 by PBOOLE:def 2,def 18;
A3:   x11-term in FreeGen(s1,X) = (FreeGen T).s1 by MSAFREE:def 15,def 16;
A4:   ((h.s1)*(h.s1)).(x11-term) = (h.s1).((h.s1).(x11-term))
      by A2,A3,FUNCT_2:15;
      per cases;
      suppose s1 = s & x11 = x1;
        then h.s1.(x11-term) = x2-term & h.s1.(x2-term) = x11-term by HOM;
        hence thesis by A4,MSUALG_3:2;
      end;
      suppose s1 = s & x11 = x2;
        then h.s1.(x11-term) = x1-term & h.s1.(x1-term) = x11-term by HOM;
        hence thesis by A4,MSUALG_3:2;
      end;
      suppose s1 <> s or x11 <> x1 & x11 <> x2;
        then h.s1.(x11-term) = x11-term by HOM;
        hence thesis by A4,MSUALG_3:2;
      end;
    end;
    hence thesis by Th52;
  end;

theorem Th78:
  r is x1-omitting x2-omitting implies Hom(T,x1,x2).r = r
  proof
    set s0 = s;
    defpred P[Element of T] means $1 is x1-omitting x2-omitting implies
    Hom(T,x1,x2).(the_sort_of $1).$1 = $1;
A1: for s,x,r st r = x-term holds P[r]
    proof
      let s,x,r;
      assume Z0: r = x-term;
      assume r is x1-omitting & r is x2-omitting;
      then x-term is x1-omitting x2-omitting by Z0;
      then (s0 <> s or x <> x1) & (s0 <> s or x <> x2);
      then Hom(T,x1,x2).s.r = r & the_sort_of @r = the_sort_of r
      by Z0,HOM,Lem00;
      hence Hom(T,x1,x2).(the_sort_of r).r = r by Z0,SORT;
    end;
A2: for o, p, r st r = o-term p &
      for t being Element of T st t in rng p holds P[t]
    holds P[r]
    proof
      let o, p, r;
      assume Z1: r = o-term p;
      assume Z2: for t being Element of T st t in rng p holds P[t];
      assume r is x1-omitting x2-omitting;
      then
Z4:   o-term p is x1-omitting x2-omitting by Z1;
A9:   the_sort_of @r = the_sort_of r by Lem00;
      then the_sort_of r = the_result_sort_of o by Z1,Th8;
      then
      o-term p in (the Sorts of T).the_result_sort_of o by Z1,SORT;
      then
A5:   Den(o,Free(S,X)).p in (the Sorts of T).the_result_sort_of o
      by MSAFREE4:13;
      then reconsider q = p as Element of Args(o,T) by MSAFREE4:def 8;
A7:   Den(o,T).q = Den(o,Free(S,X)).p = o-term p by A5,MSAFREE4:def 8,13;
A8:   Hom(T,x1,x2).(the_result_sort_of o).r = Den(o,T).(Hom(T,x1,x2)#q)
      by Z1,A7,MSUALG_3:def 7,MSUALG_6:def 2;
      q = Hom(T,x1,x2)#q
      proof
B1:     dom q = dom the_arity_of o = dom (Hom(T,x1,x2)#q) by MSUALG_3:6;
        hence len q = len (Hom(T,x1,x2)#q) by FINSEQ_3:29;
        let i; assume
B5:     1 <= i <= len q;
        then
B4:     i in dom q by FINSEQ_3:25;
        then
B2:     p/.i is x1-omitting x2-omitting & p/.i = p.i = q/.i & p.i in rng p
        by Z4,Th54,FUNCT_1:def 3,PARTFUN1:def 6;
        then q/.i is x1-omitting x2-omitting;
        then
B3:     Hom(T,x1,x2).(the_sort_of (q/.i)).(q/.i) = q/.i by Z2,B2;
        q/.i in (the Sorts of T).((the_arity_of o)/.i)
        by B1,B5,B2,FINSEQ_3:25,MSUALG_6:2;
        then the_sort_of (q/.i) = (the_arity_of o)/.i by SORT;
        hence q.i = (Hom(T,x1,x2)#q).i by B4,B2,B3,MSUALG_3:def 6;
      end;
      hence Hom(T,x1,x2).(the_sort_of r).r = r by Z1,A9,A7,A8,Th8;
    end;
    P[r] from TermAlgebraInd(A1,A2);
    hence thesis by ABBR;
  end;

registration
  let S,X,T,s,x;
  reduce (canonical_homomorphism T).s.(x-term) to x-term;
  reducibility
  proof
    x-term in T by Th24;
    then reconsider t = x-term as Element of T;
    the_sort_of (x-term) = s & the_sort_of t = the_sort_of @t by SORT,Lem00;
    then t in (the Sorts of T).s by SORT;
    hence thesis by MSAFREE4:47;
  end;
end;

theorem Th66:
  (canonical_homomorphism T)**Hom(Free(S,X),x,x1) =
  Hom(T,x,x1)**canonical_homomorphism T
  proof
    set H = canonical_homomorphism T;
    set h = Hom(T,x,x1);
    set g = Hom(Free(S,X),x,x1);
    defpred P[Element of Free(S,X)] means (H**g).$1 = (h**H).$1;
A1: for s,x holds P[x-term]
    proof
      let s1; let a be Element of X.s1;
      set r = a-term;
      the_sort_of r = s1 by SORT;
      then
B1:   (H**g).r = (H**g).s1.r & (h**H).r = (h**H).s1.r & H.r = H.s1.r by ABBR;
B2:   (H**g).s1 = (H.s1)*(g.s1) & (h**H).s1 = (h.s1)*(H.s1) by MSUALG_3:2;
B3:   (H**g).r = H.s1.(g.s1.r) & (h**H).r = h.s1.(H.s1.r) by B1,B2,FUNCT_2:15;
      per cases;
      suppose
C1:     s = s1 & a = x;
        then g.s1.r = x1-term & h.s1.r = x1-term by HOM;
        hence thesis by C1,B3;
      end;
      suppose
C2:     s = s1 & a = x1;
        then g.s1.r = x-term & h.s1.r = x-term by HOM;
        hence thesis by C2,B3;
      end;
      suppose
        s <> s1 or a <> x & a <> x1;
        then g.s1.r = r & h.s1.r = r by HOM;
        hence thesis by B3;
      end;
    end;
A2: for o being OperSymbol of S, p being Element of Args(o,Free(S,X))
    st for t being Element of Free(S,X) st t in rng p holds P[t]
    holds P[o-term p]
    proof
      let o be OperSymbol of S;
      let p be Element of Args(o,Free(S,X));
      assume Z0: for t being Element of Free(S,X) st t in rng p holds P[t];
A4:   Den(o,Free(S,X)).p = o-term p by MSAFREE4:13;
      set q = o-term p;
      set r = the_sort_of q;
A5:   r = the_result_sort_of o by Th8;
A10:  g is_homomorphism Free(S,X),Free(S,X) & h is_homomorphism T,T &
      H is_homomorphism Free(S,X),T by MSUALG_6:def 2,MSAFREE4:def 10;
A8:   (H**g)#p = (h**H)#p
      proof
A9:     dom ((H**g)#p) = dom the_arity_of o = dom ((h**H)#p) by MSUALG_3:6;
        hence len ((H**g)#p) = len ((h**H)#p) by FINSEQ_3:29;
        let i be Nat; assume
C0:     1 <= i <= len ((H**g)#p);
        then
C1:     i in dom ((H**g)#p) by FINSEQ_3:25;
C3:     dom p = dom the_arity_of o by MSUALG_6:2;
        then
C5:     p/.i = p.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
        by C0,A9,FINSEQ_3:25,PARTFUN1:def 6,MSUALG_6:2;
        then
C4:     the_sort_of (p/.i) = (the_arity_of o)/.i & p.i in rng p
        by A9,C1,C3,SORT,FUNCT_1:def 3;
        thus ((H**g)#p).i = ((H**g).((the_arity_of o)/.i)).(p/.i)
        by C0,C3,C5,A9,FINSEQ_3:25,MSUALG_3:def 6
        .= (H**g).(p/.i) by C4,ABBR
        .= (h**H).(p/.i) by Z0,C4,C5
        .= ((h**H).((the_arity_of o)/.i)).(p/.i) by C4,ABBR
        .= ((h**H)#p).i by C0,C3,C5,A9,FINSEQ_3:25,MSUALG_3:def 6;
      end;
      thus (H**g).q = (H**g).r.q by ABBR
      .= Den(o,T).((h**H)#p) by A8,A4,A5,A10,MSUALG_3:10,def 7
      .= (h**H).r.q by A4,A5,A10,MSUALG_3:10,def 7
      .= (h**H).q by ABBR;
    end;
    let s;
    thus (H**g).s = (h**H).s
    proof
      let t be Element of (the Sorts of Free(S,X)).s;
A3:   P[t] from TermInd(A1,A2);
      the_sort_of t = s by SORT;
      then (H**g).t = (H**g).s.t & (h**H).t = (h**H).s.t by ABBR;
      hence thesis by A3;
    end;
  end;

theorem
  for r being Element of T,s holds
  Hom(T,x1,x2).s.r = ((canonical_homomorphism T)**Hom(Free(S,X),x1,x2)).s.r
  proof let r be Element of T,s;
    the Sorts of T is MSSubset of Free(S,X) by MSAFREE4:def 6;
    then
A1: (the Sorts of T).s c= (the Sorts of Free(S,X)).s
    by PBOOLE:def 2,def 18;
    ((canonical_homomorphism T)**Hom(Free(S,X),x1,x2)).s.r =
    (Hom(T,x1,x2)**canonical_homomorphism T).s.r =
    ((Hom(T,x1,x2).s)*((canonical_homomorphism T).s)).r =
    (Hom(T,x1,x2).s).((canonical_homomorphism T).s.r) =
    Hom(T,x1,x2).s.r by A1,Th66,MSUALG_3:2,FUNCT_2:15,MSAFREE4:47;
    hence thesis;
  end;

theorem
   x1 <> x2 & t is x2-omitting implies  Hom(Free(S,X),x1,x2).t is x1-omitting
  proof
    assume
A0: x1 <> x2;
    set T = Free(S,X);
    set h = Hom(T,x1,x2);
    set s0 = s;
    defpred P[Element of T] means
    $1 is x2-omitting implies h.$1 is x1-omitting;
A1: for s,x holds P[x-term]
    proof
      let s,x;
      set r = x-term;
      assume Z1: r is x2-omitting;
      per cases;
      suppose
A2:     s0 <> s or x1 <> x & x2 <> x;
        then Hom(T,x1,x2).s.r = r & the_sort_of @r = the_sort_of r
        by HOM;
        then Hom(T,x1,x2).(the_sort_of r).r = r & x-term is x1-omitting
        by A2,SORT,ThC1;
        hence h.r is x1-omitting by ABBR;
      end;
      suppose
        s0 = s & x1 = x;
        then h.s.r = x2-term & the_sort_of @r = the_sort_of r by HOM;
        then
A4:     h.(the_sort_of r).r = x2-term by SORT;
        x2-term is x1-omitting by A0,ThC1;
        hence h.r is x1-omitting by A4,ABBR;
      end;
      suppose
A3:     s0 = s & x2 = x;
        thus h.r is x1-omitting by Z1,A3;
      end;
    end;
A2: for o, p st for t being Element of T st t in rng p holds P[t]
    holds P[o-term p]
    proof
      let o, p;
      set r = o-term p;
      assume Z2: for t being Element of T st t in rng p holds P[t];
      assume
S4:   r is x2-omitting;
A6:   the_sort_of r = the_result_sort_of o by Th8;
      reconsider q = p as Element of Args(o,T);
      reconsider m = h#q as Element of Args(o,Free(S,X));
A7:   Den(o,T).q = Den(o,Free(S,X)).p = o-term p by MSAFREE4:13;
A9:   h.(the_result_sort_of o).r = Den(o,Free(S,X)).m
      by A7,MSUALG_3:def 7,MSUALG_6:def 2
      .= o-term m by MSAFREE4:13;
      now let i; assume
B1:     i in dom m;
B2:     dom m = dom the_arity_of o = dom p by MSUALG_3:6;
        then
B3:     p.i in rng p & p/.i = p.i = q/.i by B1,FUNCT_1:def 3,PARTFUN1:def 6;
        q/.i in (the Sorts of T).((the_arity_of o)/.i) by B1,B2,B3,MSUALG_6:2;
        then
B5:     the_sort_of (q/.i) = (the_arity_of o)/.i by SORT;
        m/.i = m.i = h.((the_arity_of o)/.i).(q/.i)
        by B1,PARTFUN1:def 6,B2,B3,MSUALG_3:def 6;
        then h.(q/.i) = m/.i & p/.i is x2-omitting by B1,B2,S4,B5,ABBR,Th54;
        hence m/.i is x1-omitting by B3,Z2;
      end;
      then o-term m is x1-omitting by Th54;
      hence h.r is x1-omitting by A6,A9,ABBR;
    end;
    thus P[t] from TermInd(A1,A2);
  end;

theorem Th3A:
  for A being finite Subset of Union the Sorts of Free(S,Y)
  ex y st for v st v in A holds v is y-omitting
  proof
    let A be finite Subset of Union the Sorts of Free(S,Y);
    set I = union {vf v: v in A};
A0: A is finite;
    deffunc F(Element of Free(S,Y)) = vf $1;
A1: {F(v): v in A} is finite from FRAENKEL:sch 21(A0);
    now let a be set; assume a in {F(v): v in A};
      then ex v st a = F(v) & v in A;
      hence a is finite;
    end;
    then reconsider I as finite set by A1,FINSET_1:7;
    set y = the Element of Y.s \ I;
    reconsider y as Element of Y.s;
    take y;
    let v;
    assume v in A;
    then F(v) in {F(v1): v1 in A};
    then y nin I & F(v) c= I by XBOOLE_0:def 5,ZFMISC_1:74;
    hence v is y-omitting by Th92;
  end;

definition
  let S,X,T;
  attr T is struct-invariant means
  for o for p being Element of Args(o,T) st Den(o,T).p = Den(o,Free(S,X)).p
  for s,x1,x2 holds
  Den(o,T).(Hom(T,x1,x2)#p) = Den(o,Free(S,X)).(Hom(T,x1,x2)#p);
end;

theorem
  T is struct-invariant implies for r being Element of T,s holds
  Hom(T,x1,x2).s.r = Hom(Free(S,X),x1,x2).s.r
  proof assume
AA: for o for p being Element of Args(o,T) st Den(o,T).p = Den(o,Free(S,X)).p
    for s,x1,x2 holds
    Den(o,T).(Hom(T,x1,x2)#p) = Den(o,Free(S,X)).(Hom(T,x1,x2)#p);
    set h = Hom(T,x1,x2);
    set g = Hom(Free(S,X),x1,x2);
    defpred P[Element of T] means
    h.(the_sort_of $1).$1 = g.(the_sort_of $1).$1;
A1: for s,x,r st r = x-term holds P[r]
    proof let s1,x11,r; assume
A2:   r = x11-term;
      then
A3:   the_sort_of r = the_sort_of @r = s1 by SORT,Lem00;
      per cases;
      suppose s = s1 & x11 = x1;
        then h.s1.r = x2-term & g.s1.r = x2-term by A2,HOM;
        hence thesis by A3;
      end;
      suppose s = s1 & x11 = x2;
        then h.s1.r = x1-term & g.s1.r = x1-term by A2,HOM;
        hence thesis by A3;
      end;
      suppose s <> s1 or x11 <> x1 & x11 <> x2;
        then h.s1.r = r & g.s1.r = r by A2,HOM;
        hence thesis by A3;
      end;
    end;
A4: for o,p,r st r = o-term p &
    for t being Element of T st t in rng p holds P[t]
    holds P[r]
    proof
      let o,p,r;
      assume Z0: r = o-term p;
      assume Z1: for t being Element of T st t in rng p holds P[t];
A6:   r = Den(o,Free(S,X)).p by Z0,MSAFREE4:13;
A7:   r in (the Sorts of T).the_sort_of r &
      the_sort_of r = the_sort_of @r = the_result_sort_of o
      by Z0,SORT,Lem00;
      then reconsider q = p as Element of Args(o,T) by A6,MSAFREE4:def 8;
      r = Den(o,T).q by A6,A7,MSAFREE4:def 8;
      then
A8:   Den(o,T).(Hom(T,x1,x2)#q) = Den(o,Free(S,X)).(Hom(T,x1,x2)#q)
      by AA,A6;
      g#p = h#q
      proof
B1:     dom (g#p) = dom the_arity_of o = dom (h#q) by MSUALG_3:6;
        hence len (g#p) = len (h#q) by FINSEQ_3:29;
        let i be Nat; assume
C0:     1 <= i <= len(g#p);
        then
C1:     i in dom(g#p) by FINSEQ_3:25;
C3:     dom p = dom the_arity_of o by MSUALG_6:2;
        then
C5:     q/.i = q.i in (the Sorts of T).((the_arity_of o)/.i)
        by C0,B1,PARTFUN1:def 6,FINSEQ_3:25,MSUALG_6:2;
        then
C4:     the_sort_of (q/.i) = (the_arity_of o)/.i & p.i in rng p
        by B1,C1,C3,SORT,FUNCT_1:def 3;
        thus ((g)#p).i = ((g).((the_arity_of o)/.i)).(q/.i)
        by C0,C3,C5,B1,FINSEQ_3:25,MSUALG_3:def 6
        .= ((h).((the_arity_of o)/.i)).(q/.i) by C4,C5,Z1
        .= ((h)#q).i by C0,C3,C5,B1,FINSEQ_3:25,MSUALG_3:def 6;
      end;
      then g.(the_result_sort_of o).r = Den(o,Free(S,X)).(h#q)
      by A6,MSUALG_6:def 2,MSUALG_3:def 7
      .= h.(the_result_sort_of o).(Den(o,T).q)
      by A8,MSUALG_6:def 2,MSUALG_3:def 7
      .= h.(the_result_sort_of o).r by A6,A7,MSAFREE4:def 8;
      hence P[r] by A7;
    end;
    let r be Element of T,s;
A9: P[r] from TermAlgebraInd(A1,A4);
    the_sort_of r = s by SORT;
    hence thesis by A9;
  end;

theorem Th79:
  T is struct-invariant & x1 <> x2 & r is x2-omitting implies
  Hom(T,x1,x2).r is x1-omitting
  proof assume that
AA: for o for p being Element of Args(o,T) st Den(o,T).p = Den(o,Free(S,X)).p
    for s,x1,x2 holds
    Den(o,T).(Hom(T,x1,x2)#p) = Den(o,Free(S,X)).(Hom(T,x1,x2)#p) and
A0: x1 <> x2;
    set h = Hom(T,x1,x2);
    set s0 = s;
    defpred P[Element of T] means
    $1 is x2-omitting implies h.$1 is x1-omitting;
A1: for s,x,r st r = x-term holds P[r]
    proof
      let s,x,r;
      assume Z0: r = x-term;
      assume Z1: r is x2-omitting;
      per cases;
      suppose
A2:     s0 <> s or x1 <> x & x2 <> x;
        then Hom(T,x1,x2).s.r = r & the_sort_of @r = the_sort_of r
        by Z0,HOM,Lem00;
        then Hom(T,x1,x2).(the_sort_of r).r = r & x-term is x1-omitting
        by A2,Z0,SORT,ThC1;
        hence h.r is x1-omitting by Z0,ABBR;
      end;
      suppose
        s0 = s & x1 = x;
        then h.s.r = x2-term & the_sort_of @r = the_sort_of r by Z0,HOM,Lem00;
        then
A4:     h.(the_sort_of r).r = x2-term by Z0,SORT;
        x2-term is x1-omitting by A0,ThC1;
        hence h.r is x1-omitting by A4,ABBR;
      end;
      suppose
A3:     s0 = s & x2 = x;
        x2-term is non x2-omitting;
        hence h.r is x1-omitting by Z0,Z1,A3;
      end;
    end;
A2: for o, p, r st r = o-term p &
      for t being Element of T st t in rng p holds P[t]
    holds P[r]
    proof
      let o, p, r;
      assume Z1: r = o-term p;
      assume Z2: for t being Element of T st t in rng p holds P[t];
      assume r is x2-omitting;
      then
S3:   o-term p is x2-omitting by Z1;
      the_sort_of @r = the_sort_of r by Lem00;
      then
A6:   the_sort_of r = the_result_sort_of o by Z1,Th8;
      then o-term p in (the Sorts of T).the_result_sort_of o by Z1,SORT;
      then
A5:   Den(o,Free(S,X)).p in (the Sorts of T).the_result_sort_of o
      by MSAFREE4:13;
      then reconsider q = p as Element of Args(o,T) by MSAFREE4:def 8;
      Args(o,T) c= Args(o,Free(S,X)) by MSAFREE4:41;
      then reconsider m = h#q as Element of Args(o,Free(S,X));
A7:   Den(o,T).q = Den(o,Free(S,X)).p = o-term p by A5,MSAFREE4:def 8,13;
A9:   h.(the_result_sort_of o).r = Den(o,T).(h#q)
      by Z1,A7,MSUALG_3:def 7,MSUALG_6:def 2
      .= Den(o,Free(S,X)).m by AA,A7 .= o-term m by MSAFREE4:13;
      now let i; assume
B1:     i in dom m;
B2:     dom m = dom the_arity_of o = dom p by MSUALG_3:6;
        then
B3:     p.i in rng p & p/.i = p.i = q/.i by B1,FUNCT_1:def 3,PARTFUN1:def 6;
        then
B4:     P[q/.i] by Z2;
        q/.i in (the Sorts of T).((the_arity_of o)/.i) by B1,B2,B3,MSUALG_6:2;
        then
B5:     the_sort_of (q/.i) = (the_arity_of o)/.i by SORT;
        m/.i = m.i = h.((the_arity_of o)/.i).(q/.i)
        by B1,PARTFUN1:def 6,B2,B3,MSUALG_3:def 6;
        then h.(q/.i) = m/.i & p/.i is x2-omitting by B1,B2,S3,B5,ABBR,Th54;
        hence m/.i is x1-omitting by B3,B4,OMIT;
      end;
      then o-term m is x1-omitting by Th54;
      hence h.r is x1-omitting by A9,A6,ABBR;
    end;
    thus P[r] from TermAlgebraInd(A1,A2);
  end;

theorem Th68:
  Q is struct-invariant & v is y-omitting implies
  (canonical_homomorphism Q).v is y-omitting
  proof assume
AA: Q is struct-invariant;
    assume Z0: v is y-omitting;
    set H = canonical_homomorphism Q;
    assume Z1: H.v is non y-omitting;
    reconsider Hv = H.v as Element of Free(S,Y) by MSAFREE4:39;
    consider x being Element of Y.s such that
A1: for v1 st v1 in {v,Hv} holds v1 is x-omitting by Th3A;
    v in {v,Hv} & Hv in {v,Hv} by TARSKI:def 2;
    then
A2: v is x-omitting & Hv is x-omitting by A1;
    then
A4: x <> y & H.v is x-omitting by Z1;
A3: Hom(Q,x,y).(H.v) = (Hom(Q,x,y)**H).v by Th14
    .= (H**Hom(Free(S,Y),x,y)).v by Th66
    .= H.(Hom(Free(S,Y),x,y).v) by Th14
    .= H.v by Z0,A2,Th78;
    Hom(Q,x,y) = Hom(Q,y,x) by Th56;
    hence thesis by Z1,A3,AA,A4,Th79;
  end;

theorem Th77:
  Q is struct-invariant implies
  for p being Element of Args(o,Q) st
  for t being Element of Q st t in rng p holds t is y-omitting
  for t being Element of Q st t = Den(o,Q).p holds t is y-omitting
  proof assume ZZ: Q is struct-invariant;
    let p be Element of Args(o,Q);
    assume Z0: for t being Element of Q st t in rng p holds
    t is y-omitting;
    let t be Element of Q;
    assume t = Den(o,Q).p;
    then
A1: t = (canonical_homomorphism Q).(the_result_sort_of o).(Den(o,Free(S,Y)).p)
    by MSAFREE4:67;
    Args(o,Q) c= Args(o, Free(S,Y)) by MSAFREE4:41;
    then reconsider q = p as Element of Args(o,Free(S,Y));
A2: Den(o,Free(S,Y)).q = o-term q by MSAFREE4:13;
    now let v; assume
A5:   v in rng p;
      then reconsider d = v as Element of Q by RELAT_1:167;
      d is y-omitting by Z0,A5;
      hence v is y-omitting;
    end;
    then
A3: o-term q is y-omitting by Th54A;
    the_sort_of (o-term q) = the_result_sort_of o by Th8;
    then t = (canonical_homomorphism Q).(o-term q) by A1,A2,ABBR;
    hence thesis by ZZ,A3,Th68;
  end;

theorem
  Q is struct-invariant & v is y-omitting implies h2.v is y-omitting
  proof assume
Z0: Q is struct-invariant;
    defpred P[Element of Free(S,Y)] means
    $1 is y-omitting implies h2.$1 is y-omitting;
    set x0 = y; set s0 = s;
A1: for s, y holds P[y-term]
    proof let s,y; assume y-term is x0-omitting;
      then x0 <> y or s <> s0;
      hence thesis by CNST;
    end;
A2: for o, q st for v st v in rng q holds P[v]
    holds P[o-term q]
    proof
      let o, q;
      assume Z3: for v st v in rng q holds P[v];
      assume
Z4:   o-term q is y-omitting;
      canonical_homomorphism Q is_homomorphism Free(S,Y),Q by MSAFREE4:def 10;
      then
A3:   h2 is_homomorphism Free(S,Y),Q by HOMO;
      the_sort_of (o-term q) = the_result_sort_of o by Th8;
      then
A4:   h2.(o-term q) = h2.(the_result_sort_of o).(o-term q) by ABBR
      .= h2.(the_result_sort_of o).(Den(o,Free(S,Y)).q) by MSAFREE4:13
      .= Den(o,Q).(h2#q) by A3,MSUALG_3:def 7;
      for t being Element of Q st t in rng (h2#q) holds t is y-omitting
      proof
        let t be Element of Q;
A5:     dom q = dom the_arity_of o = dom (h2#q) by MSUALG_3:6;
        assume t in rng (h2#q);
        then consider i being object such that
A6:     i in dom q & t = (h2#q).i by A5,FUNCT_1:def 3;
        reconsider i as Nat by A6;
A8:     q.i = q/.i by A6,PARTFUN1:def 6;
        then q/.i in (the Sorts of Free(S,Y)).((the_arity_of o)/.i)
        by A5,A6,MSUALG_6:2;
        then
A7:     the_sort_of (q/.i) = (the_arity_of o)/.i by SORT;
A9:     t = h2.((the_arity_of o)/.i).(q/.i) by A6,A8,MSUALG_3:def 6
        .= h2.(q/.i) by A7,ABBR;
        q/.i is y-omitting & q/.i in rng q by Z4,A6,A8,Th54,FUNCT_1:def 3;
        hence t is y-omitting by A9,Z3;
      end;
      hence h2.(o-term q) is y-omitting by Z0,A4,Th77;
    end;
    thus P[v] from TermInd(A1,A2);
  end;

theorem Th112:
  for R being NF-var terminating with_UN_property invariant stable
  ManySortedRelation of Free(S,X)
  holds
  (for t being Element of NFAlgebra R holds
  Hom(Free(S,X),x1,x2).(the_sort_of t).t = Hom(NFAlgebra R, x1,x2).t) &
  Hom(Free(S,X),x1,x2)||NForms R = Hom(NFAlgebra R, x1,x2)
  proof
    let R be NF-var terminating with_UN_property invariant stable
    ManySortedRelation of Free(S,X);
    set F = Free(S,X);
    set T = NFAlgebra R;
    set HF = Hom(F,x1,x2);
    set HN = Hom(T,x1,x2);
    set N = NForms R;
    defpred P[Element of T] means HF.(the_sort_of $1).$1 = HN.$1;
A1: for s being SortSymbol of S, x being Element of X.s
    for r being Element of T st r = x-term holds P[r]
    proof set s0 = s;
      let s be SortSymbol of S;
      let x be Element of X.s;
      let r be Element of T;
      assume Z0: r = x-term;
      then
A2:   the_sort_of r = the_sort_of @r = s by SORT,Lem00;
      per cases;
      suppose s0 = s & x1 = x;
        then HF.(the_sort_of r).r = x2-term = HN.(the_sort_of r).r
        by Z0,A2,HOM;
        hence P[r] by ABBR;
      end;
      suppose s0 = s & x2 = x;
        then HF.(the_sort_of r).r = x1-term = HN.(the_sort_of r).r
        by Z0,A2,HOM;
        hence P[r] by ABBR;
      end;
      suppose s0 <> s or x1 <> x & x2 <> x;
        then HF.(the_sort_of r).r = r = HN.(the_sort_of r).r by Z0,A2,HOM;
        hence P[r] by ABBR;
      end;
    end;
A2: for o being OperSymbol of S, p being Element of Args(o,Free(S,X))
    for r being Element of T st r = o-term p &
      for t being Element of T st t in rng p holds P[t]
      holds P[r]
    proof
      let o be OperSymbol of S;
      let p be Element of Args(o,Free(S,X));
      let r be Element of T;
      assume Z1: r = o-term p;
      then
A3:   the_sort_of r = the_sort_of @r = the_result_sort_of o by Lem00,Th8;
      assume Z2: for t being Element of T st t in rng p holds P[t];
A4:   HF is_homomorphism Free(S,X),Free(S,X) & o-term p = Den(o,Free(S,X)).p
      by MSUALG_6:def 2,MSAFREE4:13;
      then
A6:   HF.(the_sort_of r).r = Den(o,Free(S,X)).(HF#p)
      by Z1,A3,MSUALG_3:def 7;
A7:   r in (the Sorts of T).the_result_sort_of o by A3,SORT;
      then
A5:   p in Args(o,T) & Den(o,T).p = o-term p by A4,Z1,MSAFREE4:def 8;
      reconsider q = p as Element of Args(o,T) by A7,A4,Z1,MSAFREE4:def 8;
      HN.(the_sort_of r).r = Den(o,T).(HN#q)
      = nf (Den(o,Free(S,X)).(HN#q), R.the_result_sort_of o)
      by Z1,A3,A5,MSUALG_3:def 7,MSAFREE4:def 20,MSUALG_6:def 2;
      then HN.(the_sort_of r).r is_a_normal_form_of Den(o,Free(S,X)).(HN#q),
      R.the_result_sort_of o by REWRITE1:54;
      then
      R.the_result_sort_of o reduces Den(o,Free(S,X)).(HN#q),
      HN.(the_sort_of r).r;
      then consider m being RedSequence of R.the_result_sort_of o such that
C1:   m.1 = Den(o,Free(S,X)).(HN#q) & m.len m = HN.(the_sort_of r).r;
C2:   HF#p = HN#q
      proof
B1:     dom (HF#p) = dom the_arity_of o = dom (HN#q) &
        dom p = dom the_arity_of o = dom q by MSUALG_3:6;
        hence len (HF#p) = len (HN#q) by FINSEQ_3:29;
        let i; assume
B0:     1 <= i <= len (HF#p);
        then i in dom (HF#p) by FINSEQ_3:25;
        then
B3:     p.i in rng p & q.i in rng q by B1,FUNCT_1:def 3;
        then reconsider t = q.i as Element of T by RELAT_1:167;
A8:     p.i = p/.i & q.i = q/.i by B1,B0,FINSEQ_3:25,PARTFUN1:def 6;
        then p/.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i) &
        q/.i in (the Sorts of T).((the_arity_of o)/.i)
        by B1,B0,FINSEQ_3:25,MSUALG_6:2;
        then
A7:     the_sort_of (p/.i) = (the_arity_of o)/.i = the_sort_of (q/.i) by SORT;
        thus (HF#p).i = (HF.((the_arity_of o)/.i)).(p/.i)
        by B1,B0,A8,FINSEQ_3:25,MSUALG_3:def 6
        .= HN.t by Z2,B3,A7,A8
        .= (HN.((the_arity_of o)/.i)).(q.i) by A7,A8,ABBR
        .= (HN#q).i by B1,B0,FINSEQ_3:25,MSUALG_3:def 6;
      end;
      assume not P[r];
      then
AA:   len m <> 1 & len m >= 0+1 by C1,C2,A6,ABBR,NAT_1:13;
      then len m > 1 by XXREAL_0:1;
      then len m >= 1+1 by NAT_1:13;
      then 1 in dom m & 1+1 in dom m by AA,FINSEQ_3:25;
      then [m.1,m.2] in R.the_result_sort_of o by REWRITE1:def 2;
      then
AB:   [HF.(the_result_sort_of o).(m.1),HF.(the_result_sort_of o).(m.2)]
      in R.the_result_sort_of o by MSUALG_6:def 9;
      HF.(the_result_sort_of o).(m.1)
      = ((HF.(the_result_sort_of o))*HF.(the_result_sort_of o)).
      (Den(o,Free(S,X)).p) by A3,A4,A6,Z1,C1,C2,FUNCT_2:15
      .= ((HF**HF).(the_result_sort_of o)).(Den(o,Free(S,X)).p) by MSUALG_3:2
      .= (id the Sorts of Free(S,X)).(the_result_sort_of o).
      (Den(o,Free(S,X)).p) by Th157
      .= (id ((the Sorts of Free(S,X)).(the_result_sort_of o))).(o-term p)
      by A4,MSUALG_3:def 1
      .= nf (Den(o,Free(S,X)).q, R.the_result_sort_of o) by A5,MSAFREE4:def 20;
      then HF.(the_result_sort_of o).(m.1) is_a_normal_form_of
      Den(o,Free(S,X)).q, R.(the_result_sort_of o) by REWRITE1:54;
      then HF.(the_result_sort_of o).(m.1) is_a_normal_form_wrt
      R.(the_result_sort_of o);
      hence thesis by AB;
    end;
    hereby let t be Element of T;
      thus P[t] from TermAlgebraInd(A1,A2);
    end;
    set s0 = s;
    let s;
    thus (Hom(Free(S,X),x1,x2)||NForms R).s = Hom(NFAlgebra R, x1,x2).s
    proof
      thus (NForms R).s = (the Sorts of T).s by MSAFREE4:def 20;
      let a be Element of (NForms R).s;
      reconsider t = a as Element of T,s by MSAFREE4:def 20;
      P[t] from TermAlgebraInd(A1,A2);
      then
AD:   HF.(the_sort_of t).t = HN.(the_sort_of t).t by ABBR;
AE:   the_sort_of t = s by SORT;
      thus (HF||N).s.a = ((HF.s)|(N.s)).a by MSAFREE:def 1
      .= HN.s.a by AD,AE,FUNCT_1:49;
    end;
  end;

theorem Th113:
  for R being NF-var terminating with_UN_property invariant stable
  ManySortedRelation of Free(S,X) holds
  i in dom p & R.((the_arity_of o)/.i) reduces t1,t2 implies
  R.the_result_sort_of o reduces Den(o,Free(S,X)).(p+*(i,t1)),
  Den(o,Free(S,X)).(p+*(i,t2))
  proof
    let R be NF-var terminating with_UN_property invariant stable
    ManySortedRelation of Free(S,X);
    assume
A1: i in dom p & R.((the_arity_of o)/.i) reduces t1,t2;
    then consider r being RedSequence of R.((the_arity_of o)/.i) such that
A2: r.1 = t1 & r.len r = t2;
    defpred P[Nat] means $1 <= len r implies R.the_result_sort_of o reduces
    Den(o,Free(S,X)).(p+*(i,t1)), Den(o,Free(S,X)).(p+*(i,r.$1));
A3: P[1] by A2,REWRITE1:12;
A4: for i st 1 <= i & P[i] holds P[i+1]
    proof let k be Nat; assume
A5:   1 <= k & P[k] & k+1 <= len r;
      k < len r & 1 <= k+1 by A5,NAT_1:13;
      then k in dom r & k+1 in dom r by A5,FINSEQ_3:25;
      then
A7:   [r.k, r.(k+1)] in R.((the_arity_of o)/.i) by REWRITE1:def 2;
      then reconsider rk = r.k, rk1 = r.(k+1) as Element of
      (the Sorts of Free(S,X)).((the_arity_of o)/.i) by ZFMISC_1:87;
      reconsider p1 = p+*(i,rk), p2 = p+*(i,rk1) as
      Element of Args(o,Free(S,X)) by MSUALG_6:7;
      set h = transl(o,i,p,Free(S,X));
A10:  dom p1 = dom the_arity_of o = dom p by MSUALG_6:2;
      h.rk = Den(o,Free(S,X)).p1 & h.rk1 = Den(o,Free(S,X)).p2
      by MSUALG_6:def 4;
      then [Den(o,Free(S,X)).p1, Den(o,Free(S,X)).p2] in R.the_result_sort_of o
      by A7,A1,A10,MSUALG_6:def 5,def 8;
      then R.the_result_sort_of o reduces
      Den(o,Free(S,X)).p1, Den(o,Free(S,X)).p2 by REWRITE1:15;
      hence R.the_result_sort_of o reduces
      Den(o,Free(S,X)).(p+*(i,t1)), Den(o,Free(S,X)).(p+*(i,r.(k+1)))
      by A5,NAT_1:13,REWRITE1:16;
    end;
A5: 0+1 <= len r by NAT_1:13;
    for i st i >= 1 holds P[i] from NAT_1:sch 8(A3,A4);
    hence R.the_result_sort_of o reduces Den(o,Free(S,X)).(p+*(i,t1)),
    Den(o,Free(S,X)).(p+*(i,t2)) by A2,A5;
  end;

theorem Th90:
  for R being NF-var terminating with_UN_property invariant stable
  ManySortedRelation of Free(S,X)
  for t holds R.the_sort_of t reduces t, (canonical_homomorphism NFAlgebra R).t
  proof
    let R be NF-var terminating with_UN_property invariant stable
    ManySortedRelation of Free(S,X);
    let t;
    set T = NFAlgebra R;
    set H = canonical_homomorphism T;
    defpred P[Element of Free(S,X)] means R.the_sort_of $1 reduces $1,H.$1;
A1: for s,x holds P[x-term] by REWRITE1:12;
A2: for o,p st for t st t in rng p holds P[t] holds P[o-term p]
    proof
      let o,p;
      assume Z0: for t st t in rng p holds P[t];
A3:   o-term p = Den(o,Free(S,X)).p by MSAFREE4:13;
A4:   the_sort_of (o-term p) = the_result_sort_of o by Th8;
      then H.(o-term p) = H.(the_result_sort_of o).(o-term p) by ABBR
      .= Den(o,T).(H#p) by A3,MSUALG_3:def 7,MSAFREE4:def 10
      .= nf (Den(o,Free(S,X)).(H#p), R.the_result_sort_of o)
      by MSAFREE4:def 20;
      then
A5:   H.(o-term p) is_a_normal_form_of Den(o,Free(S,X)).(H#p),
      R.the_result_sort_of o by REWRITE1:54;
      per cases;
      suppose len p = 0;
        then dom p = Seg 0 = {} by FINSEQ_1:def 3;
        then dom (H#p) = dom the_arity_of o = {} = dom p by MSUALG_6:2;
        then H#p = {} = p;
        then o-term p = Den(o,Free(S,X)).(H#p) &
        nf(Den(o,Free(S,X)).(H#p), R.the_result_sort_of o) =
        Den(o,T).(H#p) = H.(the_result_sort_of o).(Den(o,Free(S,X)).p)
        by MSUALG_3:def 7,MSAFREE4:13,def 20,def 10;
        then
A6:     H.(the_result_sort_of o).(Den(o,Free(S,X)).p) is_a_normal_form_of
        o-term p, R.the_result_sort_of o by REWRITE1:54;
        the_sort_of (o-term p) = the_result_sort_of o by Th8;
        hence thesis by A3,A6,ABBR;
      end;
      suppose
B0:     len p <> 0;
        deffunc F(FinSequence,Nat) = $1+*($2,(H#p).$2);
        defpred Q[Nat,set,set] means
        ex r being FinSequence st $2 = r & $3 = F(r,$1+1);
A7:     for r being Element of Args(o,Free(S,X))
        for n being Nat st 1 <= n <= len p holds
        F(r,n) in Args(o,Free(S,X))
        proof
          Args(o,T) c= Args(o,Free(S,X)) by MSAFREE4:41;
          then
C1:       H#p in Args(o,Free(S,X));
          let r be Element of Args(o,Free(S,X));
          let n be Nat; assume 1 <= n <= len p;
          then n in dom p = dom the_arity_of o by MSUALG_3:6,FINSEQ_3:25;
          then (H#p).n in (the Sorts of Free(S,X)).((the_arity_of o)/.n)
          by C1,MSUALG_6:2;
          hence thesis by MSUALG_6:7;
        end;
A6:     for n being Nat st 1 <= n & n < len p
        for x being Element of Args(o,Free(S,X))
        ex y being Element of Args(o,Free(S,X)) st Q[n,x,y]
        proof
          let n be Nat;
          assume 1 <= n;
          assume Z1: n < len p;
          let x be Element of Args(o,Free(S,X));
          1 <= n+1 <= len p by Z1,NAT_1:12,13;
          then reconsider y = F(x,n+1) as Element of Args(o,Free(S,X)) by A7;
          take y;
          thus Q[n,x,y];
        end;
B2:     len p >= 0+1 by B0,NAT_1:13;
        reconsider f1 = F(p,1) as Element of Args(o,Free(S,X))
        by A7,B2;
        consider f being FinSequence of Args(o,Free(S,X)) such that
B3:     len f = len p & (f.1 = f1 or len p = 0) &
        for n st 1 <= n & n < len p holds Q[n,f.n,f.(n+1)]
        from RECDEF_1:sch 4(A6);
B6:     dom f = dom p by B3,FINSEQ_3:29;
        defpred S[Nat] means $1 <= len p implies dom (f.$1) = dom p &
        (for i st 1 <= i <= $1 holds f.$1.i = (H#p).i) &
        (for i st $1+1 <= i <= len p holds f.$1.i = p.i);
BA:     S[1]
        proof
          assume 1 <= len p;
          then
C0:       1 in dom p by FINSEQ_3:25;
          thus dom (f.1) = dom p by B0,B3,FUNCT_7:30;
          hereby
            let i; assume 1 <= i <= 1;
            then i = 1 by XXREAL_0:1;
            hence f.1.i = (H#p).i by B0,B3,C0,FUNCT_7:31;
          end;
          let i; assume
C1:       1+1 <= i <= len p;
          i > 1 by C1,NAT_1:13;
          hence f.1.i = p.i by B0,B3,FUNCT_7:32;
        end;
BB:     for j st j >= 1 & S[j] holds S[j+1]
        proof let j; assume that
D1:       j >= 1 & S[j] and
D2:       j+1 <= len p;
D7:       j+1 >= 1 & j <= j+1 by NAT_1:12;
          consider r being FinSequence such that
D4:       f.j = r & f.(j+1) = F(r,j+1) by D1,B3,D2,NAT_1:13;
          thus dom (f.(j+1)) = dom p by D1,D7,D4,D2,XXREAL_0:2,FUNCT_7:30;
          hereby let i; assume
D6:         1 <= i <= j+1;
            per cases by NAT_1:13;
            suppose i <= j;
              then f.j.i = (H#p).i & i < j+1 by D1,D2,D6,NAT_1:13;
              hence f.(j+1).i = (H#p).i by D4,FUNCT_7:32;
            end;
            suppose i >= j+1;
              then i = j+1 by D6,XXREAL_0:1;
              hence f.(j+1).i = (H#p).i
              by D1,D2,D7,D4,FINSEQ_3:25,XXREAL_0:2,FUNCT_7:31;
            end;
          end;
          let i; assume
D8:       j+1+1 <= i <= len p;
D10:      j+1 < i by D8,NAT_1:13;
          then f.j.i = p.i by D1,D2,D7,D8,XXREAL_0:2;
          hence f.(j+1).i = p.i by D4,D10,FUNCT_7:32;
        end;
BC:     for j st j >= 1 holds S[j] from NAT_1:sch 8(BA,BB);
        defpred R[Nat] means $1 <= len p implies
        R.the_result_sort_of o reduces o-term p, Den(o,Free(S,X)).(f.$1);
B4:     R[1]
        proof
          assume 1 <= len p;
          then
C0:       1 in dom p = dom the_arity_of o = dom (H#p)
          by FINSEQ_3:25,MSUALG_6:2;
          then
C1:       p/.1 = p.1 in rng p by PARTFUN1:def 6,FUNCT_1:def 3;
          then P[p/.1] by Z0;
          then
C2:       R.the_sort_of (p/.1) reduces p/.1,H.(the_sort_of (p/.1)).(p/.1)
          by ABBR;
          reconsider t = (H#p)/.1 as Element of Free(S,X) by MSAFREE4:39;
C3:       the_sort_of (p/.1) = (the_arity_of o)/.1 by C0,Th4A;
          then H.(the_sort_of (p/.1)).(p/.1) = (H#p).1 = t &
          p+*(1,p/.1) = p by C0,C1,PARTFUN1:def 6,FUNCT_7:35,MSUALG_3:def 6;
          hence R.the_result_sort_of o reduces o-term p, Den(o,Free(S,X)).(f.1)
          by A3,B0,B3,C0,C2,C3,Th113;
        end;
B5:     for i st i >= 1 & R[i] holds R[i+1]
        proof let i; assume
D1:       i >= 1 & R[i] & i+1 <= len p;
          then
D2:       i < len p & 1 <= i+1 by NAT_1:13;
          then
C0:       i in dom p & i+1 in dom p = dom the_arity_of o = dom (H#p)
          by D1,FINSEQ_3:25,MSUALG_6:2;
          then
C1:       p/.(i+1) = p.(i+1) in rng p by PARTFUN1:def 6,FUNCT_1:def 3;
          then P[p/.(i+1)] by Z0;
          then
C2:       R.the_sort_of (p/.(i+1)) reduces p/.(i+1),
          H.(the_sort_of (p/.(i+1))).(p/.(i+1))
          by ABBR;
          reconsider t = (H#p)/.(i+1) as Element of Free(S,X) by MSAFREE4:39;
          reconsider fi = f.i, fi1 = f.(i+1) as Element of Args(o,Free(S,X))
          by B6,D2,D1,FINSEQ_3:25,FUNCT_1:102;
D3:       fi.(i+1) = p.(i+1) & dom fi = dom the_arity_of o
          by BC,D1,D2,MSUALG_6:2;
C3:       the_sort_of (p/.(i+1)) = (the_arity_of o)/.(i+1) by C0,Th4A;
          then
C4:       H.(the_sort_of (p/.(i+1))).(p/.(i+1)) = (H#p).(i+1) = t &
          fi+*(i+1,p/.(i+1)) = fi
          by D3,C0,C1,PARTFUN1:def 6,FUNCT_7:35,MSUALG_3:def 6;
          then
C5:       R.the_result_sort_of o reduces Den(o,Free(S,X)).(fi),
          Den(o,Free(S,X)).(fi+*(i+1,t)) by D3,C0,C2,C3,Th113;
          consider r being FinSequence such that
C6:       fi = r & fi1 = F(r,i+1) by B3,D1,NAT_1:13;
          thus thesis by C4,C5,C6,D1,NAT_1:13,REWRITE1:16;
        end;
BD:     for i st i >= 1 holds R[i] from NAT_1:sch 8(B4,B5);
        reconsider fl = f.len p as Element of Args(o,Free(S,X))
        by B6,FUNCT_1:102,B2,FINSEQ_3:25;
        fl = H#p
        proof
E1:       dom fl = dom the_arity_of o = dom (H#p) & dom the_arity_of o = dom p
          by MSUALG_6:2;
          hence len fl = len (H#p) by FINSEQ_3:29;
E2:       len fl = len p by E1,FINSEQ_3:29;
          let i; assume 1 <= i <= len fl;
          hence fl.i = (H#p).i by BC,B2,E2;
        end;
        then R.the_result_sort_of o reduces o-term p, Den(o,Free(S,X)).(H#p)
        by B2,BD;
        hence P[o-term p] by A4,A5,REWRITE1:16;
      end;
    end;
    thus P[t] from TermInd(A1,A2);
  end;

theorem Th98:
  for R being NF-var terminating with_UN_property invariant stable
  ManySortedRelation of Free(S,X)
  for o,p holds R.the_result_sort_of o reduces o-term p,
  Den(o,NFAlgebra R).((canonical_homomorphism NFAlgebra R)#p)
  proof
    let R be NF-var terminating with_UN_property invariant stable
    ManySortedRelation of Free(S,X);
    let o,p;
    set T = NFAlgebra R;
    set h = canonical_homomorphism T;
A1: o-term p = Den(o,Free(S,X)).p by MSAFREE4:13;
A2: the_sort_of (o-term p) = the_result_sort_of o by Th8;
    h.(the_result_sort_of o).(o-term p) = Den(o,T).(h#p)
    by A1,MSUALG_3:def 7,MSAFREE4:def 10;
    then Den(o,T).(h#p) = h.(o-term p) by A2,ABBR;
    hence R.the_result_sort_of o reduces o-term p, Den(o,T).(h#p) by A2,Th90;
  end;

theorem Th69:
  for R being NF-var terminating with_UN_property invariant stable
  ManySortedRelation of Free(S,X)
  for o,p for q being Element of Args(o, NFAlgebra R) st p = q
  holds R.the_result_sort_of o reduces o-term p, Den(o,NFAlgebra R).q
  proof
    let R be NF-var terminating with_UN_property invariant stable
    ManySortedRelation of Free(S,X);
    let o,p;
    let q be Element of Args(o, NFAlgebra R);
    assume p = q;
    then (canonical_homomorphism NFAlgebra R)#p = q by MSAFREE4:66;
    hence R.the_result_sort_of o reduces o-term p, Den(o,NFAlgebra R).q
    by Th98;
  end;

registration
  let S,X;
  let R be NF-var terminating with_UN_property invariant stable
  ManySortedRelation of Free(S,X);
  cluster NFAlgebra R -> struct-invariant;
  coherence
  proof set T = NFAlgebra R;
    let o; let p be Element of Args(o,NFAlgebra R);
    Args(o,T) c= Args(o,Free(S,X)) by MSAFREE4:41;
    then reconsider q = p as Element of Args(o,Free(S,X));
    assume
A1: Den(o,NFAlgebra R).p = Den(o,Free(S,X)).p;
    let s,x1,x2;
    set h = Hom(T,x1,x2);
    set H = Hom(Free(S,X),x1,x2);
AA: h#p = H#q
    proof
B1:   dom (h#p) = dom the_arity_of o = dom (H#q) &
      dom p = dom the_arity_of o = dom q by MSUALG_3:6;
      hence len (h#p) = len (H#q) by FINSEQ_3:29;
      let i; assume
B0:   1 <= i <= len (h#p);
B3:   (h#p).i = (h.((the_arity_of o)/.i)).(p.i) &
      (H#q).i = (H.((the_arity_of o)/.i)).(q.i)
      by B1,B0,FINSEQ_3:25,MSUALG_3:def 6;
A8:   p.i = p/.i & q.i = q/.i by B1,B0,FINSEQ_3:25,PARTFUN1:def 6;
      then q/.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i) &
      p/.i in (the Sorts of T).((the_arity_of o)/.i)
      by B1,B0,FINSEQ_3:25,MSUALG_6:2;
      then
A7:   the_sort_of (p/.i) = (the_arity_of o)/.i = the_sort_of (q/.i) by SORT;
      then H.((the_arity_of o)/.i).(p/.i) = h.(p/.i) by Th112;
      hence thesis by A7,A8,B3,ABBR;
    end;
    assume
A2: Den(o,T).(h#p) <> Den(o,Free(S,X)).(h#p);
    Args(o,T) c= Args(o,Free(S,X)) by MSAFREE4:41;
    then reconsider hp = h#p as Element of Args(o,Free(S,X));
A4: R.the_result_sort_of o reduces o-term hp, Den(o,T).(h#p) &
    o-term hp = Den(o,Free(S,X)).hp by Th69,MSAFREE4:13;
    then consider rs being RedSequence of R.the_result_sort_of o such that
A3: rs.1 = Den(o,Free(S,X)).hp & rs.len rs = Den(o,T).(h#p);
A7: len rs <> 1 & 0+1 <= len rs by A2,A3,NAT_1:13;
    then 1 < len rs by XXREAL_0:1;
    then 1+1 <= len rs by NAT_1:13;
    then 1+1 in dom rs & 1 in dom rs by A7,FINSEQ_3:25;
    then
A2: [Den(o,Free(S,X)).hp,rs.2] in R.the_result_sort_of o
    by A3,REWRITE1:def 2;
    then reconsider rsi = rs.2 as Element of Free(S,X),the_result_sort_of o
    by ZFMISC_1:87;
B2: [H.(the_result_sort_of o).(o-term hp),H.(the_result_sort_of o).rsi] in
    R.the_result_sort_of o by A2,A4,MSUALG_6:def 9;
A8: Den(o,Free(S,X)).hp = H.(the_result_sort_of o).(Den(o,Free(S,X)).q) &
    Den(o,Free(S,X)).q in Result(o,Free(S,X))
    = (the Sorts of Free(S,X)).the_result_sort_of o
    by AA,FUNCT_2:5,15,MSUALG_3:def 7,MSUALG_6:def 2;
    then
A9: H.(the_result_sort_of o).(Den(o,Free(S,X)).hp)
    = ((H.(the_result_sort_of o))*(H.(the_result_sort_of o))).
    (Den(o,Free(S,X)).q)
    by FUNCT_2:15
    .= (H**H).(the_result_sort_of o).(Den(o,Free(S,X)).q)
    by MSUALG_3:2
    .= (id the Sorts of Free(S,X)).(the_result_sort_of o).(Den(o,Free(S,X)).q)
    by Th157
    .= (id ((the Sorts of Free(S,X)).the_result_sort_of o)).
    (Den(o,Free(S,X)).q) by MSUALG_3:def 1
    .= Den(o,Free(S,X)).q by A8,FUNCT_1:18;
    set T = NFAlgebra R;
    set g = canonical_homomorphism T;
    Den(o,T).p in Result(o,T) by FUNCT_2:5;
    then Den(o,T).p is Element of T,the_result_sort_of o by FUNCT_2:15;
    then reconsider op = Den(o,T).p as Element of T;
    Den(o,T).p = nf (Den(o,Free(S,X)).p, R.the_result_sort_of o)
    by MSAFREE4:def 20;
    then Den(o,T).p is_a_normal_form_of Den(o,Free(S,X)).p,
    R.the_result_sort_of o by REWRITE1:54;
    then Den(o,T).p is_a_normal_form_wrt R.the_result_sort_of o;
    hence contradiction by A1,B2,A4,A9;
  end;
end;

registration
  let S,X;
  cluster struct-invariant for all_vars_including inheriting_operations
  free_in_itself (X,S)-terms MSAlgebra over S;
  existence
  proof
    set R = the NF-var terminating with_UN_property invariant stable
    ManySortedRelation of Free(S,X);
    take T = NFAlgebra R;
    thus thesis;
  end;
end;

begin :: Context vs translations

definition
  let S,s1,s2;
  attr s2 is s1-reachable means: REACH: TranslationRel S reduces s1,s2;
end;

registration
  let S,s1;
  cluster s1-reachable for SortSymbol of S;
  existence
  proof
    take s1;
    thus TranslationRel S reduces s1, s1 by REWRITE1:12;
  end;
end;

reserve
  s2 for s1-reachable SortSymbol of S,
  g1 for Translation of Free(S,Y),s1,s2,
  g for Translation of Free(S,X),s1,s2;

theorem
  TranslationRel S reduces s,the_sort_of C9
  proof
    defpred P[Element of Free(S,Z)] means
    TranslationRel S reduces s, the_sort_of $1;
    the_sort_of (z-term) = s by SORT;
    then
A1: P[z-term] by REWRITE1:12;
A2: now
      let o,k;
      assume
A3:   k is z-context_including;
      assume
A4:   P[z-context_in k];
      let C being context of z such that
AA:   C = o-term k;
      thus P[C]
      proof
        set t = o-term k;
        now
          take o;
          thus the_result_sort_of o = the_sort_of t by Th8;
          reconsider i = z-context_pos_in k as Element of NAT
          by ORDINAL1:def 12;
          take i;
A7:       dom k = dom the_arity_of o by MSUALG_3:6;
          hence i in dom the_arity_of o by A3,Th71;
          k.i in (the Sorts of Free(S,Z)).((the_arity_of o)/.i) &
          k.i = z-context_in k by A3,A7,Th71,MSUALG_6:2;
          hence (the_arity_of o)/.i = the_sort_of (z-context_in k)
          by SORT;
        end;
        then [the_sort_of (z-context_in k), the_sort_of (o-term k)] in
        TranslationRel S by MSUALG_6:def 3;
        then TranslationRel S reduces the_sort_of (z-context_in k),
        the_sort_of(o-term k) by REWRITE1:15;
        hence thesis by A4,AA,REWRITE1:16;
      end;
    end;
    thus P[C9] from ContextInd(A1,A2);
  end;

registration
  let S,X,s,x,C;
  cluster the_sort_of C -> s-reachable;
  coherence
  proof
    defpred P[Element of Free(S,X)] means the_sort_of $1 is s-reachable;
    s is s-reachable by REWRITE1:12;
    then
A1: P[x-term] by SORT;
A2: for o for p st p is x-context_including
    holds P[x-context_in p] implies
    for C being context of x st C = o-term p holds P[C]
    proof
      let o,p; assume that
A3:   p is x-context_including and
A4:   P[x-context_in p];
      let C such that
AA:   C = o-term p;
A6:   the_sort_of C = the_result_sort_of o by AA,Th8;
A5:   x-context_pos_in p in dom p = dom the_arity_of o &
      x-context_in p = p.(x-context_pos_in p) by A3,Th71,MSUALG_6:2;
      x-context_in p in (the Sorts of Free(S,X)).
      ((the_arity_of o)/.(x-context_pos_in p))
      = (the Sorts of Free(S,X)).((the_arity_of o).(x-context_pos_in p))
      by A5,MSUALG_6:2,PARTFUN1:def 6;
      then the_sort_of (x-context_in p) =
      (the_arity_of o)/.(x-context_pos_in p)
      = (the_arity_of o).(x-context_pos_in p) in rng the_arity_of o &
      x-context_pos_in p in NAT by A5,SORT,FUNCT_1:def 3,PARTFUN1:def 6;
      then [the_sort_of (x-context_in p),the_result_sort_of o]
      in TranslationRel S by A5,MSUALG_6:def 3;
      then TranslationRel S reduces the_sort_of (x-context_in p),
      the_result_sort_of o & TranslationRel S reduces s,
      the_sort_of (x-context_in p) by A4,REACH,REWRITE1:15;
      hence TranslationRel S reduces s, the_sort_of C
      by A6,REWRITE1:16;
    end;
    P[C] from ContextInd(A1,A2);
    hence thesis;
  end;
end;

definition
  let S,X,s1,s2,g;
  let t be Element of (the Sorts of Free(S,X)).s1;
  redefine func g.t -> Element of (the Sorts of Free(S,X)).s2;
  coherence by FUNCT_2:5;
end;

definition
  let S,X,s,x,C;
  attr C is basic means
  ex o,p st C = o-term p & x-context_in p = x-term;
end;

definition
  let S,X,s,x,C;
  func transl C -> Function of (the Sorts of Free(S,X)).s,
  (the Sorts of Free(S,X)).the_sort_of C means: TRANS:
  the_sort_of t = s implies it.t = C-sub(t);
  existence
  proof
    deffunc F(Element of (the Sorts of Free(S,X)).s) = C-sub $1;
    consider f being Function of (the Sorts of Free(S,X)).s,
    (the Sorts of Free(S,X)).the_sort_of C such that
A1: for t being Element of (the Sorts of Free(S,X)).s holds f.t = F(t)
    from FUNCT_2:sch 4;
    take f; let t; assume the_sort_of t = s;
    then t in (the Sorts of Free(S,X)).s by SORT;
    hence thesis by A1;
  end;
  uniqueness
  proof
    let f1,f2 be Function of (the Sorts of Free(S,X)).s,
    (the Sorts of Free(S,X)).the_sort_of C such that
A1: the_sort_of t = s implies f1.t = C-sub(t) and
A2: the_sort_of t = s implies f2.t = C-sub(t);
    let t be Element of (the Sorts of Free(S,X)).s;
A3: the_sort_of t = s by SORT;
    thus f1.t = C-sub t by A1,A3 .= f2.t by A2,A3;
  end;
end;

theorem Th57:
  for S,s,X,x,C st C = x-term holds
  transl C = id((the Sorts of Free(S,X)).s)
  proof
    let S,s,X,x,C;
    assume Z0: C = x-term;
    let t be Element of (the Sorts of Free(S,X)).s;
A2: the_sort_of t = s by SORT;
    hence (transl C).t = C-sub(t) by TRANS
    .= (id((the Sorts of Free(S,X)).s)).t by Z0,A2,Th41;
  end;

theorem Th58:
  C9 = o-term k & z-context_in k = z-term & k1 = k+*(z-context_pos_in k,l)
  implies C9-sub l = o-term k1
  proof set C = C9, p = k, p1 = k1, x = z, t = l, X = Z;
    assume Z0: C = o-term p;
    assume Z1: x-context_in p = x-term;
    assume Z2: p1 = p+*(x-context_pos_in p,t);
    set i = x-context_pos_in p;
A1: p is x-context_including by Z0,Th53;
    then
A2: i in dom p = dom the_arity_of o & p.i = x-term by Z1,Th71,MSUALG_3:6;
    p1.i = t by A1,Z2,Th71,FUNCT_7:31;
    then t in (the Sorts of Free(S,X)).((the_arity_of o)/.i) &
    x-term in (the Sorts of Free(S,X)).((the_arity_of o)/.i) by A2,MSUALG_6:2;
    then
A3: the_sort_of t = (the_arity_of o)/.i = the_sort_of (x-context_in p) = s
    by Z1,SORT;
    then (x-context_in p)-sub t = t by Z1,Th41;
    hence C-sub t = o-term p1 by Z0,Z2,A3,Th43,Th53;
  end;

theorem
  C9 is basic implies transl C9 is_e.translation_of Free(S,Z),s,the_sort_of C9
  proof set X = Z, C = C9, x = z;
    given o,k such that
Z0: C = o-term k & x-context_in k = z-term;
    set p = k;
    take o;
    thus the_result_sort_of o = the_sort_of C by Z0,Th8;
    reconsider i = x-context_pos_in p as Element of NAT by ORDINAL1:def 12;
    take i;
A1: p is x-context_including by Z0,Th53;
    then i in dom p by Th71;
    hence i in dom the_arity_of o by MSUALG_3:6;
    then x-term = p.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
    by Z0,A1,Th71,MSUALG_6:2;
    then
A4: s = the_sort_of (x-context_in p) = (the_arity_of o)/.i by Z0,SORT;
    hence ((the_arity_of o)/.i) = s;
    reconsider a = p as Function;
    take a; thus a in Args(o,Free(S,X));
    dom transl C = (the Sorts of Free(S,X)).s by FUNCT_2:def 1;
    hence dom transl C = dom transl(o,i,a,Free(S,X)) by A4,MSUALG_6:def 4;
    let c be object; assume
    c in dom transl C;
    then reconsider c as Element of (the Sorts of Free(S,X)).s;
    reconsider q = p+*(i,c) as Element of Args(o,Free(S,X)) by A4,MSUALG_6:7;
A6: transl(o,i,a,Free(S,X)).c = Den(o,Free(S,X)).q by A4,MSUALG_6:def 4
    .= o-term q by MSAFREE4:13;
    C-sub c = o-term q & the_sort_of c = s by Z0,Th58,SORT;
    hence thesis by A6,TRANS;
  end;

theorem Th59:
  for V being finite set holds
  m in dom q & (the_arity_of o)/.m = s implies
  ex y,C1,q1 st y nin V & C1 = o-term q1 & q1 = q+*(m,y-term) &
  q1 is y-context_including &
  m = y-context_pos_in q1 & y-context_in q1 = y-term
  proof let V be finite set;
    assume Z0: m in dom q & (the_arity_of o)/.m = s;
    set y = the Element of Y.s \ (V \/ proj1 rng (o-term q));
A0: proj1 rng (o-term q) is finite by WAYBEL26:39;
    then reconsider y as Element of Y.s by XBOOLE_0:def 5;
    reconsider t = y-term as Element of Free(S,Y);
    reconsider q1 = q+*(m,y-term) as Element of Args(o,Free(S,Y))
    by Z0,MSUALG_6:7;
A1: q1 is y-context_including
    proof
      take m; thus m in dom q1 by Z0,FUNCT_7:30;
      thus q1.m is context of y by Z0,FUNCT_7:31;
      let j,v; assume
Z1:   j in dom q1 & j <> m & v = q1.j;
      then
A4:   j in dom q by FUNCT_7:30;
      then
A2:   v = q.j in rng q by Z1,FUNCT_7:32,FUNCT_1:def 3;
      set d = the Element of Coim(v,[y,s]);
      assume
A7:   Coim(v,[y,s]) <> {};
      then
A3:   d in dom v & v.d in {[y,s]} by FUNCT_1:def 7;
      reconsider d as Element of dom v by A7,FUNCT_1:def 7;
      consider k being Nat such that
A5:   j = 1+k by Z1,FINSEQ_3:25,NAT_1:10;
A6:   v.d = [y,s] by A3,TARSKI:def 1;
      j <= len q by A4,FINSEQ_3:25;
      then <*k*>^d in dom(o-term q) & (o-term q).(<*k*>^d) = v.d
      by A2,A5,TREES_4:11,12,NAT_1:13;
      then [y,s] in rng(o-term q) by A6,FUNCT_1:def 3;
      then y in proj1 rng(o-term q) by XTUPLE_0:def 12;
      then y in V \/ proj1 rng(o-term q) by XBOOLE_0:def 3;
      hence contradiction by A0,XBOOLE_0:def 5;
    end;
    then reconsider C9 = o-term q1 as context of y by Th53;
    take y,C9,q1;
    y nin V \/ proj1 rng (o-term q) by A0,XBOOLE_0:def 5;
    hence y nin V by XBOOLE_0:def 3;
    thus C9 = o-term q1;
    thus q1 = q+*(m,y-term);
    thus q1 is y-context_including by A1;
A7: q1.m = y-term by Z0,FUNCT_7:31;
    hence m = y-context_pos_in q1 by A1,CPI;
    hence y-context_in q1 = y-term by A1,A7,Th71;
  end;

theorem Th91:
  for s1,s2 being SortSymbol of S, V being finite set holds
  m in dom q & s1 = (the_arity_of o)/.m implies
  ex y being (Element of Y.s1), C being (context of y), q1 st
  y nin V & q1 = q+*(m,y-term) &
  q1 is y-context_including & y-context_in q1 = y-term & C = o-term q1 &
  m = y-context_pos_in q1 & transl C = transl(o,m,q,Free(S,Y))
  proof
    let s1,s2 be SortSymbol of S, V be finite set;
    assume Z1: m in dom q;
    assume Z2: s1 = (the_arity_of o)/.m;
    consider y being (Element of Y.s1), C being (context of y), q1 such that
A1: y nin V & C = o-term q1 & q1 = q+*(m,y-term) &
    q1 is y-context_including &
    m = y-context_pos_in q1 & y-context_in q1 = y-term by Z1,Z2,Th59;
    take y, C, q1;
    thus y nin V by A1;
    thus q1 = q+*(m,y-term) by A1;
    thus q1 is y-context_including by A1;
    thus y-context_in q1 = y-term by A1;
    thus C = o-term q1 by A1;
    thus m = y-context_pos_in q1 by A1;
    dom transl C = (the Sorts of Free(S,Y)).s1 by FUNCT_2:def 1;
    hence dom transl C = dom transl(o,m,q,Free(S,Y)) by Z2,MSUALG_6:def 4;
    let c be object; assume
    c in dom transl C;
    then reconsider c as Element of (the Sorts of Free(S,Y)).s1;
    reconsider q2 = q+*(m,c) as Element of Args(o,Free(S,Y))
    by Z2,MSUALG_6:7;
A6: transl(o,m,q,Free(S,Y)).c = Den(o,Free(S,Y)).q2
    by Z2,MSUALG_6:def 4
    .= o-term q2 by MSAFREE4:13;
    q2 = q1+*(m,c) by A1,FUNCT_7:34;
    then C-sub c = o-term q2 & the_sort_of c = s1 by A1,Th58,SORT;
    hence thesis by A6,TRANS;
  end;

registration
  let S,X,t;
  let a;
  cluster Coim(t,a) -> FinSequence-membered;
  coherence;
end;

theorem Th70:
  X is non-trivial & the_sort_of t = s implies
  card Coim(t,a) c= card Coim(C-sub t,a)
  proof assume that
ZZ: X is non-trivial and
Z0: the_sort_of t = s;
    defpred P[context of x] means
    for C st C = $1 holds card Coim(t,a) c= card Coim(C-sub t,a);
A0: P[x-term] by Z0,Th41;
A1: for o,p st p is x-context_including
    holds P[x-context_in p] implies
    for C being context of x st C = o-term p holds P[C]
    proof
      let o,p;
      assume Z1: p is x-context_including;
      assume Z2: P[x-context_in p];
      set i = x-context_pos_in p;
A6:   i in dom p = dom the_arity_of o by Z1,Th71,MSUALG_3:6;
      then consider j such that
A3:   i = 1+j by NAT_1:10,FINSEQ_3:25;
      card (<*j*>^^Coim((x-context_in p)-sub t,a))
      = card Coim((x-context_in p)-sub t,a) by Th1;
      then consider f being Function such that
A2:   f is one-to-one & dom f = Coim(t,a) &
      rng f c= <*j*>^^Coim((x-context_in p)-sub t,a)
      by Z2,CARD_1:10;
      let C be context of x;
      assume Z3: C = o-term p;
      x-context_in p = p.i by Z1,Th71;
      then x-context_in p in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
      by A6,MSUALG_6:2;
      then the_sort_of (x-context_in p) = (the_arity_of o)/.i by SORT;
      then reconsider q = p+*(x-context_pos_in p,(x-context_in p)-sub t)
      as Element of Args(o,Free(S,X)) by MSUALG_6:7;
A4:   C-sub t = o-term q by ZZ,Z0,Z1,Z3,Th43;
      <*j*>^^Coim((x-context_in p)-sub t,a) c= Coim(C-sub t,a)
      proof
        let r be object;
        assume r in <*j*>^^Coim((x-context_in p)-sub t,a);
        then consider n being Element of Coim((x-context_in p)-sub t,a)
        such that
A5:     r = <*j*>^n & n in Coim((x-context_in p)-sub t,a);
        Coim((x-context_in p)-sub t,a) c= dom((x-context_in p)-sub t)
        by RELAT_1:132;
        then reconsider n as Element of dom((x-context_in p)-sub t) by A5;
        i <= len p & dom q = dom the_arity_of o by A6,FINSEQ_3:25,MSUALG_3:6;
        then j < len p = len q & q.i = (x-context_in p)-sub t
        by A3,Z1,Th71,MSUALG_3:6,NAT_1:13,FINSEQ_3:29,FUNCT_7:31;
        then
A9:     <*j*>^n in dom (C-sub t) &
        (C-sub t).r = ((x-context_in p)-sub t).n in {a}
        by A3,A4,A5,TREES_4:11,12,FUNCT_1:def 7;
        thus thesis by A5,A9,FUNCT_1:def 7;
      end;
      then rng f c= Coim(C-sub t,a) by A2;
      hence P[C] by A2,CARD_1:10;
    end;
    P[C] from ContextInd(A0,A1);
    hence thesis;
end;

theorem
  p is x-context_including & i in dom p implies
  (p/.i is non x-omitting iff p/.i is x-context)
  proof
    assume p is x-context_including;
    then consider j such that
A0: j in dom p & p.j is context of x &
    for n,t st n in dom p & n <> j & t = p.n
    holds t is x-omitting;
    assume Z1: i in dom p;
    then
A1: p/.i = p.i by PARTFUN1:def 6;
    thus p/.i is non x-omitting & p/.i is non x-context implies contradiction
    by A0,A1,Z1;
    assume p/.i is x-context;
    hence p/.i is non x-omitting;
  end;

theorem Th60:
  X is non-trivial & the_sort_of C = s1 implies
  for x1 being Element of X.s1
  for C1 being (context of x1), C2 being context of x st C2 = C1-sub(C)
  for t st the_sort_of t = s holds C2-sub t = C1-sub(C-sub t)
  proof assume ZZ: X is non-trivial;
    assume Z0: the_sort_of C = s1;
    let x1 be Element of X.s1;
    let C1 be (context of x1);
    let C2 be context of x;
    assume Z1: C2 = C1-sub(C);
    let t;
    assume Z2: the_sort_of t = s;
A0: the_sort_of (C-sub t) = s1 by Z0,SORT;
    defpred P[context of x1] means
    for C1 being context of x1 for C2 being context of x st C1 = $1 &
    C2 = C1-sub(C) holds C2-sub t = C1-sub(C-sub t);
A1: P[x1-term]
    proof
      let C1 be context of x1;
      let C2 be context of x;
      assume
B1:   C1 = (x1-term) & C2 = C1-sub C;
      then C2 = C by Z0,Th41;
      hence C2-sub t = C1-sub(C-sub t) by B1,A0,Th41;
    end;
A2: for o for w being Element of Args(o, Free(S,X))
    st w is x1-context_including
    holds P[x1-context_in w] implies
    for C being context of x1 st C = o-term w holds P[C]
    proof
      let o;
      let w be Element of Args(o, Free(S,X));
      assume Z3: w is x1-context_including;
      assume Z4: P[x1-context_in w];
      let C1 be context of x1;
      assume Z5: C1 = o-term w;
      let CC be context of x1;
      let C2 be context of x;
      assume
B2:   CC = C1 & C2 = CC-sub C;
      set i = x1-context_pos_in w;
B3:   x1-context_pos_in w in dom w = dom the_arity_of o &
      x1-context_in w = w.(x1-context_pos_in w) by Z3,Th71,MSUALG_3:6;
      then x1-context_in w in
      (the Sorts of Free(S,X)).((the_arity_of o)/.(x1-context_pos_in w))
      by MSUALG_6:2;
      then
B7:   the_sort_of (x1-context_in w) =
      (the_arity_of o)/.(x1-context_pos_in w) by SORT;
      then
      reconsider p = w+*(x1-context_pos_in w, (x1-context_in w)-sub(C-sub t)),
      q = w+*(x1-context_pos_in w, (x1-context_in w)-sub(C))
      as Element of Args(o,Free(S,X)) by MSUALG_6:7;
B5:   C2 = o-term q & C1-sub(C-sub t) = o-term p by ZZ,A0,Z0,Z3,Z5,B2,Th43;
      then
B6:   q is x-context_including & dom q = dom the_arity_of o by Th53,MSUALG_3:6;
      reconsider A = Coim((x1-context_in w)-sub(C),[x,s]) as finite set;
      Segm 1 = Segm card Coim(C,[x,s]) = card Coim(C,[x,s])
      c= card Coim((x1-context_in w)-sub(C),[x,s])
      = Segm card Coim((x1-context_in w)-sub(C),[x,s])
      by ZZ,Z0,Th70,CONTEXT;
      then
B9:   (x1-context_in w)-sub(C) is non x-omitting &
      q/.i = q.i = (x1-context_in w)-sub(C)
      by B3,B6,PARTFUN1:def 6,FUNCT_7:31;
      then reconsider C3 = (x1-context_in w)-sub(C) as context of x
      by B3,B6;
      the_sort_of C3 =
      (the_arity_of o)/.(x1-context_pos_in w) by B7,SORT;
      then reconsider u = w+*(x1-context_pos_in w, C3-sub t)
      as Element of Args(o,Free(S,X)) by MSUALG_6:7;
      C3 in rng q by B9,B6,B3,FUNCT_1:def 3;
      then o-term p = o-term u & x-context_pos_in q = x1-context_pos_in w &
      q+*(x1-context_pos_in w, C3-sub t) = u & x-context_in q = C3
      by B6,Z4,B9,CIn,CPI,FUNCT_7:34;
      hence thesis by B2,ZZ,Th43,Z2,B5,Th53;
    end;
    P[C1] from ContextInd(A1,A2);
    hence C2-sub t = C1-sub(C-sub t) by Z1;
  end;

theorem Th93:
  X is non-trivial & the_sort_of C = s1 implies
  for x1 being Element of X.s1
  for C1 being (context of x1), C2 being context of x st C2 = C1-sub(C)
  holds transl C2 = (transl C1)*(transl C)
  proof
    assume that
ZZ: X is non-trivial and
Z0: the_sort_of C = s1;
    let x1 be Element of X.s1;
    let C1 be (context of x1);
    let C2 be context of x;
    assume Z1: C2 = C1-sub(C);
    reconsider f = transl C as Function of (the Sorts of Free(S,X)).s,
    (the Sorts of Free(S,X)).s1 by Z0;
    transl C2 = (transl C1)*f
    proof
      let t be Element of (the Sorts of Free(S,X)).s;
A1:   the_sort_of t = s by SORT;
      then
A2:   (transl C2).t = C2-sub t & (transl C).t = C-sub t by TRANS;
      the_sort_of (C-sub t) = s1 by Z0,SORT;
      then (transl C1).(C-sub t) = C1-sub(C-sub t) by TRANS;
      then ((transl C1)*f).t = C1-sub(C-sub t) by A2,FUNCT_2:15;
      hence thesis by ZZ,A2,Z0,Z1,A1,Th60;
    end;
    hence transl C2 = (transl C1)*(transl C);
  end;

theorem
  ex y11,C12 st the_sort_of C12 = s2 & g1 = transl C12
  proof
    defpred P[Function,SortSymbol of S,SortSymbol of S] means
    for V being finite set
    ex x being Element of Y.$2 st ex C being context of x st
    x nin V & the_sort_of C = $3 & $1 = transl C;
A1: for s holds P[id ((the Sorts of Free(S,Y)).s),s,s]
    proof let s;
      let V be finite set;
      reconsider x = the Element of Y.s \ V as Element of Y.s;
      reconsider C = x-term as context of x;
      take x, C;
      thus x nin V by XBOOLE_0:def 5;
      thus the_sort_of C = s by SORT;
      thus thesis by Th57;
    end;
A2: for s1,s2,s3 being SortSymbol of S st TranslationRel S reduces s1,s2
    for t being Translation of Free(S,Y),s1,s2 st P[t,s1,s2]
    for f being Function st f is_e.translation_of Free(S,Y),s2,s3
    holds P[f*t,s1,s3]
    proof
      let s1,s2,s3 be SortSymbol of S;
      assume TranslationRel S reduces s1,s2;
      let t be Translation of Free(S,Y),s1,s2;
      assume Z1: P[t,s1,s2];
      let f be Function;
      assume f is_e.translation_of Free(S,Y),s2,s3;
      then consider o being OperSymbol of S such that
B1:   the_result_sort_of o = s3 &
      ex i being Element of NAT st i in dom the_arity_of o &
      ((the_arity_of o)/.i) = s2 &
      ex a being Function st a in Args(o,Free(S,Y)) &
      f = transl(o,i,a,Free(S,Y))
      by MSUALG_6:def 5;
      consider i being Element of NAT such that
B2:   i in dom the_arity_of o & ((the_arity_of o)/.i) = s2 &
      ex a being Function st a in Args(o,Free(S,Y)) &
      f = transl(o,i,a,Free(S,Y)) by B1;
      consider a being Function such that
B3:   a in Args(o,Free(S,Y)) & f = transl(o,i,a,Free(S,Y)) by B2;
      reconsider a as Element of Args(o,Free(S,Y)) by B3;
      let V be finite set;
      [s2,s3] in TranslationRel S & i in dom a by B1,B2,MSUALG_6:2,def 3;
      then consider y being (Element of Y.s2), C being (context of y),
      q1 being Element of Args(o,Free(S,Y)) such that
B4:   y nin V & q1 = a+*(i,y-term) &
      q1 is y-context_including & y-context_in q1 = y-term & C = o-term q1 &
      i = y-context_pos_in q1 & transl C = transl(o,i,a,Free(S,Y))
      by B2,Th91;
      consider y1 being (Element of Y.s1), C1 being context of y1 such that
B5:   y1 nin V \/ vf C & the_sort_of C1 = s2 & t = transl C1 by Z1;
      y in vf C by Th95;
      then y1 nin vf C & y <> y1 by B5,XBOOLE_0:def 3;
      then C is y1-omitting & y is y1-different by Th92;
      then reconsider C2 = C-sub C1 as context of y1 by B5,Th94;
      take y1,C2;
      thus y1 nin V by B5,XBOOLE_0:def 3;
      the_sort_of C2 = the_sort_of C by SORT;
      hence the_sort_of C2 = s3 by B1,B4,Th8;
      thus f*t = transl C2 by B3,B4,B5,Th93;
    end;
    for s1,s2 being SortSymbol of S st TranslationRel S reduces s1,s2
    for t being Translation of Free(S,Y),s1,s2 holds P[t,s1,s2]
    from MSUALG_6:sch 1(A1,A2);
    then ex x being Element of Y.s1 st ex C being context of x st
    x nin {} & the_sort_of C = s2 & g1 = transl C by REACH;
    hence thesis;
  end;

scheme LambdaTerm {S() -> non empty non void ManySortedSign,
  X() -> non-empty ManySortedSet of the carrier of S(),
  T1,T2() -> all_vars_including inheriting_operations X(),S()-terms
  MSAlgebra over S(),
  F(object) -> Element of T2()}:
  ex f being ManySortedFunction of T1(),T2() st
  for t being Element of T1() holds f.t = F(t)
provided
A0: for t being Element of T1() holds the_sort_of t = the_sort_of F(t)
  proof
    deffunc D(SortSymbol of S()) = (the Sorts of T1()).$1;
    deffunc F(object,object) = F($2);
    consider f being ManySortedFunction of the carrier of S() such that
A1: for o being SortSymbol of S() holds dom (f.o) = D(o) &
    for x being Element of D(o) holds f.o.x = F(o,x) from MSAFREE4:sch 7;
    f is ManySortedFunction of T1(),T2()
    proof
      let i be object; assume i in the carrier of S();
      then reconsider s = i as SortSymbol of S();
A2:   dom (f.s) = D(s) by A1;
      rng (f.s) c= (the Sorts of T2()).s
      proof
        let a; assume a in rng (f.s);
        then consider b such that
A3:     b in D(s) & a = f.s.b by A2,FUNCT_1:def 3;
        reconsider b as Element of D(s) by A3;
        s = the_sort_of b = the_sort_of F(b) & F(s,b) = f.s.b by A0,A1,SORT;
        hence a in (the Sorts of T2()).s by A3,SORT;
      end;
      hence f.i is Function of (the Sorts of T1()).i, (the Sorts of T2()).i
      by A2,FUNCT_2:2;
    end;
    then reconsider f as ManySortedFunction of T1(),T2();
    take f;
    let t be Element of T1();
A4: t in (the Sorts of T1()).the_sort_of t by SORT;
    thus f.t = f.(the_sort_of t).t by ABBR .= F(t) by A1,A4;
  end;

theorem Th86:
  ex g being Endomorphism of T st
  (canonical_homomorphism T)**h = g**canonical_homomorphism T &
  for t being Element of T holds g.t = (canonical_homomorphism T).(h.@t)
  proof set H = canonical_homomorphism T;
    H is_homomorphism Free(S,X),T & h is_homomorphism Free(S,X),Free(S,X)
    by MSUALG_6:def 2,MSAFREE4:def 10;
    then consider g being ManySortedFunction of T,T such that
A1: g is_homomorphism T,T & H**h = g**H by MSAFREE4:65,MSUALG_3:10;
    reconsider g as Endomorphism of T by A1,MSUALG_6:def 2;
    take g;
    thus H**h = g**H by A1;
    let t be Element of T;
    thus g.t = g.(H.@t)
    .= (g**H).@t by Th14
    .= (canonical_homomorphism T).(h.@t) by A1,Th14;
  end;

theorem
  (canonical_homomorphism T).(h.t) =
  (canonical_homomorphism T).(h.@((canonical_homomorphism T).t))
  proof
    set H = canonical_homomorphism T;
    consider g being Endomorphism of T such that
A1: H**h = g**H &
    for t being Element of T holds g.t = H.(h.@t) by Th86;
    thus H.(h.t) = (H**h).t by Th14 .= g.(H.t) by A1,Th14 .= H.(h.@(H.t))
    by A1;
  end;

begin :: Context vs endomorphism

definition
  let S;
  let B be non empty FinSequence of the carrier of S;
  let i being Element of dom B;
  redefine func B.i -> SortSymbol of S;
  coherence by PARTFUN1:4;
end;

definition
  let S,X;
  let B be FinSequence of the carrier of S;
  let V be FinSequence of Union X;
  attr V is B-sorts means: SORTS: :: Element of product (X*B)
  dom V = dom B & for i st i in dom B holds V.i in X.(B.i);
end;

registration
  let S,X;
  let B be FinSequence of the carrier of S;
  cluster B-sorts for FinSequence of Union X;
  existence
  proof
    set V = the Element of product (X*B);
A0: rng B c= the carrier of S = dom X by FINSEQ_1:def 4,PARTFUN1:def 2;
A1: dom (X*B) = dom B by PARTFUN1:def 2;
A2: dom V = dom B = Seg len B by PARTFUN1:def 2,FINSEQ_1:def 3;
    then reconsider V as FinSequence by FINSEQ_1:def 2;
    rng V c= Union X
    proof
      let a; assume a in rng V;
      then consider i being object such that
A3:   i in dom V & a = V.i by FUNCT_1:def 3;
      reconsider i as Nat by A3;
      (X*B).i = X.(B.i) by A2,A3,FUNCT_1:13;
      then V.i in X.(B.i) & B.i in the carrier of S
      by A1,A2,A3,CARD_3:9,FUNCT_1:102;
      hence a in Union X by A0,A3,CARD_5:2;
    end;
    then reconsider V as FinSequence of Union X by FINSEQ_1:def 4;
    take V;
    thus dom V = dom B by PARTFUN1:def 2;
    let i; assume
A4: i in dom B;
    then (X*B).i = X.(B.i) by FUNCT_1:13;
    hence V.i in X.(B.i) by A1,A4,CARD_3:9;
  end;
end;

registration
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  cluster B-sorts -> non empty for FinSequence of Union X;
  coherence;
end;

definition
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let V be B-sorts FinSequence of Union X;
  let i being Element of dom B;
  redefine func V.i -> Element of X.(B.i);
  coherence by SORTS;
end;

definition
  let S,X;
  let B be FinSequence of the carrier of S;
  let D be FinSequence of Free(S,X);
  attr D is B-sorts means: SORTS2: :: Element of product ((the Sorts of Free(S,X))*B)
  dom D = dom B &
  for i st i in dom B holds D.i in (the Sorts of Free(S,X)).(B.i);
end;

registration
  let S,X;
  let B be FinSequence of the carrier of S;
  cluster B-sorts for FinSequence of Free(S,X);
  existence
  proof
    set V = the Element of product ((the Sorts of Free(S,X))*B);
A0: rng B c= the carrier of S = dom the Sorts of Free(S,X)
    by FINSEQ_1:def 4,PARTFUN1:def 2;
A1: dom ((the Sorts of Free(S,X))*B) = dom B by PARTFUN1:def 2;
A2: dom V = dom B = Seg len B by PARTFUN1:def 2,FINSEQ_1:def 3;
    then reconsider V as FinSequence by FINSEQ_1:def 2;
    rng V c= Union the Sorts of Free(S,X)
    proof
      let a; assume a in rng V;
      then consider i being object such that
A3:   i in dom V & a = V.i by FUNCT_1:def 3;
      reconsider i as Nat by A3;
      ((the Sorts of Free(S,X))*B).i = (the Sorts of Free(S,X)).(B.i)
      by A2,A3,FUNCT_1:13;
      then V.i in (the Sorts of Free(S,X)).(B.i) & B.i in the carrier of S
      by A1,A2,A3,CARD_3:9,FUNCT_1:102;
      hence a in Union the Sorts of Free(S,X) by A0,A3,CARD_5:2;
    end;
    then reconsider V as FinSequence of Union the Sorts of Free(S,X)
    by FINSEQ_1:def 4;
    take V;
    thus dom V = dom B by PARTFUN1:def 2;
    let i; assume
A4: i in dom B;
    then ((the Sorts of Free(S,X))*B).i = (the Sorts of Free(S,X)).(B.i)
    by FUNCT_1:13;
    hence V.i in (the Sorts of Free(S,X)).(B.i) by A1,A4,CARD_3:9;
  end;
end;

registration
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  cluster B-sorts -> non empty for FinSequence of Free(S,X);
  coherence;
end;

definition
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let D be B-sorts FinSequence of Free(S,X);
  let i being Element of dom B;
  redefine func D.i -> Element of (the Sorts of Free(S,X)).(B.i);
  coherence by SORTS2;
end;

definition
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let V be B-sorts FinSequence of Union X;
  let F be FinSequence of Free(S,X);
  attr F is V-context-sequence means: CONTEXTSEQ:
  dom F = dom B &
  for i being Element of dom B holds F.i is context of V.i;
end;

registration
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let V be B-sorts FinSequence of Union X;
  cluster V-context-sequence -> non empty for FinSequence of Free(S,X);
  coherence;
end;

scheme FinSeqLambda{B() -> non empty FinSequence, F(set) -> object}:
  ex p being non empty FinSequence st dom p = dom B() &
  for i being Element of dom B() holds p.i = F(i)
  proof
    consider p being FinSequence such that
A1: len p = len B() &
    for i being natural set st i in dom p
       holds p.i = F(i) from FINSEQ_1:sch 2;
A2: dom p = dom B() by A1,FINSEQ_3:29;
    reconsider p as non empty FinSequence by A1;
    take p;
    thus thesis by A2,A1;
  end;

scheme FinSeqRecLambda{B() -> non empty FinSequence, A() -> object,
  F(object,object) -> set}:
  ex p being non empty FinSequence st dom p = dom B() & p.1 = A() &
  for i,j being Element of dom B() st j = i+1 holds p.j = F(i,p.i)
  proof
    defpred P[object,object,object] means $3 = F($1,$2);
A0: for n being Nat st 1 <= n & n < len B() for x being set ex y being set st
    P[n,x,y];
    consider p being FinSequence such that
A1: len p = len B() & (p.1 = A() or len B() = 0) &
    for i being natural set st 1 <= i < len B() holds P[i,p.i,p.(i+1)]
    from RECDEF_1:sch 3(A0);
    reconsider p as non empty FinSequence by A1;
    take p;
    thus dom p = dom B() by A1,FINSEQ_3:29;
    thus p.1 = A() by A1;
    let i,j be Element of dom B(); assume
A3: j = i+1; then i+1 <= len B() by FINSEQ_3:25;
    then 1 <= i < len B() by NAT_1:13,FINSEQ_3:25;
    hence thesis by A3,A1;
  end;

scheme FinSeqRec2Lambda{B() -> non empty FinSequence, A() -> DecoratedTree,
  F(object,DecoratedTree) -> DecoratedTree}:
  ex p being non empty DTree-yielding FinSequence st
  dom p = dom B() & p.1 = A() &
  for i,j being Element of dom B() st j = i+1
  for d being DecoratedTree st d = p.i holds p.j = F(i,d)
  proof
    defpred P[object,object,object] means
    for d being DecoratedTree st d = $2 holds $3 = F($1,d);
A0: for n being Nat st 1 <= n & n < len B() for x being set ex y being set st
    P[n,x,y]
    proof
      let n be Nat;
      assume 1 <= n;
      assume n < len B();
      let x be set;
      per cases;
      suppose x is DecoratedTree;
        then reconsider xx = x as DecoratedTree;
        take y = F(n,xx);
        thus P[n,x,y];
      end;
      suppose
A4:     x is not DecoratedTree;
        take y = 0;
        thus P[n,x,y] by A4;
      end;
    end;
    consider p being FinSequence such that
A1: len p = len B() & (p.1 = A() or len B() = 0) &
    for i being natural set st 1 <= i < len B() holds P[i,p.i,p.(i+1)]
    from RECDEF_1:sch 3(A0);
    reconsider p as non empty FinSequence by A1;
    p is DTree-yielding
    proof
      let a; assume a in rng p;
      then consider b such that
A5:   b in dom p & a = p.b by FUNCT_1:def 3;
      reconsider b as Element of dom B() by A5,A1,FINSEQ_3:29;
      defpred Q[Nat] means $1 in dom B() implies p.$1 is DecoratedTree;
A6:   Q[1] by A1;
A7:   for i st i >= 1 & Q[i] holds Q[i+1]
      proof let i;
        assume
A8:     i >= 1 & Q[i] & i+1 in dom B();
        then
AC:     i+1 <= len B() by FINSEQ_3:25;
        then i < len B() by NAT_1:13;
        then reconsider px = p.i as DecoratedTree by A8,FINSEQ_3:25;
        p.(i+1) = F(i,px) by A1,A8,AC,NAT_1:13;
        hence thesis;
      end;
      for i st i >= 1 holds Q[i] from NAT_1:sch 8(A6,A7);
      then b >= 1 implies a is DecoratedTree by A5;
      hence thesis by FINSEQ_3:25;
    end;
    then reconsider p as DTree-yielding non empty FinSequence;
    take p;
    thus dom p = dom B() by A1,FINSEQ_3:29;
    thus p.1 = A() by A1;
    let i,j be Element of dom B(); assume
A3: j = i+1; then i+1 <= len B() by FINSEQ_3:25;
    then 1 <= i < len B() by NAT_1:13,FINSEQ_3:25;
    hence thesis by A3,A1;
  end;

registration
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let V be B-sorts FinSequence of Union X;
  cluster V-context-sequence for FinSequence of Free(S,X);
  existence
  proof
    deffunc F(Element of dom B) = (V.$1)-term;
    consider C being non empty FinSequence such that
A1: dom C = dom B & for i being Element of dom B holds C.i = F(i)
    from FinSeqLambda;
    rng C c= Union the Sorts of Free(S,X)
    proof
      let a; assume a in rng C;
      then consider i being object such that
A3:   i in dom C & a = C.i by FUNCT_1:def 3;
      reconsider i as Element of dom B by A1,A3;
      reconsider t = (V.i)-term as Element of Free(S,X);
      C.i = t & the_sort_of t = B.i by A1,SORT;
      hence a in Union the Sorts of Free(S,X) by A3;
    end;
    then reconsider C as FinSequence of Union the Sorts of Free(S,X)
    by FINSEQ_1:def 4;
    take C;
    thus dom C = dom B by A1;
    let i being Element of dom B;
    C.i = (V.i)-term by A1;
    hence thesis;
  end;
end;

definition
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let V be B-sorts FinSequence of Union X;
  let F be V-context-sequence FinSequence of Free(S,X);
  let i being Element of dom B;
  redefine func F.i -> context of V.i;
  coherence by CONTEXTSEQ;
end;

definition
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let V1,V2 be B-sorts FinSequence of Union X;
  attr V2 is V1-omitting means: OMIT2: rng V1 misses rng V2;
  let D be B-sorts FinSequence of Free(S,X);
  let F be V2-context-sequence FinSequence of Free(S,X);
  attr F is (V1,V2,D)-consequent-context-sequence means
  for i,j being Element of dom B st i+1 = j
  holds (F.j)-sub((V1.j)-term) = (F.i)-sub(D.i);
end;

definition
  let S,X;
  let B be non empty FinSequence of the carrier of S;
  let D be B-sorts FinSequence of Free(S,X);
  let V be B-sorts FinSequence of Union X;
  attr V is D-omitting means t in rng D implies vf t misses rng V;
end;

theorem OMIT4:
  for S,X for B being non empty FinSequence of the carrier of S
  for D being B-sorts FinSequence of Free(S,X)
  for V being B-sorts FinSequence of Union X st V is D-omitting
  for b1,b2 being Element of dom B holds D.b1 is V.b2-omitting
  proof
    let S,X;
    let B be non empty FinSequence of the carrier of S;
    let D be B-sorts FinSequence of Free(S,X);
    let V be B-sorts FinSequence of Union X;
    assume Z0: V is D-omitting;
    let b1,b2 be Element of dom B;
    dom D = dom B & dom V = dom B by SORTS,SORTS2;
    then D.b1 in rng D & V.b2 in rng V by FUNCT_1:def 3;
    then V.b2 nin vf (D.b1) by Z0,XBOOLE_0:3;
    hence D.b1 is V.b2-omitting by Th92;
  end;

registration
  let S,Y;
  let B be non empty FinSequence of the carrier of S;
  let V be B-sorts FinSequence of Union Y;
  let D be B-sorts FinSequence of Free(S,Y);
  cluster one-to-one V-omitting D-omitting for B-sorts FinSequence of Union Y;
  existence
  proof set N = {vf v: v in rng D}; deffunc F(Element of Free(S,Y)) = vf $1;
A0: rng D is finite;
A1: {F(v): v in rng D} is finite from FRAENKEL:sch 21(A0);
A3: N is finite-membered
    proof
      let a be set; assume a in N;
      then ex v st a = F(v) & v in rng D;
      hence thesis;
    end;
    deffunc G((Element of dom B),set) =
    {the Element of (Y.(B.($1+1)) \ (union N \/ rng V \/ $2))}\/$2;
    consider g being non empty FinSequence such that
A2: dom g = dom B & g.1 = {the Element of (Y.(B.1) \ (union N \/ rng V))} &
    for i,j being Element of dom B st j = i+1 holds g.j = G(i,g.i)
    from FinSeqRecLambda;
    deffunc F((Element of dom B),set) = union ((g.($1+1)) \ (g.$1));
    consider f being non empty FinSequence such that
AA: dom f = dom B & f.1 = union(g.1) &
    for i,j being Element of dom B st j = i+1 holds f.j = F(i,f.i)
    from FinSeqRecLambda;
    defpred P[Nat] means $1 in dom B implies g.$1 is finite;
B1: P[1] by A2;
B2: for i st i >= 1 & P[i] holds P[i+1]
    proof let i; assume
B4:   i >= 1 & P[i] & i+1 in dom B;
      then i <= i+1 <= len B by NAT_1:12,FINSEQ_3:25;
      then i <= len B by XXREAL_0:2;
      then reconsider i as Element of dom B by B4,FINSEQ_3:25;
      g.(i+1) = G(i,g.i) & g.i is finite by B4,A2;
      hence thesis;
    end;
B3: for i st i >= 1 holds P[i] from NAT_1:sch 8(B1,B2);
    defpred Q[Nat] means $1+1 in dom B implies g.($1+1) = {f.($1+1)}\/g.$1 &
    f.($1+1) nin g.$1 &
    f.($1+1) = the Element of Y.(B.($1+1)) \ (union N \/ rng V \/ g.$1);
C1: Q[1]
    proof
      assume
C2:   1+1 in dom B;
      then 1+1 <= len B by FINSEQ_3:25;
      then 1 <= len B by XXREAL_0:2;
      then reconsider i = 1, j = 1+1 as Element of dom B by C2,FINSEQ_3:25;
      reconsider gi = g.i as finite set by A2;
      set x = the Element of (Y.(B.j) \ (union N \/ rng V \/ gi));
C6:   x nin union N \/ rng V \/ gi by A1,A3,XBOOLE_0:def 5;
      then
C3:   x nin g.i by XBOOLE_0:def 3;
      g.2 = G(i,g.1) = {x}\/(g.1) & f.2 = F(i,f.1) = union((g.(i+1))\(g.i))
      by A2,AA,C2;
      then f.2 = union {x} = x by C3,EXCHSORT:3;
      hence thesis by C6,A2,XBOOLE_0:def 3;
    end;
C5: for i st i >= 1 & Q[i] holds Q[i+1]
    proof
      let i;
      assume Z0: i >= 1;
      assume Q[i];
      assume Z2: i+1+1 in dom B;
      then i+1 <= i+1+1 <= len B by NAT_1:12,FINSEQ_3:25;
      then
C6:   1 <= i+1 <= len B by NAT_1:12,XXREAL_0:2;
      then reconsider j2 = i+1+1, j = 1+i as Element of dom B
      by Z2,FINSEQ_3:25;
      i <= i+1 by NAT_1:12;
      then i <= len B by C6,XXREAL_0:2;
      then i in dom B by Z0,FINSEQ_3:25;
      then reconsider gi = g.i, gj = g.j as finite set by B3,FINSEQ_3:25;
      set x = the Element of (Y.(B.j2) \ (union N \/ rng V \/ gj));
C7:   x nin union N \/ rng V \/ gj by A1,A3,XBOOLE_0:def 5;
      then
C3:   x nin g.j by XBOOLE_0:def 3;
      g.j2 = G(j,g.j) = {x}\/(g.j) & f.j2 = F(j,f.j) = union((g.(j+1))\(g.j))
      by A2,AA;
      then f.j2 = union {x} = x by C3,EXCHSORT:3;
      hence thesis by C7,A2,XBOOLE_0:def 3;
    end;
C7: for i st i >= 1 holds Q[i] from NAT_1:sch 8(C1,C5);
C6: now let i be Element of dom B;
      i >= 1 by FINSEQ_3:25;
      hence i+1 in dom B implies g.(i+1) = {f.(i+1)}\/g.i & f.(i+1) nin g.i &
      f.(i+1) = the Element of Y.(B.(i+1)) \ (union N \/ rng V \/ g.i)
      by C7;
    end;
    rng f c= Union Y
    proof
      let a; assume a in rng f;
      then consider b such that
A5:   b in dom f & a = f.b by FUNCT_1:def 3;
      reconsider b as Element of dom B by AA,A5;
      b >= 1 by FINSEQ_3:25;
      then per cases by XXREAL_0:1;
      suppose b = 1;
        then a in Y.(B.b) & B.b in the carrier of S = dom Y
        by A1,A2,A3,AA,A5,XBOOLE_0:def 5,PARTFUN1:def 2;
        hence thesis by CARD_5:2;
      end;
      suppose b > 1;
        then b >= 1+1 by NAT_1:13;
        then consider c being Nat such that
D1:     b = 1+1+c by NAT_1:10;
D2:     b = 1+c+1 by D1;
        then len B >= b > 1+c by NAT_1:13,FINSEQ_3:25;
        then len B >= 1+c >= 1 by NAT_1:12,XXREAL_0:2;
        then reconsider c1 = 1+c as Element of dom B by FINSEQ_3:25;
        g.c1 is finite by B3,FINSEQ_3:25;
        then a = the Element of Y.(B.b) \ (union N \/ rng V \/ g.c1) &
        Y.(B.b) \ (union N \/ rng V \/ g.c1) <> {} by C6,A1,A3,D2,A5;
        then a in Y.(B.b) & B.b in the carrier of S = dom Y
        by XBOOLE_0:def 5,PARTFUN1:def 2;
        hence thesis by CARD_5:2;
      end;
    end;
    then reconsider f as FinSequence of Union Y by FINSEQ_1:def 4;
E0: for i,j being Element of dom B st i <= j holds g.i c= g.j
    proof let i,j be Element of dom B;
      defpred R[Nat] means $1 in dom B implies g.i c= g.$1;
E1:   R[i];
E2:   for j st j >= i & R[j] holds R[j+1]
      proof let j; assume
E3:     j >= i & R[j] & j+1 in dom B;
        then len B >= j+1 >= j & i >= 1 by NAT_1:12,FINSEQ_3:25;
        then
E4:     len B >= j >= 1 by E3,XXREAL_0:2;
        then j in dom B by FINSEQ_3:25;
        then g.(j+1) = {f.(j+1)}\/(g.j) by C6,E3;
        then g.i c= g.j c= g.(j+1) by E3,E4,XBOOLE_1:7,FINSEQ_3:25;
        hence thesis;
      end;
      for j st j >= i holds R[j] from NAT_1:sch 8(E1,E2);
     hence thesis;
    end;
: for i being Element of dom B st i <  java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    proofletijbe Element of dom  j;
      then i+1 <= j    L =L1from ORDINAL1:sch 3(A4,A6)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
thenconsider k Nat such that
:   j= i++k y :10
 by E5;
      len B >= i+k+1 by           CLASSES1 1(A1)
      then len B > i    hence L. = F()java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
thenlen  >=ik> 1 by XXREAL_0:;
      reconsider ik = + as Element of dom B by FINSEQ_3:25;
1:;
      hence thesis by ZFMISC_1:136;
    end;
F1: forb  Element of dom B holds f.b in g.b
    proof
      let b be Element of dom B;
      b >= 1 by FINSEQ_3:25;
      then per cases by XXREAL_0:1;
      suppose b = 1;
hence thesisby,TARSKIdef 1java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
      end;
      suppose
    b >1;
        b <= len B by FINSEQ_3:25;
       then  <=len B by D0,XXREAL_0:2;
        then reconsider Element of dom B by FINSEQ_3:25;
        c1 < b by assume
        hence thesis by F0;
      end;
    end;
    f is   &d1Collapse EB byA1;
proof
      thus dom f = dom Collapse (E,C } byTh1;
      let i; assumeconsider   
      C (EA {d9: for std1 in d9ex B st Bin A &d1 in
>   :;
thenper cases by XXREAL_0:
      suppose i =1
        then     thus thesis by A1,4;
        Y.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
henceiinY(.iby XBOOLE_0: java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
      end;
supposei>1
        theni > 11by NAT_1:;
        then considerA8:   ex st Q[A] by A1,A7;
D1:     i = 1+1+:f  m/ E&forx being object st x m /E holds [x,x]from
D2:     j = 1+c+1 by D1;
        then len B >= j > 1+c by NAT_1:13,FINSEQ_3:25;
        then len B >= 1+c >= 1 by NAT_1java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 31
        then  + asElementof dom B by FINSEQ_3:5;
        g.c1 is finite by java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
then.j  ElementofY.B.) \(union N /rng  \/ .c1 &
        Y.B.)\(union N \/rng V\/g.) <{}by C6,A1,A3,D2java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
        hence f.i in Y.(B.i) by XBOOLE_0:def 5;
      end; B in Aand
    end;
    then reconsider f asthen
    take f;
    thus f is =A&$ CollapseEA) &st$
    proofdefpredQ[Ordinal]means d in Collapse(,1)
      let ,;assume
 f.&< bjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
thenreconsider abas Element of domBbyAA;
      a < b or b < a yF2,XXREAL_0:1;
      then f.b in take A;
nce
end
    now
let a;assume a in rng f;
      then consider b such that
:b  dom f&a =f. byFUNCT_1:ef ;
      reconsider b A4: for d st d in Collapse for d st d in Collapse E,)holds f. =f.d;
     1=b by FINSEQ_3:java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
      then per cases by XXREAL_0:java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 20
A9:   zin dand =E by A3Th7;
         a  union{the Element of Y(B.)\(union N \/ rngV)} &
       (.b) \(nion \/ rng V)< }by AA,A1,A2,A3,A5;
        hence a nin union N \/ rng V . f|ollapse EA.:dby A4A5,A6,A13
      end;
      suppose b > 1;
        then b >= 1+1         proof
        then consider c A20:       zin dom f1 and
D1:     b = 1+1+c by NAT_1consider  such
D2:     b = 1+c+1 by D1;
        then len  >=b > 1+c by NAT_1:13,FINSEQ_3:25;
        then len B >= 1+c >= 1 by NAT_1:12z  suchthat
        then reconsiderd1  zas Element of Eby A26;
iteby F25;
        then a = the Element of Y.(B.:      f1|ollapse (E,B)=f2| (,B)by A15,A29java.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59
        Y.(B.b) \ (union N      end;
        thena nin union N \/rng V \/.c1by XBOOLE_0:def 5
       a nin union N \ rng V by XBOOLE_0:ef ;
     java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    end;
    then
A4: rng f misses union N \/ rng V by XBOOLE_0:3;
    thus rng V misses rng f by A4,XBOOLE_1:7,63;
    let t be Element of Free(S,Y);
    assume t in rng D; then vf t in N;
    then vf t c= union N by ZFMISC_1:74;
    hence thesis by A4,XBOOLE_1:10,63;
  end;
end;

definition
  let SX,
mode vf- oft -> FinSequencemeans:VFS:
  ex f being one-to-one FinSequence st
  rng f = {xi wherethen f1|ollapse (EB2)=f2 by A32,A41;
  dom it = dom f & for i   Q[1f2|ollapse EB1)E by A1,A41java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
         beingobjectst xin d  x,]from TARSKIsch1(A36;
  proof set I = {xi where xi is Element of dom t: ex s,x st t.xi = [f,]&x =f.1
    I c= dom t
    proof
      take d1Bf;
thenex  beingElement oft a = &ex xst t.=[,;
      hencethesis;
end;
then consider fbeing  suchthat
A1: rng A55:Collapse (,B)c=Collapse EA)by Th4;
    A57: d inCollapse E,B);
    deffunc F(object) = t.(f.$1);
    consider V being FinSequence such that
A2letx beobject;
    take ,f; thus rng f  I byA1;
    thus dom V = dom f by A2        consider C9 being Ordinal such that
2;
  endA70      [,h,E]and
end;

registration
letf be FinSequence
  cluster pr1 f -> FinSequence-like;
  coherence
  proof
    domend
    hence thesis by FINSEQ_1:def 2;
  
 pr2 f- inSequence-ikejava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  coherence
  proof
    dom pr2 f = dom A86: Q[A,f,E] by A84;
    hence thesis by  thus dom f=E A85,A86;
  end;
end;

theorem Th96:
  Yin rng f
  proof
    let f be vf-sequence ofhence thesis byFUNCT_1def3java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    consider g being one-to-one java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
A1: rng g = {xi where xi is Element of dom7
    dom java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 19
    let a; assume a in rng pr2 f;
    then consider b such that
:bin dompr2 &a=(r2f)bby FUNCT_1:ef ;
    reconsiderb as Natby 
 pr2 f =dom
    then g.b in rng g by A1,A2:g0.0=X java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    leth;
A4: g.b = xi & ex s,x st t.xiby,FUNCT_732,128
     sx such that
A5: t.xi = [x,s] by A4;
    a = (f.b)`2 e&EX
a in   ;
  java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 6


  for f being cA such that
  st B   in Collapse(E,A)and
  
    let f be vf-sequence  not w in d1;
 FinSequence of the carrier of S;
    then consider a beingobjectsuch that
    consider g being one-to-one A24:  A2 in A & v in Collapse(E,A2) by A11,A22
A1: rng g = {xi where xi is Elementhence contradiction byA10,19,A22,A23A20,A24,ORDINAL1:;
    dom f= dom g &for i sti in dom fholds f.=t.g.)by ;
    pr1 f is FinSequence of Union X
    proof
      let a; assume a in rng pr1 f;
      then consider b such that
A2:   b in dom pr1 f & a = (pr1 
      reconsiderbas  A;
A3:  dom pr1 f =dom f byMCART_1def ;
      then .in  gby A1,2,FUNCT_1:def ;
      then consider xi being Element of dom t such that
 g.=xi  exsx  t.i x,]by ;
      consider s,x such that
A5:   t.xi = [x,s] by A4;
      a = (f.b)`1 by A2,A3,MCART_1:def 12 .= [x,s]`1 by A1,A2,A3,A4,A5;
      hence a in Union X;
    end;
    then reconsider V = pr1 f as FinSequence of Union X;
    V is B-sorts
    proof
A6:   dom V = dom f = dom B by Z0,MCART_1:def 12,def 13;
      hence dom V = dom B;
      let i; assume
A7:   i in dom B;
      then g.i in rng g by A1,A6,FUNCT_1:def 3;
      then consider xi being Element of dom t such that
A4:   g.i = xi & ex s,x st t.xi = [x,s] by A1;
      consider s,x such that
A5:   t.xi = [x,s] by A4;
      B.i = (f.i)`2 & V.i = (f.i)`1 & f.i = [x,s]
      by Z0,A1,A4,A5,A6,A7,MCART_1:def 12,def 13;
      hence V.i in X.(B.i);
    end;
    hence pr1 f is B-sorts FinSequence of Union X;
  end;

registration
  let f be non empty FinSequence;
  reduce In(1, dom f) to 1;
  reducibility by FINSEQ_5:6,SUBSET_1:def 8;
  reduce In(len f, dom f) to len f;
  reducibility by SUBSET_1:def 8,FINSEQ_5:6;
end;

theorem Th117:
  for xi being Element of dom t st t.xi = [x,s]
  holds the_sort_of t1 = s implies
  t with-replacement (xi,t1) is Element of Free(S,X), the_sort_of t
  proof
    let xi be Element of dom t;
    assume Z0: t.xi = [x,s];
    assume Z1: the_sort_of t1 = s;
    defpred P[Element of Free(S,X)] means
    for xi being Element of dom $1
    for x1,t st $1.xi = [x1,s] & t = $1 holds $1 with-replacement (xi,t1)
    is Element of Free(S,X), the_sort_of t;
A1: P[x11-term]
    proof
      let xi be Element of dom(x11-term);
      dom(x11-term) = {{}} by TREES_1:29;
      then
A1:   xi = <*>NAT;
      let x1,t; assume (x11-term).xi = [x1,s];
      then [x11,s1] = [x1,s];
      then
A2:   s1 = s & x11 = x1 by XTUPLE_0:1;
      (x11-term) with-replacement(xi, t1) in
      (the Sorts of Free(S,X)).the_sort_of t1 by A1,SORT;
      hence thesis by A2,Z1,SORT;
    end;
A3: for o,p st for t st t in rng p holds P[t] holds P[o-term p]
    proof
      let o,p; assume
A4:   for t st t in rng p holds P[t];
      let xi being Element of dom (o-term p);
      let x1,t; assume
A5:   (o-term p).xi = [x1,s] & t = o-term p;
A6:   dom(o-term p) = tree doms p & doms p is Tree-yielding by TREES_4:10;
      then per cases by TREES_3:def 15;
      suppose xi = {};
        then (o-term p).xi = [o,the carrier of S] by TREES_4:def 4;
        then s in the carrier of S = s by A5,XTUPLE_0:1;
        hence (o-term p) with-replacement (xi,t1)
        is Element of Free(S,X), the_sort_of t;
      end;
      suppose
        ex n being Nat, w being FinSequence st
        n < len doms p & w in (doms p).(n+1) & xi = <*n*>^w;
        then consider w being FinSequence, n being Nat such
        that
B1:     n < len doms p & w in (doms p).(n+1) & xi = <*n*>^w;
        1 <= n+1 <= len doms p by B1,NAT_1:12,13;
        then
B2:     n+1 in dom doms p = dom p by FINSEQ_3:25,TREES_3:37;
        then
B3:     p/.(n+1) = p.(n+1) in rng p & (doms p).(n+1) = dom (p.(n+1))
        by FUNCT_1:def 3,PARTFUN1:def 6,FUNCT_6:def 2;
        reconsider w as Element of dom (p/.(n+1)) by B1,B3;
B4:     n < len p by B1,TREES_3:38;
        then (p/.(n+1)).w = [x1,s] by A5,B1,B3,TREES_4:12;
        then (p/.(n+1)) with-replacement (w,t1) is
        Element of Free(S,X), the_sort_of (p/.(n+1)) by B3,A4;
        then (p/.(n+1)) with-replacement (w,t1) is
        Element of Free(S,X), (the_arity_of o)/.(n+1) by B2,Th4A;
        then reconsider q = p+*(n+1, (p/.(n+1)) with-replacement (w,t1)) as
        Element of Args(o,Free(S,X)) by MSUALG_6:7;
        (Sym(o,X)-tree p) with-replacement (xi,t1) = Sym(o,X)-tree q
        by B1,B3,B4,A6,Th123;
        then (o-term p) with-replacement (xi,t1)
        is Element of Free(S,X), the_sort_of (o-term q) by SORT;
        then (o-term p) with-replacement (xi,t1)
        is Element of Free(S,X), the_result_sort_of o by Th8;
        hence (o-term p) with-replacement (xi,t1)
        is Element of Free(S,X), the_sort_of t by A5,Th8;
      end;
    end;
    P[t] from TermInd(A1,A3);
    hence t with-replacement (xi,t1) is Element of Free(S,X), the_sort_of t
    by Z0;
  end;

theorem Th118:
  X is non-trivial implies
  for xi being Element of dom C st C.xi = [x,s]
  holds the_sort_of t = s implies C-sub t = C with-replacement (xi,t)
  proof
    assume ZZ: X is non-trivial;
    let xi be Element of dom C;
    assume Z0: C.xi = [x,s];
    assume Z1: the_sort_of t = s;
    defpred P[Element of Free(S,X)] means for C being context of x st C = $1
    for xi being Element of dom C st C.xi = [x,s]
    holds C-sub t = C with-replacement (xi,t);
A1: P[x-term]
    proof
      let C such that
A2:   C = x-term;
      let xi be Element of dom C;
      xi in {{}} by A2,TREES_1:29;
      then xi = <*>NAT;
      hence thesis by Z1,A2,Th41;
    end;
A3: for o being OperSymbol of S
    for w being Element of Args(o, Free(S,X))
    st w is x-context_including
    holds P[x-context_in w] implies
    for C being context of x st C = o-term w holds P[C]
    proof
      let o be OperSymbol of S;
      let w be Element of Args(o, Free(S,X));
      assume Z2: w is x-context_including;
      assume Z3: P[x-context_in w];
      let C be context of x;
      assume Z4: C = o-term w;
      let D be context of x;
      assume Z5: D = C;
      let xi be Element of dom D;
      assume Z6: D.xi = [x,s];
      dom D = tree doms w by Z4,Z5,TREES_4:10;
      then per cases by TREES_3:def 15;
      suppose xi = {};
        then D.xi = [o,the carrier of S] by Z4,Z5,TREES_4:def 4;
        then s in the carrier of S = s by Z6,XTUPLE_0:1;
        hence thesis;
      end;
      suppose ex i being Nat, r being FinSequence st i < len doms w &
        r in (doms w).(i+1) & xi = <*i*>^r;
        then consider i being Nat, r being FinSequence such that
A4:     i < len doms w & r in (doms w).(i+1) & xi = <*i*>^r;
A5:     len doms w = len w by TREES_3:38;
        then
AB:     1 <= i+1 <= len w by A4,NAT_1:12,13;
        then
A6:     i+1 in dom w by FINSEQ_3:25;
        then
A7:     w/.(i+1) = w.(i+1) in rng w & (doms w).(i+1) = dom (w.(i+1))
        by PARTFUN1:def 6,FUNCT_6:def 2,FUNCT_1:def 3;
        then reconsider r as Element of dom (w/.(i+1)) by A4;
A8:     D.xi = (w/.(i+1)).r & [x,s] in {[x,s]}
        by Z4,Z5,A4,A5,A7,TARSKI:def 1,TREES_4:12;
        then w/.(i+1) is not x-omitting by Z6,FUNCT_1:def 7;
        then
AA:     x-context_pos_in w = i+1 by Z2,AB,Th72,FINSEQ_3:25;
        then
A9:     x-context_in w = w/.(i+1) by Z2,A7,Th71;
        the_sort_of (x-context_in w) =
        (the_arity_of o)/.(x-context_pos_in w) by A6,AA,A9,Th4A;
        then
        reconsider u = w+*(x-context_pos_in w, (x-context_in w)-sub t)
        as Element of Args(o,Free(S,X)) by MSUALG_6:7;
A11:    D-sub t = o-term u by ZZ,Z1,Z2,Z4,Z5,Th43;
        xi in dom D; then
        i < len w & xi in tree doms w &
        x-context_in w = w.(i+1) &
        u = w+*(i+1,(x-context_in w) with-replacement (r, t))
        by Z4,Z5,A4,AA,A9,Z3,Z6,A8,A6,TREES_3:38,TREES_4:10,PARTFUN1:def 6;
        hence thesis by A11,Z4,Z5,A4,Th123;
      end;
    end;
    P[C] from ContextInd(A1,A3);
    hence C-sub t = C with-replacement (xi,t) by Z0;
  end;

theorem Lem9:
  for xi1,xi2 being FinSequence st xi1 <> xi2 & xi1 in dom t & xi2 in dom t
  for s1,s2 being SortSymbol of S, x1 being Element of X.s1
  for x2 being Element of X.s2 st t.xi1 = [x1,s1]
  holds not xi1 is_a_prefix_of xi2
  proof
    let xi1,xi2 be FinSequence;
    assume Z0: xi1 <> xi2;
    assume xi1 in dom t;
    then reconsider nu1 = xi1 as Element of dom t;
    assume Z2: xi2 in dom t;
    let s1,s2 be SortSymbol of S;
    let x1 be Element of X.s1;
    let x2 be Element of X.s2;
    assume Z3: t.xi1 = [x1,s1];
    assume xi1 is_a_prefix_of xi2;
    then consider r being FinSequence such that
A1: xi2 = xi1^r by TREES_1:1;
    reconsider t1 = t|nu1 as Element of Free(S,X) by MSAFREE4:44;
    <*>NAT in (dom t qua Tree)|(nu1 qua FinSequence of NAT) by TREES_1:22;
    then
A2: t1.{} = t.(nu1^{}) by TREES_2:def 10;
    xi2 is Element of dom t by Z2;
    then reconsider r as FinSequence of NAT by A1,FINSEQ_1:36;
    per cases by Th16;
    suppose ex s,x st t1 = x-term;
      then consider s,x such that
A4:   t1 = x-term;
      dom t1 = (dom t)|nu1 by TREES_2:def 10;
      then r in dom t1 by Z2,A1,TREES_1:def 6;
      then r in {{}} by A4,TREES_1:29;
      then r = {};
      hence thesis by Z0,A1;
    end;
    suppose ex o,p st t1 = o-term p;
      then consider o,p such that
A3:   t1 = o-term p;
      t1.{} = [o,the carrier of S] by A3,TREES_4:def 4;
      then s1 in the carrier of S = s1 by A2,Z3,XTUPLE_0:1;
      hence thesis;
    end;
  end;

theorem Lem10:
  for t,t1 for xi being Element of dom t st
  t1 = t with-replacement(xi,x-term) & t is x-omitting holds t1 is context of x
  proof
    let t,t1;
    let xi be Element of dom t;
    assume Z1: t1 = t with-replacement(xi,x-term);
    assume Z2: t is x-omitting;
    Coim(t1,[x,s]) = {xi}
    proof
      thus Coim(t1,[x,s]) c= {xi}
      proof
        let a; assume
A0:     a in Coim(t1,[x,s]);
        then
A1:     a in dom t1 & t1.a in {[x,s]} by FUNCT_1:def 7;
        reconsider nu = a as Element of dom t1 by A0,FUNCT_1:def 7;
        nu in dom t1;
        then
A5:     xi in dom t & nu in dom t with-replacement(xi, dom (x-term))
        by Z1,TREES_2:def 11;
        then per cases by Z1,TREES_2:def 11;
        suppose
A3:       t1.nu = t.nu & not xi is_a_prefix_of nu;
          then not ex r being FinSequence of NAT st r in dom (x-term) &
          nu = xi^r by TREES_1:1;
          then [x,s] in {[x,s]} & nu in dom t by A5,TARSKI:def 1,TREES_1:def 9;
          hence thesis by Z2,A3,A1,FUNCT_1:def 7;
        end;
        suppose ex r being FinSequence of NAT st r in dom (x-term) & nu = xi^r
          & t1.nu = (x-term).r;
          then consider r being FinSequence of NAT such that
A6:       r in dom (x-term) & nu = xi^r & t1.nu = (x-term).r;
          r in {{}} by A6,TREES_1:29;
          then r = {};
          hence thesis by A6,TARSKI:def 1;
        end;
      end;
      let a; assume a in {xi};
      then
A7:   a = xi by TARSKI:def 1;
A9:   xi in dom t with-replacement(xi, dom(x-term)) = dom t1
      by Z1,TREES_1:def 9,TREES_2:def 11;
      then consider r being FinSequence of NAT such that
A8:   r in dom (x-term) & xi = xi^r & t1.xi = (x-term).r by Z1,TREES_2:def 11;
      r = {} by A8,FINSEQ_1:87;
      then t1.xi = [x,s] in {[x,s]} by A8,TARSKI:def 1,TREES_4:3;
      hence thesis by A7,A9,FUNCT_1:def 7;
    end;
    then card Coim(t1,[x,s]) = 1 by CARD_1:30;
    hence t1 is context of x by CONTEXT;
  end;

theorem Lem11:
  for t,t1 for xi being Element of dom t st t.xi = [x,s]
  holds dom t c= dom (t with-replacement(xi,t1))
  proof
    let t,t1;
    let xi be Element of dom t;
    assume Z0: t.xi = [x,s];
    let a;
    assume a in dom t;
    then reconsider q = a as Element of dom t;
    xi in Leaves dom t by Z0,Lem13;
    then not xi c< q by TREES_1:def 5;
    then q in dom t with-replacement(xi, dom t1) by TREES_1:def 9;
    hence a in dom (t with-replacement(xi,t1)) by TREES_2:def 11;
  end;

theorem Lem11A:
  for t for xi being Element of dom t st t.xi = [x,s]
  holds dom t = dom (t with-replacement(xi,x1-term))
  proof
    let t; set t1 = x1-term;
    let xi be Element of dom t;
    assume t.xi = [x,s];
    then
A0: dom t c= dom (t with-replacement(xi,x1-term)) by Lem11;
    dom (t with-replacement(xi,x1-term)) c= dom t
    proof let a;
      assume a in dom (t with-replacement(xi,x1-term));
      then reconsider q = a as Element of dom (t with-replacement(xi,x1-term));
      dom (t with-replacement(xi,x1-term)) = dom t with-replacement(xi, dom t1)
      by TREES_2:def 11;
      then per cases by TREES_1:def 9;
      suppose q in dom t;
        hence a in dom t;
      end;
      suppose ex r being FinSequence of NAT st r in dom t1 & q = xi^r;
        then consider r being FinSequence of NAT such that
A1:     r in dom t1 & q = xi^r;
        r in {{}} by A1,TREES_1:29;
        then r = {};
        hence a in dom t by A1;
      end;
    end;
    hence thesis by A0,XBOOLE_0:def 10;
  end;

theorem Th129:
  for t,t1 being Tree, xi being Element of t holds
  (t with-replacement(xi,t1))|xi = t1
  proof
    let t,t1 be Tree;
    let xi be Element of t;
    let p be FinSequence of NAT;
A1: xi in t with-replacement(xi,t1) by TREES_1:def 9;
    hereby assume p in (t with-replacement(xi,t1))|xi;
      then xi^p in t with-replacement(xi,t1) by A1,TREES_1:def 6;
      hence p in t1 by Th01;
    end;
    assume p in t1;
    then xi^p in t with-replacement(xi,t1) by TREES_1:def 9;
    hence thesis by A1,TREES_1:def 6;
  end;

theorem Th130:
  for t,t1 being DecoratedTree, xi being Node of t holds
  (t with-replacement(xi,t1))|xi = t1
  proof
    let t,t1 be DecoratedTree;
    let xi be Node of t;
A1: xi in dom t with-replacement(xi,dom t1)
    = dom(t with-replacement(xi,t1)) by TREES_1:def 9,TREES_2:def 11;
A2: dom((t with-replacement(xi,t1))|xi)
    = (dom (t with-replacement(xi,t1)))|xi by TREES_2:def 10;
    hence dom((t with-replacement(xi,t1))|xi) = dom t1 by A1,Th129;
    let p be Node of (t with-replacement(xi,t1))|xi;
    xi^p in dom(t with-replacement(xi,t1)) & xi c= xi^p
    by A1,A2,TREES_1:1,def 6;
    then consider r being FinSequence of NAT such that
A4: r in dom t1 & xi^p = xi^r & (t with-replacement(xi,t1)).(xi^p) = t1.r
    by A1,TREES_2:def 11;
    thus ((t with-replacement(xi,t1))|xi).p
    = (t with-replacement(xi,t1)).(xi^p) by A2,TREES_2:def 10
    .= t1.p by A4,FINSEQ_1:33;
  end;

theorem Th131:
  for xi being Node of t st t1 = t|xi holds (h.t)|xi = h.t1
  proof
    let xi be Node of t;
    defpred P[Element of Free(S,X)] means for xi being Node of $1
    for t1 st t1 = $1|xi holds (h.$1)|xi = h.t1 & xi in dom (h.$1);
A1: P[x-term]
    proof
      let xi be Node of x-term;
      dom(x-term) = {{}} by TREES_1:29;
      then
A2:   xi = {};
      let t1; assume t1 = (x-term)|xi;
      then t1 = x-term by A2,TREES_9:1;
      hence (h.(x-term))|xi = h.t1 by A2,TREES_9:1;
      thus thesis by A2,TREES_1:22;
    end;
A3: for o,p st for t st t in rng p holds P[t] holds P[o-term p]
    proof
      let o,p; assume
A4:   for t st t in rng p holds P[t];
      let xi be Node of o-term p;
      let t1; assume
A5:   t1 = (o-term p)|xi;
      per cases by TREES_4:11;
      suppose
A6:     xi = {};
        hence (h.(o-term p))|xi = h.(o-term p) by TREES_9:1
        .= h.t1 by A5,A6,TREES_9:1;
        thus thesis by A6,TREES_1:22;
      end;
      suppose ex n being Nat,t being DecoratedTree,q being Node of t
        st n < len p & t = p.(n+1) & xi = <*n*>^q;
        then consider n being Nat,t being DecoratedTree,q being Node of t
        such that
A6:     n < len p & t = p.(n+1) & xi = <*n*>^q;
A8:     t1 = (o-term p)|<*n*>|q by A5,A6,TREES_9:3;
        1 <= n+1 <= len p by A6,NAT_1:12,13;
        then
A10:    n+1 in dom p by FINSEQ_3:25;
        then reconsider t as Element of Free(S,X) by A6,FUNCT_1:102;
A9:     t = (o-term p)|<*n*> by A6,TREES_4:def 4;
        t in rng p by A6,A10,FUNCT_1:def 3;
        then
A12:    (h.t)|q = h.t1 & q in dom (h.t) by A8,A9,A4;
        the_sort_of (o-term p) = the_result_sort_of o by Th8;
        then h.(o-term p) = h.(the_result_sort_of o).(o-term p) &
        o-term p = Den(o,Free(S,X)).p
        by ABBR,MSAFREE4:13;
        then
A13:    h.(o-term p) = Den(o,Free(S,X)).(h#p) by MSUALG_6:def 2,MSUALG_3:def 7
        .= o-term (h#p) by MSAFREE4:13;
        dom (h#p) = dom the_arity_of o = dom p by MSUALG_6:2;
        then
A16:    len (h#p) = len p by FINSEQ_3:29;
        then
A14:    (h#p).(n+1) = (o-term (h#p))|<*n*> by A6,TREES_4:def 4;
        (h#p).(n+1) = h.((the_arity_of o)/.(n+1)).t & t = p/.(n+1)
        by A6,A10,MSUALG_3:def 6,PARTFUN1:def 6;
        then
A15:    (h#p).(n+1) = h.(the_sort_of t).t by A10,Th4A .= h.t by ABBR;
        then <*n*>^q in dom(o-term (h#p)) by A6,A12,A16,TREES_4:11;
        hence thesis by A6,A12,A13,A14,A15,TREES_9:3;
      end;
    end;
    P[t] from TermInd(A1,A3);
    hence thesis;
  end;

theorem Th132:
  for xi being Node of t st t.xi = [x,s] holds t|xi = x-term
  proof
    let xi be Node of t;
    assume Z0: t.xi = [x,s];
    reconsider tx = t|xi as Element of Free(S,X) by MSAFREE4:44;
    per cases by Th16;
    suppose ex s1,x11 st tx = x11-term;
      then consider s1,x11 such that
A1:   tx = x11-term;
      <*>NAT in dom tx = (dom t)|xi by TREES_1:22,TREES_2:def 10;
      then tx.{} = t.(xi^{}) by TREES_2:def 10;
      hence t|xi = x-term by Z0,A1,TREES_4:3;
    end;
    suppose ex o,p st tx = o-term p;
      then consider o,p such that
A2:   tx = o-term p;
      <*>NAT in dom tx = (dom t)|xi by TREES_1:22,TREES_2:def 10;
      then tx.{} = t.(xi^{}) by TREES_2:def 10;
      then [o,the carrier of S] = [x,s] by Z0,A2,TREES_4:def 4;
      then s in the carrier of S = s by XTUPLE_0:1;
      hence thesis;
    end;
  end;

theorem Th134:
  for t,t1 being Tree, xi,nu being Element of t st not xi c= nu &
  not nu c= xi holds (t with-replacement(xi,t1))|nu = t|nu
  proof
    let t,t1 be Tree;
    let xi,nu be Element of t;
    assume Z0: not xi c= nu;
    assume Z1: not nu c= xi;
    let a be FinSequence of NAT;
    hereby
      assume a in (t with-replacement(xi,t1))|nu;
      then reconsider b = a as Element of (t with-replacement(xi,t1))|nu;
      not xi c< nu by Z0,XBOOLE_0:def 8;
      then nu in t with-replacement(xi,t1) by TREES_1:def 9;
      then nu^b in t with-replacement(xi,t1) by TREES_1:def 6;
      then per cases by TREES_1:def 9;
      suppose nu^b in t & not xi c< nu^b;
        hence a in t|nu by TREES_1:def 6;
      end;
      suppose ex r being FinSequence of NAT st r in t1 & nu^b = xi^r;
        then consider r being FinSequence of NAT such that
B1:     r in t1 & nu^b = xi^r;
        nu c= xi^r & xi c= nu^b by B1,Lem8;
        hence a in t|nu by Z0,Z1,Lem8B;
      end;
    end;
    assume a in t|nu;
    then
A2: nu^a in t by TREES_1:def 6;
    not xi c< nu^a by Z0,Z1,Lem8B,XBOOLE_0:def 8;
    then
A3: nu^a in t with-replacement(xi,t1) by A2,TREES_1:def 9;
    not xi c< nu by Z0,XBOOLE_0:def 8;
    then nu in t with-replacement(xi,t1) by TREES_1:def 9;
    hence thesis by A3,TREES_1:def 6;
  end;

theorem Th133:
  for t,t1 being DecoratedTree, xi,nu being Node of t st not xi c= nu &
  not nu c= xi holds (t with-replacement(xi,t1))|nu = t|nu
  proof
    let t,t1 be DecoratedTree;
    let xi,nu be Node of t;
    assume Z0: not xi c= nu;
    assume Z1: not nu c= xi;
    not xi c< nu by Z0,XBOOLE_0:def 8;
    then
A1: nu in dom t with-replacement(xi,dom t1)
    = dom(t with-replacement(xi,t1)) by TREES_1:def 9,TREES_2:def 11;
A2: dom((t with-replacement(xi,t1))|nu) = (dom(t with-replacement(xi,t1)))|nu
    by TREES_2:def 10;
    hence
A4: dom((t with-replacement(xi,t1))|nu) = (dom t)|nu by Z0,Z1,A1,Th134
    .= dom (t|nu) by TREES_2:def 10;
    let p be Node of (t with-replacement(xi,t1))|nu;
A8: (dom t)|nu = dom (t|nu) by TREES_2:def 10;
    then
A5: nu^p in dom t & (t|nu).p = t.(nu^p) by A4,TREES_1:def 6,TREES_2:def 10;
    not xi c< nu^p by Z0,Z1,Lem8B,XBOOLE_0:def 8;
    then
A7: nu^p in dom t with-replacement(xi,dom t1) by A5,TREES_1:def 9;
A6: not ex r being FinSequence of NAT st r in dom t1 & nu^p = xi^r &
    (t with-replacement(xi,t1)).(nu^p) = t1.r by Z0,Z1,Lem8B,TREES_1:1;
    thus ((t with-replacement(xi,t1))|nu).p
    = (t with-replacement(xi,t1)).(nu^p) by A2,TREES_2:def 10
    .= t.(nu^p) by A6,A7,TREES_2:def 11
    .= (t|nu).p by A8,TREES_2:def 10,A4;
  end;

theorem Th136:
  t c= t1 implies t = t1
  proof
    assume
A1: t c= t1;
    defpred P[Element of Free(S,X)] means for t1 st $1 c= t1 holds $1 = t1;
A2: P[x-term]
    proof
      let t1;
      assume
A3:   x-term c= t1;
      {} in dom (x-term) by TREES_1:22;
      then
A4:   t1.{} = (x-term).{} = [x,s] by A3,GRFUNC_1:2,TREES_4:3;
      per cases by Th16;
      suppose ex s,x st t1 = x-term;
        then consider s1,x11 such that
A5:     t1 = x11-term;
        thus thesis by A5,A4,TREES_4:3;
      end;
      suppose ex o,p st t1 = o-term p;
        then consider o,p such that
A6:     t1 = o-term p;
        t1.{} = [o,the carrier of S] by A6,TREES_4:def 4;
        then s in the carrier of S = s by A4,XTUPLE_0:1;
        hence thesis;
      end;
    end;
A7: for o,p st for t st t in rng p holds P[t] holds P[o-term p]
    proof
      let o,p;
      assume Z0: for t st t in rng p holds P[t];
      let t1; assume Z1: o-term p c= t1;
      {} in dom (o-term p) by TREES_1:22;
      then
A8:   t1.{} = (o-term p).{} = [o,the carrier of S]
      by Z1,GRFUNC_1:2,TREES_4:def 4;
      per cases by Th16;
      suppose ex s,x st t1 = x-term;
        then consider s1,x11 such that
A5:     t1 = x11-term;
        t1.{} = [x11,s1] by A5,TREES_4:3;
        then s1 in the carrier of S = s1 by A8,XTUPLE_0:1;
        hence thesis;
      end;
      suppose ex o,p st t1 = o-term p;
        then consider o1 being OperSymbol of S,
        p1 being Element of Args(o1,Free(S,X)) such that
A6:     t1 = o1-term p1;
        t1.{} = [o1,the carrier of S] by A6,TREES_4:def 4;
        then
A7:     o = o1 by A8,XTUPLE_0:1;
        p = p1
        proof
A8:       dom p = dom the_arity_of o = dom p1 by A7,MSUALG_6:2;
          hence
B3:       len p = len p1 by FINSEQ_3:29;
          let i; assume
A9:       1 <= i <= len p;
          then
B8:       i in dom p by FINSEQ_3:25;
          reconsider t = p.i, t1 = p1.i as Element of Free(S,X)
          by A8,A9,FUNCT_1:102,FINSEQ_3:25;
          consider j such that
B2:       i = 1+j by A9,NAT_1:10;
B7:       j < len p by A9,B2,NAT_1:13;
          then
B4:       t = (o-term p)|<*j*> & t1 = (o1-term p1)|<*j*>
          by B2,B3,TREES_4:def 4;
          then
B5:       dom t = (dom(o-term p))|<*j*> & dom t1 = (dom(o1-term p1))|<*j*>
          by TREES_2:def 10;
          (doms p).(j+1) = dom t by B2,B8,FUNCT_6:def 2;
          then {} in (doms p).(j+1) & dom(o-term p) = tree doms p &
          len doms p = len p by TREES_3:38,TREES_4:10,TREES_1:22;
          then
B6:       <*j*>^{} in dom(o-term p) by B7,TREES_3:48;
          (doms p1).(j+1) = dom t1 by B2,A9,A8,FINSEQ_3:25,FUNCT_6:def 2;
          then {} in (doms p1).(j+1) & dom(o1-term p1) = tree doms p1 &
          len doms p1 = len p1 by TREES_3:38,TREES_4:10,TREES_1:22;
          then
BB:       <*j*>^{} in dom(o1-term p1) by B3,B7,TREES_3:48;
BE:       t c= t1
          proof
            let a,b; assume
B1:         [a,b] in t;
            then reconsider a as Node of t by XTUPLE_0:def 12;
            t.a = b by B1,FUNCT_1:1;
            then
BA:         (o-term p).(<*j*>^a) = b & <*j*>^a in dom (o-term p)
            by B4,B5,B6,TREES_1:def 6,TREES_2:def 10;
            then
BC:         (o1-term p1).(<*j*>^a) = b & dom(o-term p) c= dom(o1-term p1)
            by Z1,A6,GRFUNC_1:2;
            then
BD:         a in dom t1 by BA,BB,B5,TREES_1:def 6;
            then t1.a = b by BC,B4,B5,TREES_2:def 10;
            hence thesis by BD,FUNCT_1:1;
          end;
          t in rng p by B8,FUNCT_1:def 3;
          hence thesis by BE,Z0;
        end;
        hence thesis by A6,A8,TREES_4:def 4;
      end;
    end;
    P[t] from TermInd(A2,A7);
    hence thesis by A1;
  end;

theorem Th135:
  for t
  for h being Endomorphism of Free(S,X) holds dom t c= dom (h.t) &
  for I st
  I = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]}
  holds t|((dom t) \ I) = (h.t)|((dom t) \ I)
  proof
    let t;
    let h be Endomorphism of Free(S,X);
    defpred P[Element of Free(S,X)] means dom $1 c= dom (h.$1) & for I st
    I = {xi where xi is Element of dom $1: ex s,x st $1.xi = [x,s]}
    holds $1|((dom $1) \ I) = (h.$1)|((dom $1) \ I);
A1: P[x-term]
    proof
      {} in dom (h.(x-term)) by TREES_1:22;
      then {{}} c= dom (h.(x-term));
      hence dom (x-term) c= dom (h.(x-term)) by TREES_1:29;
      let I; assume
A2:   I = {xi where xi is Node of x-term: ex s,x1 st (x-term).xi = [x1,s]};
      {} in dom (x-term) & (x-term).{} = [x,s] by TREES_1:22,TREES_4:3;
      then {} in I by A2;
      then {{}} c= I;
      then dom (x-term) c= I by TREES_1:29;
      then (x-term)|((dom(x-term))\I) = {} &
      (h.(x-term))|((dom(x-term))\I) = {};
      hence thesis;
    end;
A3: for o,p st for t st t in rng p holds P[t] holds P[o-term p]
    proof
      let o,p;
      assume Z0: for t st t in rng p holds P[t];
      the_sort_of (o-term p) = the_result_sort_of o by Th8;
      then
A6:   h.(o-term p) = h.(the_result_sort_of o).(o-term p) by ABBR
      .= h.(the_result_sort_of o).(Den(o,Free(S,X)).p) by MSAFREE4:13
      .= Den(o,Free(S,X)).(h#p) by MSUALG_6:def 2,MSUALG_3:def 7
      .= o-term (h#p) by MSAFREE4:13;
      thus
B3:   dom(o-term p) c= dom(h.(o-term p))
      proof let a;
        assume a in dom(o-term p);
        then per cases by TREES_4:11;
        suppose a = {};
          hence thesis by TREES_1:22;
        end;
        suppose
          ex i being Nat, T being DecoratedTree, r being Node of T st
          i < len p & T = p.(i+1) & a = <*i*>^r;
          then consider i being Nat, T being DecoratedTree, r being Node of T
          such that
A7:       i < len p & T = p.(i+1) & a = <*i*>^r;
          1 <= i+1 <= len p by A7,NAT_1:12,13;
          then
A8:       i+1 in dom p by FINSEQ_3:25;
          then reconsider T as Element of Free(S,X) by A7,FUNCT_1:102;
          T in rng p by A7,A8,FUNCT_1:def 3;
          then dom T c= dom (h.T) by Z0;
          then
A9:       r in dom(h.T);
A10:      (h#p).(i+1) = h.((the_arity_of o)/.(i+1)).T by A7,A8,MSUALG_3:def 6
          .= h.((the_arity_of o)/.(i+1)).(p/.(i+1)) by A7,A8,PARTFUN1:def 6
          .= h.(the_sort_of (p/.(i+1))).(p/.(i+1)) by A8,Th4A
          .= h.(p/.(i+1)) by ABBR
          .= h.T by A7,A8,PARTFUN1:def 6;
          dom (h#p) = dom the_arity_of o = dom p by MSUALG_6:2;
          then len(h#p) = len p by FINSEQ_3:29;
          hence thesis by A7,A9,A10,A6,TREES_4:11;
        end;
      end;
      let I; assume
A4:   I = {xi where xi is Node of o-term p: ex s,x st (o-term p).xi = [x,s]};
B2:   (dom (o-term p))\I c= dom(h.(o-term p)) by B3;
      thus dom((o-term p)|((dom (o-term p))\I))
      = dom((h.(o-term p))|((dom (o-term p))\I)) by B2,RELAT_1:62;
      let q being object; assume
BB:   q in dom((o-term p)|((dom (o-term p))\I));
      reconsider q as Node of o-term p by BB;
B6:   ((o-term p)|((dom (o-term p))\I)).q = (o-term p).q &
      ((h.(o-term p))|((dom (o-term p))\I)).q = h.(o-term p).q
      by BB,FUNCT_1:49;
      per cases by TREES_4:11;
      suppose q = {};
        then (o-term p).q = [o,the carrier of S] = (o-term (h#p)).q
        by TREES_4:def 4;
        hence thesis by A6,B6;
      end;
      suppose
        ex i being Nat, T being DecoratedTree, r being Node of T st
        i < len p & T = p.(i+1) & q = <*i*>^r;
        then consider i being Nat, T being DecoratedTree, r being Node of T
        such that
A7:     i < len p & T = p.(i+1) & q = <*i*>^r;
        1 <= i+1 <= len p by A7,NAT_1:12,13;
        then
A8:     i+1 in dom p by FINSEQ_3:25;
        then reconsider T as Element of Free(S,X) by A7,FUNCT_1:102;
        set II = {xi where xi is Node of T: ex s,x st T.xi = [x,s]};
        T in rng p by A7,A8,FUNCT_1:def 3;
        then
B9:     dom T c= dom (h.T) & T|((dom T)\II) = (h.T)|((dom T)\II) by Z0;
B8:     (o-term p).q = T.r by A7,TREES_4:12;
        r nin II
        proof
          assume r in II;
          then consider xi being Node of T such that
B7:       r = xi & ex s,x st T.xi = [x,s];
          q in I by A4,B8,B7;
          hence contradiction by BB,XBOOLE_0:def 5;
        end;
        then r in (dom T)\II by XBOOLE_0:def 5;
        then
A11:    T.r = (T|((dom T)\II)).r = h.T.r by B9,FUNCT_1:49;
A10:    (h#p).(i+1) = h.((the_arity_of o)/.(i+1)).T by A7,A8,MSUALG_3:def 6
        .= h.((the_arity_of o)/.(i+1)).(p/.(i+1)) by A7,A8,PARTFUN1:def 6
        .= h.(the_sort_of (p/.(i+1))).(p/.(i+1)) by A8,Th4A
        .= h.(p/.(i+1)) by ABBR
        .= h.T by A7,A8,PARTFUN1:def 6;
        dom (h#p) = dom the_arity_of o = dom p by MSUALG_6:2;
        then len(h#p) = len p & r in dom(h.T) by B9,FINSEQ_3:29;
        hence thesis by B6,B8,A6,A7,A10,A11,TREES_4:12;
      end;
    end;
    thus P[t] from TermInd(A1,A3);
  end;

theorem Th137:
  for t st I = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]}
  for xi being Node of h.t holds
  xi in (dom t)\I or ex nu being Element of dom t st nu in I &
  ex mu being Node of (h.t)|nu st xi = nu^mu
  proof
    let t;
    defpred P[Element of Free(S,X)] means for I st
    I = {xi where xi is Element of dom $1: ex s,x st $1.xi = [x,s]}
    for xi being Node of h.$1 holds
    xi in (dom $1)\I or ex nu being Element of dom $1 st nu in I &
    ex mu being Node of (h.$1)|nu st xi = nu^mu;
A1: P[x-term]
    proof
      let I; assume
A2:   I = {xi where xi is Node of x-term: ex s1,x11 st (x-term).xi = [x11,s1]};
      let xi being Node of h.(x-term);
      assume xi nin (dom(x-term))\I;
      reconsider nu = {} as Node of x-term by TREES_1:22;
      take nu; (x-term).nu = [x,s];
      hence nu in I by A2;
      reconsider mu = xi as Node of (h.(x-term))|nu by TREES_9:1;
      take mu; thus xi = nu^mu;
    end;
A3: for o,p st for t st t in rng p holds P[t] holds P[o-term p]
    proof
      let o,p;
      assume Z0: for t st t in rng p holds P[t];
      let I; assume
A4:   I = {xi where xi is Node of o-term p: ex s,x st (o-term p).xi = [x,s]};
      let xi being Node of h.(o-term p);
      assume
A5:   xi nin (dom(o-term p))\I;
      the_sort_of (o-term p) = the_result_sort_of o by Th8;
      then
A6:   h.(o-term p) = h.(the_result_sort_of o).(o-term p) by ABBR
      .= h.(the_result_sort_of o).(Den(o,Free(S,X)).p) by MSAFREE4:13
      .= Den(o,Free(S,X)).(h#p) by MSUALG_6:def 2,MSUALG_3:def 7
      .= o-term (h#p) by MSAFREE4:13;
      then per cases by TREES_4:11;
      suppose xi = {};
        then
B0:     (o-term p).xi = [o,the carrier of S] & xi in dom (o-term p)
        by TREES_1:22,TREES_4:def 4;
        xi nin I
        proof
          assume xi in I;
          then consider nu being Node of o-term p such that
B1:       xi = nu & ex s,x st (o-term p).nu = [x,s] by A4;
          consider s,x such that
B2:       (o-term p).xi = [x,s] by B1;
          s in the carrier of S = s by B0,B2,XTUPLE_0:1;
          hence contradiction;
        end;
        hence thesis by B0,A5,XBOOLE_0:def 5;
      end;
      suppose
        ex i being Nat, T being DecoratedTree, q being Node of T st
        i < len (h#p) & T = (h#p).(i+1) & xi = <*i*>^q;
        then consider i being Nat, T being DecoratedTree, q being Node of T
        such that
B3:     i < len (h#p) & T = (h#p).(i+1) & xi = <*i*>^q;
        dom (h#p) = dom the_arity_of o = dom p by MSUALG_6:2;
        then
BA:     len (h#p) = len p by FINSEQ_3:29;
        then 1 <= i+1 <= len p by B3,NAT_1:12,13;
        then
B4:     i+1 in dom p by FINSEQ_3:25;
        then reconsider t = p.(i+1) as Element of Free(S,X) by FUNCT_1:102;
        set II = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]};
B5:     t = p/.(i+1) by B4,PARTFUN1:def 6;
B6:     T = h.((the_arity_of o)/.(i+1)).t by B3,B4,MSUALG_3:def 6
        .= h.(the_sort_of (p/.(i+1))).t by B4,Th4A
        .= h.t by B5,ABBR;
        then reconsider q as Node of h.t;
        t in rng p by B4,FUNCT_1:def 3;
        then per cases by Z0;
        suppose
BB:       q in (dom t)\II;
          then
B7:       q in dom t & q nin II by XBOOLE_0:def 5;
B8:       xi in dom (o-term p) by B3,BA,BB,TREES_4:11;
          xi nin I
          proof
            assume xi in I;
            then consider nu being Node of o-term p such that
B1:         xi = nu & ex s,x st (o-term p).nu = [x,s] by A4;
            consider s,x such that
B2:         (o-term p).xi = [x,s] by B1;
            t.q = [x,s] by B2,B3,BA,BB,TREES_4:12;
            hence contradiction by B7;
          end;
          hence thesis by A5,B8,XBOOLE_0:def 5;
        end;
        suppose ex nu being Element of dom t st nu in II &
          ex mu being Node of (h.t)|nu st q = nu^mu;
          then consider nu being Node of t, mu being Node of (h.t)|nu such that
C1:       nu in II & q = nu^mu;
          reconsider inu = <*i*>^nu as Node of o-term p by B3,BA,TREES_4:11;
          take inu;
          consider xi1 being Node of t such that
C2:       nu = xi1 & ex s,x st t.xi1 = [x,s] by C1;
          ex s,x st (o-term p).inu = [x,s] by C2,B3,BA,TREES_4:12;
          hence inu in I by A4;
          h.t = (h.(o-term p))|<*i*> &
          inu in dom(o-term p) c= dom(h.(o-term p))
          by B3,A6,B6,Th135,TREES_4:def 4;
          then reconsider mu as Node of (h.(o-term p))|inu by TREES_9:3;
          take mu;
          thus thesis by B3,C1,FINSEQ_1:32;
        end;
      end;
    end;
    P[t] from TermInd(A1,A3);
    hence thesis;
  end;

theorem Th138:
  for v,v1
  for h being Endomorphism of Free(S,Y)
  for g being one-to-one FinSequence of dom v st
  rng g = {xi where xi is Element of dom v: ex s,y st v.xi = [y,s]} &
  dom v c= dom v1 & v|((dom v) \ rng g) = v1|((dom v) \ rng g) &
  for i st i in dom g holds (h.v)|(g/.i qua Node of v)=v1|(g/.i qua Node of v)
  holds h.v = v1
  proof
    let v,v1;
    let h be Endomorphism of Free(S,Y);
    let g be one-to-one FinSequence of dom v;
    assume
Z0: rng g = {xi where xi is Element of dom v: ex s,y st v.xi = [y,s]};
    assume Z1: dom v c= dom v1;
    assume v|((dom v) \ rng g) = v1|((dom v) \ rng g);
    then
A5: (h.v)|((dom v) \ rng g) = v1|((dom v) \ rng g) by Z0,Th135;
    assume Z3: for i st i in dom g holds
    (h.v)|(g/.i qua Node of v) = v1|(g/.i qua Node of v);
    h.v c= v1
    proof let a,b;
      assume [a,b] in h.v;
      then
A1:   a in dom(h.v) & b = h.v.a by FUNCT_1:1;
      then per cases by Z0,Th137;
      suppose a in (dom v)\rng g;
        then
A2:     ((h.v)|((dom v) \ rng g)).a = h.v.a & a in dom v &
        (v1|((dom v) \ rng g)).a = v1.a by FUNCT_1:49;
        thus thesis by Z1,A5,A1,A2,FUNCT_1:1;
      end;
      suppose ex nu being Element of dom v st nu in rng g &
        ex mu being Node of (h.v)|nu st a = nu^mu;
        then consider nu being (Element of dom v), mu being Node of (h.v)|nu
        such that
A3:     nu in rng g & a = nu^mu;
        consider i being object such that
A6:     i in dom g & nu = g.i by A3,FUNCT_1:def 3;
        reconsider i as Nat by A6;
        nu = g/.i by A6,PARTFUN1:def 6;
        then
A7:     (h.v)|nu = v1|nu by A6,Z3;
A8:     nu in dom v c= dom (h.v) by Th135;
        mu in dom((h.v)|nu) = (dom (h.v))|nu & dom(v1|nu) = (dom v1)|nu
        by TREES_2:def 10;
        then b = ((h.v)|nu).mu = v1.a & a in dom v1
        by Z1,A7,A1,A3,A8,TREES_1:def 6,TREES_2:def 10;
        hence thesis by FUNCT_1:1;
      end;
    end;
    hence h.v = v1 by Th136;
  end;

theorem
  for h being Endomorphism of Free(S,Y)
  for f being vf-sequence of v st f <> {}
  ex B being non empty FinSequence of the carrier of S st
  ex V1 be B-sorts FinSequence of Union Y
  st dom B = dom f & B = pr2 f & V1 = pr1 f &
  ex D being B-sorts FinSequence of Free(S,Y) st
  ex V2 being V1-omitting D-omitting B-sorts FinSequence of Union Y
  st (for i being Element of dom B holds D.i = h.((V1.i)-term)) &
  ex F be V2-context-sequence FinSequence of Free(S,Y) st
  F is (V1,V2,D)-consequent-context-sequence &
  (F.In(1,dom B))-sub((V1.In(1,dom B))-term) = v &
  h.v = (F.In(len B,dom B))-sub(D.In(len B,dom B))
  proof
    let h be Endomorphism of Free(S,Y);
    let f be vf-sequence of v;
    assume
A0: f <> {};
    then {} <> dom f = dom pr2 f by MCART_1:def 13;
    then
    reconsider B = pr2 f as non empty FinSequence of the carrier of S by Th96;
    consider g being one-to-one FinSequence such that
AA: rng g = {xi where xi is Element of dom v: ex s,y st v.xi = [y,s]} &
    dom f = dom g & for i st i in dom f holds f.i = v.(g.i) by VFS;
    rng g c= dom v
    proof let a;
      assume a in rng g;
      then ex xi being Element of dom v st a = xi & ex s,y st v.xi = [y,s]
      by AA;
      hence thesis;
    end;
    then reconsider g as one-to-one FinSequence of dom v by FINSEQ_1:def 4;
    take B;
    B = pr2 f;
    then reconsider V1 = pr1 f as B-sorts FinSequence of Union Y by Th97;
    take V1;
    thus
AB: dom B = dom f & B = pr2 f & V1 = pr1 f by MCART_1:def 13;
    deffunc F(Element of dom B) = h.((V1.$1)-term);
    consider D being non empty FinSequence such that
A2: dom D = dom B &
    for i being Element of dom B holds D.i = F(i) from FinSeqLambda;
    D is FinSequence of Free(S,Y)
    proof
      let a; assume a in rng D;
      then consider b such that
A3:   b in dom D & a = D.b by FUNCT_1:def 3;
      reconsider b as Element of dom B by A2,A3;
      a = F(b) by A2,A3;
      hence thesis;
    end;
    then reconsider D as FinSequence of Free(S,Y);
    D is B-sorts
    proof
      thus dom D = dom B by A2;
      let i; assume i in dom B;
      then reconsider i as Element of dom B;
      reconsider t = ((V1.i)-term) as Element of Free(S,Y);
      the_sort_of t = B.i by SORT;
      then the_sort_of (h.t) = B.i by Lem0;
      then h.t in (the Sorts of Free(S,Y)).(B.i) by SORT;
      hence thesis by A2;
    end;
    then reconsider D as B-sorts FinSequence of Free(S,Y);
    take D;
    set V2 = the one-to-one V1-omitting D-omitting B-sorts
    FinSequence of Union Y;
    take V2;
    thus for i being Element of dom B holds D.i = h.((V1.i)-term) by A2;
    deffunc H((Element of dom B), DecoratedTree)
    = $2 with-replacement((g/.$1 qua Element of dom v)
    qua FinSequence of NAT, D.$1)
    with-replacement((g/.($1+1) qua Element of dom v) qua FinSequence of NAT,
    root-tree [V2.($1+1),B.($1+1)]);
    consider F being non empty DTree-yielding FinSequence such that
A7: dom F = dom B & F.1 = v with-replacement ((g/.1 qua Element of dom v)
    qua FinSequence of NAT, root-tree [V2.1,B.1]) &
    for i,j being Element of dom B st j = i+1
    for d being DecoratedTree st d = F.i holds F.j = H(i,d)
    from FinSeqRec2Lambda;
    rng F c= Union the Sorts of Free(S,Y)
    proof let a;
      assume a in rng F;
      then consider b such that
B1:   b in dom F & a = F.b by FUNCT_1:def 3;
      reconsider b as Element of dom B by A7,B1;
      defpred R[Nat] means
      $1 in dom B implies F.$1 in Union the Sorts of Free(S,Y) &
      g.$1 in dom (F.$1) & F.$1.(g.$1) = [V2.$1,B.$1] &
      for j st j > $1 & j in dom B holds g.j in dom (F.$1) &
      F.$1.(g.j) = [V1.j,B.j];
B2:   R[1]
      proof assume 1 in dom B;
        then reconsider b = 1 as Element of dom B;
        reconsider bb = b as Element of dom g by AA,MCART_1:def 13;
        g.b in rng g by AA,AB,FUNCT_1:def 3;
        then consider xi being Element of dom v such that
B3:     g.b = xi & ex s,y st v.xi = [y,s] by AA;
        consider s,y such that
B4:     v.xi = [y,s] by B3;
        reconsider v2 = (V2.b)-term as Element of Free(S,Y);
        f.b = v.(g.b) by AA,AB;
        then V1.b = [y,s]`1 & B.b = [y,s]`2
        by B3,B4,AB,MCART_1:def 12,def 13;
        then
B6:     v.(g.b) = [V1.b,B.b] & the_sort_of (v2) = B.b by B3,B4,SORT;
B7:     g/.bb = g.bb by AA,A0,PARTFUN1:def 6;
        F.b is Element of Free(S,Y),the_sort_of v by A7,B6,B7,Th117;
        hence F.1 in Union the Sorts of Free(S,Y);
C1:     dom(F.b) = dom v with-replacement((g/.bb qua Element of dom v)
        qua FinSequence of NAT, dom((V2.b)-term)) by B3,B7,A7,TREES_2:def 11;
        hence g.1 in dom (F.1) by B3,B7,TREES_1:def 9;
        then consider r being FinSequence of NAT such that
CD:     r in dom((V2.b)-term) & xi = xi^r & (F.b).xi = ((V2.b)-term).r
        by C1,A7,B7,B3,TREES_2:def 11;
        r = {} by CD,FINSEQ_1:87;
        hence F.1.(g.1) = [V2.1,B.1] by CD,B3,TREES_4:3;
        let j; assume
C2:     j > 1 & j in dom B;
        then g.j in rng g by AA,AB,FUNCT_1:def 3;
        then consider xi2 being Element of dom v such that
C3:     g.j = xi2 & ex s,y st v.xi2 = [y,s] by AA;
        consider s,y such that
C4:     v.xi2 = [y,s] by C3;
        f.j = v.(g.j) by C2,AA,AB;
        then
B0:     V1.j = [y,s]`1 & B.j = [y,s]`2
        by C3,C4,C2,AB,MCART_1:def 12,def 13;
        xi <> xi2 by AA,AB,C2,C3,B3,FUNCT_1:def 4;
        then
C6:     not xi c= xi2 by B4,Lem9;
        then
C8:     not ex r being FinSequence of NAT st r in dom((V2.b)-term) & xi2 = xi^r
        & (v with-replacement((g/.bb qua Element of dom v)
        qua FinSequence of NAT, (V2.b)-term)).xi2
        = ((V2.b)-term).r by TREES_1:1;
C7:     not xi c< xi2 & dom (F.b) = dom v with-replacement(xi,
        dom((V2.b)-term)) by A7,B3,C6,B7,TREES_2:def 11,XBOOLE_0:def 8;
        hence g.j in dom (F.1) by C3,TREES_1:def 9;
        hence thesis by C7,C8,B3,B7,A7,B0,C3,C4,TREES_2:def 11;
      end;
B8:   for i st i >= 1 & R[i] holds R[i+1]
      proof
        let i;
        assume Z1: i >= 1;
        assume Z2: R[i];
        assume Z3: i+1 in dom B;
        then i+1 <= len B by FINSEQ_3:25;
        then
D0:     i < len B by NAT_1:13;
        then
D1:     i in dom B & i+1 > i by Z1,NAT_1:13,FINSEQ_3:25;
        reconsider v1 = F.i as Element of Free(S,Y)
        by Z2,D0,Z1,FINSEQ_3:25;
        reconsider b = i, b1 = i+1 as Element of dom B
        by D0,Z3,Z1,FINSEQ_3:25;
D2:     g.(i+1) in dom v1 & v1.(g.(i+1)) = [V1.b1,B.b1] by D1,Z2,Z3;
D3:     g.b in dom v1 & v1.(g.b) = [V2.b,B.b] by Z2;
        reconsider xi1 = g.b, xi2 = g.(i+1) as Element of dom v1
        by Z2,D1,Z3;
D4:     g/.b = xi1 & g/.b1 = xi2 by AA,AB,PARTFUN1:def 6;
        the_sort_of (D.b) = B.b by SORT;
        then reconsider v2 = v1 with-replacement(xi1, D.b) as
        Element of Free(S,Y), the_sort_of v1 by D3,Th117;
        xi1 <> xi2 by AA,AB,Z3,D1,FUNCT_1:def 4;
        then
D5:     not xi1 c= xi2 by D3,Lem9;
        then
D6:     not ex r being FinSequence of NAT st r in dom(D.b) & xi2 = xi1^r &
        v2.xi2 = (D.b).r by TREES_1:1;
        reconsider t1 = (V2.b1)-term as Element of Free(S,Y);
        not xi1 c< xi2 by D5,XBOOLE_0:def 8;
        then
DD:     xi2 in dom v1 with-replacement(xi1, dom(D.b)) by TREES_1:def 9;
        then
D7:     xi2 in dom v2 & v2.xi2 = [V1.b1,B.b1] & the_sort_of t1 = B.b1
        by D6,D2,SORT,TREES_2:def 11;
        reconsider xi3 = xi2 as Element of dom v2
        by DD,TREES_2:def 11;
        reconsider v3 = v2 with-replacement(xi3,t1) as
        Element of Free(S,Y), the_sort_of v2 by D7,Th117;
D8:     F.(i+1) = v3 by D4,A7;
        hence F.(i+1) in Union the Sorts of Free(S,Y);
D9:     dom (F.b1) = dom v2 with-replacement(xi3,dom t1) by D8,TREES_2:def 11;
        thus g.(i+1) in dom(F.(i+1)) by D9,TREES_1:def 9;
        then consider r being FinSequence of NAT such that
D10:    r in dom t1 & xi3 = xi3^r & v3.xi3 = t1.r by D9,TREES_2:def 11;
        r = {} by D10,FINSEQ_1:87;
        hence F.(i+1).(g.(i+1)) = [V2.(i+1),B.(i+1)] by D8,D10,TREES_4:3;
        let j; assume
E1:     j > i+1 & j in dom B;
        then reconsider b2 = j as Element of dom B;
EE:     j > i by E1,NAT_1:13;
        then
E2:     g.j in dom v1 & v1.(g.j) = [V1.b2,B.b2]
        by E1,Z2,D0,Z1,FINSEQ_3:25;
        reconsider xi = g.j as Element of dom v1
        by EE,E1,Z2,D0,Z1,FINSEQ_3:25;
        xi1 <> xi by E1,AA,AB,D1,FUNCT_1:def 4;
        then
E5:     not xi1 c= xi by D3,Lem9;
        then
E6:     not ex r being FinSequence of NAT st r in dom(D.b) & xi = xi1^r &
        v2.xi = (D.b).r by TREES_1:1;
        reconsider t2 = (V2.b2)-term as Element of Free(S,Y);
        not xi1 c< xi by E5,XBOOLE_0:def 8;
        then
EF:     xi in dom v1 with-replacement(xi1, dom(D.b)) by TREES_1:def 9;
        then
E7:     xi in dom v2 & v2.xi = [V1.b2,B.b2] & the_sort_of t2 = B.b2
        by E6,E2,SORT,TREES_2:def 11;
        reconsider xi as Element of dom v2 by EF,TREES_2:def 11;
        xi3 <> xi by AA,AB,Z3,E1,FUNCT_1:def 4;
        then
E9:     not xi3 c= xi by Lem9,D2;
        then not xi3 c< xi by XBOOLE_0:def 8;
        hence
E8:     g.j in dom(F.(i+1)) by D9,TREES_1:def 9;
        not ex r being FinSequence of NAT st r in dom t1 & xi = xi3^r &
        v3.xi = t1.r by E9,TREES_1:1;
        hence F.(i+1).(g.j) = [V1.j,B.j] by E7,D8,D9,E8,TREES_2:def 11;
      end;
B9:   for i st i >= 1 holds R[i] from NAT_1:sch 8(B2,B8);
      b >= 1 by FINSEQ_3:25;
      hence thesis by B1,B9;
    end;
    then reconsider F as FinSequence of Free(S,Y) by FINSEQ_1:def 4;
    defpred Q[Nat] means for b being Element of dom B st $1 = b holds
    F.b is context of V2.b & dom v c= dom (F.b) & F.b.(g/.b) = [V2.b,B.b] &
    for b1 being Element of dom B st b1 > b
    holds F/.b is V2.b1-omitting & (F.b).(g/.b1) = [V1.b1,B.b1];
F1: Q[1]
    proof
      let b be Element of dom B such that
F2:   1 = b;
      reconsider xi = g/.b as Element of dom v;
      reconsider t = (V2.b)-term as Element of Free(S,Y);
      reconsider F1 = F.1 as Element of Free(S,Y) by A7,F2,FUNCT_1:102;
F3:   F1 = v with-replacement (xi,t) by A7,F2;
FD:   dom F1 = dom v with-replacement (xi,dom t) by A7,F2,TREES_2:def 11;
      v is V2.b-omitting
      proof
        assume Coim(v,[V2.b,B.b]) <> {};
        then consider a such that
F4:     a in Coim(v,[V2.b,B.b]) by XBOOLE_0:7;
F5:     a in dom v & v.a in {[V2.b,B.b]} by F4,FUNCT_1:def 7;
        reconsider a as Element of dom v by F4,FUNCT_1:def 7;
F7:     v.a = [V2.b,B.b] by F5,TARSKI:def 1;
        then a in rng g by AA;
        then consider i being object such that
F6:     i in dom g & g.i = a by FUNCT_1:def 3;
        reconsider i as Element of dom B by AA,F6,MCART_1:def 13;
        f.i = v.a by AA,F6;
        then V1.i = [V2.b,B.b]`1 & dom V1 = dom f
        by AB,F7,MCART_1:def 12;
        then V2.b in rng V1 misses rng V2 by AB,OMIT2,FUNCT_1:def 3;
        then V2.b nin rng V2 & dom V2 = dom B by SORTS,XBOOLE_0:3;
        hence contradiction by FUNCT_1:def 3;
      end;
      hence F.b is context of V2.b by F2,F3,Lem10;
      g.b = xi by AA,AB,PARTFUN1:def 6;
      then xi in rng g by AA,AB,FUNCT_1:def 3;
      then consider nu being Element of dom v such that
G0:   xi = nu & ex s,y st v.nu = [y,s] by AA;
      thus dom v c= dom (F.b) by G0,F2,F3,Lem11;
      then xi^{} = xi in dom F1 by F2;
      then consider mu being FinSequence of NAT such that
H0:   mu in dom t & xi = xi^mu & F1.xi = t.mu by A7,F2,FD,TREES_2:def 11;
      mu = {} by H0,FINSEQ_1:87;
      hence F.b.(g/.b) = [V2.b,B.b] by F2,H0,TREES_4:3;
      let b1 be Element of dom B; assume
G1:   b1 > b;
      thus F/.b is V2.b1-omitting
      proof
        assume Coim(F/.b,[V2.b1,B.b1]) <> {};
        then consider i being object such that
G2:     i in Coim(F/.b,[V2.b1,B.b1]) by XBOOLE_0:7;
G3:     i in dom (F/.b) & (F/.b).i in {[V2.b1,B.b1]} by G2,FUNCT_1:def 7;
        reconsider i as Element of dom (F/.b) by G2,FUNCT_1:def 7;
G4:     F/.b = F.b by A7,PARTFUN1:def 6;
G5:     (F/.b).i = [V2.b1,B.b1] by G3,TARSKI:def 1;
G7:     dom F1 = dom v with-replacement(xi,dom t) by A7,F2,TREES_2:def 11;
        then per cases by F2,A7,G4,TREES_2:def 11;
        suppose
G6:       not xi is_a_prefix_of i & F1.i = v.i;
          then not ex r being FinSequence of NAT st r in dom t & i = xi^r
          by TREES_1:1;
          then i is Element of dom v by G4,G7,F2,TREES_1:def 9;
          then i in rng g by AA,G5,G6,G4,F2;
          then consider j being object such that
G8:       j in dom g & g.j = i by FUNCT_1:def 3;
          reconsider j as Element of dom B by AA,G8,MCART_1:def 13;
          f.j = v.(g.j) by AA,AB;
          then V1.j = [V2.b1,B.b1]`1 & dom V1 = dom B
          by AB,G8,G6,G5,G4,F2,MCART_1:def 12;
          then V2.b1 in rng V1 misses rng V2
          by OMIT2,FUNCT_1:def 3;
          then V2.b1 nin rng V2 & dom V2 = dom B by SORTS,XBOOLE_0:3;
          hence contradiction by FUNCT_1:def 3;
        end;
        suppose ex r being FinSequence of NAT st
          r in dom t & i = xi^r & F1.i = t.r;
          then consider r being FinSequence of NAT such that
G9:       r in dom t & i = xi^r & F1.i = t.r;
          r in {{}} by G9,TREES_1:29;
          then r = {};
          then
G10:      F1.i = [V2.b,B.b] & dom V2 = dom B by G9,SORTS,TREES_4:3;
          then V2.b <> V2.b1 by G1,FUNCT_1:def 4;
          hence contradiction by G5,G4,F2,G10,XTUPLE_0:1;
        end;
      end;
K2:   xi = g.b & g/.b1 = g.b1 by AA,AB,PARTFUN1:def 6;
      then
K0:   v.xi = f.b & v.(g/.b1) = f.b1 & g/.b1 in rng g & xi in rng g
      by AA,AB,FUNCT_1:def 3;
      then consider mu being Element of dom v such that
K1:   mu = g/.b1 & ex s,y st v.mu = [y,s] by AA;
      reconsider fb1 = f.b1 as pair object by K2,K1,AA,AB;
K3:   v.mu = [(fb1)`1,(fb1)`2] by K2,K1,AA,AB
      .= [V1.b1,fb1`2] by AB,MCART_1:def 12
      .= [V1.b1,B.b1] by AB,MCART_1:def 13;
      consider nu being Element of dom v such that
K4:   nu = xi & ex s,y st v.nu = [y,s] by AA,K0;
      reconsider fb = f.b as pair object by K2,K4,AA,AB;
K5:   v.xi = [(fb)`1,(fb)`2] by K2,AA,AB
      .= [V1.b,fb`2] by AB,MCART_1:def 12
      .= [V1.b,B.b] by AB,MCART_1:def 13;
      xi <> mu by AA,AB,K1,K2,G1,FUNCT_1:def 4;
      then
K6:   not xi c= mu by K5,Lem9;
      then not xi c< mu by XBOOLE_0:def 8;
      then
K7:   mu in dom v with-replacement(xi, dom t) by TREES_1:def 9;
      not ex r being FinSequence of NAT st r in dom t & mu = xi^r &
      F1.mu = t.r by K6,TREES_1:1;
      hence F.b.(g/.b1) = [V1.b1,B.b1] by F2,A7,K1,K3,K7,TREES_2:def 11;
    end;
WW: for i holds 1 <= i & Q[i] implies Q[i+1]
    proof let i;
      assume
H1:   1 <= i & Q[i];
      let b be Element of dom B; assume
H2:   i+1 = b;
      reconsider xi = g/.b as Element of dom v;
      reconsider t = (V2.b)-term as Element of Free(S,Y);
      i+1 <= len F by A7,H2,FINSEQ_3:25;
      then
HH:   1 <= i < len F by H1,NAT_1:13;
      reconsider F1 = F.(i+1), Fi = F.i as Element of Free(S,Y)
      by HH,A7,H2,FUNCT_1:102,FINSEQ_3:25;
      reconsider bi = i as Element of dom B by HH,A7,FINSEQ_3:25;
      reconsider Fi as context of V2.bi by H1;
      reconsider nu = g/.bi as Element of dom v;
F3:   F1 = Fi with-replacement(nu, D.bi) with-replacement(xi,t) by A7,H2;
H8:   b > bi & F/.bi = Fi by A7,H2,NAT_1:13,PARTFUN1:def 6;
      then
H5:   Fi is V2.b-omitting & Fi.xi = [V1.b,B.b] by H1;
I2:   D.bi in (the Sorts of Free(S,Y)).(B.bi) & dom v c= dom Fi
      by H1;
      nu = g.bi & xi = g.b by AA,AB,PARTFUN1:def 6;
      then
H6:   Fi.nu = [V2.bi,B.bi] & the_sort_of (D.bi) = B.bi & nu in dom Fi &
      xi in dom Fi & nu <> xi by AA,AB,I2,H1,H8,SORT,FUNCT_1:def 4;
      then
H7:   Fi with-replacement(nu, D.bi) = Fi-sub(D.bi) by Th118;
I1:   not nu c= xi by H6,Lem9;
      then not nu c< xi by XBOOLE_0:def 8;
      then
I3:   xi in dom Fi with-replacement(nu, dom(D.bi)) by H6,TREES_1:def 9;
      then
H9:   xi in dom(Fi-sub(D.bi)) by H6,H7,TREES_2:def 11;
      D.bi is V2.b-omitting by OMIT4;
      then Fi-sub(D.bi) is V2.b-omitting by H5,H6,Th45A;
      hence F.b is context of V2.b by H2,F3,H7,H9,Lem10;
      not ex r being FinSequence of NAT st r in dom (D.bi) & xi = nu^r &
      (Fi with-replacement(nu,D.bi)).xi = D.bi.r by I1,TREES_1:1;
      then (Fi-sub(D.bi)).xi = [V1.b,B.b] by I3,H5,H6,H7,TREES_2:def 11;
      then
L1:   dom Fi c= dom (Fi-sub(D.bi)) c= dom F1 by F3,H7,H9,H6,Lem11;
      hence dom v c= dom (F.b) by I2,H2;
      xi in dom F1 = dom (Fi-sub(D.bi)) with-replacement(xi, dom t)
      by L1,F3,H7,H6,TREES_2:def 11;
      then consider r being FinSequence of NAT such that
J0:   r in dom t & xi = xi^r & F1.xi = t.r by H7,H9,F3,TREES_2:def 11;
      r = {} by J0,FINSEQ_1:87;
      hence F.b.(g/.b) = [V2.b,B.b] by H2,J0,TREES_4:3;
      let b1 be Element of dom B; assume
J1:   b1 > b;
      thus F/.b is V2.b1-omitting
      proof
        assume Coim(F/.b,[V2.b1,B.b1]) <> {};
        then consider a such that
J2:     a in Coim(F/.b,[V2.b1,B.b1]) by XBOOLE_0:7;
J3:     a in dom (F/.b) & (F/.b).a in {[V2.b1,B.b1]} by J2,FUNCT_1:def 7;
        reconsider q = a as Element of dom (F/.b) by J2,FUNCT_1:def 7;
J4:     F/.b = F.b by A7,PARTFUN1:def 6;
        then
J5:     q in dom (Fi-sub(D.bi)) with-replacement(xi,dom t) = dom F1
        by F3,J3,H2,H7,H9,TREES_2:def 11;
        then per cases by F3,H7,H9,TREES_2:def 11;
        suppose
J6:       not xi is_a_prefix_of q & F1.q = (Fi-sub(D.bi)).q;
          then
J7:       q in dom (Fi-sub(D.bi)) by H9,J5,Th01;
          b1 > bi by J1,H2,NAT_1:13;
          then Fi is V2.b1-omitting & D.bi is V2.b1-omitting by H1,H8,OMIT4;
          then Fi-sub(D.bi) is V2.b1-omitting by H6,Th45A;
          hence contradiction by J7,H2,J3,J4,J6,FUNCT_1:def 7;
        end;
        suppose
          ex r being FinSequence of NAT st
          r in dom t & q = xi^r & F1.q = t.r;
          then consider r being FinSequence of NAT such that
:: License version 3.0 or later, subject :: detailed in file COPYING.interpretation.
          dom V2 = dom B by SORTS;
          then XBOOLE_0, ORDINAL4 CARD_3, FINSOP_1, FUNCOP_1 BINOP_2, FUNCT_2, SEQ_1,
          t is V2.1-mitting by ThC1;
           contradiction by H2,J3,J4,J8,FUNCT_1:def 7;
        end;
      end;
er mu= g/b1 as odeofv;
L5:   bi < q9 for XFinSequence,
then
L2:   Fi.(g/.b1) = [V1.b1,B.b1]   hence thesis by A1;
  /bi  gbi by AA,B,:def ;
      then g/.b1      then
      g/bi indomFibyAB,AA,,I2,L5FUNCT_1:def 4;
      then
L3:   not g/.b c= g/.b1 & not nu c= mu by H6,L2,Lem9;
      then
L4:   not ex r being FinSequence of NAT st
      r in dom (D.bi) & mu = nu^r & (Fi-sub(D.bi)).mu = D.bi.r
      by TREES_1:1;
L6:   nu in dom Fi & g/.b1 in dom (Fi-sub(D.bi)) by I2,L1;
    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 58
      by H7,TREES_2:def 11;
      proof
L7:   (Fi-sub(D.bi)).(g/.b1) = [V1.b1,B.b1]
      java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
L4:   not ex r being FinSequence of NAT st
      r in dom t & mu = xi^r & F1.mu = t.r
      by L3,TREES_1:1;
      g/.b1 in dom Fi by I2;
      then
L6:   xi in dom (Fi-sub(D.bi)) & g/.b1 in dom F1 by I2,L1;
      then g/.b1 in dom (Fi-sub(D.bi)) with-replacement(xi,dom t)
      by H7,F3,TREES_2:def 11;
      hence F.b.(g/.b1) = [V1.b1,B.b1]
      by H2,L4,L6,L7,F3,H7,TREES_2:def 11;
    end;
L8: for i st i >= 1 holds Q[i] from NAT_1:sch 8(F1,WW);
       CATAL,FUNCT_7;
    proof
       SETWISEO, REAL_1, NAT_D, YELLOW20, RECDEF_1, BINOP_2, RELSET_1, SQUARE_1,
letb  Element (m-1)by A3,AFINSQ_1:17
1<=+om (->)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
      hence thesis by L8
    end;
    thenproof
F;
    thus F is (V1,V2,D)-consequent-context
    proof
      let i,jend;
      reconsider nu = g/.i, xiassume k <= dom (p|nproof
java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 6
     reconsider t=(.)termasElement of Free,Y)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
proof
H2:assume p is dominated_by_0;
t * Sum(|*)n1
:F.e thesis
    i&F/.=:13,PARTFUN1e;
then
:Sum(k->)0*kby AFINSQ_2:;
I2:      k<len:md< by XREAL_16
      byhence thesis by A8,XXREAL_0:;
domp= len n->-- isdominated_by_0
      then
H6:theorem Th11:
   nu< xi byH1,AA,,I2,L8,H8,SORTdom p| =domp/ by RELAT_1:java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 39
then
:java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 61
      reconsider q = A5: Sum(p|(len p|) (k=+java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
M1:   not nu c= xi by H6,Lem9    end;
      then
H4:   not ex r being FinSequence of NAT st r in dom (D.i) & xi = nu^r &
 = D.i. by TREES_1:1;
      not nu c<xi  M1,XBOOLE_0:def 8;
      thenxi   Fi -eplacement(nu  (D.)by H6,TREES_1def9java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
      then
M8:   ((F.i)-sub(D.i)).xi = [V1.j,B.j] & xi in dom ((F.i)-sub(D.i))
      by H4,H5,H6,H7,TREES_2:def 11;
      then
M3:   dom ((F.i)-sub(D.i)) = dom Fj & dom v c= dom Fj
      by H3,L8,F3,H7,A2: n <= len p- 2 * Sum pn =len p 2*Sump;
M2:   Fj.xi = [ rngp ={,}by ;
      bythen (q|=pm by :58
      then
M5then *um ((^q|)   Sump+mdom p+md by A6
      hence
M4: k +lenp -  Sum p;
      et a e Node of(F.)sub(V1.)term)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
          njava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
      by M2,M5,TREES_2java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 6
      thenper cases byM5,lenq+by A2A3,Th11;

   not xi  set q0=(1-->0)
        then not  then reconsider s=Sum |k-as NatbyNAT_1:1

M7:     rngqby
        by M8,M4,TREES_1:def 9;
        not ex r being FinSequenceSegmn cjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
        by M6,TREES_1:1;
    hence ((F.)-ub((V1.j)-erm)).  ((F.)-ub(D.i).a
        by F3A5 *um(pn)=nand
      end;
 being FinSequence  NATst r  dom q  a5;
        (F.)sub(q). =q.java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
qq=q0^qq1java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
;
        r in {{}} by N1,java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 6
        java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 20
        hence    then1+ in M
        by M8,N1,TREES_4:3;
      end
    end
    set b o:k < dompand
    reconsider nu = g/.b, xi = g
by FINSEQ_3:25;
N6 .  v withreplacementnu,V2.))  A7
:= g.b by AAAB,PARTFUN1def 6java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
 rngg ABAFUNCT_1:ef3;
    then n1 < n1+1 by13;
u &exsy st y, AA
    reconsider fb = f.b as pair object by NM,N5,AB,AA;
N7 nu  b`f`2by NM,,AA
    .= [V1.b,fb`A22: n1 in dom p by AFINSQ_1:86;
A24 p;
    then
N8: domfor p & 2*  q & k > 0holds *N2*(pN)  N &N  }=
    reconsider   setk0=k->0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
O3: domA1:then * p|*k q=len q+k byA1,A3,7A5java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
    byA7,java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 25
    thenconsider mu being FinSequence of NATsuchthat
N9: mu in java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 8
    byA7,  &kqk^qk)byAFINSQ_127;
 N9FINSEQ_18;
    then F.b.A7:Sum(p|0 =0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    then
O1: (Fthen henmk<mkA212A23Th2
    ence
O5: dom ((F.In(1,dom B)            then
    by N8,OA,Lem11A,N9,TREES_4:3;
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 71
      dom ((F.b)-sub t) = dom (F.b)     hencecontradiction A15;
f Adom|=+ by :2;
      then per    then:pdominated_by_0
      suppose
otnu =a&(F.b- t.  java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 8
        hence< java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
        a = dominated_by_0 & 2*Sum q = len java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 6
        
       byA7,N8O3,O4,TREES_2def 11;
      end;
      suppose ex r being  ofNATstr in dom t & a = nu^r &
        ((F.b-ub t).a = t.rjava.lang.StringIndexOutOfBoundsException: Range [30, 31) out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [29, 6) out of bounds for length 29
6 r indom t&a =nu^  (F.b)-sub t).a = t.r;
  ((0>p)i)Sum <0>+Sum (p  setkqk^^1
       thenr  
        hence ((F.In(1,dom java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 22
        : m <= dom q;
      end;
    : 2*Su(q|  m;
    defpred S[Nat] hence by A2,A5,AT_1:def1;
    holdsxin it  ex p be
    (F.-subD.)|(om)rng g)=v|(dom v\rng g)
:S[]
    proof
      let b,b1 be       rng p c= {0,1} by A
tX;
       kqk=k+q+k1)by A9,:java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 50
      then
 =1 by XXREAL_0:1java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
      reconsider nu = g/.b as Node of v;
S4:   F.b.nu = [V2.b,B.b] & nu in dom v c= dom (F.b) & the_sort_of (D.b) = B.b
      by S2,F1,SORT;
            per cases;
S8:   (F.b)-sub(D.b) = (F.b) with-replacement(nu, D.b) by Th118;
      then
.-(b)u =D by h130java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
SD:   nu = gA20:        minpc= 01by 
      then
:v
      java.lang.StringIndexOutOfBoundsException: Range [12, 9) out of bounds for length 67
S6:   nu = mu & ex s,y    set p=nm-0
      fb  f.as pair object  SD,6AA,AB;
   thenminM(0qmkL;
      .= [V1.b,fb`2A7  in            min*M len  A,,X:;
      .= [V1.b,B.b] by AB,MCART_1:def 13;
      then v|nu = (V1.  set =n->0;
      then (h.A2: x
((F.-D.))|/b1 quaNode of v)
      =hence thesis;
      dom(F.bhjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 5
      then (dom vtheoremTh25
      hence dom(((F.b)-sub(D.b)  holdsq.=n-.
      by RELAT_1:62;
      a;assume
=by ,: 2
      ainconsider  bebe XFinSequence of{,n}such that
      then reconsider a as Node of v;
SJ:   (((F.qand
      (v|((dom v)\rng g)).a = v.a by SKthen
      nu <> a by S5,SK,XBOOLE_0:def 5;
      then
SD:   notnu c a java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
      then
   ex  FinSequenceofNAT  inom(V2.-erm) java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
      a = nu;
   notnu c aby SD,:def8;
      then
      a  n/m!(>REAL_1java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
      then
:v(..S,TREES_2def;
SF:   not ex r 
      a = nu^r & ((java.lang.StringIndexOutOfBoundsException: Range [19, 20) out of bounds for length 0
      a in dom (F.b) & nu in dom (F.b) by S4;
indom F. replacement(,(Db) bySG,TREES_1:ef9;
      hence thesis    not*+byNAT_1;
:2 *+ min*2*(| N} &2 o+  domp&o
   S [+
    proof:lenq
i;assume
T2 rngr2 c rng pb A10Sumpmjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 20
      let b,b1 be Element given
 hence thesis:q|*p2 ;
plet be objectjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
      
thenreconsiderb2   Rinby ,0
T5:   :
,ssumexin Domin_0n);
      v.gbhence byA1A3:java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36
      then consider e;
 t Domin_0(m)isemptyimplies * m >n
      reconsider fb =     m=+then
U3:    M{N:*um (|N<}
      t* |)&   byA29,java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 61
        consider that
      .=
:   a xinDomin_0,)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
      g/.b2 in dom T_1:13;
      then
:(.)D))java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
      (F.b2) n){n->0>
  .1 & pc 0}
      dom (F.b2) c= dom((F.b2)-sub(D.b2)) by  k suchthat
     then
T21:  g/.bA:2*k:sch2;
      per  consider      java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
b1< b;
        then:domrq    then
T8:k1. t  \ =01 A46,:8
        thenthen
 ()subD considerj be Natsuchthat
(.|/  java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 42
.=.&g. rngjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 63
        then consider nu being Node ofTh27:
:g.b1  java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 48
        reconsider fb1 = f.b1 asA1: 2*+ =n
U6 java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 30
. fb11fb12 byAA,AB
          p,8
         :j1k1by ,java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 29
T9:      considerbe java.lang.StringIndexOutOfBoundsException: Range [40, 36) out of bounds for length 53
java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
    
, ^r2.(p|^qi 77AFINSQ_13;
        1 <= i java.lang.StringIndexOutOfBoundsException: Range [4, 3) out of bounds for length 72
        then
T12A10,:55java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
        the_sort_of (D
        then
java.lang.StringIndexOutOfBoundsException: Range [6, 2) out of bounds for length 11
        (F.b) with-replacementconsider psuch hencethesis A5A2526FUNCT_1;
        henceA92  =: xbeing java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 75
         bejava.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 37
        dom v c= dom    thenconsiderq <+1y 
        d v)\ g .-(D.)
        hence dom      hence  byORDINAL1def ;
        by62;
        letthen  =- asNat    then q is not dominated_by_0 by A95;
TT:     a in dom(((F.b)-sub(D.b))|((dom v(q|*2) q.*21byA96Th15
-ub(D.bthat
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 38
        (((F.b2)java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 8
S|k)
then
T17:    ((F.A49  =lenp|)len q A,AFINSQ_1def3java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        g/.b in rng g & a nin rngA52: Sum p|)Sum r1*en(|1 by A45,47;
        by T18,t
        then
F)=
        dom((F.b2)-java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 17
        dom rq in byA29,42,A52,,java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 61
java.lang.StringIndexOutOfBoundsException: Range [48, 10) out of bounds for length 48
        then not exthen
        a =
java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12
:    Fb.=v.byT18U2T17,T5,T6;
T24:    a in dom((F.java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 18
        g. Nodeofv,dom(b)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
T11 ;
notex r being FinSequence  NAT  r  dom(D.  a  (/b)r 
        (:len plen (r1^r2) by      end
        hence thesis by T16,T18,h thesis by A28,java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
      end;

7isnot9,ef2
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 12
        i+1 >= 1 by NAT_1:12;java.lang.StringIndexOutOfBoundsException: Range [29, 14) out of bounds for length 14
S4:     F:k1q|2k2+java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
        the_sort_of (D.b) = B.b by T3,L8,SORT;
       
iof 
        then
S7:     ((F.b)-sub(D.b))|nu =  pi>.by A89,
T18:    nu = g.b by AAnow
        then v.nu = f.b & nu in:      <lenpk
        then consider mu being Node of v             r1.i=1-p.i & s1.i=1-q.i by A108,A1phence byA101,A124,128java.lang.StringIndexOutOfBoundsException: Range [67, 63) out of bounds for length 67
S6:     nu = mu & ex s,y st v.mu = [y,A102,len =len p| qk)byA,A122RELAT_1:;
         pair object byT18,endjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
        [`11java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 39
        .= [V1,b2  6;
 .B]yABC:def13;
        then           k  A127:     k in len s1 inlen  byA126,6java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
        then (hp=| ,48
.b-.)|g/b1 Node of
        = (h.v)|(g/.b1        lenqk (pl  A102:;
        dom v c= dom (Fr.=java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
(D.))java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        thenpk=q|len pk by A138,AFINSQ_1:9;
        by RELAT_1:62;
      leta 
T24    in(F.)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        then    A108A137,144,145s (+10)
T16:    (((F.b)-sub(D.b))|((dom v)\rng g)).a = ((F.b)-sub(D.b)).a &
   ((.)-sub(.)|( )\rngg;
           (CHZ)Ware_equipotent
        then
T17:    ((F.b2)-sub(D.b2)).A1  (by19;
        g/.b in rng g &     end;
        by T18,
        then
:notg/bca  /19*=(1*)((*1) XCMPLX_1java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
        dom((F.b2)-sub(D.b2)) with-replacement(g/.b qua Node of v,
        dom((V2      set m9m!
        A5:   n choose *)m9*nm9(1)byjava.lang.StringIndexOutOfBoundsException: Range [50, 47) out of bounds for length 50
        a = (g/.b)^r & (F.b).a = ((V2A9    <byA1,XXREAL_02C:;
        then
T22:    (F.b).a = v.a by T18,T17
A10  n
        (g/.b qua Node of v, dom(D.b))
        by S4hence2+,=(++-*(++-*2k)choose1by,NAT_111
        not ex r being FinSequence ofjava.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
        ((F.b)-sub(  card Domin_0(4+k,2 =  7;
        hence thesis by T16,T11 =(k+1/k  cardDomin_0+,) k+(k+/
      end;
    end;
    set 
    set v1 = (F.b)-sub(D.b);
 ist i >  holdsjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
S8: F.b.(g/.b) = [V22java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
    then
SA: the_sort_of (D.b) = B.b & g/.b in dom 
    then   modeOMEGAofD- functional non empty meanstthesisby AFINSQ_1ef 
    then dom(F.b) c= dom v1 by SA,S8,Lem11;
    then
S9: dom v c= dom v1 & v|((dom v) \ rng g) = java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 6
    by SK,S8,NK;
    now
tjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 70
      b1 <= len B by FINSEQ_3:25;
      A1: for k s in(n1  beqNjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 40
      by SK,NK;
    end;
  h. : and
  end;

Messung
CHZG
8110010093

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.601Angebot  ¤

*Eine klare Vorstellung vom Zielzustand







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,055
#Domains=861,552