:: Cardinal Numbers
:: by Grzegorz Bancerek
::
:: Received September 19, 1989
:: Copyright (c) 1990-2011 Association of Mizar Users


begin

notation
synonym 0 for {} ;
end;

definition
let IT be set ;
attr IT is cardinal means :Def1: :: CARD_1:def 1
ex B being Ordinal st
( IT = B & ( for A being Ordinal st A,B are_equipotent holds
B c= A ) );
end;

:: deftheorem Def1 defines cardinal CARD_1:def 1 :
for IT being set holds
( IT is cardinal iff ex B being Ordinal st
( IT = B & ( for A being Ordinal st A,B are_equipotent holds
B c= A ) ) );

registration
cluster cardinal set ;
existence
ex b1 being set st b1 is cardinal
proof end;
end;

definition
mode Cardinal is cardinal set ;
end;

registration
cluster cardinal -> ordinal set ;
coherence
for b1 being set st b1 is cardinal holds
b1 is ordinal
proof end;
end;

theorem :: CARD_1:1
canceled;

theorem :: CARD_1:2
canceled;

theorem :: CARD_1:3
canceled;

theorem Th4: :: CARD_1:4
for X being set ex A being Ordinal st X,A are_equipotent
proof end;

theorem :: CARD_1:5
canceled;

theorem :: CARD_1:6
canceled;

theorem :: CARD_1:7
canceled;

theorem Th8: :: CARD_1:8
for M, N being Cardinal holds
( M = N iff M,N are_equipotent )
proof end;

theorem :: CARD_1:9
canceled;

theorem :: CARD_1:10
canceled;

theorem :: CARD_1:11
canceled;

theorem :: CARD_1:12
canceled;

theorem :: CARD_1:13
for M, N being Cardinal holds
( M in N iff ( M c= N & M <> N ) )
proof end;

theorem :: CARD_1:14
for M, N being Cardinal holds
( M in N iff not N c= M ) by ORDINAL1:7, ORDINAL1:26;

definition
let X be set ;
canceled;
canceled;
canceled;
func card X -> Cardinal means :Def5: :: CARD_1:def 5
X,it are_equipotent ;
existence
ex b1 being Cardinal st X,b1 are_equipotent
proof end;
uniqueness
for b1, b2 being Cardinal st X,b1 are_equipotent & X,b2 are_equipotent holds
b1 = b2
proof end;
projectivity
for b1, b2 being Cardinal st b2,b1 are_equipotent holds
b1,b1 are_equipotent
;
end;

:: deftheorem CARD_1:def 2 :
canceled;

:: deftheorem CARD_1:def 3 :
canceled;

:: deftheorem CARD_1:def 4 :
canceled;

:: deftheorem Def5 defines card CARD_1:def 5 :
for X being set
for b2 being Cardinal holds
( b2 = card X iff X,b2 are_equipotent );

registration
cluster empty -> cardinal set ;
coherence
for b1 being set st b1 is empty holds
b1 is cardinal
proof end;
end;

registration
let X be empty set ;
cluster card X -> empty ;
coherence
card X is empty
by Def5;
end;

registration
let X be non empty set ;
cluster card X -> non empty ;
coherence
not card X is empty
proof end;
end;

theorem :: CARD_1:15
canceled;

theorem :: CARD_1:16
canceled;

theorem :: CARD_1:17
canceled;

theorem :: CARD_1:18
canceled;

theorem :: CARD_1:19
canceled;

theorem :: CARD_1:20
canceled;

theorem Th21: :: CARD_1:21
for X, Y being set holds
( X,Y are_equipotent iff card X = card Y )
proof end;

theorem Th22: :: CARD_1:22
for R being Relation st R is well-ordering holds
field R, order_type_of R are_equipotent
proof end;

theorem Th23: :: CARD_1:23
for X being set
for M being Cardinal st X c= M holds
card X c= M
proof end;

theorem Th24: :: CARD_1:24
for A being Ordinal holds card A c= A
proof end;

theorem :: CARD_1:25
for X being set
for M being Cardinal st X in M holds
card X in M by Th24, ORDINAL1:22;

theorem Th26: :: CARD_1:26
for X, Y being set holds
( card X c= card Y iff ex f being Function st
( f is one-to-one & dom f = X & rng f c= Y ) )
proof end;

theorem Th27: :: CARD_1:27
for X, Y being set st X c= Y holds
card X c= card Y
proof end;

theorem :: CARD_1:28
for X, Y being set holds
( card X c= card Y iff ex f being Function st
( dom f = Y & X c= rng f ) )
proof end;

theorem Th29: :: CARD_1:29
for X being set holds not X, bool X are_equipotent
proof end;

theorem Th30: :: CARD_1:30
for X being set holds card X in card (bool X)
proof end;

definition
let X be set ;
func nextcard X -> Cardinal means :Def6: :: CARD_1:def 6
( card X in it & ( for M being Cardinal st card X in M holds
it c= M ) );
existence
ex b1 being Cardinal st
( card X in b1 & ( for M being Cardinal st card X in M holds
b1 c= M ) )
proof end;
uniqueness
for b1, b2 being Cardinal st card X in b1 & ( for M being Cardinal st card X in M holds
b1 c= M ) & card X in b2 & ( for M being Cardinal st card X in M holds
b2 c= M ) holds
b1 = b2
proof end;
end;

:: deftheorem Def6 defines nextcard CARD_1:def 6 :
for X being set
for b2 being Cardinal holds
( b2 = nextcard X iff ( card X in b2 & ( for M being Cardinal st card X in M holds
b2 c= M ) ) );

theorem :: CARD_1:31
canceled;

theorem :: CARD_1:32
canceled;

theorem :: CARD_1:33
for X being set holds {} in nextcard X
proof end;

theorem Th34: :: CARD_1:34
for X, Y being set st card X = card Y holds
nextcard X = nextcard Y
proof end;

theorem Th35: :: CARD_1:35
for X, Y being set st X,Y are_equipotent holds
nextcard X = nextcard Y
proof end;

theorem Th36: :: CARD_1:36
for A being Ordinal holds A in nextcard A
proof end;

definition
let M be Cardinal;
attr M is limit_cardinal means :Def7: :: CARD_1:def 7
for N being Cardinal holds not M = nextcard N;
end;

:: deftheorem Def7 defines limit_cardinal CARD_1:def 7 :
for M being Cardinal holds
( M is limit_cardinal iff for N being Cardinal holds not M = nextcard N );

definition
let A be Ordinal;
func alef A -> set means :Def8: :: CARD_1:def 8
ex S being T-Sequence st
( it = last S & dom S = succ A & S . {} = card omega & ( for B being Ordinal st succ B in succ A holds
S . (succ B) = nextcard (union {(S . B)}) ) & ( for B being Ordinal st B in succ A & B <> {} & B is limit_ordinal holds
S . B = card (sup (S | B)) ) );
correctness
existence
ex b1 being set ex S being T-Sequence st
( b1 = last S & dom S = succ A & S . {} = card omega & ( for B being Ordinal st succ B in succ A holds
S . (succ B) = nextcard (union {(S . B)}) ) & ( for B being Ordinal st B in succ A & B <> {} & B is limit_ordinal holds
S . B = card (sup (S | B)) ) )
;
uniqueness
for b1, b2 being set st ex S being T-Sequence st
( b1 = last S & dom S = succ A & S . {} = card omega & ( for B being Ordinal st succ B in succ A holds
S . (succ B) = nextcard (union {(S . B)}) ) & ( for B being Ordinal st B in succ A & B <> {} & B is limit_ordinal holds
S . B = card (sup (S | B)) ) ) & ex S being T-Sequence st
( b2 = last S & dom S = succ A & S . {} = card omega & ( for B being Ordinal st succ B in succ A holds
S . (succ B) = nextcard (union {(S . B)}) ) & ( for B being Ordinal st B in succ A & B <> {} & B is limit_ordinal holds
S . B = card (sup (S | B)) ) ) holds
b1 = b2
;
proof end;
end;

:: deftheorem Def8 defines alef CARD_1:def 8 :
for A being Ordinal
for b2 being set holds
( b2 = alef A iff ex S being T-Sequence st
( b2 = last S & dom S = succ A & S . {} = card omega & ( for B being Ordinal st succ B in succ A holds
S . (succ B) = nextcard (union {(S . B)}) ) & ( for B being Ordinal st B in succ A & B <> {} & B is limit_ordinal holds
S . B = card (sup (S | B)) ) ) );

Lm1: now
deffunc H1( Ordinal, T-Sequence) -> Cardinal = card (sup $2);
deffunc H2( Ordinal, set ) -> Cardinal = nextcard (union {$2});
deffunc H3( Ordinal) -> set = alef $1;
A1: for A being Ordinal
for x being set holds
( x = H3(A) iff ex S being T-Sequence st
( x = last S & dom S = succ A & S . {} = card omega & ( for C being Ordinal st succ C in succ A holds
S . (succ C) = H2(C,S . C) ) & ( for C being Ordinal st C in succ A & C <> {} & C is limit_ordinal holds
S . C = H1(C,S | C) ) ) ) by Def8;
H3( {} ) = card omega from ORDINAL2:sch 8(A1);
hence alef 0 = card omega ; :: thesis: ( ( for A being Ordinal holds H3( succ A) = H2(A,H3(A)) ) & ( for A being Ordinal st A <> {} & A is limit_ordinal holds
for S being T-Sequence st dom S = A & ( for B being Ordinal st B in A holds
S . B = alef B ) holds
alef A = card (sup S) ) )

thus for A being Ordinal holds H3( succ A) = H2(A,H3(A)) from ORDINAL2:sch 9(A1); :: thesis: for A being Ordinal st A <> {} & A is limit_ordinal holds
for S being T-Sequence st dom S = A & ( for B being Ordinal st B in A holds
S . B = alef B ) holds
alef A = card (sup S)

thus for A being Ordinal st A <> {} & A is limit_ordinal holds
for S being T-Sequence st dom S = A & ( for B being Ordinal st B in A holds
S . B = alef B ) holds
alef A = card (sup S) :: thesis: verum
proof
let A be Ordinal; :: thesis: ( A <> {} & A is limit_ordinal implies for S being T-Sequence st dom S = A & ( for B being Ordinal st B in A holds
S . B = alef B ) holds
alef A = card (sup S) )

assume A2: ( A <> {} & A is limit_ordinal ) ; :: thesis: for S being T-Sequence st dom S = A & ( for B being Ordinal st B in A holds
S . B = alef B ) holds
alef A = card (sup S)

let S be T-Sequence; :: thesis: ( dom S = A & ( for B being Ordinal st B in A holds
S . B = alef B ) implies alef A = card (sup S) )

assume that
A3: dom S = A and
A4: for B being Ordinal st B in A holds
S . B = H3(B) ; :: thesis: alef A = card (sup S)
thus H3(A) = H1(A,S) from ORDINAL2:sch 10(A1, A2, A3, A4); :: thesis: verum
end;
end;

deffunc H1( Ordinal) -> set = alef $1;

registration
let A be Ordinal;
cluster alef A -> cardinal ;
coherence
alef A is cardinal
proof end;
end;

theorem :: CARD_1:37
canceled;

theorem :: CARD_1:38
canceled;

theorem Th39: :: CARD_1:39
for A being Ordinal holds alef (succ A) = nextcard (alef A)
proof end;

theorem :: CARD_1:40
for A being Ordinal st A <> {} & A is limit_ordinal holds
for S being T-Sequence st dom S = A & ( for B being Ordinal st B in A holds
S . B = alef B ) holds
alef A = card (sup S) by Lm1;

theorem Th41: :: CARD_1:41
for A, B being Ordinal holds
( A in B iff alef A in alef B )
proof end;

theorem Th42: :: CARD_1:42
for A, B being Ordinal st alef A = alef B holds
A = B
proof end;

theorem :: CARD_1:43
for A, B being Ordinal holds
( A c= B iff alef A c= alef B )
proof end;

theorem :: CARD_1:44
for X, Y, Z being set st X c= Y & Y c= Z & X,Z are_equipotent holds
( X,Y are_equipotent & Y,Z are_equipotent )
proof end;

theorem :: CARD_1:45
for Y, X being set st bool Y c= X holds
( card Y in card X & not Y,X are_equipotent )
proof end;

theorem Th46: :: CARD_1:46
for X being set st X, {} are_equipotent holds
X = {}
proof end;

theorem :: CARD_1:47
card {} = {} ;

theorem Th48: :: CARD_1:48
for X, x being set holds
( X,{x} are_equipotent iff ex x being set st X = {x} )
proof end;

theorem :: CARD_1:49
for X, x being set holds
( card X = card {x} iff ex x being set st X = {x} )
proof end;

theorem :: CARD_1:50
for x being set holds card {x} = 1
proof end;

theorem :: CARD_1:51
canceled;

theorem :: CARD_1:52
canceled;

theorem :: CARD_1:53
canceled;

theorem :: CARD_1:54
canceled;

theorem :: CARD_1:55
canceled;

theorem :: CARD_1:56
canceled;

theorem :: CARD_1:57
canceled;

theorem Th58: :: CARD_1:58
for X, X1, Y, Y1 being set st X misses X1 & Y misses Y1 & X,Y are_equipotent & X1,Y1 are_equipotent holds
X \/ X1,Y \/ Y1 are_equipotent
proof end;

theorem Th59: :: CARD_1:59
for x, X, y being set st x in X & y in X holds
X \ {x},X \ {y} are_equipotent
proof end;

theorem Th60: :: CARD_1:60
for X being set
for f being Function st X c= dom f & f is one-to-one holds
X,f .: X are_equipotent
proof end;

theorem Th61: :: CARD_1:61
for X, Y, x, y being set st X,Y are_equipotent & x in X & y in Y holds
X \ {x},Y \ {y} are_equipotent
proof end;

theorem Th62: :: CARD_1:62
for X, Y being set st succ X, succ Y are_equipotent holds
X,Y are_equipotent
proof end;

theorem Th63: :: CARD_1:63
for n being natural number holds
( n = {} or ex m being natural number st n = succ m )
proof end;

theorem :: CARD_1:64
canceled;

Lm2: for n, m being natural number st n,m are_equipotent holds
n = m
proof end;

theorem Th65: :: CARD_1:65
for x being set st x in omega holds
x is cardinal
proof end;

registration
cluster natural -> cardinal set ;
correctness
coherence
for b1 being number st b1 is natural holds
b1 is cardinal
;
proof end;
end;

theorem :: CARD_1:66
canceled;

theorem :: CARD_1:67
canceled;

theorem Th68: :: CARD_1:68
for X, Y being set st X,Y are_equipotent & X is finite holds
Y is finite
proof end;

theorem Th69: :: CARD_1:69
for n being natural number holds
( n is finite & card n is finite )
proof end;

theorem :: CARD_1:70
canceled;

theorem :: CARD_1:71
for n, m being natural number st card n = card m holds
n = m
proof end;

theorem :: CARD_1:72
for n, m being natural number holds
( card n c= card m iff n c= m )
proof end;

theorem Th73: :: CARD_1:73
for n, m being natural number holds
( card n in card m iff n in m )
proof end;

theorem Th74: :: CARD_1:74
for X being set st X is finite holds
ex n being natural number st X,n are_equipotent
proof end;

theorem :: CARD_1:75
canceled;

theorem Th76: :: CARD_1:76
for n being natural number holds nextcard (card n) = card (succ n)
proof end;

definition
let n be natural number ;
:: original: succ
redefine func succ n -> Element of omega ;
coherence
succ n is Element of omega
by ORDINAL1:def 13;
end;

definition
let X be finite set ;
:: original: card
redefine func card X -> Element of omega ;
coherence
card X is Element of omega
proof end;
end;

theorem :: CARD_1:77
canceled;

theorem :: CARD_1:78
canceled;

theorem :: CARD_1:79
canceled;

theorem :: CARD_1:80
canceled;

theorem :: CARD_1:81
canceled;

theorem :: CARD_1:82
for X being set st X is finite holds
nextcard X is finite
proof end;

scheme :: CARD_1:sch 1
CardinalInd{ P1[ set ] } :
for M being Cardinal holds P1[M]
provided
A1: P1[ {} ] and
A2: for M being Cardinal st P1[M] holds
P1[ nextcard M] and
A3: for M being Cardinal st M <> {} & M is limit_cardinal & ( for N being Cardinal st N in M holds
P1[N] ) holds
P1[M]
proof end;

scheme :: CARD_1:sch 2
CardinalCompInd{ P1[ set ] } :
for M being Cardinal holds P1[M]
provided
A1: for M being Cardinal st ( for N being Cardinal st N in M holds
P1[N] ) holds
P1[M]
proof end;

theorem Th83: :: CARD_1:83
alef 0 = omega
proof end;

registration
cluster omega -> cardinal number ;
coherence
for b1 being number st b1 = omega holds
b1 is cardinal
by Th83;
end;

theorem :: CARD_1:84
card omega = omega by Lm1, Th83;

registration
cluster omega -> limit_cardinal ;
coherence
omega is limit_cardinal
proof end;
end;

registration
cluster -> finite Element of omega ;
coherence
for b1 being Element of omega holds b1 is finite
by Th69;
end;

registration
cluster epsilon-transitive epsilon-connected ordinal finite cardinal set ;
existence
ex b1 being Cardinal st b1 is finite
proof end;
end;

theorem :: CARD_1:85
canceled;

theorem :: CARD_1:86
for M being finite Cardinal ex n being natural number st M = card n
proof end;

registration
let X be finite set ;
cluster card X -> finite ;
coherence
card X is finite
;
end;

Lm3: for A being Ordinal
for n being natural number st A,n are_equipotent holds
A = n
proof end;

Lm4: for A being Ordinal holds
( A is finite iff A in omega )
proof end;

registration
cluster omega -> infinite ;
coherence
not omega is finite
proof end;
end;

registration
cluster infinite set ;
existence
not for b1 being set holds b1 is finite
proof end;
end;

registration
let X be infinite set ;
cluster card X -> infinite ;
coherence
not card X is finite
proof end;
end;

begin

theorem Th87: :: CARD_1:87
1 = {0}
proof end;

theorem Th88: :: CARD_1:88
2 = {0,1}
proof end;

theorem Th89: :: CARD_1:89
3 = {0,1,2}
proof end;

theorem Th90: :: CARD_1:90
4 = {0,1,2,3}
proof end;

theorem Th91: :: CARD_1:91
5 = {0,1,2,3,4}
proof end;

theorem Th92: :: CARD_1:92
6 = {0,1,2,3,4,5}
proof end;

theorem Th93: :: CARD_1:93
7 = {0,1,2,3,4,5,6}
proof end;

theorem Th94: :: CARD_1:94
8 = {0,1,2,3,4,5,6,7}
proof end;

theorem Th95: :: CARD_1:95
9 = {0,1,2,3,4,5,6,7,8}
proof end;

theorem :: CARD_1:96
10 = {0,1,2,3,4,5,6,7,8,9}
proof end;

theorem :: CARD_1:97
for f being Function st not dom f is finite & f is one-to-one holds
not rng f is finite
proof end;

definition
canceled;
canceled;
canceled;
let n be natural number ;
func Segm n -> set equals :: CARD_1:def 12
n;
coherence
n is set
;
end;

:: deftheorem CARD_1:def 9 :
canceled;

:: deftheorem CARD_1:def 10 :
canceled;

:: deftheorem CARD_1:def 11 :
canceled;

:: deftheorem defines Segm CARD_1:def 12 :
for n being natural number holds Segm n = n;

definition
let n be natural number ;
:: original: Segm
redefine func Segm n -> Subset of omega;
coherence
Segm n is Subset of omega
proof end;
end;

theorem :: CARD_1:98
canceled;

theorem :: CARD_1:99
canceled;

theorem :: CARD_1:100
canceled;

theorem :: CARD_1:101
canceled;

theorem :: CARD_1:102
for A being Ordinal
for n being natural number st A,n are_equipotent holds
A = n by Lm3;

theorem :: CARD_1:103
for A being Ordinal holds
( A is finite iff A in omega ) by Lm4;

registration
cluster natural -> finite set ;
coherence
for b1 being set st b1 is natural holds
b1 is finite
proof end;
end;

registration
let A be infinite set ;
cluster bool A -> infinite ;
coherence
not bool A is finite
proof end;
let B be non empty set ;
cluster [:A,B:] -> infinite ;
coherence
not [:A,B:] is finite
proof end;
cluster [:B,A:] -> infinite ;
coherence
not [:B,A:] is finite
proof end;
end;

registration
let X be infinite set ;
cluster infinite Element of bool X;
existence
not for b1 being Subset of X holds b1 is finite
proof end;
end;

registration
cluster ordinal finite -> natural set ;
coherence
for b1 being number st b1 is finite & b1 is ordinal holds
b1 is natural
proof end;
end;

theorem Th104: :: CARD_1:104
for f being Function holds card f = card (dom f)
proof end;

registration
let X be finite set ;
cluster RelIncl X -> finite ;
coherence
RelIncl X is finite
proof end;
end;

theorem :: CARD_1:105
for X being set st RelIncl X is finite holds
X is finite
proof end;

theorem :: CARD_1:106
for x being set
for k being natural number holds card (k --> x) = k
proof end;

begin

definition
let N be Cardinal;
let X be set ;
attr X is N -element means :Def13: :: CARD_1:def 13
card X = N;
end;

:: deftheorem Def13 defines -element CARD_1:def 13 :
for N being Cardinal
for X being set holds
( X is N -element iff card X = N );

registration
let N be Cardinal;
cluster N -element set ;
existence
ex b1 being set st b1 is N -element
proof end;
end;

registration
cluster 0 -element -> empty set ;
coherence
for b1 being set st b1 is 0 -element holds
b1 is empty
proof end;
cluster empty -> 0 -element set ;
coherence
for b1 being set st b1 is empty holds
b1 is 0 -element
proof end;
end;

registration
let x be set ;
cluster {x} -> 1 -element ;
coherence
{x} is 1 -element
proof end;
end;

registration
let N be Cardinal;
cluster Relation-like Function-like N -element set ;
existence
ex b1 being Function st b1 is N -element
proof end;
end;

registration
let N be Cardinal;
let f be N -element Function;
cluster proj1 f -> N -element ;
coherence
dom f is N -element
proof end;
end;