Expose main db on proto object.

Additionally rename it to upper case 'Db'
Index filter
relation.isValid
Remove unused var
`has` for sets
set#intersection
set#union
Set extend helper
Exclude set identify to dedicated module
set#complement