| Some definitions of interest. |
|
adjl-graph | Def adjl-graph(G) == < vertices = G.size, edges = x: G.size ||G.out(x)||, incidence = e. < 1of(e),(G.out(1of(e)))[2of(e)] > > |
|
adjm-graph | Def adjm-graph(A) == < vertices = A.size, edges = {p:( A.size A.size)| (A.adj(1of(p),2of(p))) }, incidence = e.e > |
|
adjm_to_adjl | Def adjm_to_adjl(m) == Case(m) Case mk_adjmatrix(n,f) = > mk_adjlist(n, i.filter( j.f(i,j);upto(0;n))) |
| | Thm* m:AdjMatrix. adjm_to_adjl(m) AdjList |
|
adjmatrix | Def AdjMatrix == size:  size  size   |
| | Thm* AdjMatrix Type |
|
assert | Def b == if b True else False fi |
| | Thm* b: . b Prop |
|
graph-isomorphic | Def G H == vmap:(Vertices(G) Vertices(H)), emap:(Edges(G) Edges(H)). Bij(Vertices(G); Vertices(H); vmap) & Bij(Edges(G); Edges(H); emap) & (vmap,vmap) o Incidence(G) = Incidence(H) o emap |
|
biject | Def Bij(A; B; f) == Inj(A; B; f) & Surj(A; B; f) |
| | Thm* A,B:Type, f:(A B). Bij(A; B; f) Prop |
|
compose | Def (f o g)(x) == f(g(x)) |
| | Thm* A,B,C:Type, f:(B C), g:(A B). f o g A C |
|
compose2 | Def (f1,f2) o g(x) == g(x)/x,y. < f1(x),f2(y) > |
| | Thm* A,B,C,B',C':Type, g:(A B C), f1:(B B'), f2:(C C'). (f1,f2) o g A B' C' |
|
filter | Def filter(P;l) == reduce( a,v. if P(a) [a / v] else v fi;nil;l) |
| | Thm* T:Type, P:(T  ), l:T List. filter(P;l) T List |
|
identity | Def Id(x) == x |
| | Thm* A:Type. Id A A |
|
int_seg | Def {i..j } == {k: | i k < j } |
| | Thm* m,n: . {m..n } Type |
|
length | Def ||as|| == Case of as; nil 0 ; a.as' ||as'||+1 (recursive) |
| | Thm* A:Type, l:A List. ||l||  |
| | Thm* ||nil||  |
|
nat | Def == {i: | 0 i } |
| | Thm* Type |
|
pi1 | Def 1of(t) == t.1 |
| | Thm* A:Type, B:(A Type), p:(a:A B(a)). 1of(p) A |
|
pi2 | Def 2of(t) == t.2 |
| | Thm* A:Type, B:(A Type), p:(a:A B(a)). 2of(p) B(1of(p)) |
|
select | Def l[i] == hd(nth_tl(i;l)) |
| | Thm* A:Type, l:A List, n: . 0 n  n < ||l||  l[n] A |
|
upto | Def upto(i;j) == if i < j [i / upto(i+1;j)] else nil fi (recursive) |
| | Thm* i,j: . upto(i;j) {i..j } List |