Article LANG1, MML version 4.99.1005
:: LANG1:structnot 1 => LANG1:struct 1
definition
struct(1-sorted) DTConstrStr(#
carrier -> set,
Rules -> Relation of the carrier of it,(the carrier of it) *
#);
end;
:: LANG1:attrnot 1 => LANG1:attr 1
definition
let a1 be DTConstrStr;
attr a1 is strict;
end;
:: LANG1:exreg 1
registration
cluster strict DTConstrStr;
end;
:: LANG1:aggrnot 1 => LANG1:aggr 1
definition
let a1 be set;
let a2 be Relation of a1,a1 *;
aggr DTConstrStr(#a1,a2#) -> strict DTConstrStr;
end;
:: LANG1:selnot 1 => LANG1:sel 1
definition
let a1 be DTConstrStr;
sel the Rules of a1 -> Relation of the carrier of a1,(the carrier of a1) *;
end;
:: LANG1:exreg 2
registration
cluster non empty strict DTConstrStr;
end;
:: LANG1:structnot 2 => LANG1:struct 2
definition
struct(DTConstrStr) GrammarStr(#
carrier -> set,
InitialSym -> Element of the carrier of it,
Rules -> Relation of the carrier of it,(the carrier of it) *
#);
end;
:: LANG1:attrnot 2 => LANG1:attr 2
definition
let a1 be GrammarStr;
attr a1 is strict;
end;
:: LANG1:exreg 3
registration
cluster strict GrammarStr;
end;
:: LANG1:aggrnot 2 => LANG1:aggr 2
definition
let a1 be set;
let a2 be Element of a1;
let a3 be Relation of a1,a1 *;
aggr GrammarStr(#a1,a2,a3#) -> strict GrammarStr;
end;
:: LANG1:selnot 2 => LANG1:sel 2
definition
let a1 be GrammarStr;
sel the InitialSym of a1 -> Element of the carrier of a1;
end;
:: LANG1:exreg 4
registration
cluster non empty GrammarStr;
end;
:: LANG1:modenot 1
definition
let a1 be DTConstrStr;
mode Symbol of a1 is Element of the carrier of a1;
end;
:: LANG1:modenot 2
definition
let a1 be DTConstrStr;
mode String of a1 is Element of (the carrier of a1) *;
end;
:: LANG1:funcnot 1 => LANG1:func 1
definition
let a1 be set;
let a2, a3 be Element of a1 *;
redefine func a2 ^ a3 -> Element of a1 *;
end;
:: LANG1:exreg 5
registration
let a1 be set;
cluster Relation-like Function-like empty finite FinSequence-like Element of a1 *;
end;
:: LANG1:funcnot 2 => LANG1:func 2
definition
let a1 be set;
redefine func <*> a1 -> empty Element of a1 *;
end;
:: LANG1:funcnot 3 => LANG1:func 3
definition
let a1 be non empty set;
let a2 be Element of a1;
redefine func <*a2*> -> Element of a1 *;
end;
:: LANG1:funcnot 4 => LANG1:func 4
definition
let a1 be non empty set;
let a2, a3 be Element of a1;
redefine func <*a2, a3*> -> Element of a1 *;
end;
:: LANG1:prednot 1 => LANG1:pred 1
definition
let a1 be non empty DTConstrStr;
let a2 be Element of the carrier of a1;
let a3 be Relation-like Function-like FinSequence-like set;
pred A2 ==> A3 means
[a2,a3] in the Rules of a1;
end;
:: LANG1:dfs 1
definiens
let a1 be non empty DTConstrStr;
let a2 be Element of the carrier of a1;
let a3 be Relation-like Function-like FinSequence-like set;
To prove
a2 ==> a3
it is sufficient to prove
thus [a2,a3] in the Rules of a1;
:: LANG1:def 1
theorem
for b1 being non empty DTConstrStr
for b2 being Element of the carrier of b1
for b3 being Relation-like Function-like FinSequence-like set holds
b2 ==> b3
iff
[b2,b3] in the Rules of b1;
:: LANG1:funcnot 5 => LANG1:func 5
definition
let a1 be non empty DTConstrStr;
func Terminals A1 -> set equals
{b1 where b1 is Element of the carrier of a1: for b2 being Relation-like Function-like FinSequence-like set holds
not b1 ==> b2};
end;
:: LANG1:def 2
theorem
for b1 being non empty DTConstrStr holds
Terminals b1 = {b2 where b2 is Element of the carrier of b1: for b3 being Relation-like Function-like FinSequence-like set holds
not b2 ==> b3};
:: LANG1:funcnot 6 => LANG1:func 6
definition
let a1 be non empty DTConstrStr;
func NonTerminals A1 -> set equals
{b1 where b1 is Element of the carrier of a1: ex b2 being Relation-like Function-like FinSequence-like set st
b1 ==> b2};
end;
:: LANG1:def 3
theorem
for b1 being non empty DTConstrStr holds
NonTerminals b1 = {b2 where b2 is Element of the carrier of b1: ex b3 being Relation-like Function-like FinSequence-like set st
b2 ==> b3};
:: LANG1:th 1
theorem
for b1 being non empty DTConstrStr holds
(Terminals b1) \/ NonTerminals b1 = the carrier of b1;
:: LANG1:prednot 2 => LANG1:pred 2
definition
let a1 be non empty DTConstrStr;
let a2, a3 be Element of (the carrier of a1) *;
pred A2 ==> A3 means
ex b1, b2, b3 being Element of (the carrier of a1) * st
ex b4 being Element of the carrier of a1 st
a2 = (b1 ^ <*b4*>) ^ b2 & a3 = (b1 ^ b3) ^ b2 & b4 ==> b3;
end;
:: LANG1:dfs 4
definiens
let a1 be non empty DTConstrStr;
let a2, a3 be Element of (the carrier of a1) *;
To prove
a2 ==> a3
it is sufficient to prove
thus ex b1, b2, b3 being Element of (the carrier of a1) * st
ex b4 being Element of the carrier of a1 st
a2 = (b1 ^ <*b4*>) ^ b2 & a3 = (b1 ^ b3) ^ b2 & b4 ==> b3;
:: LANG1:def 4
theorem
for b1 being non empty DTConstrStr
for b2, b3 being Element of (the carrier of b1) * holds
b2 ==> b3
iff
ex b4, b5, b6 being Element of (the carrier of b1) * st
ex b7 being Element of the carrier of b1 st
b2 = (b4 ^ <*b7*>) ^ b5 & b3 = (b4 ^ b6) ^ b5 & b7 ==> b6;
:: LANG1:th 2
theorem
for b1 being non empty DTConstrStr
for b2 being Element of the carrier of b1
for b3, b4, b5 being Element of (the carrier of b1) *
st b2 ==> b3
holds (b4 ^ <*b2*>) ^ b5 ==> (b4 ^ b3) ^ b5;
:: LANG1:th 3
theorem
for b1 being non empty DTConstrStr
for b2 being Element of the carrier of b1
for b3 being Element of (the carrier of b1) *
st b2 ==> b3
holds <*b2*> ==> b3;
:: LANG1:th 4
theorem
for b1 being non empty DTConstrStr
for b2 being Element of the carrier of b1
for b3 being Element of (the carrier of b1) *
st <*b2*> ==> b3
holds b2 ==> b3;
:: LANG1:th 5
theorem
for b1 being non empty DTConstrStr
for b2, b3, b4 being Element of (the carrier of b1) *
st b3 ==> b4
holds b2 ^ b3 ==> b2 ^ b4 & b3 ^ b2 ==> b4 ^ b2;
:: LANG1:prednot 3 => LANG1:pred 3
definition
let a1 be non empty DTConstrStr;
let a2, a3 be Element of (the carrier of a1) *;
pred A3 is_derivable_from A2 means
ex b1 being Relation-like Function-like FinSequence-like set st
1 <= len b1 &
b1 . 1 = a2 &
b1 . len b1 = a3 &
(for b2 being Element of NAT
st 1 <= b2 & b2 < len b1
holds ex b3, b4 being Element of (the carrier of a1) * st
b1 . b2 = b3 & b1 . (b2 + 1) = b4 & b3 ==> b4);
end;
:: LANG1:dfs 5
definiens
let a1 be non empty DTConstrStr;
let a2, a3 be Element of (the carrier of a1) *;
To prove
a3 is_derivable_from a2
it is sufficient to prove
thus ex b1 being Relation-like Function-like FinSequence-like set st
1 <= len b1 &
b1 . 1 = a2 &
b1 . len b1 = a3 &
(for b2 being Element of NAT
st 1 <= b2 & b2 < len b1
holds ex b3, b4 being Element of (the carrier of a1) * st
b1 . b2 = b3 & b1 . (b2 + 1) = b4 & b3 ==> b4);
:: LANG1:def 5
theorem
for b1 being non empty DTConstrStr
for b2, b3 being Element of (the carrier of b1) * holds
b3 is_derivable_from b2
iff
ex b4 being Relation-like Function-like FinSequence-like set st
1 <= len b4 &
b4 . 1 = b2 &
b4 . len b4 = b3 &
(for b5 being Element of NAT
st 1 <= b5 & b5 < len b4
holds ex b6, b7 being Element of (the carrier of b1) * st
b4 . b5 = b6 & b4 . (b5 + 1) = b7 & b6 ==> b7);
:: LANG1:th 6
theorem
for b1 being non empty DTConstrStr
for b2 being Element of (the carrier of b1) * holds
b2 is_derivable_from b2;
:: LANG1:th 7
theorem
for b1 being non empty DTConstrStr
for b2, b3 being Element of (the carrier of b1) *
st b2 ==> b3
holds b3 is_derivable_from b2;
:: LANG1:th 8
theorem
for b1 being non empty DTConstrStr
for b2, b3, b4 being Element of (the carrier of b1) *
st b2 is_derivable_from b3 & b3 is_derivable_from b4
holds b2 is_derivable_from b4;
:: LANG1:funcnot 7 => LANG1:func 7
definition
let a1 be non empty GrammarStr;
func Lang A1 -> set equals
{b1 where b1 is Element of (the carrier of a1) *: rng b1 c= Terminals a1 & b1 is_derivable_from <*the InitialSym of a1*>};
end;
:: LANG1:def 6
theorem
for b1 being non empty GrammarStr holds
Lang b1 = {b2 where b2 is Element of (the carrier of b1) *: rng b2 c= Terminals b1 & b2 is_derivable_from <*the InitialSym of b1*>};
:: LANG1:th 9
theorem
for b1 being non empty GrammarStr
for b2 being Element of (the carrier of b1) * holds
b2 in Lang b1
iff
rng b2 c= Terminals b1 & b2 is_derivable_from <*the InitialSym of b1*>;
:: LANG1:funcnot 8 => LANG1:func 8
definition
let a1, a2 be non empty set;
let a3 be Element of [:a1,a2:];
redefine func {a3} -> Relation of a1,a2;
end;
:: LANG1:funcnot 9 => LANG1:func 9
definition
let a1, a2 be non empty set;
let a3, a4 be Element of [:a1,a2:];
redefine func {a3, a4} -> Relation of a1,a2;
commutativity;
:: for a1, a2 being non empty set
:: for a3, a4 being Element of [:a1,a2:] holds
:: {a3,a4} = {a4,a3};
end;
:: LANG1:funcnot 10 => LANG1:func 10
definition
let a1 be set;
func EmptyGrammar A1 -> strict GrammarStr means
the carrier of it = {a1} &
the Rules of it = {[a1,{}]};
end;
:: LANG1:def 7
theorem
for b1 being set
for b2 being strict GrammarStr holds
b2 = EmptyGrammar b1
iff
the carrier of b2 = {b1} &
the Rules of b2 = {[b1,{}]};
:: LANG1:funcnot 11 => LANG1:func 11
definition
let a1, a2 be set;
func SingleGrammar(A1,A2) -> strict GrammarStr means
the carrier of it = {a1,a2} &
the InitialSym of it = a1 &
the Rules of it = {[a1,<*a2*>]};
end;
:: LANG1:def 8
theorem
for b1, b2 being set
for b3 being strict GrammarStr holds
b3 = SingleGrammar(b1,b2)
iff
the carrier of b3 = {b1,b2} &
the InitialSym of b3 = b1 &
the Rules of b3 = {[b1,<*b2*>]};
:: LANG1:funcnot 12 => LANG1:func 12
definition
let a1, a2 be set;
func IterGrammar(A1,A2) -> strict GrammarStr means
the carrier of it = {a1,a2} &
the InitialSym of it = a1 &
the Rules of it = {[a1,<*a2,a1*>],[a1,{}]};
end;
:: LANG1:def 9
theorem
for b1, b2 being set
for b3 being strict GrammarStr holds
b3 = IterGrammar(b1,b2)
iff
the carrier of b3 = {b1,b2} &
the InitialSym of b3 = b1 &
the Rules of b3 = {[b1,<*b2,b1*>],[b1,{}]};
:: LANG1:funcreg 1
registration
let a1 be set;
cluster EmptyGrammar a1 -> non empty strict;
end;
:: LANG1:funcreg 2
registration
let a1, a2 be set;
cluster SingleGrammar(a1,a2) -> non empty strict;
end;
:: LANG1:funcreg 3
registration
let a1, a2 be set;
cluster IterGrammar(a1,a2) -> non empty strict;
end;
:: LANG1:funcnot 13 => LANG1:func 13
definition
let a1 be non empty set;
func TotalGrammar A1 -> strict GrammarStr means
the carrier of it = succ a1 &
the InitialSym of it = a1 &
the Rules of it = {[a1,<*b1,a1*>] where b1 is Element of a1: b1 = b1} \/ {[a1,{}]};
end;
:: LANG1:def 10
theorem
for b1 being non empty set
for b2 being strict GrammarStr holds
b2 = TotalGrammar b1
iff
the carrier of b2 = succ b1 &
the InitialSym of b2 = b1 &
the Rules of b2 = {[b1,<*b3,b1*>] where b3 is Element of b1: b3 = b3} \/ {[b1,{}]};
:: LANG1:funcreg 4
registration
let a1 be non empty set;
cluster TotalGrammar a1 -> non empty strict;
end;
:: LANG1:th 10
theorem
for b1 being set holds
Terminals EmptyGrammar b1 = {};
:: LANG1:th 11
theorem
for b1 being set holds
Lang EmptyGrammar b1 = {{}};
:: LANG1:th 12
theorem
for b1, b2 being set
st b1 <> b2
holds Terminals SingleGrammar(b1,b2) = {b2};
:: LANG1:th 13
theorem
for b1, b2 being set
st b1 <> b2
holds Lang SingleGrammar(b1,b2) = {<*b2*>};
:: LANG1:th 14
theorem
for b1, b2 being set
st b1 <> b2
holds Terminals IterGrammar(b1,b2) = {b2};
:: LANG1:th 15
theorem
for b1, b2 being set
st b1 <> b2
holds Lang IterGrammar(b1,b2) = {b2} *;
:: LANG1:th 16
theorem
for b1 being non empty set holds
Terminals TotalGrammar b1 = b1;
:: LANG1:th 17
theorem
for b1 being non empty set holds
Lang TotalGrammar b1 = b1 *;
:: LANG1:attrnot 3 => LANG1:attr 3
definition
let a1 be non empty GrammarStr;
attr a1 is efective means
Lang a1 is not empty &
the InitialSym of a1 in NonTerminals a1 &
(for b1 being Element of the carrier of a1
st b1 in Terminals a1
holds ex b2 being Element of (the carrier of a1) * st
b2 in Lang a1 & b1 in rng b2);
end;
:: LANG1:dfs 11
definiens
let a1 be non empty GrammarStr;
To prove
a1 is efective
it is sufficient to prove
thus Lang a1 is not empty &
the InitialSym of a1 in NonTerminals a1 &
(for b1 being Element of the carrier of a1
st b1 in Terminals a1
holds ex b2 being Element of (the carrier of a1) * st
b2 in Lang a1 & b1 in rng b2);
:: LANG1:def 11
theorem
for b1 being non empty GrammarStr holds
b1 is efective
iff
Lang b1 is not empty &
the InitialSym of b1 in NonTerminals b1 &
(for b2 being Element of the carrier of b1
st b2 in Terminals b1
holds ex b3 being Element of (the carrier of b1) * st
b3 in Lang b1 & b2 in rng b3);
:: LANG1:attrnot 4 => LANG1:attr 4
definition
let a1 be GrammarStr;
attr a1 is finite means
the Rules of a1 is finite;
end;
:: LANG1:dfs 12
definiens
let a1 be GrammarStr;
To prove
a1 is finite
it is sufficient to prove
thus the Rules of a1 is finite;
:: LANG1:def 12
theorem
for b1 being GrammarStr holds
b1 is finite
iff
the Rules of b1 is finite;
:: LANG1:exreg 6
registration
cluster non empty efective finite GrammarStr;
end;
:: LANG1:funcnot 14 => LANG1:func 14
definition
let a1 be non empty efective GrammarStr;
redefine func NonTerminals a1 -> non empty Element of bool the carrier of a1;
end;
:: LANG1:funcnot 15 => LANG1:func 15
definition
let a1, a2 be non empty set;
let a3 be FinSequence of a1;
let a4 be Function-like quasi_total Relation of a1,a2;
redefine func a4 * a3 -> Element of a2 *;
end;
:: LANG1:funcnot 16 => LANG1:func 16
definition
let a1, a2 be non empty set;
let a3 be Function-like quasi_total Relation of a1,a2;
func A3 * -> Function-like quasi_total Relation of a1 *,a2 * means
for b1 being Element of a1 * holds
it . b1 = a3 * b1;
end;
:: LANG1:def 14
theorem
for b1, b2 being non empty set
for b3 being Function-like quasi_total Relation of b1,b2
for b4 being Function-like quasi_total Relation of b1 *,b2 * holds
b4 = b3 *
iff
for b5 being Element of b1 * holds
b4 . b5 = b3 * b5;
:: LANG1:th 18
theorem
for b1 being Relation-like set holds
b1 c= b1 [*];
:: LANG1:funcnot 17 => LANG1:func 17
definition
let a1 be non empty set;
let a2 be Relation of a1,a1;
redefine func a2 [*] -> Relation of a1,a1;
end;
:: LANG1:funcnot 18 => LANG1:func 18
definition
let a1 be non empty GrammarStr;
let a2 be non empty set;
let a3 be Function-like quasi_total Relation of the carrier of a1,a2;
func A1 . A3 -> strict GrammarStr equals
GrammarStr(#a2,a3 . the InitialSym of a1,(a3 ~ * the Rules of a1) * (a3 *)#);
end;
:: LANG1:def 15
theorem
for b1 being non empty GrammarStr
for b2 being non empty set
for b3 being Function-like quasi_total Relation of the carrier of b1,b2 holds
b1 . b3 = GrammarStr(#b2,b3 . the InitialSym of b1,(b3 ~ * the Rules of b1) * (b3 *)#);