:: TRIANG_1 semantic presentation

scheme :: TRIANG_1:sch 1
s1{ F1() -> Nat, P1[ set ] } :
for b1 being Nat st b1 <= F1() holds
P1[b1]
provided
E1: P1[F1()] and
E2: for b1 being Nat st b1 < F1() & P1[b1 + 1] holds
P1[b1]
proof end;

registration
let c1 be Nat;
cluster Seg (a1 + 1) -> non empty ;
coherence
not Seg (c1 + 1) is empty
by FINSEQ_1:6;
end;

registration
let c1 be non empty set ;
let c2 be Order of c1;
cluster RelStr(# a1,a2 #) -> non empty ;
coherence
not RelStr(# c1,c2 #) is empty
;
end;

theorem Th1: :: TRIANG_1:1
for b1 being set holds {} |_2 b1 = {}
proof end;

registration
let c1 be set ;
cluster non empty Element of bool (Fin a1);
existence
not for b1 being Subset of (Fin c1) holds b1 is empty
proof end;
end;

registration
let c1 be non empty set ;
cluster non empty with_non-empty_elements Element of bool (Fin a1);
existence
ex b1 being Subset of (Fin c1) st
( not b1 is empty & b1 is with_non-empty_elements )
proof end;
end;

registration
let c1 be non empty set ;
let c2 be non empty with_non-empty_elements Subset of (Fin c1);
cluster non empty Element of a2;
existence
not for b1 being Element of c2 holds b1 is empty
proof end;
end;

registration
let c1 be non empty set ;
cluster with_non-empty_element Element of bool (Fin a1);
existence
ex b1 being Subset of (Fin c1) st b1 is with_non-empty_element
proof end;
end;

definition
let c1 be non empty set ;
let c2 be Order of c1;
let c3 be Subset of c1;
redefine func |_2 as c2 |_2 c3 -> Order of a3;
coherence
c2 |_2 c3 is Order of c3
proof end;
end;

scheme :: TRIANG_1:sch 2
s2{ F1() -> set , F2() -> Subset of F1(), P1[ set ] } :
P1[F2()]
provided
E1: F2() is finite and
E2: P1[ {} F1()] and
E3: for b1 being Element of F1()
for b2 being Subset of F1() st b1 in F2() & b2 c= F2() & P1[b2] holds
P1[b2 \/ {b1}]
proof end;

theorem Th2: :: TRIANG_1:2
for b1 being non empty Poset
for b2 being Subset of b1 st b2 is finite & b2 <> {} & ( for b3, b4 being Element of b1 st b3 in b2 & b4 in b2 & not b3 <= b4 holds
b4 <= b3 ) holds
ex b3 being Element of b1 st
( b3 in b2 & ( for b4 being Element of b1 st b4 in b2 holds
b3 <= b4 ) )
proof end;

registration
let c1 be non empty set ;
let c2 be with_non-empty_element Subset of (Fin c1);
cluster non empty finite Element of a2;
existence
ex b1 being Element of c2 st
( b1 is finite & not b1 is empty )
proof end;
end;

registration
let c1 be non empty Poset;
let c2 be non empty finite Subset of c1;
let c3 be Element of c1;
cluster InitSegm a2,a3 -> finite ;
coherence
InitSegm c2,c3 is finite
proof end;
end;

theorem Th3: :: TRIANG_1:3
for b1, b2 being finite set st b1 c= b2 & card b1 = card b2 holds
b1 = b2
proof end;

definition
let c1 be set ;
let c2 be finite Subset of c1;
let c3 be Order of c1;
assume E2: c3 linearly_orders c2 ;
canceled;
func SgmX c3,c2 -> FinSequence of a1 means :Def2: :: TRIANG_1:def 2
( rng a4 = a2 & ( for b1, b2 being Nat st b1 in dom a4 & b2 in dom a4 & b1 < b2 holds
( a4 /. b1 <> a4 /. b2 & [(a4 /. b1),(a4 /. b2)] in a3 ) ) );
existence
ex b1 being FinSequence of c1 st
( rng b1 = c2 & ( for b2, b3 being Nat st b2 in dom b1 & b3 in dom b1 & b2 < b3 holds
( b1 /. b2 <> b1 /. b3 & [(b1 /. b2),(b1 /. b3)] in c3 ) ) )
proof end;
uniqueness
for b1, b2 being FinSequence of c1 st rng b1 = c2 & ( for b3, b4 being Nat st b3 in dom b1 & b4 in dom b1 & b3 < b4 holds
( b1 /. b3 <> b1 /. b4 & [(b1 /. b3),(b1 /. b4)] in c3 ) ) & rng b2 = c2 & ( for b3, b4 being Nat st b3 in dom b2 & b4 in dom b2 & b3 < b4 holds
( b2 /. b3 <> b2 /. b4 & [(b2 /. b3),(b2 /. b4)] in c3 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 TRIANG_1:def 1 :
canceled;

:: deftheorem Def2 defines SgmX TRIANG_1:def 2 :
for b1 being set
for b2 being finite Subset of b1
for b3 being Order of b1 st b3 linearly_orders b2 holds
for b4 being FinSequence of b1 holds
( b4 = SgmX b3,b2 iff ( rng b4 = b2 & ( for b5, b6 being Nat st b5 in dom b4 & b6 in dom b4 & b5 < b6 holds
( b4 /. b5 <> b4 /. b6 & [(b4 /. b5),(b4 /. b6)] in b3 ) ) ) );

theorem Th4: :: TRIANG_1:4
for b1 being set
for b2 being finite Subset of b1
for b3 being Order of b1
for b4 being FinSequence of b1 st rng b4 = b2 & ( for b5, b6 being Nat st b5 in dom b4 & b6 in dom b4 & b5 < b6 holds
( b4 /. b5 <> b4 /. b6 & [(b4 /. b5),(b4 /. b6)] in b3 ) ) holds
b4 = SgmX b3,b2
proof end;

definition
let c1 be non empty Poset;
func symplexes c1 -> Subset of (Fin the carrier of a1) equals :: TRIANG_1:def 3
{ b1 where B is Element of Fin the carrier of a1 : the InternalRel of a1 linearly_orders b1 } ;
coherence
{ b1 where B is Element of Fin the carrier of c1 : the InternalRel of c1 linearly_orders b1 } is Subset of (Fin the carrier of c1)
proof end;
end;

:: deftheorem Def3 defines symplexes TRIANG_1:def 3 :
for b1 being non empty Poset holds symplexes b1 = { b2 where B is Element of Fin the carrier of b1 : the InternalRel of b1 linearly_orders b2 } ;

registration
let c1 be non empty Poset;
cluster symplexes a1 -> with_non-empty_element ;
coherence
symplexes c1 is with_non-empty_element
proof end;
end;

theorem Th5: :: TRIANG_1:5
for b1 being non empty Poset
for b2 being Element of b1 holds {b2} in symplexes b1
proof end;

theorem Th6: :: TRIANG_1:6
for b1 being non empty Poset holds {} in symplexes b1
proof end;

theorem Th7: :: TRIANG_1:7
for b1 being non empty Poset
for b2, b3 being set st b2 c= b3 & b3 in symplexes b1 holds
b2 in symplexes b1
proof end;

registration
let c1 be set ;
let c2 be non empty Subset of (Fin c1);
cluster -> finite Element of a2;
coherence
for b1 being Element of c2 holds b1 is finite
by FINSUB_1:def 5;
end;

definition
let c1 be set ;
let c2 be non empty Subset of (Fin c1);
redefine mode Element as Element of c2 -> Subset of a1;
coherence
for b1 being Element of c2 holds b1 is Subset of c1
proof end;
end;

theorem Th8: :: TRIANG_1:8
for b1 being set
for b2 being finite Subset of b1
for b3 being Order of b1 st b3 linearly_orders b2 holds
SgmX b3,b2 is one-to-one
proof end;

theorem Th9: :: TRIANG_1:9
for b1 being set
for b2 being finite Subset of b1
for b3 being Order of b1 st b3 linearly_orders b2 holds
len (SgmX b3,b2) = Card b2
proof end;

theorem Th10: :: TRIANG_1:10
for b1 being Nat
for b2 being non empty Poset
for b3 being non empty Element of symplexes b2 st Card b3 = b1 holds
dom (SgmX the InternalRel of b2,b3) = Seg b1
proof end;

registration
let c1 be non empty Poset;
cluster non empty finite Element of symplexes a1;
existence
not for b1 being Element of symplexes c1 holds b1 is empty
proof end;
end;

definition
mode SetSequence is ManySortedSet of NAT ;
end;

definition
let c1 be SetSequence;
attr a1 is lower_non-empty means :Def4: :: TRIANG_1:def 4
for b1 being Nat st not a1 . b1 is empty holds
for b2 being Nat st b2 < b1 holds
not a1 . b2 is empty;
end;

:: deftheorem Def4 defines lower_non-empty TRIANG_1:def 4 :
for b1 being SetSequence holds
( b1 is lower_non-empty iff for b2 being Nat st not b1 . b2 is empty holds
for b3 being Nat st b3 < b2 holds
not b1 . b3 is empty );

registration
cluster lower_non-empty ManySortedSet of NAT ;
existence
ex b1 being SetSequence st b1 is lower_non-empty
proof end;
end;

definition
let c1 be SetSequence;
func FuncsSeq c1 -> SetSequence means :Def5: :: TRIANG_1:def 5
for b1 being Nat holds a2 . b1 = Funcs (a1 . (b1 + 1)),(a1 . b1);
existence
ex b1 being SetSequence st
for b2 being Nat holds b1 . b2 = Funcs (c1 . (b2 + 1)),(c1 . b2)
proof end;
uniqueness
for b1, b2 being SetSequence st ( for b3 being Nat holds b1 . b3 = Funcs (c1 . (b3 + 1)),(c1 . b3) ) & ( for b3 being Nat holds b2 . b3 = Funcs (c1 . (b3 + 1)),(c1 . b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def5 defines FuncsSeq TRIANG_1:def 5 :
for b1, b2 being SetSequence holds
( b2 = FuncsSeq b1 iff for b3 being Nat holds b2 . b3 = Funcs (b1 . (b3 + 1)),(b1 . b3) );

registration
let c1 be lower_non-empty SetSequence;
let c2 be Nat;
cluster (FuncsSeq a1) . a2 -> non empty ;
coherence
not (FuncsSeq c1) . c2 is empty
proof end;
end;

definition
let c1 be Nat;
let c2 be Element of Funcs (Seg c1),(Seg (c1 + 1));
func @ c2 -> FinSequence of REAL equals :: TRIANG_1:def 6
a2;
coherence
c2 is FinSequence of REAL
proof end;
end;

:: deftheorem Def6 defines @ TRIANG_1:def 6 :
for b1 being Nat
for b2 being Element of Funcs (Seg b1),(Seg (b1 + 1)) holds @ b2 = b2;

definition
func NatEmbSeq -> SetSequence means :Def7: :: TRIANG_1:def 7
for b1 being Nat holds a1 . b1 = { b2 where B is Element of Funcs (Seg b1),(Seg (b1 + 1)) : @ b2 is increasing } ;
existence
ex b1 being SetSequence st
for b2 being Nat holds b1 . b2 = { b3 where B is Element of Funcs (Seg b2),(Seg (b2 + 1)) : @ b3 is increasing }
proof end;
uniqueness
for b1, b2 being SetSequence st ( for b3 being Nat holds b1 . b3 = { b4 where B is Element of Funcs (Seg b3),(Seg (b3 + 1)) : @ b4 is increasing } ) & ( for b3 being Nat holds b2 . b3 = { b4 where B is Element of Funcs (Seg b3),(Seg (b3 + 1)) : @ b4 is increasing } ) holds
b1 = b2
proof end;
end;

:: deftheorem Def7 defines NatEmbSeq TRIANG_1:def 7 :
for b1 being SetSequence holds
( b1 = NatEmbSeq iff for b2 being Nat holds b1 . b2 = { b3 where B is Element of Funcs (Seg b2),(Seg (b2 + 1)) : @ b3 is increasing } );

registration
let c1 be Nat;
cluster NatEmbSeq . a1 -> non empty ;
coherence
not NatEmbSeq . c1 is empty
proof end;
end;

registration
let c1 be Nat;
cluster -> Relation-like Function-like Element of NatEmbSeq . a1;
coherence
for b1 being Element of NatEmbSeq . c1 holds
( b1 is Function-like & b1 is Relation-like )
proof end;
end;

definition
let c1 be SetSequence;
mode triangulation of a1 is ManySortedFunction of NatEmbSeq , FuncsSeq a1;
end;

definition
attr a1 is strict;
struct TriangStr -> ;
aggr TriangStr(# SkeletonSeq, FacesAssign #) -> TriangStr ;
sel SkeletonSeq c1 -> SetSequence;
sel FacesAssign c1 -> ManySortedFunction of NatEmbSeq , FuncsSeq the SkeletonSeq of a1;
end;

definition
let c1 be TriangStr ;
canceled;
attr a1 is lower_non-empty means :Def9: :: TRIANG_1:def 9
the SkeletonSeq of a1 is lower_non-empty;
end;

:: deftheorem Def8 TRIANG_1:def 8 :
canceled;

:: deftheorem Def9 defines lower_non-empty TRIANG_1:def 9 :
for b1 being TriangStr holds
( b1 is lower_non-empty iff the SkeletonSeq of b1 is lower_non-empty );

registration
cluster strict lower_non-empty TriangStr ;
existence
ex b1 being TriangStr st
( b1 is lower_non-empty & b1 is strict )
proof end;
end;

registration
let c1 be lower_non-empty TriangStr ;
cluster the SkeletonSeq of a1 -> lower_non-empty ;
coherence
the SkeletonSeq of c1 is lower_non-empty
by Def9;
end;

registration
let c1 be lower_non-empty SetSequence;
let c2 be ManySortedFunction of NatEmbSeq , FuncsSeq c1;
cluster TriangStr(# a1,a2 #) -> lower_non-empty ;
coherence
TriangStr(# c1,c2 #) is lower_non-empty
by Def9;
end;

definition
let c1 be TriangStr ;
let c2 be Nat;
mode Symplex of a1,a2 is Element of the SkeletonSeq of a1 . a2;
end;

definition
let c1 be Nat;
mode Face of a1 is Element of NatEmbSeq . a1;
end;

definition
let c1 be lower_non-empty TriangStr ;
let c2 be Nat;
let c3 be Symplex of c1,(c2 + 1);
let c4 be Face of c2;
assume E13: the SkeletonSeq of c1 . (c2 + 1) <> {} ;
func face c3,c4 -> Symplex of a1,a2 means :Def10: :: TRIANG_1:def 10
for b1, b2 being Function st b1 = the FacesAssign of a1 . a2 & b2 = b1 . a4 holds
a5 = b2 . a3;
existence
ex b1 being Symplex of c1,c2 st
for b2, b3 being Function st b2 = the FacesAssign of c1 . c2 & b3 = b2 . c4 holds
b1 = b3 . c3
proof end;
uniqueness
for b1, b2 being Symplex of c1,c2 st ( for b3, b4 being Function st b3 = the FacesAssign of c1 . c2 & b4 = b3 . c4 holds
b1 = b4 . c3 ) & ( for b3, b4 being Function st b3 = the FacesAssign of c1 . c2 & b4 = b3 . c4 holds
b2 = b4 . c3 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def10 defines face TRIANG_1:def 10 :
for b1 being lower_non-empty TriangStr
for b2 being Nat
for b3 being Symplex of b1,(b2 + 1)
for b4 being Face of b2 st the SkeletonSeq of b1 . (b2 + 1) <> {} holds
for b5 being Symplex of b1,b2 holds
( b5 = face b3,b4 iff for b6, b7 being Function st b6 = the FacesAssign of b1 . b2 & b7 = b6 . b4 holds
b5 = b7 . b3 );

definition
let c1 be non empty Poset;
func Triang c1 -> strict lower_non-empty TriangStr means :: TRIANG_1:def 11
( the SkeletonSeq of a2 . 0 = {{} } & ( for b1 being Nat st b1 > 0 holds
the SkeletonSeq of a2 . b1 = { (SgmX the InternalRel of a1,b2) where B is non empty Element of symplexes a1 : Card b2 = b1 } ) & ( for b1 being Nat
for b2 being Face of b1
for b3 being Element of the SkeletonSeq of a2 . (b1 + 1) st b3 in the SkeletonSeq of a2 . (b1 + 1) holds
for b4 being non empty Element of symplexes a1 st SgmX the InternalRel of a1,b4 = b3 holds
face b3,b2 = (SgmX the InternalRel of a1,b4) * b2 ) );
existence
ex b1 being strict lower_non-empty TriangStr st
( the SkeletonSeq of b1 . 0 = {{} } & ( for b2 being Nat st b2 > 0 holds
the SkeletonSeq of b1 . b2 = { (SgmX the InternalRel of c1,b3) where B is non empty Element of symplexes c1 : Card b3 = b2 } ) & ( for b2 being Nat
for b3 being Face of b2
for b4 being Element of the SkeletonSeq of b1 . (b2 + 1) st b4 in the SkeletonSeq of b1 . (b2 + 1) holds
for b5 being non empty Element of symplexes c1 st SgmX the InternalRel of c1,b5 = b4 holds
face b4,b3 = (SgmX the InternalRel of c1,b5) * b3 ) )
proof end;
uniqueness
for b1, b2 being strict lower_non-empty TriangStr st the SkeletonSeq of b1 . 0 = {{} } & ( for b3 being Nat st b3 > 0 holds
the SkeletonSeq of b1 . b3 = { (SgmX the InternalRel of c1,b4) where B is non empty Element of symplexes c1 : Card b4 = b3 } ) & ( for b3 being Nat
for b4 being Face of b3
for b5 being Element of the SkeletonSeq of b1 . (b3 + 1) st b5 in the SkeletonSeq of b1 . (b3 + 1) holds
for b6 being non empty Element of symplexes c1 st SgmX the InternalRel of c1,b6 = b5 holds
face b5,b4 = (SgmX the InternalRel of c1,b6) * b4 ) & the SkeletonSeq of b2 . 0 = {{} } & ( for b3 being Nat st b3 > 0 holds
the SkeletonSeq of b2 . b3 = { (SgmX the InternalRel of c1,b4) where B is non empty Element of symplexes c1 : Card b4 = b3 } ) & ( for b3 being Nat
for b4 being Face of b3
for b5 being Element of the SkeletonSeq of b2 . (b3 + 1) st b5 in the SkeletonSeq of b2 . (b3 + 1) holds
for b6 being non empty Element of symplexes c1 st SgmX the InternalRel of c1,b6 = b5 holds
face b5,b4 = (SgmX the InternalRel of c1,b6) * b4 ) holds
b1 = b2
proof end;
end;

:: deftheorem Def11 defines Triang TRIANG_1:def 11 :
for b1 being non empty Poset
for b2 being strict lower_non-empty TriangStr holds
( b2 = Triang b1 iff ( the SkeletonSeq of b2 . 0 = {{} } & ( for b3 being Nat st b3 > 0 holds
the SkeletonSeq of b2 . b3 = { (SgmX the InternalRel of b1,b4) where B is non empty Element of symplexes b1 : Card b4 = b3 } ) & ( for b3 being Nat
for b4 being Face of b3
for b5 being Element of the SkeletonSeq of b2 . (b3 + 1) st b5 in the SkeletonSeq of b2 . (b3 + 1) holds
for b6 being non empty Element of symplexes b1 st SgmX the InternalRel of b1,b6 = b5 holds
face b5,b4 = (SgmX the InternalRel of b1,b6) * b4 ) ) );