| Who Cites count pairs? |
|
count_pairs | Def count(x < y in L | P(x;y)) == sum(if (i < j) P(L[i];L[j]) 1 else 0 fi | i < ||L||; j < ||L||) |
| | Thm* T:Type, L:T List, P:(T T  ). count(x < y in L | P(x,y))  |
|
select | Def l[i] == hd(nth_tl(i;l)) |
| | Thm* A:Type, l:A List, n: . 0 n  n < ||l||  l[n] A |
|
nth_tl | Def nth_tl(n;as) == if n 0 as else nth_tl(n-1;tl(as)) fi (recursive) |
| | Thm* A:Type, as:A List, i: . nth_tl(i;as) A List |
|
le_int | Def i j ==  j < i |
| | Thm* i,j: . (i j)  |
|
lt_int | Def i < j == if i < j true ; false fi |
| | Thm* i,j: . (i < j)  |
|
band | Def p q == if p q else false fi |
| | Thm* p,q: . (p q)  |
|
length | Def ||as|| == Case of as; nil 0 ; a.as' ||as'||+1 (recursive) |
| | Thm* A:Type, l:A List. ||l||  |
| | Thm* ||nil||  |
|
double_sum | Def sum(f(x;y) | x < n; y < m) == sum(sum(f(x;y) | y < m) | x < n) |
| | Thm* n,m: , f:( n  m  ). sum(f(x,y) | x < n; y < m)  |
|
hd | Def hd(l) == Case of l; nil "?" ; h.t h |
| | Thm* A:Type, l:A List. ||l|| 1  hd(l) A |
| | Thm* A:Type, l:A List . hd(l) A |
|
sum | Def sum(f(x) | x < k) == primrec(k;0; x,n. n+f(x)) |
| | Thm* n: , f:( n  ). sum(f(x) | x < n)  |
|
tl | Def tl(l) == Case of l; nil nil ; h.t t |
| | Thm* A:Type, l:A List. tl(l) A List |
|
primrec | Def primrec(n;b;c) == if n= 0 b else c(n-1,primrec(n-1;b;c)) fi (recursive) |
| | Thm* T:Type, n: , b:T, c:( n T T). primrec(n;b;c) T |
|
bnot | Def  b == if b false else true fi |
| | Thm* b: .  b  |
|
eq_int | Def i= j == if i=j true ; false fi |
| | Thm* i,j: . (i= j)  |