:: GOBOARD2 semantic presentation

scheme :: GOBOARD2:sch 1
s1{ F1() -> non empty set , F2() -> Nat, F3( set ) -> Element of F1() } :
ex b1 being FinSequence of F1() st
( len b1 = F2() & ( for b2 being Nat st b2 in dom b1 holds
b1 /. b2 = F3(b2) ) )
proof end;

defpred S1[ Nat] means for b1 being finite Subset of REAL st b1 <> {} & card b1 = a1 holds
( b1 is bounded_above & upper_bound b1 in b1 & b1 is bounded_below & lower_bound b1 in b1 );

Lemma1: S1[0]
by CARD_2:59;

Lemma2: for b1 being Nat st S1[b1] holds
S1[b1 + 1]
proof end;

Lemma3: for b1 being Nat holds S1[b1]
from NAT_1:sch 1(Lemma1, Lemma2);

theorem Th1: :: GOBOARD2:1
for b1 being finite Subset of REAL st b1 <> {} holds
( b1 is bounded_above & upper_bound b1 in b1 & b1 is bounded_below & lower_bound b1 in b1 )
proof end;

theorem Th2: :: GOBOARD2:2
canceled;

theorem Th3: :: GOBOARD2:3
for b1 being Nat
for b2 being FinSequence holds
( 1 <= b1 & b1 + 1 <= len b2 iff ( b1 in dom b2 & b1 + 1 in dom b2 ) )
proof end;

theorem Th4: :: GOBOARD2:4
for b1 being Nat
for b2 being FinSequence holds
( 1 <= b1 & b1 + 2 <= len b2 iff ( b1 in dom b2 & b1 + 1 in dom b2 & b1 + 2 in dom b2 ) )
proof end;

theorem Th5: :: GOBOARD2:5
for b1 being non empty set
for b2, b3 being FinSequence of b1
for b4 being Nat st 1 <= b4 & b4 <= len b3 holds
(b2 ^ b3) /. (b4 + (len b2)) = b3 /. b4
proof end;

theorem Th6: :: GOBOARD2:6
for b1 being FinSequence of (TOP-REAL 2) st ( for b2, b3 being Nat st b3 > b2 + 1 & b2 in dom b1 & b2 + 1 in dom b1 & b3 in dom b1 & b3 + 1 in dom b1 holds
LSeg b1,b2 misses LSeg b1,b3 ) holds
b1 is s.n.c.
proof end;

theorem Th7: :: GOBOARD2:7
for b1 being FinSequence of (TOP-REAL 2)
for b2 being Nat st b1 is unfolded & b1 is s.n.c. & b1 is one-to-one & b1 /. (len b1) in LSeg b1,b2 & b2 in dom b1 & b2 + 1 in dom b1 holds
b2 + 1 = len b1
proof end;

theorem Th8: :: GOBOARD2:8
for b1 being FinSequence of (TOP-REAL 2)
for b2 being Nat st b2 <> 0 & len b1 = b2 + 1 holds
L~ b1 = (L~ (b1 | b2)) \/ (LSeg b1,b2)
proof end;

theorem Th9: :: GOBOARD2:9
for b1 being FinSequence of (TOP-REAL 2)
for b2 being Nat st 1 < b2 & len b1 = b2 + 1 & b1 is unfolded & b1 is s.n.c. holds
(L~ (b1 | b2)) /\ (LSeg b1,b2) = {(b1 /. b2)}
proof end;

theorem Th10: :: GOBOARD2:10
for b1, b2 being FinSequence of (TOP-REAL 2)
for b3, b4 being Nat st len b1 < b3 & b3 + 1 <= len (b1 ^ b2) & b4 + (len b1) = b3 holds
LSeg (b1 ^ b2),b3 = LSeg b2,b4
proof end;

theorem Th11: :: GOBOARD2:11
for b1, b2 being FinSequence of (TOP-REAL 2) holds L~ b1 c= L~ (b1 ^ b2)
proof end;

theorem Th12: :: GOBOARD2:12
for b1 being FinSequence of (TOP-REAL 2)
for b2 being Nat st b1 is s.n.c. holds
b1 | b2 is s.n.c.
proof end;

theorem Th13: :: GOBOARD2:13
for b1, b2 being FinSequence of (TOP-REAL 2) st b1 is special & b2 is special & ( (b1 /. (len b1)) `1 = (b2 /. 1) `1 or (b1 /. (len b1)) `2 = (b2 /. 1) `2 ) holds
b1 ^ b2 is special
proof end;

theorem Th14: :: GOBOARD2:14
for b1 being FinSequence of (TOP-REAL 2) st b1 <> {} holds
X_axis b1 <> {}
proof end;

theorem Th15: :: GOBOARD2:15
for b1 being FinSequence of (TOP-REAL 2) st b1 <> {} holds
Y_axis b1 <> {}
proof end;

registration
let c1 be non empty FinSequence of (TOP-REAL 2);
cluster X_axis a1 -> non empty ;
coherence
not X_axis c1 is empty
by Th14;
cluster Y_axis a1 -> non empty ;
coherence
not Y_axis c1 is empty
by Th15;
end;

theorem Th16: :: GOBOARD2:16
for b1 being FinSequence of (TOP-REAL 2)
for b2 being Go-board st b1 is special holds
for b3 being Nat st b3 in dom b1 & b3 + 1 in dom b1 holds
for b4, b5, b6, b7 being Nat st [b4,b5] in Indices b2 & [b6,b7] in Indices b2 & b1 /. b3 = b2 * b4,b5 & b1 /. (b3 + 1) = b2 * b6,b7 & not b4 = b6 holds
b7 = b5
proof end;

theorem Th17: :: GOBOARD2:17
for b1 being FinSequence of (TOP-REAL 2)
for b2 being Go-board st ( for b3 being Nat st b3 in dom b1 holds
ex b4, b5 being Nat st
( [b4,b5] in Indices b2 & b1 /. b3 = b2 * b4,b5 ) ) & b1 is special & ( for b3 being Nat st b3 in dom b1 & b3 + 1 in dom b1 holds
b1 /. b3 <> b1 /. (b3 + 1) ) holds
ex b3 being FinSequence of (TOP-REAL 2) st
( b3 is_sequence_on b2 & L~ b1 = L~ b3 & b3 /. 1 = b1 /. 1 & b3 /. (len b3) = b1 /. (len b1) & len b1 <= len b3 )
proof end;

theorem Th18: :: GOBOARD2:18
for b1 being FinSequence of REAL st b1 is increasing holds
for b2, b3 being Nat st b2 in dom b1 & b3 in dom b1 & b2 <= b3 holds
b1 . b2 <= b1 . b3
proof end;

theorem Th19: :: GOBOARD2:19
for b1 being FinSequence of REAL st b1 is increasing holds
for b2, b3 being Nat st b2 in dom b1 & b3 in dom b1 & b2 <> b3 holds
b1 . b2 <> b1 . b3
proof end;

theorem Th20: :: GOBOARD2:20
for b1, b2 being FinSequence of REAL
for b3 being Nat st b1 is increasing & b2 = b1 | (Seg b3) holds
b2 is increasing
proof end;

defpred S2[ Nat] means for b1 being FinSequence of REAL st card (rng b1) = a1 holds
ex b2 being FinSequence of REAL st
( rng b2 = rng b1 & len b2 = card (rng b1) & b2 is increasing );

Lemma15: S2[0]
proof end;

Lemma16: for b1 being Nat st S2[b1] holds
S2[b1 + 1]
proof end;

Lemma17: for b1 being Nat holds S2[b1]
from NAT_1:sch 1(Lemma15, Lemma16);

theorem Th21: :: GOBOARD2:21
for b1 being FinSequence of REAL ex b2 being FinSequence of REAL st
( rng b2 = rng b1 & len b2 = card (rng b1) & b2 is increasing ) by Lemma17;

defpred S3[ Nat] means for b1, b2 being FinSequence of REAL st len b1 = a1 & len b2 = a1 & rng b1 = rng b2 & b1 is increasing & b2 is increasing holds
b1 = b2;

Lemma18: S3[0]
proof end;

Lemma19: for b1 being Nat st S3[b1] holds
S3[b1 + 1]
proof end;

Lemma20: for b1 being Nat holds S3[b1]
from NAT_1:sch 1(Lemma18, Lemma19);

theorem Th22: :: GOBOARD2:22
for b1, b2 being FinSequence of REAL st len b1 = len b2 & rng b1 = rng b2 & b1 is increasing & b2 is increasing holds
b1 = b2 by Lemma20;

definition
let c1, c2 be increasing FinSequence of REAL ;
assume E21: ( c1 <> {} & c2 <> {} ) ;
func GoB c1,c2 -> Matrix of (TOP-REAL 2) means :Def1: :: GOBOARD2:def 1
( len a3 = len a1 & width a3 = len a2 & ( for b1, b2 being Nat st [b1,b2] in Indices a3 holds
a3 * b1,b2 = |[(a1 . b1),(a2 . b2)]| ) );
existence
ex b1 being Matrix of (TOP-REAL 2) st
( len b1 = len c1 & width b1 = len c2 & ( for b2, b3 being Nat st [b2,b3] in Indices b1 holds
b1 * b2,b3 = |[(c1 . b2),(c2 . b3)]| ) )
proof end;
uniqueness
for b1, b2 being Matrix of (TOP-REAL 2) st len b1 = len c1 & width b1 = len c2 & ( for b3, b4 being Nat st [b3,b4] in Indices b1 holds
b1 * b3,b4 = |[(c1 . b3),(c2 . b4)]| ) & len b2 = len c1 & width b2 = len c2 & ( for b3, b4 being Nat st [b3,b4] in Indices b2 holds
b2 * b3,b4 = |[(c1 . b3),(c2 . b4)]| ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines GoB GOBOARD2:def 1 :
for b1, b2 being increasing FinSequence of REAL st b1 <> {} & b2 <> {} holds
for b3 being Matrix of (TOP-REAL 2) holds
( b3 = GoB b1,b2 iff ( len b3 = len b1 & width b3 = len b2 & ( for b4, b5 being Nat st [b4,b5] in Indices b3 holds
b3 * b4,b5 = |[(b1 . b4),(b2 . b5)]| ) ) );

registration
let c1, c2 be non empty increasing FinSequence of REAL ;
cluster GoB a1,a2 -> V4 X_equal-in-line Y_equal-in-column Y_increasing-in-line X_increasing-in-column ;
coherence
( not GoB c1,c2 is empty-yielding & GoB c1,c2 is X_equal-in-line & GoB c1,c2 is Y_equal-in-column & GoB c1,c2 is Y_increasing-in-line & GoB c1,c2 is X_increasing-in-column )
proof end;
end;

definition
let c1 be FinSequence of REAL ;
func Incr c1 -> increasing FinSequence of REAL means :Def2: :: GOBOARD2:def 2
( rng a2 = rng a1 & len a2 = card (rng a1) );
existence
ex b1 being increasing FinSequence of REAL st
( rng b1 = rng c1 & len b1 = card (rng c1) )
proof end;
uniqueness
for b1, b2 being increasing FinSequence of REAL st rng b1 = rng c1 & len b1 = card (rng c1) & rng b2 = rng c1 & len b2 = card (rng c1) holds
b1 = b2
by Lemma20;
end;

:: deftheorem Def2 defines Incr GOBOARD2:def 2 :
for b1 being FinSequence of REAL
for b2 being increasing FinSequence of REAL holds
( b2 = Incr b1 iff ( rng b2 = rng b1 & len b2 = card (rng b1) ) );

definition
let c1 be non empty FinSequence of (TOP-REAL 2);
func GoB c1 -> Matrix of (TOP-REAL 2) equals :: GOBOARD2:def 3
GoB (Incr (X_axis a1)),(Incr (Y_axis a1));
correctness
coherence
GoB (Incr (X_axis c1)),(Incr (Y_axis c1)) is Matrix of (TOP-REAL 2)
;
;
end;

:: deftheorem Def3 defines GoB GOBOARD2:def 3 :
for b1 being non empty FinSequence of (TOP-REAL 2) holds GoB b1 = GoB (Incr (X_axis b1)),(Incr (Y_axis b1));

theorem Th23: :: GOBOARD2:23
for b1 being FinSequence of REAL st b1 <> {} holds
Incr b1 <> {}
proof end;

registration
let c1 be non empty FinSequence of REAL ;
cluster Incr a1 -> non empty increasing ;
coherence
not Incr c1 is empty
by Th23;
end;

registration
let c1 be non empty FinSequence of (TOP-REAL 2);
cluster GoB a1 -> V4 X_equal-in-line Y_equal-in-column Y_increasing-in-line X_increasing-in-column ;
coherence
( not GoB c1 is empty-yielding & GoB c1 is X_equal-in-line & GoB c1 is Y_equal-in-column & GoB c1 is Y_increasing-in-line & GoB c1 is X_increasing-in-column )
;
end;

theorem Th24: :: GOBOARD2:24
for b1 being non empty FinSequence of (TOP-REAL 2) holds
( len (GoB b1) = card (rng (X_axis b1)) & width (GoB b1) = card (rng (Y_axis b1)) )
proof end;

theorem Th25: :: GOBOARD2:25
for b1 being non empty FinSequence of (TOP-REAL 2)
for b2 being Nat st b2 in dom b1 holds
ex b3, b4 being Nat st
( [b3,b4] in Indices (GoB b1) & b1 /. b2 = (GoB b1) * b3,b4 )
proof end;

theorem Th26: :: GOBOARD2:26
for b1 being Nat
for b2 being non empty FinSequence of (TOP-REAL 2) st b1 in dom b2 & ( for b3 being Nat st b3 in dom b2 holds
(X_axis b2) . b1 <= (X_axis b2) . b3 ) holds
b2 /. b1 in rng (Line (GoB b2),1)
proof end;

theorem Th27: :: GOBOARD2:27
for b1 being Nat
for b2 being non empty FinSequence of (TOP-REAL 2) st b1 in dom b2 & ( for b3 being Nat st b3 in dom b2 holds
(X_axis b2) . b3 <= (X_axis b2) . b1 ) holds
b2 /. b1 in rng (Line (GoB b2),(len (GoB b2)))
proof end;

theorem Th28: :: GOBOARD2:28
for b1 being Nat
for b2 being non empty FinSequence of (TOP-REAL 2) st b1 in dom b2 & ( for b3 being Nat st b3 in dom b2 holds
(Y_axis b2) . b1 <= (Y_axis b2) . b3 ) holds
b2 /. b1 in rng (Col (GoB b2),1)
proof end;

theorem Th29: :: GOBOARD2:29
for b1 being Nat
for b2 being non empty FinSequence of (TOP-REAL 2) st b1 in dom b2 & ( for b3 being Nat st b3 in dom b2 holds
(Y_axis b2) . b3 <= (Y_axis b2) . b1 ) holds
b2 /. b1 in rng (Col (GoB b2),(width (GoB b2)))
proof end;