begin
theorem Lem1:
theorem FINSEQp2150:
definition
let C,
D be non
empty set ;
let R be
Relation;
mode BinOp of
C,
D,
R -> Function of
[:C,D:],
D means :
Def2:
for
x being
Element of
C for
y1,
y2 being
Element of
D st
[y1,y2] in R holds
[(it . (x,y1)),(it . (x,y2))] in R;
existence
ex b1 being Function of [:C,D:],D st
for x being Element of C
for y1, y2 being Element of D st [y1,y2] in R holds
[(b1 . (x,y1)),(b1 . (x,y2))] in R
end;
:: deftheorem Def2 defines BinOp STACKS_1:def 1 :
for C, D being non empty set
for R being Relation
for b4 being Function of [:C,D:],D holds
( b4 is BinOp of C,D,R iff for x being Element of C
for y1, y2 being Element of D st [y1,y2] in R holds
[(b4 . (x,y1)),(b4 . (x,y2))] in R );
definition
let C,
D be non
empty set ;
let R be
Equivalence_Relation of
D;
let b be
Function of
[:C,D:],
D;
assume A1:
b is
BinOp of
C,
D,
R
;
func b /\/ R -> Function of
[:C,(Class R):],
(Class R) means :
Def4:
for
x,
y,
y1 being
set st
x in C &
y in Class R &
y1 in y holds
it . (
x,
y)
= Class (
R,
(b . (x,y1)));
existence
ex b1 being Function of [:C,(Class R):],(Class R) st
for x, y, y1 being set st x in C & y in Class R & y1 in y holds
b1 . (x,y) = Class (R,(b . (x,y1)))
uniqueness
for b1, b2 being Function of [:C,(Class R):],(Class R) st ( for x, y, y1 being set st x in C & y in Class R & y1 in y holds
b1 . (x,y) = Class (R,(b . (x,y1))) ) & ( for x, y, y1 being set st x in C & y in Class R & y1 in y holds
b2 . (x,y) = Class (R,(b . (x,y1))) ) holds
b1 = b2
end;
:: deftheorem Def4 defines /\/ STACKS_1:def 2 :
for C, D being non empty set
for R being Equivalence_Relation of D
for b being Function of [:C,D:],D st b is BinOp of C,D,R holds
for b5 being Function of [:C,(Class R):],(Class R) holds
( b5 = b /\/ R iff for x, y, y1 being set st x in C & y in Class R & y1 in y holds
b5 . (x,y) = Class (R,(b . (x,y1))) );
begin
registration
let a1 be non
empty set ;
let a2 be
set ;
let a3 be
Subset of
a2;
let a4 be
Function of
[:a1,a2:],
a2;
let a5 be
Function of
a2,
a2;
let a6 be
Function of
a2,
a1;
cluster StackSystem(#
a1,
a2,
a3,
a4,
a5,
a6 #)
-> non
empty ;
coherence
not StackSystem(# a1,a2,a3,a4,a5,a6 #) is empty
;
end;
registration
let a1 be
set ;
let a2 be non
empty set ;
let a3 be
Subset of
a2;
let a4 be
Function of
[:a1,a2:],
a2;
let a5 be
Function of
a2,
a2;
let a6 be
Function of
a2,
a1;
cluster StackSystem(#
a1,
a2,
a3,
a4,
a5,
a6 #)
-> non
void ;
coherence
not StackSystem(# a1,a2,a3,a4,a5,a6 #) is void
;
end;
:: deftheorem EMP defines emp STACKS_1:def 3 :
for X being non empty non void StackSystem
for s being stack of X holds
( emp s iff s in the s_empty of X );
:: deftheorem defines pop STACKS_1:def 4 :
for X being non empty non void StackSystem
for s being stack of X holds pop s = the s_pop of X . s;
:: deftheorem defines top STACKS_1:def 5 :
for X being non empty non void StackSystem
for s being stack of X holds top s = the s_top of X . s;
:: deftheorem defines push STACKS_1:def 6 :
for X being non empty non void StackSystem
for s being stack of X
for e being Element of X holds push (e,s) = the s_push of X . (e,s);
:: deftheorem EXAM defines StandardStackSystem STACKS_1:def 7 :
for A being non empty set
for b2 being non empty non void strict StackSystem holds
( b2 = StandardStackSystem A iff ( the carrier of b2 = A & the carrier' of b2 = A * & ( for s being stack of b2 holds
( ( emp s implies s is empty ) & ( s is empty implies emp s ) & ( for g being FinSequence st g = s holds
( ( not emp s implies ( top s = g . 1 & pop s = Del (g,1) ) ) & ( emp s implies ( top s = the Element of b2 & pop s = {} ) ) & ( for e being Element of b2 holds push (e,s) = <*e*> ^ g ) ) ) ) ) ) );
for A being non empty set
for m being stack of (StandardStackSystem A) holds
( emp m iff m = {} )
by EXAM;
for A being non empty set
for c being Element of (StandardStackSystem A)
for m being stack of (StandardStackSystem A) holds push (c,m) = <*c*> ^ m
by EXAM;
for A being non empty set
for m being stack of (StandardStackSystem A) st not emp m holds
pop m = Del (m,1)
by EXAM;
:: deftheorem POPFIN defines pop-finite STACKS_1:def 8 :
for X being non empty non void StackSystem holds
( X is pop-finite iff for f being Function of NAT, the carrier' of X ex i being Nat ex s being stack of X st
( f . i = s & ( not emp s implies f . (i + 1) <> pop s ) ) );
:: deftheorem PUSHPOP defines push-pop STACKS_1:def 9 :
for X being non empty non void StackSystem holds
( X is push-pop iff for s being stack of X st not emp s holds
s = push ((top s),(pop s)) );
:: deftheorem TOPPUSH defines top-push STACKS_1:def 10 :
for X being non empty non void StackSystem holds
( X is top-push iff for s being stack of X
for e being Element of X holds e = top (push (e,s)) );
:: deftheorem POPPUSH defines pop-push STACKS_1:def 11 :
for X being non empty non void StackSystem holds
( X is pop-push iff for s being stack of X
for e being Element of X holds s = pop (push (e,s)) );
:: deftheorem PUSHNE defines push-non-empty STACKS_1:def 12 :
for X being non empty non void StackSystem holds
( X is push-non-empty iff for s being stack of X
for e being Element of X holds not emp push (e,s) );
theorem Th1:
theorem Th2:
theorem
begin
scheme
UNIQsch{
F1()
-> StackAlgebra,
F2()
-> stack of
F1(),
F3()
-> non
empty set ,
F4()
-> Element of
F3(),
F5(
set ,
set )
-> Element of
F3() } :
for
a1,
a2 being
Element of
F3() st ex
F being
Function of the
carrier' of
F1(),
F3() st
(
a1 = F . F2() & ( for
s1 being
stack of
F1() st
emp s1 holds
F . s1 = F4() ) & ( for
s1 being
stack of
F1()
for
e being
Element of
F1() holds
F . (push (e,s1)) = F5(
e,
(F . s1)) ) ) & ex
F being
Function of the
carrier' of
F1(),
F3() st
(
a2 = F . F2() & ( for
s1 being
stack of
F1() st
emp s1 holds
F . s1 = F4() ) & ( for
s1 being
stack of
F1()
for
e being
Element of
F1() holds
F . (push (e,s1)) = F5(
e,
(F . s1)) ) ) holds
a1 = a2
begin
:: deftheorem MOD defines |. STACKS_1:def 13 :
for X being StackAlgebra
for s being stack of X
for b3 being Element of the carrier of X * holds
( b3 = |.s.| iff ex F being Function of the carrier' of X,( the carrier of X *) st
( b3 = F . s & ( for s1 being stack of X st emp s1 holds
F . s1 = {} ) & ( for s1 being stack of X
for e being Element of X holds F . (push (e,s1)) = <*e*> ^ (F . s1) ) ) );
theorem Th31:
theorem Th32:
theorem Th33:
theorem Th34:
theorem Th35:
theorem Th351:
theorem ThZ:
theorem Th36:
:: deftheorem CONG defines == STACKS_1:def 14 :
for X being StackAlgebra
for s1, s2 being stack of X holds
( s1 == s2 iff |.s1.| = |.s2.| );
theorem Th41:
theorem Th42:
theorem Th43:
theorem Th44:
theorem Th45:
theorem Th46:
:: deftheorem PROP defines proper-for-identity STACKS_1:def 15 :
for X being StackAlgebra holds
( X is proper-for-identity iff for s1, s2 being stack of X st s1 == s2 holds
s1 = s2 );
:: deftheorem REL defines ==_ STACKS_1:def 16 :
for X being StackAlgebra
for b2 being Relation of the carrier' of X holds
( b2 = ==_ X iff for s1, s2 being stack of X holds
( [s1,s2] in b2 iff s1 == s2 ) );
theorem Th50:
:: deftheorem COSET defines coset STACKS_1:def 17 :
for X being StackAlgebra
for s being stack of X
for b3 being Subset of the carrier' of X holds
( b3 = coset s iff ( s in b3 & ( for e being Element of X
for s1 being stack of X st s1 in b3 holds
( push (e,s1) in b3 & ( not emp s1 implies pop s1 in b3 ) ) ) & ( for A being Subset of the carrier' of X st s in A & ( for e being Element of X
for s1 being stack of X st s1 in A holds
( push (e,s1) in A & ( not emp s1 implies pop s1 in A ) ) ) holds
b3 c= A ) ) );
theorem Th53:
theorem
theorem
definition
let X be
StackAlgebra;
func ConstructionRed X -> Relation of the
carrier' of
X means :
CRED:
for
s1,
s2 being
stack of
X holds
(
[s1,s2] in it iff ( ( not
emp s1 &
s2 = pop s1 ) or ex
e being
Element of
X st
s2 = push (
e,
s1) ) );
existence
ex b1 being Relation of the carrier' of X st
for s1, s2 being stack of X holds
( [s1,s2] in b1 iff ( ( not emp s1 & s2 = pop s1 ) or ex e being Element of X st s2 = push (e,s1) ) )
uniqueness
for b1, b2 being Relation of the carrier' of X st ( for s1, s2 being stack of X holds
( [s1,s2] in b1 iff ( ( not emp s1 & s2 = pop s1 ) or ex e being Element of X st s2 = push (e,s1) ) ) ) & ( for s1, s2 being stack of X holds
( [s1,s2] in b2 iff ( ( not emp s1 & s2 = pop s1 ) or ex e being Element of X st s2 = push (e,s1) ) ) ) holds
b1 = b2
end;
:: deftheorem CRED defines ConstructionRed STACKS_1:def 18 :
for X being StackAlgebra
for b2 being Relation of the carrier' of X holds
( b2 = ConstructionRed X iff for s1, s2 being stack of X holds
( [s1,s2] in b2 iff ( ( not emp s1 & s2 = pop s1 ) or ex e being Element of X st s2 = push (e,s1) ) ) );
theorem Lem2:
theorem Th57:
theorem Th58:
:: deftheorem CORE defines core STACKS_1:def 19 :
for X being StackAlgebra
for s, b3 being stack of X holds
( b3 = core s iff ( emp b3 & ex t being the carrier' of b1 -valued RedSequence of ConstructionRed X st
( t . 1 = s & t . (len t) = b3 & ( for i being Nat st 1 <= i & i < len t holds
( not emp t /. i & t /. (i + 1) = pop (t /. i) ) ) ) ) );
theorem Th11:
theorem Th12:
theorem Th13:
theorem Th59a:
theorem Th17:
theorem Th14:
theorem Th15:
theorem Th60:
begin
:: deftheorem QUOT defines /== STACKS_1:def 20 :
for X being StackAlgebra
for b2 being strict StackSystem holds
( b2 = X /== iff ( the carrier of b2 = the carrier of X & the carrier' of b2 = Class (==_ X) & the s_empty of b2 = { the s_empty of X} & the s_push of b2 = the s_push of X /\/ (==_ X) & the s_pop of b2 = ( the s_pop of X +* (id the s_empty of X)) /\/ (==_ X) & ( for f being Choice_Function of Class (==_ X) holds the s_top of b2 = ( the s_top of X * f) +* ( the s_empty of X, the Element of the carrier of X) ) ) );
theorem Th70:
theorem Th70a:
theorem Th71:
theorem Th71a:
theorem Th72:
theorem Th73:
theorem Th74:
theorem Th80:
begin
:: deftheorem ISO defines form_isomorphism_between STACKS_1:def 21 :
for X1, X2 being StackAlgebra
for F, G being Function holds
( F,G form_isomorphism_between X1,X2 iff ( dom F = the carrier of X1 & rng F = the carrier of X2 & F is one-to-one & dom G = the carrier' of X1 & rng G = the carrier' of X2 & G is one-to-one & ( for s1 being stack of X1
for s2 being stack of X2 st s2 = G . s1 holds
( ( emp s1 implies emp s2 ) & ( emp s2 implies emp s1 ) & ( not emp s1 implies ( pop s2 = G . (pop s1) & top s2 = F . (top s1) ) ) & ( for e1 being Element of X1
for e2 being Element of X2 st e2 = F . e1 holds
push (e2,s2) = G . (push (e1,s1)) ) ) ) ) );
theorem ThI1:
theorem ThI2:
theorem Th90:
for
X1,
X2,
X3 being
StackAlgebra for
F1,
G1,
F2,
G2 being
Function st
F1,
G1 form_isomorphism_between X1,
X2 &
F2,
G2 form_isomorphism_between X2,
X3 holds
F2 * F1,
G2 * G1 form_isomorphism_between X1,
X3
theorem Th97:
definition
let X1,
X2 be
StackAlgebra;
pred X1,
X2 are_isomorphic means
ex
F,
G being
Function st
F,
G form_isomorphism_between X1,
X2;
reflexivity
for X1 being StackAlgebra ex F, G being Function st F,G form_isomorphism_between X1,X1
symmetry
for X1, X2 being StackAlgebra st ex F, G being Function st F,G form_isomorphism_between X1,X2 holds
ex F, G being Function st F,G form_isomorphism_between X2,X1
end;
:: deftheorem defines are_isomorphic STACKS_1:def 22 :
for X1, X2 being StackAlgebra holds
( X1,X2 are_isomorphic iff ex F, G being Function st F,G form_isomorphism_between X1,X2 );
theorem
theorem
theorem Th100:
theorem