:: MSAFREE2 semantic presentation

definition
let c1 be ManySortedSign ;
mode Vertex is Element of a1;
end;

definition
let c1 be non empty ManySortedSign ;
func SortsWithConstants c1 -> Subset of a1 equals :Def1: :: MSAFREE2:def 1
{ b1 where B is SortSymbol of a1 : b1 is with_const_op } if not a1 is void
otherwise {} ;
coherence
( ( not c1 is void implies { b1 where B is SortSymbol of c1 : b1 is with_const_op } is Subset of c1 ) & ( c1 is void implies {} is Subset of c1 ) )
proof end;
consistency
for b1 being Subset of c1 holds
verum
;
end;

:: deftheorem Def1 defines SortsWithConstants MSAFREE2:def 1 :
for b1 being non empty ManySortedSign holds
( ( not b1 is void implies SortsWithConstants b1 = { b2 where B is SortSymbol of b1 : b2 is with_const_op } ) & ( b1 is void implies SortsWithConstants b1 = {} ) );

definition
let c1 be non empty ManySortedSign ;
func InputVertices c1 -> Subset of a1 equals :: MSAFREE2:def 2
the carrier of a1 \ (rng the ResultSort of a1);
coherence
the carrier of c1 \ (rng the ResultSort of c1) is Subset of c1
;
func InnerVertices c1 -> Subset of a1 equals :: MSAFREE2:def 3
rng the ResultSort of a1;
coherence
rng the ResultSort of c1 is Subset of c1
;
end;

:: deftheorem Def2 defines InputVertices MSAFREE2:def 2 :
for b1 being non empty ManySortedSign holds InputVertices b1 = the carrier of b1 \ (rng the ResultSort of b1);

:: deftheorem Def3 defines InnerVertices MSAFREE2:def 3 :
for b1 being non empty ManySortedSign holds InnerVertices b1 = rng the ResultSort of b1;

theorem Th1: :: MSAFREE2:1
for b1 being non empty void ManySortedSign holds InputVertices b1 = the carrier of b1
proof end;

theorem Th2: :: MSAFREE2:2
for b1 being non empty non void ManySortedSign
for b2 being Vertex of b1 holds
( b2 in InputVertices b1 implies for b3 being OperSymbol of b1 holds
not the_result_sort_of b3 = b2 )
proof end;

theorem Th3: :: MSAFREE2:3
for b1 being non empty ManySortedSign holds (InputVertices b1) \/ (InnerVertices b1) = the carrier of b1 by XBOOLE_1:45;

theorem Th4: :: MSAFREE2:4
for b1 being non empty ManySortedSign holds InputVertices b1 misses InnerVertices b1 by XBOOLE_1:79;

theorem Th5: :: MSAFREE2:5
for b1 being non empty ManySortedSign holds SortsWithConstants b1 c= InnerVertices b1
proof end;

theorem Th6: :: MSAFREE2:6
for b1 being non empty ManySortedSign holds InputVertices b1 misses SortsWithConstants b1
proof end;

definition
let c1 be non empty ManySortedSign ;
attr a1 is with_input_V means :Def4: :: MSAFREE2:def 4
InputVertices a1 <> {} ;
end;

:: deftheorem Def4 defines with_input_V MSAFREE2:def 4 :
for b1 being non empty ManySortedSign holds
( b1 is with_input_V iff InputVertices b1 <> {} );

registration
cluster non empty non void with_input_V ManySortedSign ;
existence
ex b1 being non empty ManySortedSign st
( not b1 is void & b1 is with_input_V )
proof end;
end;

registration
let c1 be non empty with_input_V ManySortedSign ;
cluster InputVertices a1 -> non empty ;
coherence
not InputVertices c1 is empty
by Def4;
end;

definition
let c1 be non empty non void ManySortedSign ;
redefine func InnerVertices as InnerVertices c1 -> non empty Subset of a1;
coherence
InnerVertices c1 is non empty Subset of c1
proof end;
end;

definition
let c1 be non empty ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
mode InputValues of c2 -> ManySortedSet of InputVertices a1 means :: MSAFREE2:def 5
for b1 being Vertex of a1 holds
( b1 in InputVertices a1 implies a3 . b1 in the Sorts of a2 . b1 );
existence
ex b1 being ManySortedSet of InputVertices c1 st
for b2 being Vertex of c1 holds
( b2 in InputVertices c1 implies b1 . b2 in the Sorts of c2 . b2 )
proof end;
end;

:: deftheorem Def5 defines InputValues MSAFREE2:def 5 :
for b1 being non empty ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3 being ManySortedSet of InputVertices b1 holds
( b3 is InputValues of b2 iff for b4 being Vertex of b1 holds
( b4 in InputVertices b1 implies b3 . b4 in the Sorts of b2 . b4 ) );

definition
let c1 be non empty ManySortedSign ;
attr a1 is Circuit-like means :Def6: :: MSAFREE2:def 6
for b1 being non empty non void ManySortedSign holds
( b1 = a1 implies for b2, b3 being OperSymbol of b1 holds
( the_result_sort_of b2 = the_result_sort_of b3 implies b2 = b3 ) );
end;

:: deftheorem Def6 defines Circuit-like MSAFREE2:def 6 :
for b1 being non empty ManySortedSign holds
( b1 is Circuit-like iff for b2 being non empty non void ManySortedSign holds
( b2 = b1 implies for b3, b4 being OperSymbol of b2 holds
( the_result_sort_of b3 = the_result_sort_of b4 implies b3 = b4 ) ) );

registration
cluster non empty void -> non empty Circuit-like ManySortedSign ;
coherence
for b1 being non empty ManySortedSign holds
( b1 is void implies b1 is Circuit-like )
proof end;
end;

registration
cluster non empty strict non void Circuit-like ManySortedSign ;
existence
ex b1 being non empty ManySortedSign st
( not b1 is void & b1 is Circuit-like & b1 is strict )
proof end;
end;

definition
let c1 be non empty non void Circuit-like ManySortedSign ;
let c2 be Vertex of c1;
assume E7: c2 in InnerVertices c1 ;
func action_at c2 -> OperSymbol of a1 means :: MSAFREE2:def 7
the_result_sort_of a3 = a2;
existence
ex b1 being OperSymbol of c1 st the_result_sort_of b1 = c2
proof end;
uniqueness
for b1, b2 being OperSymbol of c1 holds
( the_result_sort_of b1 = c2 & the_result_sort_of b2 = c2 implies b1 = b2 )
by Def6;
end;

:: deftheorem Def7 defines action_at MSAFREE2:def 7 :
for b1 being non empty non void Circuit-like ManySortedSign
for b2 being Vertex of b1 holds
( b2 in InnerVertices b1 implies for b3 being OperSymbol of b1 holds
( b3 = action_at b2 iff the_result_sort_of b3 = b2 ) );

theorem Th7: :: MSAFREE2:7
for b1 being non empty non void ManySortedSign
for b2 being MSAlgebra of b1
for b3 being OperSymbol of b1
for b4 being FinSequence holds
( len b4 = len (the_arity_of b3) & ( for b5 being Nat holds
( b5 in dom b4 implies b4 . b5 in the Sorts of b2 . ((the_arity_of b3) /. b5) ) ) implies b4 in Args b3,b2 )
proof end;

definition
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
func FreeEnv c2 -> strict non-empty free MSAlgebra of a1 equals :: MSAFREE2:def 8
FreeMSA the Sorts of a2;
coherence
FreeMSA the Sorts of c2 is strict non-empty free MSAlgebra of c1
by MSAFREE:18;
end;

:: deftheorem Def8 defines FreeEnv MSAFREE2:def 8 :
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1 holds FreeEnv b2 = FreeMSA the Sorts of b2;

theorem Th8: :: MSAFREE2:8
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1 holds
FreeGen the Sorts of b2 is free GeneratorSet of FreeEnv b2 by MSAFREE:17;

definition
let c1 be non empty non void ManySortedSign ;
let c2 be non-empty MSAlgebra of c1;
func Eval c2 -> ManySortedFunction of (FreeEnv a2),a2 means :: MSAFREE2:def 9
( a3 is_homomorphism FreeEnv a2,a2 & ( for b1 being SortSymbol of a1
for b2, b3 being set holds
( b3 in FreeSort the Sorts of a2,b1 & b3 = root-tree [b2,b1] & b2 in the Sorts of a2 . b1 implies (a3 . b1) . b3 = b2 ) ) );
existence
ex b1 being ManySortedFunction of (FreeEnv c2),c2 st
( b1 is_homomorphism FreeEnv c2,c2 & ( for b2 being SortSymbol of c1
for b3, b4 being set holds
( b4 in FreeSort the Sorts of c2,b2 & b4 = root-tree [b3,b2] & b3 in the Sorts of c2 . b2 implies (b1 . b2) . b4 = b3 ) ) )
proof end;
uniqueness
for b1, b2 being ManySortedFunction of (FreeEnv c2),c2 holds
( b1 is_homomorphism FreeEnv c2,c2 & ( for b3 being SortSymbol of c1
for b4, b5 being set holds
( b5 in FreeSort the Sorts of c2,b3 & b5 = root-tree [b4,b3] & b4 in the Sorts of c2 . b3 implies (b1 . b3) . b5 = b4 ) ) & b2 is_homomorphism FreeEnv c2,c2 & ( for b3 being SortSymbol of c1
for b4, b5 being set holds
( b5 in FreeSort the Sorts of c2,b3 & b5 = root-tree [b4,b3] & b4 in the Sorts of c2 . b3 implies (b2 . b3) . b5 = b4 ) ) implies b1 = b2 )
proof end;
end;

:: deftheorem Def9 defines Eval MSAFREE2:def 9 :
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3 being ManySortedFunction of (FreeEnv b2),b2 holds
( b3 = Eval b2 iff ( b3 is_homomorphism FreeEnv b2,b2 & ( for b4 being SortSymbol of b1
for b5, b6 being set holds
( b6 in FreeSort the Sorts of b2,b4 & b6 = root-tree [b5,b4] & b5 in the Sorts of b2 . b4 implies (b3 . b4) . b6 = b5 ) ) ) );

theorem Th9: :: MSAFREE2:9
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1 holds
the Sorts of b2 is GeneratorSet of b2
proof end;

definition
let c1 be non empty ManySortedSign ;
let c2 be MSAlgebra of c1;
attr a2 is finitely-generated means :Def10: :: MSAFREE2:def 10
for b1 being non empty non void ManySortedSign holds
( b1 = a1 implies for b2 being MSAlgebra of b1 holds
not ( b2 = a2 & ( for b3 being GeneratorSet of b2 holds
not b3 is locally-finite ) ) ) if not a1 is void
otherwise the Sorts of a2 is locally-finite;
consistency
verum
;
end;

:: deftheorem Def10 defines finitely-generated MSAFREE2:def 10 :
for b1 being non empty ManySortedSign
for b2 being MSAlgebra of b1 holds
( ( not b1 is void implies ( b2 is finitely-generated iff for b3 being non empty non void ManySortedSign holds
( b3 = b1 implies for b4 being MSAlgebra of b3 holds
not ( b4 = b2 & ( for b5 being GeneratorSet of b4 holds
not b5 is locally-finite ) ) ) ) ) & ( b1 is void implies ( b2 is finitely-generated iff the Sorts of b2 is locally-finite ) ) );

definition
let c1 be non empty ManySortedSign ;
let c2 be MSAlgebra of c1;
attr a2 is locally-finite means :Def11: :: MSAFREE2:def 11
the Sorts of a2 is locally-finite;
end;

:: deftheorem Def11 defines locally-finite MSAFREE2:def 11 :
for b1 being non empty ManySortedSign
for b2 being MSAlgebra of b1 holds
( b2 is locally-finite iff the Sorts of b2 is locally-finite );

registration
let c1 be non empty ManySortedSign ;
cluster non-empty locally-finite -> non-empty finitely-generated MSAlgebra of a1;
coherence
for b1 being non-empty MSAlgebra of c1 holds
( b1 is locally-finite implies b1 is finitely-generated )
proof end;
end;

definition
let c1 be non empty ManySortedSign ;
func Trivial_Algebra c1 -> strict MSAlgebra of a1 means :Def12: :: MSAFREE2:def 12
the Sorts of a2 = the carrier of a1 --> {0};
existence
ex b1 being strict MSAlgebra of c1 st the Sorts of b1 = the carrier of c1 --> {0}
proof end;
uniqueness
for b1, b2 being strict MSAlgebra of c1 holds
( the Sorts of b1 = the carrier of c1 --> {0} & the Sorts of b2 = the carrier of c1 --> {0} implies b1 = b2 )
proof end;
end;

:: deftheorem Def12 defines Trivial_Algebra MSAFREE2:def 12 :
for b1 being non empty ManySortedSign
for b2 being strict MSAlgebra of b1 holds
( b2 = Trivial_Algebra b1 iff the Sorts of b2 = the carrier of b1 --> {0} );

registration
let c1 be non empty ManySortedSign ;
cluster strict non-empty finitely-generated locally-finite MSAlgebra of a1;
existence
ex b1 being MSAlgebra of c1 st
( b1 is locally-finite & b1 is non-empty & b1 is strict )
proof end;
end;

definition
let c1 be non empty ManySortedSign ;
attr a1 is monotonic means :: MSAFREE2:def 13
for b1 being non-empty finitely-generated MSAlgebra of a1 holds b1 is locally-finite;
end;

:: deftheorem Def13 defines monotonic MSAFREE2:def 13 :
for b1 being non empty ManySortedSign holds
( b1 is monotonic iff for b2 being non-empty finitely-generated MSAlgebra of b1 holds b2 is locally-finite );

registration
cluster non empty finite non void Circuit-like monotonic ManySortedSign ;
existence
ex b1 being non empty ManySortedSign st
( not b1 is void & b1 is finite & b1 is monotonic & b1 is Circuit-like )
proof end;
end;

theorem Th10: :: MSAFREE2:10
for b1 being non empty non void ManySortedSign
for b2 being V3 ManySortedSet of the carrier of b1
for b3 being SortSymbol of b1
for b4 being Element of the Sorts of (FreeMSA b2) . b3 holds
b4 is finite DecoratedTree
proof end;

theorem Th11: :: MSAFREE2:11
for b1 being non empty non void ManySortedSign
for b2 being V3 locally-finite ManySortedSet of the carrier of b1 holds FreeMSA b2 is finitely-generated
proof end;

theorem Th12: :: MSAFREE2:12
for b1 being non empty non void ManySortedSign
for b2 being non-empty MSAlgebra of b1
for b3 being Vertex of b1
for b4 being Element of the Sorts of (FreeEnv b2) . b3 holds
not ( b3 in InputVertices b1 & ( for b5 being Element of the Sorts of b2 . b3 holds
not b4 = root-tree [b5,b3] ) )
proof end;

theorem Th13: :: MSAFREE2:13
for b1 being non empty non void ManySortedSign
for b2 being V3 ManySortedSet of the carrier of b1
for b3 being OperSymbol of b1
for b4 being DTree-yielding FinSequence holds
( [b3,the carrier of b1] -tree b4 in the Sorts of (FreeMSA b2) . (the_result_sort_of b3) implies len b4 = len (the_arity_of b3) )
proof end;

theorem Th14: :: MSAFREE2:14
for b1 being non empty non void ManySortedSign
for b2 being V3 ManySortedSet of the carrier of b1
for b3 being OperSymbol of b1
for b4 being DTree-yielding FinSequence holds
( [b3,the carrier of b1] -tree b4 in the Sorts of (FreeMSA b2) . (the_result_sort_of b3) implies for b5 being Nat holds
( b5 in dom (the_arity_of b3) implies b4 . b5 in the Sorts of (FreeMSA b2) . ((the_arity_of b3) . b5) ) )
proof end;

registration
let c1 be non empty non void ManySortedSign ;
let c2 be V3 ManySortedSet of the carrier of c1;
let c3 be Vertex of c1;
cluster -> non empty Relation-like Function-like finite Element of the Sorts of (FreeMSA a2) . a3;
coherence
for b1 being Element of the Sorts of (FreeMSA c2) . c3 holds
( b1 is finite & not b1 is empty & b1 is Function-like & b1 is Relation-like )
proof end;
end;

registration
let c1 be non empty non void ManySortedSign ;
let c2 be V3 ManySortedSet of the carrier of c1;
let c3 be Vertex of c1;
cluster non empty Relation-like Function-like finite Element of the Sorts of (FreeMSA a2) . a3;
existence
ex b1 being Element of the Sorts of (FreeMSA c2) . c3 st
( b1 is Function-like & b1 is Relation-like )
proof end;
end;

registration
let c1 be non empty non void ManySortedSign ;
let c2 be V3 ManySortedSet of the carrier of c1;
let c3 be Vertex of c1;
cluster Relation-like Function-like -> non empty Relation-like Function-like finite DecoratedTree-like Element of the Sorts of (FreeMSA a2) . a3;
coherence
for b1 being Relation-like Function-like Element of the Sorts of (FreeMSA c2) . c3 holds b1 is DecoratedTree-like
by Th10;
end;

registration
let c1 be non empty non void ManySortedSign ;
let c2 be V3 ManySortedSet of the carrier of c1;
let c3 be Vertex of c1;
cluster non empty Relation-like Function-like finite DecoratedTree-like Element of the Sorts of (FreeMSA a2) . a3;
existence
ex b1 being Element of the Sorts of (FreeMSA c2) . c3 st b1 is finite
proof end;
end;

theorem Th15: :: MSAFREE2:15
for b1 being non empty non void ManySortedSign
for b2 being V3 ManySortedSet of the carrier of b1
for b3 being Vertex of b1
for b4 being OperSymbol of b1
for b5 being Element of the Sorts of (FreeMSA b2) . b3 holds
not ( b3 in InnerVertices b1 & b5 . {} = [b4,the carrier of b1] & ( for b6 being DTree-yielding FinSequence holds
not ( len b6 = len (the_arity_of b4) & ( for b7 being Nat holds
( b7 in dom b6 implies b6 . b7 in the Sorts of (FreeMSA b2) . ((the_arity_of b4) . b7) ) ) ) ) )
proof end;

definition
let c1 be non empty non void ManySortedSign ;
let c2 be V3 ManySortedSet of the carrier of c1;
let c3 be SortSymbol of c1;
let c4 be Element of the Sorts of (FreeMSA c2) . c3;
func depth c4 -> Nat means :: MSAFREE2:def 14
ex b1 being finite DecoratedTreeex b2 being finite Tree st
( b1 = a4 & b2 = dom b1 & a5 = height b2 );
existence
ex b1 being Natex b2 being finite DecoratedTreeex b3 being finite Tree st
( b2 = c4 & b3 = dom b2 & b1 = height b3 )
proof end;
uniqueness
for b1, b2 being Nat holds
( ex b3 being finite DecoratedTreeex b4 being finite Tree st
( b3 = c4 & b4 = dom b3 & b1 = height b4 ) & ex b3 being finite DecoratedTreeex b4 being finite Tree st
( b3 = c4 & b4 = dom b3 & b2 = height b4 ) implies b1 = b2 )
;
end;

:: deftheorem Def14 defines depth MSAFREE2:def 14 :
for b1 being non empty non void ManySortedSign
for b2 being V3 ManySortedSet of the carrier of b1
for b3 being SortSymbol of b1
for b4 being Element of the Sorts of (FreeMSA b2) . b3
for b5 being Nat holds
( b5 = depth b4 iff ex b6 being finite DecoratedTreeex b7 being finite Tree st
( b6 = b4 & b7 = dom b6 & b5 = height b7 ) );