:: Preliminaries to Circuits, I
:: by Yatsuka Nakamura, Piotr Rudnicki, Andrzej Trybulec and Pauline N. Kawamoto
::
:: Received November 17, 1994
:: Copyright (c) 1994-2011 Association of Mizar Users


begin

scheme :: PRE_CIRC:sch 1
FraenkelFinIm{ F1() -> non empty finite set , F2( set ) -> set , P1[ set ] } :
{ F2(x) where x is Element of F1() : P1[x] } is finite
proof end;

theorem :: PRE_CIRC:1
canceled;

theorem :: PRE_CIRC:2
for f being Function
for x, y being set st dom f = {x} & rng f = {y} holds
f = {[x,y]}
proof end;

begin

theorem :: PRE_CIRC:3
canceled;

theorem :: PRE_CIRC:4
canceled;

theorem :: PRE_CIRC:5
for I being set
for MSS being ManySortedSet of I holds (MSS #) . (<*> I) = {{}}
proof end;

scheme :: PRE_CIRC:sch 2
MSSLambda2Part{ F1() -> set , P1[ set ], F2( set ) -> set , F3( set ) -> set } :
ex f being ManySortedSet of F1() st
for i being Element of F1() st i in F1() holds
( ( P1[i] implies f . i = F2(i) ) & ( P1[i] implies f . i = F3(i) ) )
proof end;

registration
let I be set ;
cluster Relation-like V2() I -defined Function-like total V38() set ;
existence
ex b1 being ManySortedSet of I st
( b1 is non-empty & b1 is finite-yielding )
proof end;
end;

registration
let I be set ;
let M be ManySortedSet of I;
let A be Subset of I;
cluster M | A -> A -defined total A -defined Function;
coherence
for b1 being A -defined Function st b1 = M | A holds
b1 is total
proof end;
end;

registration
let I be set ;
let M be ManySortedSet of I;
let A be Subset of I;
cluster M | A -> total ;
coherence
M | A is total
;
end;

registration
let M be non-empty Function;
let A be set ;
cluster M | A -> non-empty ;
coherence
M | A is non-empty
proof end;
end;

theorem Th6: :: PRE_CIRC:6
for I being non empty set
for B being V2() ManySortedSet of I holds not union (rng B) is empty
proof end;

theorem Th7: :: PRE_CIRC:7
for I being set holds uncurry (I --> {}) = {}
proof end;

theorem :: PRE_CIRC:8
for I being non empty set
for A being set
for B being V2() ManySortedSet of I
for F being ManySortedFunction of I --> A,B holds dom (commute F) = A
proof end;

scheme :: PRE_CIRC:sch 3
LambdaRecCorrD{ F1() -> non empty set , F2() -> Element of F1(), F3( Nat, Element of F1()) -> Element of F1() } :
( ex f being Function of NAT,F1() st
( f . 0 = F2() & ( for i being Nat holds f . (i + 1) = F3(i,(f . i)) ) ) & ( for f1, f2 being Function of NAT,F1() st f1 . 0 = F2() & ( for i being Nat holds f1 . (i + 1) = F3(i,(f1 . i)) ) & f2 . 0 = F2() & ( for i being Nat holds f2 . (i + 1) = F3(i,(f2 . i)) ) holds
f1 = f2 ) )
proof end;

scheme :: PRE_CIRC:sch 4
LambdaMSFD{ F1() -> non empty set , F2() -> Subset of F1(), F3() -> ManySortedSet of F2(), F4() -> ManySortedSet of F2(), F5( set ) -> set } :
ex f being ManySortedFunction of F3(),F4() st
for i being Element of F1() st i in F2() holds
f . i = F5(i)
provided
A1: for i being Element of F1() st i in F2() holds
F5(i) is Function of (F3() . i),(F4() . i)
proof end;

theorem :: PRE_CIRC:9
for I being set
for f being V2() ManySortedSet of I
for g being Function
for s being Element of product f st dom g c= dom f & ( for x being set st x in dom g holds
g . x in f . x ) holds
s +* g is Element of product f
proof end;

theorem :: PRE_CIRC:10
for A, B being non empty set
for C being V2() ManySortedSet of A
for InpFs being ManySortedFunction of A --> B,C
for b being Element of B ex c being ManySortedSet of A st
( c = (commute InpFs) . b & c in C )
proof end;

theorem :: PRE_CIRC:11
canceled;

theorem :: PRE_CIRC:12
for n being Element of NAT
for a being set holds product (n |-> {a}) = {(n |-> a)}
proof end;

begin

registration
let D be non empty set ;
cluster -> finite Element of FinTrees D;
coherence
for b1 being Element of FinTrees D holds b1 is finite
proof end;
end;

registration
let T be finite DecoratedTree;
let t be Element of dom T;
cluster T | t -> finite ;
coherence
T | t is finite
proof end;
end;

theorem Th13: :: PRE_CIRC:13
for T being finite Tree
for p being Element of T holds T | p, { t where t is Element of T : p is_a_prefix_of t } are_equipotent
proof end;

registration
let T be finite DecoratedTree-like Function;
let t be Element of dom T;
let T1 be finite DecoratedTree;
cluster T with-replacement (t,T1) -> finite ;
coherence
T with-replacement (t,T1) is finite
proof end;
end;

theorem Th14: :: PRE_CIRC:14
for T, T1 being finite Tree
for p being Element of T holds T with-replacement (p,T1) = { t where t is Element of T : not p is_a_prefix_of t } \/ { (p ^ t1) where t1 is Element of T1 : verum }
proof end;

theorem Th15: :: PRE_CIRC:15
for T, T1 being finite Tree
for p being Element of T
for f being FinSequence of NAT st f in T with-replacement (p,T1) & p is_a_prefix_of f holds
ex t1 being Element of T1 st f = p ^ t1
proof end;

theorem Th16: :: PRE_CIRC:16
for p being Tree-yielding FinSequence
for k being Element of NAT st k + 1 in dom p holds
(tree p) | <*k*> = p . (k + 1)
proof end;

theorem :: PRE_CIRC:17
for q being DTree-yielding FinSequence
for k being Element of NAT st k + 1 in dom q holds
<*k*> in tree (doms q)
proof end;

theorem Th18: :: PRE_CIRC:18
for p, q being Tree-yielding FinSequence
for k being Element of NAT st len p = len q & k + 1 in dom p & ( for i being Element of NAT st i in dom p & i <> k + 1 holds
p . i = q . i ) holds
for t being Tree st q . (k + 1) = t holds
tree q = (tree p) with-replacement (<*k*>,t)
proof end;

theorem :: PRE_CIRC:19
for e1, e2 being finite DecoratedTree
for x being set
for k being Element of NAT
for p being DTree-yielding FinSequence st <*k*> in dom e1 & e1 = x -tree p holds
ex q being DTree-yielding FinSequence st
( e1 with-replacement (<*k*>,e2) = x -tree q & len q = len p & q . (k + 1) = e2 & ( for i being Element of NAT st i in dom p & i <> k + 1 holds
q . i = p . i ) )
proof end;

theorem :: PRE_CIRC:20
for T being finite Tree
for p being Element of T st p <> {} holds
card (T | p) < card T
proof end;

theorem :: PRE_CIRC:21
canceled;

theorem Th22: :: PRE_CIRC:22
for T, T1 being finite Tree
for p being Element of T holds (card (T with-replacement (p,T1))) + (card (T | p)) = (card T) + (card T1)
proof end;

theorem :: PRE_CIRC:23
for T, T1 being finite DecoratedTree
for p being Element of dom T holds (card (T with-replacement (p,T1))) + (card (T | p)) = (card T) + (card T1)
proof end;

registration
let x be set ;
cluster root-tree x -> finite ;
coherence
root-tree x is finite
proof end;
end;

theorem :: PRE_CIRC:24
for x being set holds card (root-tree x) = 1
proof end;

begin

theorem :: PRE_CIRC:25
for F being non empty finite set holds (card F) - 1 = (card F) -' 1
proof end;

theorem :: PRE_CIRC:26
for f, g being Function holds
( dom f, dom g are_equipotent iff f,g are_equipotent )
proof end;

theorem :: PRE_CIRC:27
for f, g being finite Function st dom f misses dom g holds
card (f +* g) = (card f) + (card g)
proof end;

theorem :: PRE_CIRC:28
canceled;

theorem :: PRE_CIRC:29
for n being Nat holds not { k where k is Element of NAT : k > n } is finite
proof end;