let S be locally_directed OrderSortedSign; :: thesis: for X being non-empty ManySortedSet of S holds OSFreeGen X is osfree
let X be non-empty ManySortedSet of S; :: thesis: OSFreeGen X is osfree
set FA = FreeOSA X;
set PTA = ParsedTermsOSA X;
set SPTA = the Sorts of (ParsedTermsOSA X);
set FG = OSFreeGen X;
let U1 be non-empty monotone OSAlgebra of S; :: according to OSAFREE:def 2 :: thesis: for f being ManySortedFunction of OSFreeGen X, the Sorts of U1 ex h being ManySortedFunction of (FreeOSA X),U1 st
( h is_homomorphism FreeOSA X,U1 & h is order-sorted & h || (OSFreeGen X) = f )

let F be ManySortedFunction of OSFreeGen X, the Sorts of U1; :: thesis: ex h being ManySortedFunction of (FreeOSA X),U1 st
( h is_homomorphism FreeOSA X,U1 & h is order-sorted & h || (OSFreeGen X) = F )

set SA = the Sorts of (FreeOSA X);
set S1 = the Sorts of U1;
set R = LCongruence X;
set NH = OSNat_Hom ((ParsedTermsOSA X),(LCongruence X));
reconsider NH1 = OSNat_Hom ((ParsedTermsOSA X),(LCongruence X)) as ManySortedFunction of (ParsedTermsOSA X),(FreeOSA X) ;
set NHP = NH1 || (PTVars X);
A1: now :: thesis: for s being Element of S holds
( (NH1 || (PTVars X)) . s = (NH1 . s) | (PTVars (s,X)) & PTVars (s,X) c= the Sorts of (ParsedTermsOSA X) . s & dom (NH1 . s) = the Sorts of (ParsedTermsOSA X) . s & rng (NH1 . s) c= the Sorts of (FreeOSA X) . s & dom ((NH1 || (PTVars X)) . s) = PTVars (s,X) & rng ((NH1 || (PTVars X)) . s) = (OSFreeGen X) . s & (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) & (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) )
let s be Element of S; :: thesis: ( (NH1 || (PTVars X)) . s = (NH1 . s) | (PTVars (s,X)) & PTVars (s,X) c= the Sorts of (ParsedTermsOSA X) . s & dom (NH1 . s) = the Sorts of (ParsedTermsOSA X) . s & rng (NH1 . s) c= the Sorts of (FreeOSA X) . s & dom ((NH1 || (PTVars X)) . s) = PTVars (s,X) & rng ((NH1 || (PTVars X)) . s) = (OSFreeGen X) . s & (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) & (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) )
A2: (NH1 || (PTVars X)) . s = (NH1 . s) | ((PTVars X) . s) by MSAFREE:def 1;
hence (NH1 || (PTVars X)) . s = (NH1 . s) | (PTVars (s,X)) by Def24; :: thesis: ( PTVars (s,X) c= the Sorts of (ParsedTermsOSA X) . s & dom (NH1 . s) = the Sorts of (ParsedTermsOSA X) . s & rng (NH1 . s) c= the Sorts of (FreeOSA X) . s & dom ((NH1 || (PTVars X)) . s) = PTVars (s,X) & rng ((NH1 || (PTVars X)) . s) = (OSFreeGen X) . s & (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) & (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) )
thus PTVars (s,X) c= the Sorts of (ParsedTermsOSA X) . s ; :: thesis: ( dom (NH1 . s) = the Sorts of (ParsedTermsOSA X) . s & rng (NH1 . s) c= the Sorts of (FreeOSA X) . s & dom ((NH1 || (PTVars X)) . s) = PTVars (s,X) & rng ((NH1 || (PTVars X)) . s) = (OSFreeGen X) . s & (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) & (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) )
thus ( dom (NH1 . s) = the Sorts of (ParsedTermsOSA X) . s & rng (NH1 . s) c= the Sorts of (FreeOSA X) . s ) by FUNCT_2:def 1, RELAT_1:def 19; :: thesis: ( dom ((NH1 || (PTVars X)) . s) = PTVars (s,X) & rng ((NH1 || (PTVars X)) . s) = (OSFreeGen X) . s & (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) & (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) )
A3: (PTVars X) . s = PTVars (s,X) by Def24;
hence A4: dom ((NH1 || (PTVars X)) . s) = PTVars (s,X) by FUNCT_2:def 1; :: thesis: ( rng ((NH1 || (PTVars X)) . s) = (OSFreeGen X) . s & (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) & (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) )
for y being object holds
( y in (OSFreeGen X) . s iff ex x being object st
( x in dom ((NH1 || (PTVars X)) . s) & y = ((NH1 || (PTVars X)) . s) . x ) )
proof
let y be object ; :: thesis: ( y in (OSFreeGen X) . s iff ex x being object st
( x in dom ((NH1 || (PTVars X)) . s) & y = ((NH1 || (PTVars X)) . s) . x ) )

thus ( y in (OSFreeGen X) . s implies ex x being object st
( x in dom ((NH1 || (PTVars X)) . s) & y = ((NH1 || (PTVars X)) . s) . x ) ) :: thesis: ( ex x being object st
( x in dom ((NH1 || (PTVars X)) . s) & y = ((NH1 || (PTVars X)) . s) . x ) implies y in (OSFreeGen X) . s )
proof
assume y in (OSFreeGen X) . s ; :: thesis: ex x being object st
( x in dom ((NH1 || (PTVars X)) . s) & y = ((NH1 || (PTVars X)) . s) . x )

then y in OSFreeGen (s,X) by Def26;
then consider a being object such that
A5: a in X . s and
A6: y = ((OSNat_Hom ((ParsedTermsOSA X),(LCongruence X))) . s) . (root-tree [a,s]) by Def25;
take x = root-tree [a,s]; :: thesis: ( x in dom ((NH1 || (PTVars X)) . s) & y = ((NH1 || (PTVars X)) . s) . x )
root-tree [a,s] in dom ((NH1 || (PTVars X)) . s) by A4, A5, Def23;
hence ( x in dom ((NH1 || (PTVars X)) . s) & y = ((NH1 || (PTVars X)) . s) . x ) by A2, A6, FUNCT_1:47; :: thesis: verum
end;
given x being object such that A7: x in dom ((NH1 || (PTVars X)) . s) and
A8: y = ((NH1 || (PTVars X)) . s) . x ; :: thesis: y in (OSFreeGen X) . s
consider a being object such that
A9: a in X . s and
A10: x = root-tree [a,s] by A3, A7, Def23;
y = ((OSNat_Hom ((ParsedTermsOSA X),(LCongruence X))) . s) . (root-tree [a,s]) by A2, A7, A8, A10, FUNCT_1:47;
then y in OSFreeGen (s,X) by A9, Def25;
hence y in (OSFreeGen X) . s by Def26; :: thesis: verum
end;
hence A11: rng ((NH1 || (PTVars X)) . s) = (OSFreeGen X) . s by FUNCT_1:def 3; :: thesis: ( (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) & (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) )
hence (NH1 || (PTVars X)) . s is Function of (PTVars (s,X)),((OSFreeGen X) . s) by A4, FUNCT_2:1; :: thesis: (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s)
thus (NH1 || (PTVars X)) . s is Function of ((PTVars X) . s),((OSFreeGen X) . s) by A3, A4, A11, FUNCT_2:1; :: thesis: verum
end;
then for i being object st i in the carrier of S holds
(NH1 || (PTVars X)) . i is Function of ((PTVars X) . i),((OSFreeGen X) . i) ;
then reconsider NHP = NH1 || (PTVars X) as ManySortedFunction of PTVars X, OSFreeGen X by PBOOLE:def 15;
consider h being ManySortedFunction of (ParsedTermsOSA X),U1 such that
A12: h is_homomorphism ParsedTermsOSA X,U1 and
A13: h is order-sorted and
A14: h || (PTVars X) = F ** NHP by Th37;
reconsider hCng = OSCng h as monotone OSCongruence of ParsedTermsOSA X by A12, A13, OSALG_4:24;
reconsider H = OSHomQuot (h,(LCongruence X)) as ManySortedFunction of (FreeOSA X),U1 ;
take H ; :: thesis: ( H is_homomorphism FreeOSA X,U1 & H is order-sorted & H || (OSFreeGen X) = F )
A15: LCongruence X c= hCng by Def17;
hence ( H is_homomorphism FreeOSA X,U1 & H is order-sorted ) by A12, A13, OSALG_4:25; :: thesis: H || (OSFreeGen X) = F
for s being Element of S holds F . s = (H . s) | ((OSFreeGen X) . s)
proof
let s be Element of S; :: thesis: F . s = (H . s) | ((OSFreeGen X) . s)
A16: (OSFreeGen X) . s = OSFreeGen (s,X) by Def26;
then (OSFreeGen X) . s c= the Sorts of (FreeOSA X) . s ;
then (OSFreeGen X) . s c= dom (OSHomQuot (h,(LCongruence X),s)) by FUNCT_2:def 1;
then A17: dom ((OSHomQuot (h,(LCongruence X),s)) | ((OSFreeGen X) . s)) = (OSFreeGen X) . s by RELAT_1:62;
rng ((OSHomQuot (h,(LCongruence X),s)) | ((OSFreeGen X) . s)) c= the Sorts of U1 . s by RELAT_1:def 19;
then reconsider OSF = (OSHomQuot (h,(LCongruence X),s)) | ((OSFreeGen X) . s) as Function of ((OSFreeGen X) . s),( the Sorts of U1 . s) by A17, FUNCT_2:2;
now :: thesis: for x being object st x in (OSFreeGen X) . s holds
(F . s) . x = ((OSHomQuot (h,(LCongruence X),s)) | ((OSFreeGen X) . s)) . x
A18: dom (NHP . s) = PTVars (s,X) by A1;
A19: (h . s) | ((PTVars X) . s) = (F ** NHP) . s by A14, MSAFREE:def 1
.= (F . s) * (NHP . s) by MSUALG_3:2 ;
let x be object ; :: thesis: ( x in (OSFreeGen X) . s implies (F . s) . x = ((OSHomQuot (h,(LCongruence X),s)) | ((OSFreeGen X) . s)) . x )
assume A20: x in (OSFreeGen X) . s ; :: thesis: (F . s) . x = ((OSHomQuot (h,(LCongruence X),s)) | ((OSFreeGen X) . s)) . x
consider a being object such that
A21: a in X . s and
A22: x = ((OSNat_Hom ((ParsedTermsOSA X),(LCongruence X))) . s) . (root-tree [a,s]) by A16, A20, Def25;
reconsider xa = root-tree [a,s] as Element of the Sorts of (ParsedTermsOSA X) . s by A21, Th10;
A23: OSClass ((LCongruence X),xa) = (OSNat_Hom ((ParsedTermsOSA X),(LCongruence X),s)) . xa by OSALG_4:def 21
.= x by A22, OSALG_4:def 22 ;
A24: root-tree [a,s] in PTVars (s,X) by A21, Def23;
then xa in (PTVars X) . s by Def24;
then A25: (h . s) . xa = ((h . s) | ((PTVars X) . s)) . xa by FUNCT_1:49;
A26: (OSHomQuot (h,(LCongruence X),s)) . (OSClass ((LCongruence X),xa)) = (h . s) . xa by A12, A13, A15, OSALG_4:def 27;
(NHP . s) . xa = (((OSNat_Hom ((ParsedTermsOSA X),(LCongruence X))) . s) | (PTVars (s,X))) . xa by A1
.= ((OSNat_Hom ((ParsedTermsOSA X),(LCongruence X))) . s) . xa by A24, FUNCT_1:49 ;
then (h . s) . xa = (F . s) . x by A22, A24, A19, A25, A18, FUNCT_1:13;
hence (F . s) . x = ((OSHomQuot (h,(LCongruence X),s)) | ((OSFreeGen X) . s)) . x by A20, A23, A26, FUNCT_1:49; :: thesis: verum
end;
then F . s = OSF by FUNCT_2:12;
hence F . s = (H . s) | ((OSFreeGen X) . s) by OSALG_4:def 28; :: thesis: verum
end;
then for i being set st i in the carrier of S holds
F . i = (H . i) | ((OSFreeGen X) . i) ;
hence H || (OSFreeGen X) = F by MSAFREE:def 1; :: thesis: verum