:: Compactness of Neural Networks
:: by Keiichi Miyajima and Hiroshi Yamazaki
::
:: Received April 30, 2022
:: Copyright (c) 2022-2026 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 NEURONS1, ASCOLI, STRUCT_0, NUMBERS, PRE_TOPC, ORDINAL2,
PCOMPS_1, NORMSP_0, RELAT_1, CARD_3, SUBSET_1, RCOMP_1, XBOOLE_0,
FUNCT_1, TARSKI, CARD_1, ARYTM_3, ARYTM_1, COMPLEX1, RLVECT_1, ALGSTR_0,
REAL_1, FUNCT_2, VALUED_1, SUPINF_2, REALSET1, ZFMISC_1, XXREAL_0,
NORMSP_1, NORMSP_2, REWRITE1, NAT_1, RLVECT_2, RLVECT_3, SEQ_2, ORDEQ_01,
PARTFUN1, C0SP2, METRIC_1, RELAT_2, RLSUB_1, RLTOPSP1, FINSET_1, TBSP_1,
TOPMETR4, C0SP3, FINSEQ_1, REAL_NS1, RLVECT_5, NEWTON;
notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, FUNCT_1, CARD_1, RELSET_1,
PARTFUN1, FUNCT_2, BINOP_1, REALSET1, FINSET_1, ORDINAL1, NUMBERS,
XCMPLX_0, XXREAL_0, XREAL_0, NAT_1, COMPLEX1, FINSEQ_1, NEWTON, STRUCT_0,
ALGSTR_0, RLSUB_1, RLVECT_1, RLVECT_2, RLVECT_3, RLVECT_5, PCOMPS_1,
TBSP_1, NORMSP_0, NORMSP_1, NFCONT_1, COMPTS_1, PRE_TOPC, METRIC_1,
RUSUB_4, TOPMETR, CONVEX1, RLTOPSP1, LOPBAN_1, NORMSP_3, NORMSP_2,
TOPMETR4, C0SP3, REAL_NS1, ASCOLI;
constructors REALSET1, RSSPACE, PCOMPS_1, TBSP_1, NFCONT_1, TOPMETR, NORMSP_2,
RUSUB_4, CONVEX1, RLVECT_5, ABIAN, RLVECT_3, NEWTON, NORMSP_3, TOPMETR4,
C0SP3, ASCOLI, REAL_NS1;
registrations XBOOLE_0, SUBSET_1, STRUCT_0, PRE_TOPC, XREAL_0, ALGSTR_0,
NUMBERS, ORDINAL1, MEMBERED, VALUED_0, COMPTS_1, FUNCT_1, NEWTON,
FUNCT_2, TOPMETR, RELSET_1, NORMSP_1, NORMSP_2, RLVECT_1, RLVECT_5,
PARTFUN1, NORMSP_3, C0SP3, TBSP_1, CARD_1, NAT_1, FINSEQ_1, REAL_NS1,
ASCOLI;
requirements NUMERALS, BOOLE, SUBSET, ARITHM, REAL;
begin :: Preliminaries
reserve RNS1,RNS2
for RealLinearSpace;
theorem :: NEURONS1:1
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies the carrier
of RNS1 = the carrier
of RNS2;
theorem :: NEURONS1:2
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies 0.(RNS1) =
0.(RNS2);
theorem :: NEURONS1:3
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for p,q
be Element
of RNS1,
f,g
be Element
of RNS2
st p=f & q=g
holds p+q = f+g;
theorem :: NEURONS1:4
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for r
be Real,
q
be Element
of RNS1,
g
be Element
of RNS2
st q = g
holds r*q = r*g;
theorem :: NEURONS1:5
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for q
be Element
of RNS1,
g
be Element
of RNS2
st q = g
holds -q = -g;
theorem :: NEURONS1:6
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for p,q
be Element
of RNS1,
f,g
be Element
of RNS2
st p=f & q=g
holds p-q = f-g;
theorem :: NEURONS1:7
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for X
being set
for n
being Nat
holds
( X
is Linear_Combination
of RNS2
iff X
is Linear_Combination
of RNS1 );
theorem :: NEURONS1:8
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for Lv
be Linear_Combination
of RNS1,
Lr
be Linear_Combination
of RNS2 st Lr = Lv
holds Carrier Lr = Carrier Lv;
theorem :: NEURONS1:9
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for F
be set
holds
F
is Subset
of RNS1
iff
F
is Subset
of RNS2;
theorem :: NEURONS1:10
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for F
be set
holds
F
is FinSequence
of RNS1
iff
F
is FinSequence
of RNS2;
theorem :: NEURONS1:11
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for F
be set
holds
F
is Function
of RNS1, REAL
iff
F
is Function
of RNS2, REAL;
theorem :: NEURONS1:12
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for FFr
be FinSequence
of RNS1,
fr
be Function
of RNS1,REAL,
Fv
be FinSequence
of RNS2,
fv
be Function
of RNS2,REAL st fr = fv & FFr = Fv
holds fr(
#)FFr = fv(
#)Fv;
theorem :: NEURONS1:13
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for Ft
be FinSequence
of RNS1,
FFr
be FinSequence
of RNS2 st Ft = FFr
holds Sum Ft = Sum FFr;
theorem :: NEURONS1:14
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for Lr
be Linear_Combination
of RNS2,
Lt
be Linear_Combination
of RNS1 st Lr = Lt
holds Sum Lr = Sum Lt;
theorem :: NEURONS1:15
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for Ar
be Subset
of RNS2,
At
be Subset
of RNS1 st Ar = At
holds
for X
be object
holds
X
is Linear_Combination
of Ar
iff
X
is Linear_Combination
of At;
theorem :: NEURONS1:16
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for Ar
be Subset
of RNS2,
At
be Subset
of RNS1 st Ar = At
holds [
#]Lin Ar = [
#]Lin At;
theorem :: NEURONS1:17
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for Ar
be Subset
of RNS2,
At
be Subset
of RNS1 st Ar = At
holds
Ar
is linearly-independent
iff
At
is linearly-independent;
theorem :: NEURONS1:18
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for X
being object
holds
(X
is Subspace
of RNS2
iff
X
is Subspace
of RNS1);
theorem :: NEURONS1:19
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for L
be Linear_Combination
of RNS2,
S
be Linear_Combination
of RNS1
st L = S
holds
Sum L = Sum S;
theorem :: NEURONS1:20
the RLSStruct
of RNS1 = the RLSStruct
of RNS2
implies
for X
be set
holds
X
is Basis
of RNS1
iff
X
is Basis
of RNS2;
theorem :: NEURONS1:21
for RNS1,RNS2
be RealLinearSpace
st the RLSStruct
of RNS1 = the RLSStruct
of RNS2
& RNS1
is finite-dimensional
holds RNS2
is finite-dimensional & dim RNS2 = dim RNS1;
theorem :: NEURONS1:22
for RNS
be RealNormSpace
holds the NORMSTR
of RNS
is strict RealNormSpace;
theorem :: NEURONS1:23
for RNS
be RealNormSpace
holds ex T
be NormedLinearTopSpace
st the NORMSTR
of RNS = the NORMSTR
of T;
theorem :: NEURONS1:24
for RNS
be RealNormSpace
st RNS
is finite-dimensional
holds ex T
be NormedLinearTopSpace
st the NORMSTR
of RNS = the NORMSTR
of T & T
is finite-dimensional;
theorem :: NEURONS1:25
for T
be NormedLinearTopSpace,
RNS
be RealNormSpace
st T
is finite-dimensional & RNS = the NORMSTR
of T
holds
RNS
is finite-dimensional & dim RNS = dim T;
begin :: The Ascoli-Arzela theorem on the finite dimensional normed linear spaces
theorem :: NEURONS1:26
for M
be non empty MetrSpace, S
be non empty compact TopSpace,
T
be NormedLinearTopSpace
st S = TopSpaceMetr(M) & T
is complete & T
is finite-dimensional
& dim (T) <>
0
holds
for G
be Subset
of Funcs(the carrier
of M, the carrier
of T),
H
be non empty Subset
of
(MetricSpaceNorm R_NormSpace_of_ContinuousFunctions(S,T))
st G = H
holds
(MetricSpaceNorm R_NormSpace_of_ContinuousFunctions(S,T))
| H
is totally_bounded
iff
G
is equibounded & G
is equicontinuous;
theorem :: NEURONS1:27
for M
be non empty MetrSpace, S
be non empty compact TopSpace,
T
be NormedLinearTopSpace
st S = TopSpaceMetr(M) & T
is complete & T
is finite-dimensional
& dim (T) <>
0
holds
for G
be Subset
of Funcs(the carrier
of M, the carrier
of T),
H
be non empty Subset
of
(MetricSpaceNorm R_NormSpace_of_ContinuousFunctions(S,T))
st G = H
holds
Cl(H)
is sequentially_compact
iff
G
is equibounded & G
is equicontinuous;
theorem :: NEURONS1:28
for M
be non empty MetrSpace, S
be non empty compact TopSpace,
T
be NormedLinearTopSpace
st S = TopSpaceMetr(M) & T
is complete & T
is finite-dimensional
& dim (T) <>
0
holds
for G
be Subset
of Funcs(the carrier
of M, the carrier
of T),
F
be non empty Subset
of R_NormSpace_of_ContinuousFunctions(S,T)
st G = F
holds
Cl(F)
is compact
iff
G
is equibounded & G
is equicontinuous;
theorem :: NEURONS1:29
for RNS
be non empty RealNormSpace,T
be NormedLinearTopSpace,
X
be non empty Subset
of RNS,
S
be non empty compact strict TopSpace,
G
be non empty Subset
of R_NormSpace_of_ContinuousFunctions(S,T)
st S
is SubSpace
of TopSpaceNorm RNS
& the carrier
of S = X
& X
is compact
& T
is complete & T
is finite-dimensional & dim T <>
0
&
ex K,D
be Real st
0 < K &
0 < D
&
for F
be Function
of X,T
st F
in G
holds
( (
for x,y
be Point
of RNS
st x
in X & y
in X
holds ||.F/.x-F/.y.|| <= D*||.x-y.|| )
&
(
for x
be Point
of RNS st x
in X
holds ||.F/.x.|| <= K ) )
holds
Cl(G)
is compact;
begin
definition
let n
be Nat,
k
be FinSequence
of NAT,
N
be FinSequence;
pred N is_Multilayer_perceptron_with k, n means
:: NEURONS1:def 1
len N = n & len N +
1 = len k
&
for i
be Nat st
1 <= i & i < len k
holds N.i
is Function
of REAL-NS (k.i), REAL-NS (k.(i+
1));
end;
definition
let N
be FinSequence;
attr N
is Multilayer_perceptron_like means
:: NEURONS1:def 2
ex k
be FinSequence
of NAT
st
len N+
1 = len k
&
for i
be Nat st
1 <= i & i < len k
holds N.i
is Function
of REAL-NS (k.i), REAL-NS (k.(i+
1));
end;
registration
cluster Multilayer_perceptron_like
for FinSequence;
end;
definition
mode Multilayer_perceptron
is Multilayer_perceptron_like FinSequence;
end;
theorem :: NEURONS1:30
for N
be Multilayer_perceptron
holds
ex k
be FinSequence
of NAT
st
len N +
1 = len k
&
for i
be Nat st
1<=i & i < len k
holds N.i
is Function
of REAL-NS (k.i), REAL-NS (k.(i+
1));
definition
let n
be Nat,
k
be FinSequence
of NAT,
N
be FinSequence;
assume N is_Multilayer_perceptron_with k,n;
assume len N <>
0;
func OutPutFunc(N,k,n) -> Function
of REAL-NS (k.
1), REAL-NS (k.(n+
1))
means
:: NEURONS1:def 3
ex p
be FinSequence
st
len p = len N
&
p.
1 = N.
1
& (
for i
be Nat st
1 <= i & i < len N
holds
ex NN
be Function
of REAL-NS (k.(i+
1)), REAL-NS (k.(i+
2)),
pp
be Function
of REAL-NS (k.
1), REAL-NS (k.(i+
1))
st NN=N.(i+
1) & pp =p.i
&
p.(i+
1) = NN*pp )
& it = p.(len N);
end;
theorem :: NEURONS1:31
for n
be Nat,
k
be FinSequence
of NAT,
N
be non empty FinSequence
st n <>
0 & N is_Multilayer_perceptron_with k,(n+
1)
holds
ex k1
be FinSequence
of NAT,
N1
be non empty FinSequence,
NN
be Function
of REAL-NS (k.(n+
1)), REAL-NS (k.(n+
2))
st N1=N|n & k1 = k| (n+
1) & NN=N.(n+
1) &
N1 is_Multilayer_perceptron_with k1,n &
OutPutFunc(N,k,n+
1) = NN* OutPutFunc(N1,k1,n);
definition
let n
be Nat,
k
be FinSequence
of NAT;
func NEURONS(n,k) -> Subset
of
Funcs(the carrier
of REAL-NS (k.
1),the carrier
of REAL-NS (k.(n+
1)))
equals
:: NEURONS1:def 4
{ F
where F
is Function
of REAL-NS (k.
1),REAL-NS (k.(n+
1))
:
ex N
be FinSequence st N is_Multilayer_perceptron_with k,n
& F = OutPutFunc(N,k,n) };
end;
theorem :: NEURONS1:32
for n
be Nat,
k
be FinSequence
of NAT,
S
be non empty compact strict TopSpace,
M
be non empty SubSpace
of MetricSpaceNorm REAL-NS (k.
1),
X
be non empty Subset
of REAL-NS (k.
1),
T
be NormedLinearTopSpace
st
S = TopSpaceMetr(M)
& the carrier
of M = X
& X
is compact
& T
is complete & T
is finite-dimensional
& dim (T) <>
0
& REAL-NS (k.(n+
1)) = the NORMSTR
of T
holds
for G
be Subset
of Funcs(the carrier
of M, the carrier
of T),
F
be non empty Subset
of R_NormSpace_of_ContinuousFunctions(S,T)
st G = F & G c= { f|X
where f
is Function
of REAL-NS (k.
1),
REAL-NS (k.(n+
1)): f
in NEURONS(n,k) }
holds
Cl(F)
is compact
iff
G
is equibounded & G
is equicontinuous;
theorem :: NEURONS1:33
for n
be Nat,
k
be FinSequence
of NAT,
S
be non empty compact strict TopSpace,
X
be non empty Subset
of REAL-NS (k.
1),
T
be NormedLinearTopSpace
st
S
is SubSpace
of TopSpaceNorm REAL-NS (k.
1)
& the carrier
of S = X
& X
is compact
& T
is complete & T
is finite-dimensional
& dim (T) <>
0
& REAL-NS (k.(n+
1)) = the NORMSTR
of T
holds
for G
be non empty Subset
of R_NormSpace_of_ContinuousFunctions(S,T)
st G c= { f|X
where f
is Function
of REAL-NS (k.
1),
REAL-NS (k.(n+
1)): f
in NEURONS(n,k) }
&
ex K,D
be Real st
0 < K &
0 < D
&
for F
be Function
of X,T st F
in G
holds
( (
for x,y
be Point
of REAL-NS (k.
1)
st x
in X & y
in X
holds ||.F/.x-F/.y.|| <= D*||.x-y.|| )
&
(
for x
be Point
of REAL-NS (k.
1) st x
in X
holds ||.F/.x.|| <= K ) )
holds
Cl(G)
is compact;
definition
let X,Y
be RealNormSpace;
let F
be Function
of X,Y;
let D,K
be Real;
pred F is_LayerFunc D,K means
:: NEURONS1:def 5
(
for x,y
be Point
of X
holds ||.F.x-F.y.|| <= D*||.x-y.|| )
&
(
for x
be Point
of X
holds ||.F.x.|| <= K );
end;
definition
let n
be Nat;
let k
be FinSequence
of NAT;
let D,K
be Real;
let N
be FinSequence;
pred N is_LayerFunc_Seq D,K,k,n means
:: NEURONS1:def 6
len N = n
& N is_Multilayer_perceptron_with k,n
&
for i
be Nat st
1<=i & i < len k
holds
ex Ni
be Function
of REAL-NS (k.i),REAL-NS (k.(i+
1))
st N.i = Ni & Ni is_LayerFunc D,K;
end;
theorem :: NEURONS1:34
for D,K
be Real st
0<= D &
0<= K
holds
for n
be Nat,
k
be FinSequence
of NAT,
N
be non empty FinSequence
st N is_LayerFunc_Seq D,K,k,n
holds OutPutFunc(N,k,n) is_LayerFunc D|^n,K;
theorem :: NEURONS1:35
for n
be Nat,
k
be FinSequence
of NAT,
S
be non empty compact strict TopSpace,
X
be non empty Subset
of REAL-NS (k.
1),
T
be NormedLinearTopSpace
st
S
is SubSpace
of TopSpaceNorm REAL-NS (k.
1)
& the carrier
of S = X
& X
is compact
& T
is complete & T
is finite-dimensional
& dim (T) <>
0
& REAL-NS (k.(n+
1)) = the NORMSTR
of T
holds
for G
be non empty Subset
of R_NormSpace_of_ContinuousFunctions(S,T),
D,K
be Real
st
0 < D &
0 < K
& G c= { F|X
where F
is Function
of REAL-NS (k.
1),REAL-NS (k.(n+
1))
:
ex N
be non empty FinSequence
st N is_LayerFunc_Seq D,K,k,n
& F = OutPutFunc(N,k,n) }
holds
Cl(G)
is compact;