:: Term Context
:: by Grzegorz Bancerek
::
:: Received June 13, 2014
:: Copyright (c) 2014 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,
MSAFREE, CIRCUIT2, REWRITE1, MSUALG_4, ZF_MODEL, MSUALG_6, SUBSET_1,
NAT_1, FUNCOP_1, MARGREL1, PARTFUN1, FUNCT_4, MOD_4, FINSEQ_1, FUNCT_7,
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, FINSEQ_4, TREES_2, ABCMIZ_A, ABCMIZ_1, PRE_POLY, FINSEQ_2,
TREES_3, AOFA_000, ORDINAL1, TREES_1, MEMBERED, MEMBER_1, FUNCT_6, CAT_1,
REALSET1, AOFA_A01, VALUED_2, MSUALG_2, MCART_1, ORDINAL4, MSUALG_3,
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, FINSET_1,
RELAT_1, RELSET_1, FUNCT_1, PARTFUN1, FUNCT_2, STRUCT_0, FUNCOP_1,
ORDINAL1, FINSEQ_1, FINSEQ_2, FINSEQ_4, FUNCT_7, FUNCT_4, MCART_1,
CARD_2, TREES_1, TREES_2, FUNCT_6, TREES_3, TREES_4, CARD_3, MATRIX_7,
XXREAL_0, XXREAL_2, XCMPLX_0, NUMBERS, WSIERP_1, MEMBERED, ORDINAL6,
REWRITE1, PBOOLE, MSUALG_1, MSUALG_2, MSUALG_3, MSUALG_4, MSUALG_6,
MSAFREE, MSAFREE1, MSATERM, CATALG_1, ABCMIZ_1, ABCMIZ_A, AOFA_A00,
AOFA_A01, MSAFREE3, CARD_1, MSAFREE4;
constructors RELSET_1, FINSEQ_4, DOMAIN_1, CARD_2, WSIERP_1, MSAFREE1,
AOFA_A01, CATALG_1, ABCMIZ_A, ORDINAL6, RECDEF_1, XFAMILY, SEQ_4,
MSUALG_3;
registrations RELSET_1, FUNCOP_1, FINSEQ_1, FINSEQ_2, XCMPLX_0, SUBSET_1,
CARD_1, XXREAL_0, RELAT_1, FUNCT_1, FUNCT_7, PBOOLE, STRUCT_0, MSUALG_1,
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, MSUALG_2, ALGSPEC1, VALUED_0, NAT_1, ORDINAL6, FINSEQ_6;
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_4, ORDINAL1,
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, FUNCT_1,
TREES_1, FINSEQ_1, FINSEQ_5, FINSEQ_2, CARD_1, XXREAL_0, TREES_3,
MATRIX_7, CARD_2, RVSUM_1, ORDINAL6, XXREAL_2, FUNCT_6, SIMPLEX0,
POLYNOM3, EXTENS_1, WAYBEL26, EXCHSORT, TREES_2, FINSEQ_6, TREES_9,
GRFUNC_1, HUFFMAN1;
schemes NAT_1, FUNCT_1, FUNCT_2, FINSEQ_1, RECDEF_1, CLASSES1, FRAENKEL,
MSUALG_6, MSATERM, MSAFREE4;
begin :: Preliminary
definition
let S be non empty non void ManySortedSign;
let A be non-empty MSAlgebra over S;
let s be SortSymbol of S;
mode Element of A,s is Element of (the Sorts of A).s;
end;
reserve
a,b for object, I,J for set, f for Function, R for 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 (Element of X.s), x11 for (Element of X.s1),
T for all_vars_including inheriting_operations free_in_itself
(X,S)-terms MSAlgebra over S,
g for Translation of Free(S,X),s1,s2,
h for Endomorphism of Free(S,X);
definition
let S,X; let T be all_vars_including (X,S)-terms MSAlgebra over S;
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 r be Element of T;
@r = r;
hence thesis;
end;
end;
registration
cluster natural-membered -> c=-linear for set;
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 A be MSAlgebra over S;
let a;
pred a in A means: ELEM: a in Union the Sorts of A;
end;
definition
let a,b;
attr b is a-different means: DIFF: b <> a;
end;
registration
let I be non trivial set;
let a;
cluster a-different for Element of I;
existence
proof a is set by TARSKI:1;
then consider i being Element of I such that
A1: i <> a by SUBSET_1:50;
take i; thus i <> a by A1;
end;
end;
theorem Th01:
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 being FinSequence of NAT st q = p^r holds r in t1
proof
let t,t1 be Tree;
let p,q be FinSequence of NAT;
assume Z0: p in t;
assume Z1: q in t with-replacement(p,t1);
thus (not p is_a_prefix_of q implies q in t)
proof
assume not p is_a_prefix_of q;
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 r be FinSequence of NAT;
assume Z3: q = p^r;
then p c= q by TREES_1:1;
then p c< q or p = q & p = p^{} by XBOOLE_0:def 8,FINSEQ_1:34;
then ex r being FinSequence of NAT st r in t1 & q = p^r
by Z0,Z1,TREES_1:22,def 9;
hence r in t1 by Z3,FINSEQ_1:33;
end;
registration
let R be finite Relation;
let a;
cluster Coim(R,a) -> finite; ::: RFINSEQ generalized
coherence
proof
Coim(R,a) c= dom R by RELAT_1:132;
hence thesis;
end;
end;
theorem Lem8:
for p,q,r being FinSequence st p^q is_a_prefix_of r holds p is_a_prefix_of r
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 TREES_1:1;
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 holds
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 D & (p^q)|i = (p^q)|Seg i
& p|Seg i = p|i by FINSEQ_1:def 4,XBOOLE_1:10;
hence thesis by FINSEQ_5:22;
end;
theorem Lem8B:
for p,q,r being FinSequence st q is_a_prefix_of p^r holds
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 NAT_1:10;
q = p^(r|Seg j) by Z0,A1,FINSEQ_6:14;
hence thesis by TREES_1:1;
end;
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;
cluster n-ary_oper_including for non empty non void ManySortedSign;
existence
proof
take S = ManySortedSign(#{0},{1},{1}-->In(n|->0,{0}*),{1}-->In(0,{0})#);
take o = In(1, the carrier' of S);
A2: o = 1 & In(0,{0}) = 0 by TARSKI:def 1;
A3: the_arity_of o = In(n|->0,{0}*) by FUNCOP_1:7;
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 A3,SUBSET_1:def 8;
hence len the_arity_of o = n by CARD_1:def 7;
end;
end;
registration
cluster sufficiently_rich for non empty non void ManySortedSign;
existence
proof set n = 1;
take S = ManySortedSign(#{0},{1},{1}-->In(n|->0,{0}*),{1}-->In(0,{0})#);
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;
A3: the_arity_of o = In(n|->0,{0}*) by FUNCOP_1:7;
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 = <*0*> by A3,SUBSET_1:def 8,FINSEQ_2:59;
hence s in rng the_arity_of o by A1,FINSEQ_1:39;
end;
end;
definition
let R;
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 implies I is infinite;
end;
registration
cluster non-trivial -> non-empty for Relation;
coherence
proof
let r be Relation;
assume I in rng r implies I is non trivial;
hence not {} in rng r;
end;
cluster infinite-yielding -> non-trivial for Relation;
coherence;
end;
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;
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 -> infinite;
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,
q,q1 for (Element of Args(o,Free(S,Y))),
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 Z.s),
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;
func p^^I -> set equals {p^q where q is Element of I: q in I};
coherence;
end;
registration
let I be FinSequence-membered set;
let p be FinSequence;
cluster p^^I -> FinSequence-membered;
coherence
proof
let J be object; assume J in p^^I;
then ex q being Element of I st J = p^q & 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-membered set;
thus f^^E c= E
proof
let a; assume a in f^^E;
then ex p being Element of X st a = f^p & p in X;
hence thesis;
end;
thus thesis;
end;
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;
assume A is Tree-like;
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 in t;
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(<*>NAT, dom d) by TREES_2:def 11;
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 = d1.p or
ex r being FinSequence of NAT st r in dom d & p = {}^r &
(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 being Tree-yielding FinSequence
for d,t being Tree
st i < len p & xi = <*i*>^w & d = p.(i+1) &
q = p+*(i+1,d with-replacement (w, t)) & xi in tree p
holds (tree p) with-replacement (xi, t) = tree q
proof
let xi,w be FinSequence of NAT;
let p,q be Tree-yielding FinSequence;
let d,t be Tree;
assume Z0: i < len p;
assume Z1: xi = <*i*>^w;
assume Z2: d = p.(i+1);
assume Z3: q = p+*(i+1,d with-replacement (w, t));
assume Z4: xi in tree p;
consider j being Nat, u being FinSequence such that
A2: j < len p & u in 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;
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 FINSEQ_3:25;
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;
end;
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 such that
A9: j < len p & u in p.(j+1) & n = <*j*>^u;
per cases;
suppose j+1 <> i+1;
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;
hence n in tree q by A4,A7,A9,B1,TREES_3:def 15;
end;
end;
end;
suppose ex r being FinSequence of NAT st r in t & n = xi^r;
then consider r being FinSequence of NAT such that
A1: r in t & n = xi^r;
w^r in d with-replacement (w,t) by A1,A2,A3,Z2,TREES_1:def 9;
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
q.(j+1) = p.(j+1) & i <> j by Z3,FUNCT_7:32;
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 8;
hence thesis by Z4,C3,TREES_1:def 9;
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 n in tree p & not xi c< n
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;
let a;
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;
end;
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 be FinSequence of NAT;
let p,q be DTree-yielding FinSequence;
let d,t be DecoratedTree;
assume Z0: i < len p;
assume Z1: xi = <*i*>^w;
assume Z2: d = p.(i+1);
assume Z3: q = p+*(i+1,d with-replacement (w, 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)+*(i+1,dom(d with-replacement(w,t))) by Z3,Lem12;
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 p by Z0,NAT_1:12,13;
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,A2,A3,A4,Th124,TREES_2:def 11;
hence dom((a-tree p) with-replacement (xi, t)) = dom (a-tree q)
by TREES_4:10;
A8: dom doms q = dom q = dom p = dom doms p by Z3,FUNCT_6:def 2,FUNCT_7:30;
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 p) with-replacement (xi, t)).nu = (a-tree p).nu
by Z4,A1,A5,TREES_2:def 11
.= a by A6,TREES_4:def 4
.= (a-tree q).nu 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) & nu = <*j*>^r;
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
r in dom t & nu = xi^r & ((a-tree p) with-replacement (xi, t)).nu = t.r
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.r by A6,A7,A11,TREES_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) = d with-replacement(w,t)
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)
by A6,Z2,A2,A3,A10,TREES_2:def 11;
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;
xi c= nu by Z1,A6,A10,A12,FINSEQ_6:13;
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 (xi, t)).nu = t.r2
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 st
r2 in dom t & r = w^r2 & (d with-replacement (w, t)).r = t.r2
by TREES_1:1;
not ex r2 being FinSequence of NAT st r2 in dom t & r = w^r2
by A12,TREES_1:1;
then
A15: r in dom d by Z2,A2,A3,A10,A11,TREES_1:def 9;
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 A12,A10,A6,Z1,Lem8A,TREES_1:1;
hence ((a-tree p) with-replacement (xi, t)).nu = (a-tree p).nu
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:def 11
.= (a-tree q).nu by A6,A7,A11,TREES_4:12;
end;
end;
end;
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
by TREES_4:3
.= ({{}}-->c).:dom({{}}-->c) by TREES_1:29,TREES_4:3,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 by TREES_4:3;
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 A2,TREES_4:3,TREES_1:29,HUFFMAN1:15;
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;
dom root-tree c = elementary_tree 0 by TREES_4:3;
then q in Leaves dom root-tree c & (root-tree c).q = c & r = q^r
by TREES_4:3,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;
dom root-tree c = elementary_tree 0 by TREES_4:3;
then q in Leaves dom root-tree c & (root-tree c).q = c & r = q^r
by TREES_4:3,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;
q in {{}} by A2,TREES_4:3,TREES_1:29,HUFFMAN1:15;
then q = {};
hence x in dom root-tree c1 by A2,A0,TREES_4:3;
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;
dom root-tree c1 = elementary_tree 0 by TREES_4:3;
then p = {} by TREES_1:29;
then (root-tree c1).p = c1 by TREES_4:3;
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,FUNCOP_1:13;
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 FUNCOP_1:13,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,FUNCOP_1:13;
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,FUNCOP_1:13;
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+1);
then consider t such that
A2: a = t & t in T & height t <= i+1;
per cases by Th16;
suppose ex s,x st t = x-term;
then t in the set of all x-term;
then t in (the set of all x-term) \/
{o-term p: o-term p in T & the_arity_of o = {}} by XBOOLE_0:def 3;
then t in T height<= 0 by Th12;
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;
reconsider n = union {height t1: t1 in rng p} as Nat by Th25;
per cases;
suppose the_arity_of o = {};
then t in {o-term p where o,p: o-term p in T & the_arity_of o = {}}
by A2,A3;
then t in (the set of all x-term) \/
{o-term p where o,p: o-term p in T & the_arity_of o = {}}
by XBOOLE_0:def 3;
then t in T height<= 0 by Th12;
hence thesis by A2,XBOOLE_0:def 3;
end;
suppose the_arity_of o <> {};
then height t = n + 1 by A3,Th26;
then Segm n c= Segm i by A2,XREAL_1:6,NAT_1:39;
then t in I & t in Union the Sorts of T by A2,A3;
then t in I /\ Union the Sorts of T by XBOOLE_0:def 4;
hence thesis by A2,XBOOLE_0:def 3;
end;
end;
end;
A10: T height<= 0 c= T height<= (i+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,FUNCOP_1:13;
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;
rng g c= NAT
proof let a be object;
assume a in rng g;
then consider b being object such that
B2: b in dom g & a = g.b by FUNCT_1:def 3;
a = G(b) by A6,B2;
hence thesis;
end;
then reconsider g as FinSequence of NAT by FINSEQ_1:def 4;
now let i,t;
assume i in dom the_arity_of o & t = p.i;
then t = p/.i & g.i = G(i) by A6,A9,PARTFUN1:def 6;
hence g.i = deg t;
end;
then
B3: deg(o-term p) = Sum g + 1 by A6,Th29;
Sum g >= g.i = G(i) = deg t1 >= n
by A3,A7,A8,A9,A6,PARTFUN1:def 6,POLYNOM3:4;
then Sum g >= n by XXREAL_0:2;
hence deg(o-term p) >= height(o-term p) by B3,A5,XREAL_1:6;
end;
end;
thus P[t] from TermInd(A1,A2);
end;
theorem
Union the Sorts of T = union {T deg<= i: not contradiction}
proof
thus Union the Sorts of T c= union {T deg<= i: not contradiction}
proof
let a; assume a in Union the Sorts of T;
then reconsider t = a as Element of T;
t in T deg<= deg t & T deg<= deg t in {T deg<= i: not contradiction};
hence thesis by TARSKI:def 4;
end;
let a; assume a in union {T deg<= i: not contradiction};
then consider I such that
A1: a in I & I in {T deg<= i: not contradiction} by TARSKI:def 4;
consider i such that
A2: I = T deg<= i by A1;
thus thesis by A1,A2;
end;
theorem
Union the Sorts of T = union {T height<= i: not contradiction}
proof
thus Union the Sorts of T c= union {T height<= i: not contradiction}
proof
let a; assume a in Union the Sorts of T;
then reconsider t = a as Element of T;
t in T height<= height t &
T height<= height t in {T height<= i: not contradiction} by Th10a;
hence thesis by TARSKI:def 4;
end;
let a; assume a in union {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 such that
A2: I = T height<= i by A1;
thus thesis by A1,A2;
end;
theorem
for i holds T deg<= i c= Free(S,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]`2 = b;
then a in {a`1 where a is Element of rng r: a`2 = b} by A2;
then a in (X variables_in r).s &
dom(X variables_in r) = the carrier of S
by A7,A8,XBOOLE_0:def 4,PARTFUN1:def 2;
hence thesis by CARD_5:2;
end;
suppose ex o,p st t = o-term p;
then consider o,p such that
A6: t = o-term p;
<*>NAT in (dom r)|d by TREES_1:22;
then r.(d^{}) = t.{} by TREES_2:def 10
.= [o,the carrier of S] by A6,TREES_4:def 4;
then
b in the carrier of S = b by A5,XTUPLE_0:1;
hence thesis;
end;
end;
let a; assume a in Union (X variables_in r);
then consider b such that
B1: b in dom (X variables_in r) & a in (X variables_in r).b by CARD_5:2;
reconsider b as SortSymbol of S by B1;
(X variables_in r).b = (X.b)/\{a`1 where a is Element of rng r: a`2 = b}
by MSAFREE3:9;
then
B2: a in X.b & a in {a`1 where a is Element of rng r: a`2 = b}
by B1,XBOOLE_0:def 4;
then consider q being Element of rng r such that
B3: a = q`1 & q`2 = b;
dom X = the carrier of S by PARTFUN1:def 2;
then a in Union X by B2,CARD_5:2;
then
B6: [a,b] in [:Union X, the carrier of S:] by ZFMISC_1:87;
consider xi being object such that
B4: xi in dom r & q = r.xi by FUNCT_1:def 3;
reconsider xi as Element of dom r by B4;
reconsider t = r|xi as Element of T by MSAFREE4:44;
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)|xi by TREES_1:22;
then r.(xi^{}) = t.{} by TREES_2:def 10
.= [x,s] by A6,TREES_4:3;
then [a,b] in rng r /\ [:Union X, the carrier of S:]
by B6,B3,B4,XBOOLE_0:def 4;
hence thesis by XTUPLE_0:def 12;
end;
suppose ex o,p st t = o-term p;
then consider o,p such that
A6: t = o-term p;
<*>NAT in (dom r)|xi by TREES_1:22;
then r.(xi^{}) = t.{} by TREES_2:def 10
.= [o,the carrier of S] by A6,TREES_4:def 4;
then
b in the carrier of S = b by B3,B4;
hence thesis;
end;
end;
theorem
vf (x-term) = {x}
proof
A1: rng (x-term) = {[x,s]} by FUNCOP_1:8;
rng (x-term) c= [:Union X, the carrier of S:] by A1,ZFMISC_1:31,87;
then rng (x-term) /\ [:Union X, the carrier of S:] = rng (x-term)
by XBOOLE_1:28;
hence thesis by A1,RELAT_1:9;
end;
theorem
vf (o-term p) = union {vf t: t in rng p}
proof
B1: dom (X variables_in (o-term p)) = the carrier of S by PARTFUN1:def 2;
thus vf (o-term p) c= union {vf t: t in rng p}
proof
let a; assume a in vf (o-term p);
then a in Union(X variables_in (o-term p)) by ThR1;
then consider b such that
A1: b in dom (X variables_in (o-term p)) & a in (X variables_in (o-term p)).b
by CARD_5:2;
reconsider b as SortSymbol of S by A1;
consider t being DecoratedTree such that
A2: t in rng p & a in (X variables_in t).b by A1,MSAFREE3:13;
reconsider t as Element of Free(S,X) by A2,RELAT_1:167;
A3: dom (X variables_in t) = the carrier of S by PARTFUN1:def 2;
a in Union(X variables_in t) = vf t in {vf t1: t1 in rng p}
by A2,A3,ThR1,CARD_5:2;
hence a in union {vf t1: t1 in rng p} by TARSKI:def 4;
end;
let a; assume a in union {vf t: t in rng p};
then consider I such that
A4: a in I in {vf t: t in rng p} by TARSKI:def 4;
consider t such that
A5: I = vf t & t in rng p by A4;
a in Union(X variables_in t) by A4,A5,ThR1;
then consider b such that
A6: b in dom(X variables_in t) & a in (X variables_in t).b by CARD_5:2;
reconsider b as SortSymbol of S by A6;
a in (X variables_in (o-term p)).b by A5,A6,MSAFREE3:13;
then a in Union(X variables_in (o-term p)) by B1,CARD_5:2;
hence thesis by ThR1;
end;
registration
let S,X,T,r;
cluster vf r -> finite;
coherence;
end;
theorem Th92:
x nin vf r implies r is x-omitting
proof
assume x nin vf r;
then
A1: [x,s] nin rng r /\ [:Union X, the carrier of S:] by XTUPLE_0:def 12;
[x,s] in [:Union X, the carrier of S:] by ZFMISC_1:87;
then [x,s] nin rng r by A1,XBOOLE_0:def 4;
hence Coim(r,[x,s]) = {} by FUNCT_1:72;
end;
definition
let S,X,s,t;
attr t is s-context means
ex x st t is x-context;
end;
registration
let S,X,s,x;
cluster x-context -> s-context for Element of Free(S,X);
coherence;
end;
registration
let S,X,s,x;
cluster x-term -> x-context;
coherence
proof set t = x-term;
[x,s] in {[x,s]} by TARSKI:def 1;
then Coim(t,[x,s]) = {{}} by TREES_1:29,FUNCOP_1:14;
hence card Coim(t,[x,s]) = 1 by CARD_1:30;
end;
end;
registration
let S,X,s,x;
cluster x-context non compound for Element of Free(S,X);
existence
proof
take t = x-term;
thus thesis;
end;
cluster x-omitting -> non x-context for Element of Free(S,X);
coherence;
end;
theorem ThC1:
for s1,s2 being SortSymbol of S
for x1 being Element of X.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 S;
let x1 be Element of X.s1;
let x2 be Element of X.s2;
hereby
assume s1 <> s2 or x1 <> x2;
then [x1,s1] <> [x2,s2] by XTUPLE_0:1;
then [x1,s1] nin {[x2,s2]} by TARSKI:def 1;
hence x1-term is x2-omitting by FUNCOP_1:16;
end;
assume Coim(x1-term,[x2,s2]) = {};
then [x1,s1] nin {[x2,s2]} by FUNCOP_1:14;
hence s1 <> s2 or x1 <> x2 by TARSKI:def 1;
end;
registration
let S,s,s1,Z,z;
let z9 be z-different Element of Z.s1;
cluster z9-term -> z-omitting;
coherence
proof
z9 <> z by DIFF;
hence thesis by ThC1;
end;
end;
registration
let S,s,Z,z;
cluster z-omitting for Element of Free(S,Z);
existence
proof
consider y being Element of Z.s such that
A1: y <> z by SUBSET_1:50;
take y-term;
thus thesis by A1,ThC1;
end;
end;
registration
let S,s,s1,Z,z;
let z1 be z-different Element of Z.s1;
cluster z-omitting z1-context for Element of Free(S,Z);
existence
proof
take z1-term;
thus thesis;
end;
end;
definition
let S,X,s,x;
mode context of x is x-context Element of Free(S,X);
end;
theorem Th27:
for r being SortSymbol of S, y being Element of X.r holds
x-term is context of y iff r = s & x = y
proof
let r be SortSymbol of S, y be Element of X.r;
A0: ([x,s] in {[y,r]} iff [x,s] = [y,r]) & (x-term).{} = [x,s] &
Coim(x-term, [y,r]) c= dom(x-term) = {{}} & {} in {{}}
by TARSKI:def 1,TREES_1:29,TREES_4:3,RELAT_1:132;
(ex a st Coim(x-term, [y,r]) = {a}) implies Coim(x-term, [y,r]) = {{}}
by A0,ZFMISC_1:33;
then card Coim(x-term, [y,r]) = 1 implies Coim(x-term, [y,r]) = {{}}
by CARD_2:42;
hence thesis by A0,CONTEXT,XTUPLE_0:1,FUNCT_1:def 7;
end;
definition
let S,X,s;
mode context of s,X is s-context Element of Free(S,X);
end;
reserve C for (context of x), C1 for (context of y), C9 for (context of z),
C11 for (context of x11), C12 for (context of y11), D for context of s,X;
theorem
C is context of s,X;
theorem Th95:
x in vf C
proof
card Coim(C,[x,s]) = 1 by CONTEXT;
then consider a such that
A1: Coim(C,[x,s]) = {a} by CARD_2:42;
a in {a} by TARSKI:def 1;
then a in dom C & C.a in {[x,s]} by A1,FUNCT_1:def 7;
then
A2: [x,s] = C.a in rng C by TARSKI:def 1,FUNCT_1:def 3;
[x,s] in [:Union X, the carrier of S:] by ZFMISC_1:87;
then [x,s] in rng C /\ [:Union X, the carrier of S:] by A2,XBOOLE_0:def 4;
hence thesis by XTUPLE_0:def 12;
end;
definition
let S,o,s,X,x,p;
attr p is x-context_including means
ex i st i in dom p & p.i is context of x &
for j,t st j in dom p & j <> i & t = p.j
holds t is x-omitting;
end;
registration
let S,o,s,X,x;
cluster x-context_including -> non empty for Element of Args(o,Free(S,X));
coherence;
end;
theorem Th53:
p is x-context_including iff o-term p is context of x
proof
set I = {[x,s]}; set k = p;
reconsider J = [o,the carrier of S] as set;
s in the carrier of S; then s <> the carrier of S;
then [o,the carrier of S] <> [x,s] by XTUPLE_0:1;
then [o,the carrier of S] nin I by TARSKI:def 1;
then IFIN(J,I,{{}},{}) = {} by MATRIX_7:def 1;
then
A5: (o-term k)"I = {} \/ union {<*i*>^^((k.(i+1))"I): i < len k} by Th80;
thus k is x-context_including implies o-term k is context of x
proof
given i such that
A6: i in dom k & k.i is context of x &
for j for t being Element of Free(S,X) st j in dom k & j <> i & t = k.j
holds t is x-omitting;
reconsider C = k.i as context of x by A6;
card Coim(C,[x,s]) = 1 by CONTEXT;
then consider a such that
A9: C"I = {a} by CARD_2:42;
a in C"I by A9,TARSKI:def 1;
then reconsider a as FinSequence;
consider j such that
A7: i = 1+j by A6,FINSEQ_3:25,NAT_1:10;
1+j <= len k by A6,A7,FINSEQ_3:25;
then
A8: j < len k by NAT_1:13;
union {<*i*>^^((k.(i+1))"I) where i: i < len k} = {<*j*>^a}
proof
thus union {<*i*>^^((k.(i+1))"I) where i: i < len k} c= {<*j*>^a}
proof
let b; assume b in union {<*i*>^^((k.(i+1))"I) where i: i < len k};
then consider J such that
B1: b in J in {<*i*>^^((k.(i+1))"I) where i: i < len k} by TARSKI:def 4;
consider n being Nat such that
B2: J = <*n*>^^((k.(n+1))"I) & n < len k by B1;
B4: 1 <= n+1 <= len k by B2,NAT_1:11,13;
then n+1 in dom k by FINSEQ_3:25;
then reconsider t = k.(n+1) as Element of Free(S,X) by FUNCT_1:102;
per cases;
suppose n = j;
hence thesis by B1,B2,A9,A7,Th6;
end;
suppose n <> j;
then n+1 <> j+1;
then t is x-omitting by A6,A7,B4,FINSEQ_3:25;
hence thesis by B1,B2;
end;
end;
let b; assume b in {<*j*>^a};
then b in <*j*>^^(C"I) in {<*i*>^^((k.(i+1))"I) where i: i < len k}
by A7,A8,A9,Th6;
hence thesis by TARSKI:def 4;
end;
then card Coim(o-term k,[x,s]) = 1 by A5,CARD_1:30;
hence thesis by CONTEXT;
end;
assume o-term k is context of x;
then card Coim(o-term k, [x,s]) = 1 by CONTEXT;
then consider a such 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 such that
D2: a in J in {<*i*>^^((k.(i+1))"I): i < len k} by A5,TARSKI:def 4;
consider i such that
D3: J = <*i*>^^((k.(i+1))"I) & i < len k by D2;
consider p being Element of (k.(i+1))"I such that
D4: a = <*i*>^p & p in (k.(i+1))"I by D2,D3;
take n = i+1;
1 <= n <= len k by D3,NAT_1:11,13;
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;
J c= {a} = <*i*>^^{p} by A5,D1,D2,D4,Th6,ZFMISC_1:74;
then kn"I c= {p} by D3,Th18;
then kn"I = {p} by D6,XBOOLE_0:def 10;
then card Coim(kn,[x,s]) = 1 by CARD_1:30;
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]) <> {};
then consider c being object such that
D8: c in Coim(t,[x,s]) by XBOOLE_0:7;
reconsider c as Node of t by D8,FUNCT_1:def 7;
consider m being Nat such that
D9: j = 1+m by D7,FINSEQ_3:25,NAT_1:10;
1+m <= len k by D7,D9,FINSEQ_3:25;
then m < len k by NAT_1:13;
then <*m*>^c in <*m*>^^(t"I) in
{<*i*>^^((k.(i+1))"I) where i: i < len k} by D7,D8,D9;
then <*m*>^c in {a} by A5,D1,TARSKI:def 4;
then <*m*>^c = <*i*>^p by D4,TARSKI:def 1;
then m = (<*m*>^c).1 = i by FINSEQ_1:41;
hence contradiction by D7,D9;
end;
theorem Th54:
(for i st i in dom p holds p/.i is x-omitting) iff o-term p is x-omitting
proof
set I = {[x,s]}; set k = p;
reconsider J = [o,the carrier of S] as set;
s in the carrier of S; then s <> the carrier of S;
then [o,the carrier of S] <> [x,s] by XTUPLE_0:1;
then [o,the carrier of S] nin I by TARSKI:def 1;
then IFIN(J,I,{{}},{}) = {} by MATRIX_7:def 1;
then
A5: (o-term k)"I = {} \/ union {<*i*>^^((k.(i+1))"I): i < len k} by Th80;
hereby assume
A6: for i st i in dom p holds p/.i is x-omitting;
thus o-term p is x-omitting
proof
assume Coim(o-term p,[x,s]) <> {};
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 = <*i*>^^((p.(i+1))"I) & i < len p by A8;
1 <= i+1 <= len p by A9,NAT_1:11,13;
then p/.(i+1) = p.(i+1) & p/.(i+1) is x-omitting
by A6,FINSEQ_3:25,PARTFUN1:def 6;
hence contradiction by A8,A9;
end;
end;
assume
B1: Coim(o-term p,[x,s]) = {};
let i; assume
B2: i in dom p;
then consider j such that
B3: i = 1+j by NAT_1:10,FINSEQ_3:25;
1+j <= len p by B2,B3,FINSEQ_3:25;
then j < len p by NAT_1:13;
then <*j*>^^((p.i)"I) in {<*i*>^^((k.(i+1))"I) where i: i < len k} by B3;
then <*j*>^^((p.i)"I) c= {} = <*j*>^^{} by A5,B1,ZFMISC_1:74;
then (p.i)"I c= {} & p/.i = p.i by B2,Th18,PARTFUN1:def 6;
hence Coim(p/.i,[x,s]) = {};
end;
theorem Th54A:
(for t st t in rng p holds t is x-omitting) iff o-term p is x-omitting
proof
A0: now assume
A1: for i st i in dom p holds p/.i is x-omitting;
let t; assume t in rng p;
then consider i being object such that
A2: i in dom p & t = p.i by FUNCT_1:def 3;
reconsider i as Nat by A2;
t = p/.i by A2,PARTFUN1:def 6;
hence t is x-omitting by A1,A2;
end;
now assume
A3: for t st t in rng p holds t is x-omitting;
let i; assume i in dom p;
then p/.i = p.i in rng p by FUNCT_1:def 3,PARTFUN1:def 6;
hence p/.i is x-omitting by A3;
end;
hence thesis by A0,Th54;
end;
definition
let S,s,o;
attr o is s-dependent means: DEP: s in rng the_arity_of o;
end;
registration
let S be sufficiently_rich non void non empty ManySortedSign;
let s be SortSymbol of S;
cluster s-dependent for OperSymbol of S;
existence
proof
consider o be OperSymbol of S such that
A1: s in rng the_arity_of o by SR;
take o;
thus s in rng the_arity_of o by A1;
end;
end;
reserve
S9 for sufficiently_rich non empty non void ManySortedSign,
s9 for SortSymbol of S9,
o9 for s9-dependent OperSymbol of S9,
X9 for non-trivial ManySortedSet of the carrier of S9,
x9 for (Element of X9.s9);
registration
let S9,s9,o9,X9,x9;
cluster x9-context_including for Element of Args(o9,Free(S9,X9));
existence
proof
s9 in rng the_arity_of o9 by DEP;
then consider i being object such that
A1: i in dom the_arity_of o9 & s9 = (the_arity_of o9).i by FUNCT_1:def 3;
reconsider i as Nat by A1;
A2: s9 = (the_arity_of o9)/.i by A1,PARTFUN1:def 6;
deffunc F(Nat) = IFEQ($1,i,x9-term,
(the x9-different Element of X9.((the_arity_of o9)/.$1))-term);
consider f being FinSequence such that
A3: len f = len the_arity_of o9 & for i st i in dom f holds f.i = F(i)
from FINSEQ_1:sch 2;
now
let j; assume j in dom f;
then f.j = F(j) & (i = j or i <> j) by A3;
then i = j & f.j = x9-term or
f.j = (the x9-different Element of X9.((the_arity_of o9)/.j))-term
by FUNCOP_1:def 8;
hence f.j in (the Sorts of Free(S9,X9)).((the_arity_of o9)/.j) by A2;
end;
then reconsider f as Element of Args(o9,Free(S9,X9)) by A3,MSAFREE2:5;
take f,i;
thus i in dom f by A1,A3,FINSEQ_3:29;
then f.i = F(i) by A3 .= x9-term by FUNCOP_1:def 8;
hence f.i is context of x9;
let j; let t be Element of Free(S9,X9);
assume j in dom f & j <> i;
then f.j = F(j)
= (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-omitting;
end;
end;
registration
let S9,X9,s9,x9,o9;
let p9 be x9-context_including Element of Args(o9,Free(S9,X9));
cluster o9-term p9 -> x9-context;
coherence by Th53;
end;
definition
let S,o,s,X,x,p such that
A: p is x-context_including;
consider i such that
B: i in dom p & p.i is context of x &
for j for t being Element of Free(S,X) st j in dom p & j <> i & t = p.j
holds t is x-omitting by A;
func x-context_pos_in p -> Nat means: CPI:
p.it is context of x;
existence by B;
uniqueness
proof let i1,i2 be Nat such that
A1: p.i1 is context of x and
A2: p.i2 is context of x;
reconsider C1 = p.i1, C2 = p.i2 as context of x by A1,A2;
i1 in dom p & i2 in dom p by A1,A2,FUNCT_1:def 2;
then (i1 <> i implies C1 is x-omitting) &
(i2 <> i implies C2 is x-omitting) by B;
hence i1 = i2;
end;
func x-context_in p -> context of x means: CIn:
it in rng p;
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;
uniqueness
proof
let t1,t2 be context of x such that
A3: t1 in rng p and
A4: t2 in rng p;
consider i1 being object such that
A5: i1 in dom p & t1 = p.i1 by A3,FUNCT_1:def 3;
consider i2 being object such that
A6: i2 in dom p & t2 = p.i2 by A4,FUNCT_1:def 3;
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 A5,A6,A7;
end;
end;
theorem Th71:
p is x-context_including implies x-context_pos_in p in dom p &
x-context_in p = p.(x-context_pos_in p)
proof
assume
A0: p is x-context_including;
then
A1: p.(x-context_pos_in p) is context of x by CPI;
thus x-context_pos_in p in dom p by A0,CPI;
then p.(x-context_pos_in p) in rng p by FUNCT_1:def 3;
hence thesis by A0,A1,CIn;
end;
theorem Th72:
p is x-context_including & x-context_pos_in p <> i in dom p implies
p/.i is x-omitting
proof
assume
A1: p is x-context_including & x-context_pos_in p <> i in dom p;
then consider j such that
A2: j in dom p & p.j is context of x &
for n being Nat for t st n in dom p & n <> j & t = p.n
holds t is x-omitting;
A3: x-context_pos_in p = j by A1,A2,CPI;
p/.i = p.i by A1,PARTFUN1:def 6;
hence p/.i is x-omitting by A1,A2,A3;
end;
theorem Th73:
p is x-context_including implies p just_once_values x-context_in p
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-context_pos_in k}
proof
let a; reconsider x = a as set by TARSKI:1;
assume a in Coim(k, z-context_in k);
then x in dom k & k.x in {z-context_in k} by FUNCT_1:def 7;
then x is Nat & k.x = z-context_in k by TARSKI:def 1;
then x = z-context_pos_in k by A0,CPI;
hence a in {z-context_pos_in k} by TARSKI:def 1;
end;
let a be Nat;
assume a in {z-context_pos_in k};
then a = z-context_pos_in k by TARSKI:def 1;
then k.a = z-context_in k by A0,Th71;
then a in dom k & k.a in {z-context_in k} by TARSKI:def 1,FUNCT_1:def 2;
hence thesis by FUNCT_1:def 7;
end;
hence card Coim(k, z-context_in k) = 1 by CARD_1:30;
end;
theorem
p is x-context_including implies p<-(x-context_in p) = x-context_pos_in p
proof
assume
A1: p is x-context_including;
then p just_once_values x-context_in p by Th73;
then p<-(x-context_in p) in dom p &
p.(p<-(x-context_in p)) = x-context_in p by FINSEQ_4:def 3;
hence thesis by A1,CPI;
end;
theorem
C = x-term or
ex o,p st p is x-context_including & C = o-term p
proof
per cases by Th16;
suppose ex s,x st C = x-term;
then consider s0 being SortSymbol of S, y being Element of X.s0 such that
A1: C = y-term;
s0 = s & x = y by A1,Th27;
hence thesis by A1;
end;
suppose ex o,p st C = o-term p;
then consider o,p such that
A2: C = o-term p;
thus thesis by A2,Th53;
end;
end;
registration
let S9,X9,s9,x9;
cluster x9-context compound for Element of Free(S9,X9);
existence
proof
set o9 = the s9-dependent OperSymbol of S9;
set p9 = the x9-context_including Element of Args(o9,Free(S9,X9));
take t = o9-term p9;
thus t is x9-context;
thus t is compound;
end;
end;
scheme ContextInd{P[set],
S() -> non empty non void ManySortedSign,
s() -> SortSymbol of S(),
X() -> non-empty ManySortedSet of the carrier of S(),
x() -> (Element of X().s()),
C() -> context of x()}:
P[C()]
provided
A0: P[x()-term] and
A1: 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
defpred Q[Element of Free(S(),X())] means $1 is context of x() implies P[$1];
A2: for s being SortSymbol of S(), x being Element of X().s holds Q[x-term]
proof
let s be SortSymbol of S(), x being Element of X().s;
assume x-term is context of x();
then s = s() & x = x() by Th27;
hence P[x-term] by A0;
end;
A3: 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 Q[t]
holds Q[o-term p]
proof
let o be OperSymbol of S(), p be Element of Args(o,Free(S(),X())) such
that
A4: for t being Element of Free(S(),X()) st t in rng p holds Q[t] and
A5: o-term p is context of x();
p is x()-context_including by A5,Th53;
then x()-context_in p in rng p by CIn;
then P[x()-context_in p] by A4;
hence thesis by A1,A5,Th53;
end;
Q[C()] from TermInd(A2,A3);
hence P[C()];
end;
theorem Th23:
t is x-omitting implies (t,[x,s])<-t1 = t
proof assume
A1: Coim(t,[x,s]) = {};
reconsider dt = dom t as set;
AA: dom ((t,[x,s])<-t1) = dt
proof
thus dom ((t,[x,s])<-t1) c= dt
proof let a; assume a in dom ((t,[x,s])<-t1);
then reconsider r = a as Node of (t,[x,s])<-t1;
per cases by TREES_4:def 7;
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;
then consider q being Node of t, p being Node of t1 such that
A2: q in Leaves dom t & t.q = [x,s] & r = q^p;
[x,s] in {[x,s]} by TARSKI:def 1;
hence thesis by A1,A2,FUNCT_1:def 7;
end;
end;
thus dt c= dom ((t,[x,s])<-t1) by TREES_4:def 7;
end;
now let a; assume a in dom t;
then reconsider r = a as Node of t;
[x,s] in {[x,s]} by TARSKI:def 1;
then t.r <> [x,s] by A1,FUNCT_1:def 7;
hence ((t,[x,s])<-t1).a = t.a by TREES_4:def 7;
end;
hence thesis by AA,FUNCT_1:2;
end;
theorem
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 = s;
defpred P[Element of Free(S,X)] means
($1,[x,s])<-t1 in (the Sorts of Free(S,X)).the_sort_of $1;
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;
suppose s1 = s & y = x;
then (y-term,[x,s])<-t1 = t1 & the_sort_of (y-term) = s by SORT;
hence (y-term,[x,s])<-t1 in
(the Sorts of Free(S,X)).the_sort_of (y-term) by A,SORT;
end;
suppose [y,s1] <> [x,s];
then (y-term,[x,s])<-t1 = y-term & the_sort_of (y-term) = s1
by SORT,ThL7;
hence (y-term,[x,s])<-t1 in
(the Sorts of Free(S,X)).the_sort_of (y-term);
end;
end;
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 in rng p holds P[t2];
per cases;
suppose p = {};
then
A2: o-term p = root-tree [o,the carrier of S] by TREES_4:20;
s in the carrier of S; then s <> the carrier of S;
then [x,s] <> [o, the carrier of S] by XTUPLE_0:1;
then (o-term p,[x,s])<-t1 = o-term p by A2,ThL7;
hence thesis by SORT;
end;
suppose
A2: p <> {};
deffunc F(Nat) = (p/.$1,[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 q = dom p <> {} by A2,A4,FINSEQ_3:29;
A6: p is non empty & q is non empty by A2,A4;
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;
now let i;
assume
B1: i in dom q;
then
B2: p/.i = p.i by A5,PARTFUN1:def 6;
then p/.i in rng p by B1,A5,FUNCT_1:def 3;
then
B3: P[p/.i] & q.i = F(i) by A3,A4,B1;
p.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
by B1,A5,A8,MSUALG_6:2;
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: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;
hence q.i = (d1,[x,s])<-t1;
end;
then
A7: (o-term p,[x,s])<-t1 = o-term q by A6,ThL8,A4,FINSEQ_3:29;
the_sort_of (o-term p) = the_result_sort_of o = the_sort_of (o-term q)
by Th8;
hence thesis by A7;
end;
end;
thus P[t] from TermInd(A0,A1);
end;
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,[x,s])<-t = t & the_sort_of (x-term) = s by SORT;
then
A0: P[x-term] by A,SORT;
A1: 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; let p; assume that
A2: p is x-context_including and
A3: P[x-context_in p];
deffunc F(Nat) = (p/.$1,[x,s])<-t;
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 q = dom p <> {} by A2,A4,FINSEQ_3:29;
A6: p is non empty & q is non empty by A2,A4;
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;
now let i;
assume
B1: i in dom q;
then
B2: p/.i = p.i by A5,PARTFUN1:def 6;
per cases;
suppose x-context_pos_in p = i;
then
B3: x-context_in p = p.i & q.i = F(i) by B1,A4,A2,Th71;
p.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
by B1,A5,A8,MSUALG_6:2;
then the_sort_of (x-context_in p) = (the_arity_of o)/.i by B3,SORT;
hence q.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
by B2,B3,A3;
end;
suppose x-context_pos_in p <> i;
then q.i = F(i) = p.i by A4,B1,B2,A2,A5,Th72,Th23;
hence q.i in (the Sorts of Free(S,X)).((the_arity_of o)/.i)
by B1,A5,A8,MSUALG_6:2;
end;
end;
then reconsider q as Element of Args(o,Free(S,X)) 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;
hence q.i = (d1,[x,s])<-t;
end;
then (o-term p,[x,s])<-t = o-term q by A6,ThL8,A4,FINSEQ_3:29;
hence thesis by Th8;
end;
thus P[C] from ContextInd(A0,A1);
end;
end;
theorem Th41:
the_sort_of t = s implies (x-term)-sub(t) = t
proof assume the_sort_of t = s;
hence (x-term)-sub(t) = (x-term,[x,s])<-t by SUB .= t;
end;
registration
let S,X,s,x,C;
reduce C-sub(x-term) to C;
reducibility
proof
defpred P[Element of Free(S,X)] means ($1,[x,s])<-(x-term) = $1;
A1: P[x-term];
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; let p; assume that
A2: p is x-context_including and
A3: P[x-context_in p];
set t = x-term;
deffunc F(Nat) = (p/.$1,[x,s])<-t;
now let i,d1; assume
B1: i in dom p & d1 = p.i;
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;
hence p.i = (d1,[x,s])<-t by A3,B1;
end;
suppose x-context_pos_in p <> i;
hence p.i = (d1,[x,s])<-t by B1,B2,A2,Th72,Th23;
end;
end;
hence thesis by A2,ThL8;
end;
AA: P[C] from ContextInd(A1,A2);
the_sort_of (x-term) = s by SORT;
hence thesis by AA,SUB;
end;
end;
theorem Th42:
for w being Element of Args(o,Free(S,Z)) for t being Element of Free(S,Z)
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 w = dom the_arity_of o
by FUNCT_7:30,MSUALG_6:2;
then
A3: len (w+*(z-context_pos_in w,t)) = len the_arity_of o by FINSEQ_3:29;
now
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 &
the_sort_of t = (the_arity_of o)/.i
by A1,A2,A4,PARTFUN1:def 6,FUNCT_7:31;
hence (w+*(z-context_pos_in w,t)).i in
(the Sorts of Free(S,Z)).((the_arity_of o)/.i) by SORT;
end;
suppose i <> z-context_pos_in w;
then (w+*(z-context_pos_in w,t)).i = w.i by FUNCT_7:32;
hence (w+*(z-context_pos_in w,t)).i in
(the Sorts of Free(S,Z)).((the_arity_of o)/.i) by A2,A4,MSUALG_6:2;
end;
end;
hence w+*(z-context_pos_in w,t) in Args(o,Free(S,Z)) by A2,A3,MSAFREE2:5;
end;
theorem Th94:
the_sort_of C9 = s1 implies
for z1 being z-different Element of Z.s1
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 P[Element of Free(S,Z)] means
$1 is z-omitting implies ($1,[z1,s1])<-C9 is context of z;
A2: P[z1-term];
A3: for o for k st k is z1-context_including
holds P[z1-context_in k] implies
for C being context of z1 st C = o-term k holds P[C] by Th53;
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 of Args(o,Free(S,Z)) for t being Element of Free(S,Z)
st w is z-context_including & C9 = o-term w &
p = w+*(z-context_pos_in w, (z-context_in w)-sub(t)) &
the_sort_of t = s
holds C9-sub(t) = o-term p
proof
let w,p be Element of Args(o,Free(S,Z));
let t be Element of Free(S,Z);
assume that
A1: w is z-context_including and
A2: C9 = o-term w and
A3: p = w+*(z-context_pos_in w, (z-context_in w)-sub(t)) and
A4: the_sort_of t = s;
A5: dom p = dom the_arity_of o = dom w <> {} by A1,MSUALG_3:6;
then reconsider v = w, q = p as non empty DTree-yielding FinSequence;
now let i,d1; assume
A6: i in dom v & d1 = v.i;
A7: (z-context_in w)-sub(t) = (z-context_in w,[z,s])<-t by A4,SUB;
per cases;
suppose
A8: i = z-context_pos_in w;
then d1 = z-context_in w by A1,A6,Th71;
hence q.i = (d1,[z,s])<-t by A3,A6,A7,A8,FUNCT_7:31;
end;
suppose
A8: i <> z-context_pos_in w;
then w/.i is z-omitting & w/.i = d1 by A1,A6,Th72,PARTFUN1:def 6;
then (d1,[z,s])<-t = d1 by Th23;
hence q.i = (d1,[z,s])<-t by A3,A6,A8,FUNCT_7:32;
end;
end;
then ([o,the carrier of S]-tree v,[z,s])<-t
= [o,the carrier of S]-tree q by A5,ThL8;
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 in Leaves dom t
proof
assume Z0: t.a = [x,s];
then reconsider q = a as Element of dom t by FUNCT_1:def 2;
reconsider v = t|q as Element of Free(S,X) by MSAFREE4:44;
{} in (dom t)|q by TREES_1:22;
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 consider o,p such that
A1: v = o-term p;
[o,the carrier of S] = v.{} = [x,s] by Z0,A1,A2,TREES_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 st v = x11-term;
then consider s1,x11 such that
A1: v = x11-term;
reconsider r = <*0*> as FinSequence of NAT;
now assume q^<*0*> in dom t;
then r in (dom t)|q = dom v by TREES_1:def 6,TREES_2:def 10;
then <*0*> in {{}} by A1,TREES_4:3,TREES_1:29;
hence contradiction;
end;
hence a in Leaves dom t by TREES_1:54;
end;
end;
theorem Th45A:
for s0 being SortSymbol of S, x0 being Element of X.s0 holds
the_sort_of t = s & C is x0-omitting & t is x0-omitting implies
C-sub t is x0-omitting
proof
let s0 be SortSymbol of S;
let x0 be Element of X.s0;
assume the_sort_of t = s;
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, [x0,s0]) <> {};
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-sub t).a in {[x0,s0]} by A2,FUNCT_1:def 7;
reconsider a as Element of dom(C-sub t) by A2,FUNCT_1:def 7;
A5: now given q being Node of C, r being Node of t such that
B1: q in Leaves dom C & C.q = [x,s] & a = q^r;
(C-sub t).a = t.r by A1,B1,TREES_4:def 7;
hence contradiction by Z2,A3,FUNCT_1:def 7;
end;
per cases by A1,TREES_4:def 7;
suppose
B3: a in dom C & C.a <> [x,s];
then (C-sub t).a = C.a by A1,TREES_4:def 7;
hence contradiction by Z1,A3,B3,FUNCT_1:def 7;
end;
suppose
B2: a in dom C & C.a = [x,s];
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:
p is x-context_including implies
the_sort_of (x-context_in p) = (the_arity_of o).(x-context_pos_in p)
proof
assume p is x-context_including;
then x-context_pos_in p in dom p = dom the_arity_of o &
x-context_in p = p.(x-context_pos_in p) by Th71,MSUALG_3:6;
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 o)/.(x-context_pos_in p))
by PARTFUN1:def 6,MSUALG_6:2;
hence the_sort_of (x-context_in p) = (the_arity_of o).(x-context_pos_in p)
by SORT;
end;
theorem Th47:
for A being disjoint_valued non-empty MSAlgebra over S
for B being non-empty MSAlgebra over S
for o being OperSymbol of S, p,q being Element of Args(o,A)
for h being ManySortedFunction of A,B, a being Element of A
for i st i in dom p & q = p+*(i,a) holds h#q = (h#p)+*(i,h.a)
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 Args(o,A);
let h be ManySortedFunction of A,B;
let a be Element of A;
let i;
assume Z0: i in dom p;
assume Z1: q = p+*(i,a);
A1: dom (h#q) = dom the_arity_of o = dom (h#p) = dom((h#p)+*(i,h.a)) &
dom q = dom the_arity_of o = dom p by MSUALG_3:6,FUNCT_7:30;
now let j be object;
assume
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,Z1,FUNCT_7:31;
then a in (the Sorts of A).((the_arity_of o)/.i) by Z0,A1,MSUALG_6:2;
then the_sort_of a = (the_arity_of o)/.i by SORT;
then
A5: h.((the_arity_of o)/.i).a = h.a by ABBR;
per cases;
suppose
A4: j = i;
hence (h#q).j = h.((the_arity_of o)/.k).a by Z1,A1,A2,A3,FUNCT_7:31
.= ((h#p)+*(i,h.a)).j by A4,A5,A1,A2,FUNCT_7:31;
end;
suppose
A6: j <> i;
hence (h#q).j = h.((the_arity_of o)/.k).(p.k) by Z1,A3,FUNCT_7:32
.= ((h#p)+*(i,h.a)).j by A3,A6,FUNCT_7:32;
end;
end;
hence h#q = (h#p)+*(i,h.a) by A1,FUNCT_1:2;
end;
theorem
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 @((canonical_homomorphism R).t))
proof let t be Element of Free(S,Z); assume
A1: the_sort_of t = s;
set H = canonical_homomorphism R;
defpred P[context of z] means
H.($1-sub(t)) = H.($1-sub @(H.t));
B1: the_sort_of @(H.t) = the_sort_of (H.t) by Lem00
.= the_sort_of t by Lem0;
B3: the_sort_of ((z-term)-sub @(H.t)) = the_sort_of (z-term) by SORT
.= 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;
B6: t in (the Sorts of Free(S,Z)).s & (the Sorts of R).s <> {} &
H.s is Function of (the Sorts of Free(S,Z)).s, (the Sorts of R).s
by A1,SORT;
B4: (z-term)-sub t = t & (z-term)-sub @(H.t) = H.t = H.s.t
by A1,B1,Th41,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
.= H.((z-term)-sub @(H.t)) by B3,ABBR;
end;
A3: now
let o be OperSymbol of S, p be Element of Args(o,Free(S,Z));
assume
A4: p is z-context_including;
assume
A5: P[z-context_in p];
let C be context of z such that
A6: C = o-term p;
C2: the_sort_of ((z-context_in p)-sub t) =
the_sort_of (z-context_in p) = (the_arity_of o).(z-context_pos_in p)
by A4,Th46,SORT;
then reconsider w = p+*(z-context_pos_in p,(z-context_in p)-sub t) as
Element of Args(o,Free(S,Z)) by A4,Th42;
Args(o,R) c= Args(o, Free(S,Z)) by MSAFREE4:41;
then reconsider q = H#w, r = H#p as Element of Args(o,Free(S,Z));
C1: the_sort_of @(H.t) = the_sort_of (H.t) by Lem00 .= s by A1,Lem0;
C3: the_sort_of ((z-context_in p)-sub @(H.t))
= the_sort_of (z-context_in p) by SORT;
reconsider m = p+*(z-context_pos_in p, (z-context_in p)-sub @(H.t)) as
Element of Args(o,Free(S,Z)) by A4,C2,C3,Th42;
A9: q = r+*(z-context_pos_in p,H.((z-context_in p)-sub @(H.t)))
by A5,A4,Th71,Th47
.= H#m by A4,Th71,Th47;
C-sub t = o-term w by A1,A4,A6,Th43;
then
H.(C-sub t) = H.(the_sort_of (o-term w)).(o-term w) by ABBR
.= H.(the_result_sort_of o).(o-term w) by Th8
.= H.(the_result_sort_of o).(Den(o,Free(S,Z)).w) by MSAFREE4:13
.= Den(o,R).(H#w) by MSAFREE4:def 10,MSUALG_3:def 7
.= H.(the_result_sort_of o).(Den(o,Free(S,Z)).m)
by A9,MSAFREE4:def 10,MSUALG_3:def 7
.= 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.(o-term m) by ABBR
.= H.(C-sub @(H.t)) by C1,A4,A6,Th43;
hence P[C];
end;
thus P[C9] from ContextInd(A2,A3);
end;
definition
let S,X,T,s,x;
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 s <> s1
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;
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;
F0: for i,j being Element of dom B st i < j holds f.j nin g.i & f.j in g.j
proof let i,j be Element of dom B; assume i < j;
then i+1 <= j by NAT_1:13;
then consider k being Nat such that
E5: j = i+1+k by NAT_1:10;
E6: j = i+k+1 by E5;
len B >= i+k+1 by E5,FINSEQ_3:25;
then len B > i+k >= i >= 1 by NAT_1:12,13,FINSEQ_3:25;
then len B >= i+k >= 1 by XXREAL_0:2;
then reconsider ik = i+k as Element of dom B by FINSEQ_3:25;
g.i c= g.ik & f.j nin g.ik & g.j = {f.j}\/g.ik by C6,E6,E0,NAT_1:12;
hence thesis by ZFMISC_1:136;
end;
F1: for b being 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 thesis by AA,A2,TARSKI:def 1;
end;
suppose
D0: b > 1;
b <= len B by FINSEQ_3:25;
then 1 <= len B by D0,XXREAL_0:2;
then reconsider c1 = 1 as Element of dom B by FINSEQ_3:25;
c1 < b by D0;
hence thesis by F0;
end;
end;
f is B-sorts
proof
thus dom f = dom B by AA;
let i; assume i in dom B;
then reconsider j = i as Element of dom B;
j >= 1 by FINSEQ_3:25;
then per cases by XXREAL_0:1;
suppose i = 1;
then f.i = union{the Element of (Y.(B.j) \ (union N \/ rng V))} &
Y.(B.j) \ (union N \/ rng V) <> {} by AA,A1,A2,A3;
hence f.i in Y.(B.i) by XBOOLE_0:def 5;
end;
suppose i > 1;
then i >= 1+1 by NAT_1:13;
then consider c being Nat such that
D1: i = 1+1+c by NAT_1:10;
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_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 f.j = the Element of Y.(B.j) \ (union N \/ rng V \/ g.c1) &
Y.(B.j) \ (union N \/ rng V \/ g.c1) <> {} by C6,A1,A3,D2;
hence f.i in Y.(B.i) by XBOOLE_0:def 5;
end;
end;
then reconsider f as B-sorts FinSequence of Union Y;
take f;
thus f is one-to-one
proof
let a,b; assume
F2: a in dom f & b in dom f & f.a = f.b & a <> b;
then reconsider a,b as Element of dom B by AA;
a < b or b < a by F2,XXREAL_0:1;
then f.b in g.a & f.b nin g.a or f.a in g.b & f.a nin g.b by F0,F1,F2;
hence thesis;
end;
now
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;
1 <= b by FINSEQ_3:25;
then per cases by XXREAL_0:1;
suppose b = 1;
then a = union{the Element of (Y.(B.b) \ (union N \/ rng V))} &
Y.(B.b) \ (union N \/ rng V) <> {} by AA,A1,A2,A3,A5;
hence a nin union N \/ rng V by XBOOLE_0:def 5;
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 nin union N \/ rng V \/ g.c1 by XBOOLE_0:def 5;
hence a nin union N \/ rng V by XBOOLE_0:def 3;
end;
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 S,X,t;
mode vf-sequence of t -> FinSequence means: VFS:
ex f being one-to-one FinSequence st
rng f = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]} &
dom it = dom f & for i st i in dom it holds it.i = t.(f.i);
existence
proof set I = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]};
I c= dom t
proof
let a; assume a in I;
then ex xi being Element of dom t st a = xi & ex s,x st t.xi = [x,s];
hence thesis;
end;
then consider f being FinSequence such that
A1: rng f = I & f is one-to-one by FINSEQ_4:58;
reconsider f as one-to-one FinSequence by A1;
deffunc F(object) = t.(f.$1);
consider V being FinSequence such that
A2: len V = len f & for i st i in dom V holds V.i = F(i) from FINSEQ_1:sch 2;
take V,f; thus rng f = I by A1;
thus dom V = dom f by A2,FINSEQ_3:29;
thus thesis by A2;
end;
end;
registration
let f be FinSequence;
cluster pr1 f -> FinSequence-like;
coherence
proof
dom pr1 f = dom f = Seg len f by MCART_1:def 12,FINSEQ_1:def 3;
hence thesis by FINSEQ_1:def 2;
end;
cluster pr2 f -> FinSequence-like;
coherence
proof
dom pr2 f = dom f = Seg len f by MCART_1:def 13,FINSEQ_1:def 3;
hence thesis by FINSEQ_1:def 2;
end;
end;
theorem Th96:
for f being vf-sequence of t holds pr2 f is FinSequence of the carrier of S
proof
let f be vf-sequence of t;
consider g being one-to-one FinSequence such that
A1: rng g = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]} &
dom f = dom g & for i st i in dom f holds f.i = t.(g.i) by VFS;
let a; assume a in rng pr2 f;
then consider b such that
A2: b in dom pr2 f & a = (pr2 f).b by FUNCT_1:def 3;
reconsider b as Nat by A2;
A3: dom pr2 f = dom f by MCART_1:def 13;
then g.b in rng g by A1,A2,FUNCT_1:def 3;
then consider xi being Element of dom t such that
A4: g.b = xi & ex s,x st t.xi = [x,s] by A1;
consider s,x such that
A5: t.xi = [x,s] by A4;
a = (f.b)`2 by A2,A3,MCART_1:def 13 .= [x,s]`2 by A1,A2,A3,A4,A5 .= s;
hence a in the carrier of S;
end;
theorem Th97:
for f being vf-sequence of t, B being FinSequence of the carrier of S
st B = pr2 f holds pr1 f is B-sorts FinSequence of Union X
proof
let f be vf-sequence of t;
let B be FinSequence of the carrier of S;
assume Z0: B = pr2 f;
consider g being one-to-one FinSequence such that
A1: rng g = {xi where xi is Element of dom t: ex s,x st t.xi = [x,s]} &
dom f = dom g & for i st i in dom f holds f.i = t.(g.i) by VFS;
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 f).b by FUNCT_1:def 3;
reconsider b as Nat by A2;
A3: dom pr1 f = dom f by MCART_1:def 12;
then g.b in rng g by A1,A2,FUNCT_1:def 3;
then consider xi being Element of dom t such that
A4: g.b = xi & ex s,x st t.xi = [x,s] by A1;
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_4:3,TREES_1:29;
then
A1: xi = <*>NAT;
let x1,t; assume (x11-term).xi = [x1,s];
then [x11,s1] = [x1,s] by A1,TREES_4:3;
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 dom C; then
xi in {{}} by A2,TREES_1:29,TREES_4:3;
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,TREES_4:3;
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,TREES_4:3;
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,TREES_4:3;
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,TREES_4:3;
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_4:3,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_4:3,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] by TREES_4:3;
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,TREES_4:3;
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
J8: r in dom t & q = xi^r & F1.q = t.r;
dom V2 = dom B by SORTS;
then V2.b <> V2.b1 by J1,FUNCT_1:def 4;
then t is V2.b1-omitting by ThC1;
hence contradiction by H2,J3,J4,J8,FUNCT_1:def 7;
end;
end;
reconsider mu = g/.b1 as Node of v;
L5: bi < b1 & b > bi by J1,H2,NAT_1:13;
then
L2: Fi.(g/.b1) = [V1.b1,B.b1] & Fi.(g/.b) = [V1.b,B.b] by H1;
g/.b1 = g.b1 & g/.b = g.b & g/.bi = g.bi by AA,AB,PARTFUN1:def 6;
then g/.b1 <> g/.b & g/.bi <> g/.b1 & g/.b1 in dom Fi & g/.b in dom Fi &
g/.bi in dom Fi by AB,AA,J1,I2,L5,FUNCT_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;
then g/.b1 in dom Fi with-replacement(nu,dom (D.bi))
by H7,TREES_2:def 11;
then
L7: (Fi-sub(D.bi)).(g/.b1) = [V1.b1,B.b1]
by L4,L2,L6,H7,TREES_2:def 11;
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);
F is V2-context-sequence
proof
thus dom F = dom B by A7;
let b be Element of dom B;
1 <= b by FINSEQ_3:25;
hence thesis by L8;
end;
then reconsider F as V2-context-sequence FinSequence of Free(S,Y);
take F;
thus F is (V1,V2,D)-consequent-context-sequence
proof
let i,j be Element of dom B;
reconsider nu = g/.i, xi = g/.j as Node of v;
reconsider Fi = F.i, Fj = F.j as Element of Free(S,Y);
reconsider t = (V2.j)-term as Element of Free(S,Y);
H1: i >= 1 by FINSEQ_3:25;
assume
H2: i+1 = j;
H3: j >= 1 by H2,NAT_1:12;
F3: F.j = Fi with-replacement(nu, D.i) with-replacement(xi,t) by A7,H2;
H8: j > i & F/.i = Fi by A7,H2,NAT_1:13,PARTFUN1:def 6;
then
H5: Fi is V2.j-omitting & Fi.xi = [V1.j,B.j] by H1,L8;
I2: D.i in (the Sorts of Free(S,Y)).(B.i) & dom v c= dom Fi
by H1,L8;
nu = g.i & xi = g.j by AA,AB,PARTFUN1:def 6;
then
H6: Fi.nu = [V2.i,B.i] & the_sort_of (D.i) = B.i & nu in dom Fi &
xi in dom Fi & nu <> xi by H1,AA,AB,I2,L8,H8,SORT,FUNCT_1:def 4;
then
H7: Fi with-replacement(nu, D.i) = (F.i)-sub(D.i) by Th118;
reconsider q = (V1.j)-term as Element of Free(S,Y);
M1: not nu c= xi by H6,Lem9;
then
H4: not ex r being FinSequence of NAT st r in dom (D.i) & xi = nu^r &
((F.i)-sub(D.i)).xi = D.i.r by TREES_1:1;
not nu c< xi by M1,XBOOLE_0:def 8;
then xi in dom Fi with-replacement(nu, dom (D.i)) by H6,TREES_1:def 9;
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,Lem11A;
M2: Fj.xi = [V2.j,B.j] & the_sort_of q = B.j & xi in dom Fj
by M8,H3,L8,SORT,F3,H7,Lem11A;
then
M5: (F.j)-sub(q) = (F.j) with-replacement(xi, q) by Th118;
hence
M4: dom ((F.j)-sub((V1.j)-term)) = dom ((F.i)-sub(D.i)) by M3,M2,Lem11A;
let a be Node of (F.j)-sub((V1.j)-term);
a in dom((F.j)-sub((V1.j)-term)) = dom Fj with-replacement(xi, dom q)
by M2,M5,TREES_2:def 11;
then per cases by M5,M2,TREES_2:def 11;
suppose
M6: not xi c= a & ((F.j)-sub(q)).a = Fj.a;
then not xi c< a by XBOOLE_0:def 8;
then
M7: a in dom((F.i)-sub(D.i)) with-replacement(xi,dom t)
by M8,M4,TREES_1:def 9;
not ex r being FinSequence of NAT st r in dom t & a = xi^r & Fj.a = t.r
by M6,TREES_1:1;
hence ((F.j)-sub((V1.j)-term)).a = ((F.i)-sub(D.i)).a
by F3,H7,M6,M7,M8,TREES_2:def 11;
end;
suppose ex r being FinSequence of NAT st r in dom q & a = xi^r &
((F.j)-sub(q)).a = q.r;
then consider r being FinSequence of NAT such that
N1: r in dom q & a = xi^r & ((F.j)-sub(q)).a = q.r;
r in {{}} by N1,TREES_1:29,TREES_4:3;
then r = {};
hence ((F.j)-sub((V1.j)-term)).a = ((F.i)-sub(D.i)).a
by M8,N1,TREES_4:3;
end;
end;
set b = In(1,dom B);
reconsider nu = g/.b, xi = g/.len B as Node of v;
NK: 1 <= b <= len B by FINSEQ_3:25;
N6: F.b = v with-replacement(nu,(V2.b)-term) by A7;
NM: nu = g.b by AA,AB,PARTFUN1:def 6;
then v.nu = f.b & nu in rng g by AB,AA,FUNCT_1:def 3;
then consider mu being Node of v such that
N5: nu = mu & ex s,y st v.mu = [y,s] by AA;
reconsider fb = f.b as pair object by NM,N5,AB,AA;
N7: v.nu = [fb`1,fb`2] by NM,AB,AA
.= [V1.b,fb`2] by AB,MCART_1:def 12
.= [V1.b,B.b] by AB,MCART_1:def 13;
then
N8: dom (F.b) = dom v by N6,Lem11A;
reconsider t = (V1.b)-term as Element of Free(S,Y);
O3: dom (F.b) = dom v with-replacement(nu,dom((V2.b)-term))
by A7,TREES_2:def 11;
then consider mu being FinSequence of NAT such that
N9: mu in dom((V2.b)-term) & nu = nu^mu & F.b.nu = ((V2.b)-term).mu
by A7,N8,TREES_2:def 11;
OA: mu = {} by N9,FINSEQ_1:87;
then F.b.nu = [V2.b,B.b] & the_sort_of t = B.b by N9,SORT,TREES_4:3;
then
O1: (F.b)-sub t = (F.b) with-replacement(nu,t) by N8,Th118;
hence
O5: dom ((F.In(1,dom B))-sub((V1.In(1,dom B))-term)) = dom v
by N8,OA,Lem11A,N9,TREES_4:3;
hereby let a be Node of (F.In(1,dom B))-sub((V1.In(1,dom B))-term);
dom ((F.b)-sub t) = dom (F.b) with-replacement(nu,dom t)
by N8,O1,TREES_2:def 11;
then per cases by N8,O1,TREES_2:def 11;
suppose
O4: not nu c= a & ((F.b)-sub t).a = F.b.a;
then not ex r being FinSequence of NAT st r in dom((V2.b)-term) &
a = nu^r & F.b.a = ((V2.b)-term).r by TREES_1:1;
hence ((F.In(1,dom B))-sub((V1.In(1,dom B))-term)).a = v.a
by A7,N8,O3,O4,O5,TREES_2:def 11;
end;
suppose ex r being FinSequence of NAT st r in dom t & a = nu^r &
((F.b)-sub t).a = t.r;
then consider r being FinSequence of NAT such that
O6: r in dom t & a = nu^r & ((F.b)-sub t).a = t.r;
r in {{}} by O6,TREES_1:29,TREES_4:3;
then r = {};
hence ((F.In(1,dom B))-sub((V1.In(1,dom B))-term)).a = v.a
by N7,O6,TREES_4:3;
end;
end;
defpred S[Nat] means for b,b1 being Element of dom B st $1 = b & b1 <= b
holds ((F.b)-sub(D.b))|(g/.b1 qua Node of v) = (h.v)|(g/.b1 qua Node of v)&
((F.b)-sub(D.b))|((dom v)\rng g) = v|((dom v)\rng g);
S1: S[1]
proof
let b,b1 be Element of dom B such that
S2: 1 = b & b1 <= b;
b1 >= 1 by FINSEQ_3:25;
then
S3: b1 = 1 by S2,XXREAL_0:1;
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;
then
S8: (F.b)-sub(D.b) = (F.b) with-replacement(nu, D.b) by Th118;
then
S7: ((F.b)-sub(D.b))|nu = D.b by S4,Th130;
SD: nu = g.b by AA,AB,PARTFUN1:def 6;
then
S5: v.nu = f.b & nu in rng g by AA,AB,FUNCT_1:def 3;
then consider mu being Node of v such that
S6: nu = mu & ex s,y st v.mu = [y,s] by AA;
reconsider fb = f.b as pair object by SD,S6,AA,AB;
SC: v.nu = [fb`1,fb`2] by SD,AA,AB
.= [V1.b,fb`2] by AB,MCART_1:def 12
.= [V1.b,B.b] by AB,MCART_1:def 13;
then v|nu = (V1.b)-term by Th132;
then (h.v)|nu = h.((V1.b)-term) by Th131;
hence ((F.b)-sub(D.b))|(g/.b1 qua Node of v)
= (h.v)|(g/.b1 qua Node of v) by A2,S7,S2,S3;
dom(F.b) c= dom((F.b)-sub(D.b)) by S4,S8,Lem11;
then (dom v)\rng g c= dom((F.b)-sub(D.b)) by S4;
hence dom(((F.b)-sub(D.b))|((dom v)\rng g)) = dom(v|((dom v)\rng g))
by RELAT_1:62;
let a; assume
SK: a in dom(((F.b)-sub(D.b))|((dom v)\rng g));
then a in (dom v)\rng g;
then reconsider a as Node of v;
SJ: (((F.b)-sub(D.b))|((dom v)\rng g)).a = ((F.b)-sub(D.b)).a &
(v|((dom v)\rng g)).a = v.a by SK,FUNCT_1:49;
nu <> a by S5,SK,XBOOLE_0:def 5;
then
SD: not nu c= a by SC,Lem9;
then
SE: not ex r being FinSequence of NAT st r in dom ((V2.b)-term) &
a = nu^r & F.b.a = ((V2.b)-term).r by TREES_1:1;
SG: not nu c< a by SD,XBOOLE_0:def 8;
then
a in dom v with-replacement(nu, dom((V2.b)-term)) by TREES_1:def 9;
then
SI: v.a = (F.b).a by A7,S2,SE,TREES_2:def 11;
SF: not ex r being FinSequence of NAT st r in dom (D.b) &
a = nu^r & ((F.b)-sub(D.b)).a = (D.b).r by SD,TREES_1:1;
a in dom (F.b) & nu in dom (F.b) by S4;
then a in dom (F.b) with-replacement(nu,dom(D.b)) by SG,TREES_1:def 9;
hence thesis by SI,SJ,SF,S4,S8,TREES_2:def 11;
end;
T1: for i st i >= 1 & S[i] holds S[i+1]
proof
let i; assume
T2: i >= 1 & S[i];
let b,b1 be Element of dom B; assume
T3: b = i+1 & b1 <= b;
then i+1 <= len B by FINSEQ_3:25;
then i < len B by NAT_1:13;
then reconsider b2 = i as Element of dom B by T2,FINSEQ_3:25;
T5: F.b = (F.b2) with-replacement(g/.b2 qua Node of v, D.b2)
with-replacement(g/.b qua Node of v, (V2.b)-term) by A7,T3;
v.(g.b) = f.b & g.b in rng g by AA,AB,FUNCT_1:def 3;
then consider nu being Node of v such that
U2: g.b = nu & ex s,y st v.nu = [y,s] by AA;
reconsider fb = f.b as pair object by U2,AA,AB;
U3: v.(g/.b) = v.(g.b) by AA,AB,PARTFUN1:def 6
.= [fb`1,fb`2] by AA,AB
.= [V1.b,fb`2] by AB,MCART_1:def 12
.= [V1.b,B.b] by AB,MCART_1:def 13;
T7: the_sort_of (D.b2) = B.b2 & F.b2.(g/.b2) = [V2.b2,B.b2] &
g/.b2 in dom v c= dom (F.b2) by T2,L8,SORT;
then
T6: (F.b2)-sub(D.b2) =
(F.b2) with-replacement(g/.b2 qua Node of v, D.b2) by Th118;
T18: g/.b1 = g.b1 & g/.b = g.b by AA,AB,PARTFUN1:def 6;
dom (F.b2) c= dom((F.b2)-sub(D.b2)) by T6,T7,Lem11;
then
T21: g/.b in dom((F.b2)-sub(D.b2)) & g/.b1 in dom((F.b2)-sub(D.b2)) by T7;
per cases by T3,XXREAL_0:1;
suppose b1 < b;
then
T8: b1 <= b2 & g.b1 <> g.b by AA,AB,T3,FUNCT_1:def 4,NAT_1:13;
then
T4: ((F.b2)-sub(D.b2))|(g/.b1 qua Node of v) =
(h.v)|(g/.b1 qua Node of v) by T2;
v.(g.b1) = f.b1 & g.b1 in rng g by AA,AB,FUNCT_1:def 3;
then consider nu being Node of v such that
U5: g.b1 = nu & ex s,y st v.nu = [y,s] by AA;
reconsider fb1 = f.b1 as pair object by U5,AA,AB;
U6: v.(g/.b1) = v.(g.b1) by AA,AB,PARTFUN1:def 6
.= [fb1`1,fb1`2] by AA,AB
.= [V1.b1,fb1`2] by AB,MCART_1:def 12
.= [V1.b1,B.b1] by AB,MCART_1:def 13;
T9: not g/.b c= g/.b1 & not g/.b1 c= g/.b by T18,T8,U3,U6,Lem9;
then
T10: (F.b)|(g/.b1 qua Node of v) = (h.v)|(g/.b1 qua Node of v)
by T21,T4,T5,T6,Th133;
1 <= i+1 by NAT_1:12;
then
T12: F.b.(g/.b) = [V2.b,B.b] & g/.b in dom v c= dom (F.b) & g/.b1 in dom v &
the_sort_of (D.b) = B.b by T3,L8,SORT;
then
T11: (F.b)-sub(D.b) =
(F.b) with-replacement(g/.b qua Node of v, D.b) by Th118;
hence ((F.b)-sub(D.b))|(g/.b1 qua Node of v)
= (h.v)|(g/.b1 qua Node of v) by T10,T12,T9,Th133;
dom v c= dom (F.b) c= dom((F.b)-sub(D.b)) by T12,T11,Lem11;
then (dom v)\rng g c= dom((F.b)-sub(D.b));
hence dom (((F.b)-sub(D.b))|((dom v)\rng g)) = dom (v|((dom v)\rng g))
by RELAT_1:62;
let a; assume
TT: a in dom(((F.b)-sub(D.b))|((dom v)\rng g));
reconsider a as Node of (F.b)-sub(D.b) by TT,RELAT_1:57;
T16: (((F.b)-sub(D.b))|((dom v)\rng g)).a = ((F.b)-sub(D.b)).a &
(((F.b2)-sub(D.b2))|((dom v)\rng g)).a = ((F.b2)-sub(D.b2)).a &
(v|((dom v)\rng g)).a = v.a by TT,FUNCT_1:49;
then
T17: ((F.b2)-sub(D.b2)).a = v.a by T2;
g/.b in rng g & a nin rng g & a in dom v
by T18,AA,AB,TT,XBOOLE_0:def 5,FUNCT_1:def 3;
then
T19: not g/.b c= a & a in dom (F.b) =
dom((F.b2)-sub(D.b2)) with-replacement(g/.b qua Node of v,
dom((V2.b)-term))
by T18,U2,T21,T5,T6,T12,Lem9,TREES_2:def 11;
then not ex r being FinSequence of NAT st r in dom((V2.b)-term) &
a = (g/.b)^r & (F.b).a = ((V2.b)-term).r by TREES_1:1;
then
T22: (F.b).a = v.a by T18,U2,T17,T19,T21,T5,T6,TREES_2:def 11;
T24: a in dom((F.b)-sub(D.b)) = dom (F.b) with-replacement
(g/.b qua Node of v, dom(D.b))
by T12,T18,U2,T11,TREES_2:def 11;
not ex r being FinSequence of NAT st r in dom (D.b) & a = (g/.b)^r &
((F.b)-sub(D.b)).a = D.b.r by T19,TREES_1:1;
hence thesis by T16,T18,U2,T11,T22,T12,T24,TREES_2:def 11;
end;
suppose
U7: b1 = b;
reconsider nu = g/.b as Node of v;
i+1 >= 1 by NAT_1:12; then
S4: F.b.nu = [V2.b,B.b] & nu in dom v c= dom (F.b) &
the_sort_of (D.b) = B.b by T3,L8,SORT;
then
T11: (F.b)-sub(D.b) = (F.b) with-replacement(nu, D.b) by Th118;
then
S7: ((F.b)-sub(D.b))|nu = D.b by S4,Th130;
T18: nu = g.b by AA,AB,PARTFUN1:def 6;
then v.nu = f.b & nu in rng g by AA,AB,FUNCT_1:def 3;
then consider mu being Node of v such that
S6: nu = mu & ex s,y st v.mu = [y,s] by AA;
reconsider fb = f.b as pair object by T18,S6,AA,AB;
v.nu = [fb`1,fb`2] by T18,AA,AB
.= [V1.b,fb`2] by AB,MCART_1:def 12
.= [V1.b,B.b] by AB,MCART_1:def 13;
then v|nu = (V1.b)-term by Th132;
then (h.v)|nu = h.((V1.b)-term) by Th131;
hence ((F.b)-sub(D.b))|(g/.b1 qua Node of v)
= (h.v)|(g/.b1 qua Node of v) by A2,S7,U7;
dom v c= dom (F.b) c= dom((F.b)-sub(D.b)) by S4,T11,Lem11;
then (dom v)\rng g c= dom((F.b)-sub(D.b));
hence dom (((F.b)-sub(D.b))|((dom v)\rng g)) = dom (v|((dom v)\rng g))
by RELAT_1:62;
let a; assume
T24: a in dom(((F.b)-sub(D.b))|((dom v)\rng g));
then reconsider a as Node of (F.b)-sub(D.b) by RELAT_1:57;
T16: (((F.b)-sub(D.b))|((dom v)\rng g)).a = ((F.b)-sub(D.b)).a &
(((F.b2)-sub(D.b2))|((dom v)\rng g)).a = ((F.b2)-sub(D.b2)).a &
(v|((dom v)\rng g)).a = v.a by T24,FUNCT_1:49;
then
T17: ((F.b2)-sub(D.b2)).a = v.a by T2;
g/.b in rng g & a nin rng g & a in dom v
by T18,AA,AB,T24,XBOOLE_0:def 5,FUNCT_1:def 3;
then
T19: not g/.b c= a & a in dom (F.b) =
dom((F.b2)-sub(D.b2)) with-replacement(g/.b qua Node of v,
dom((V2.b)-term)) by T21,T5,T6,S4,Lem9,TREES_2:def 11;
then not ex r being FinSequence of NAT st r in dom((V2.b)-term) &
a = (g/.b)^r & (F.b).a = ((V2.b)-term).r by TREES_1:1;
then
T22: (F.b).a = v.a by T18,T17,T19,T21,T5,T6,TREES_2:def 11;
T24: a in dom((F.b)-sub(D.b)) = dom (F.b) with-replacement
(g/.b qua Node of v, dom(D.b))
by S4,T11,TREES_2:def 11;
not ex r being FinSequence of NAT st r in dom (D.b) & a = (g/.b)^r &
((F.b)-sub(D.b)).a = D.b.r by T19,TREES_1:1;
hence thesis by T16,T11,T22,S4,T24,TREES_2:def 11;
end;
end;
set b = In(len B, dom B);
set v1 = (F.b)-sub(D.b);
SK: for i st i >= 1 holds S[i] from NAT_1:sch 8(S1,T1);
S8: F.b.(g/.b) = [V2.b,B.b] & dom v c= dom (F.b) by L8,NK;
then
SA: the_sort_of (D.b) = B.b & g/.b in dom (F.b) by SORT;
then v1 = (F.b)with-replacement(g/.b qua Node of v,D.b) by S8,Th118;
then dom(F.b) c= dom v1 by SA,S8,Lem11;
then
S9: dom v c= dom v1 & v|((dom v) \ rng g) = v1|((dom v) \ rng g)
by SK,S8,NK;
now let i; assume i in dom g;
then reconsider b1 = i as Element of dom B by AA,MCART_1:def 13;
b1 <= len B by FINSEQ_3:25;
hence (h.v)|(g/.i qua Node of v) = v1|(g/.i qua Node of v)
by SK,NK;
end;
hence h.v = (F.In(len B,dom B))-sub(D.In(len B,dom B)) by AA,S9,Th138;
end;