refactor(kernel/type_checker): factor out part for definition checking
refactor(kernel/type_checker): factor out part for definition checking

Kha/lean,fpvandoorn/lean,fgdorais/lean,avigad/lean,johoelzl/lean,leanprover-community/lean,leodemoura/lean,leodemoura/lean,leodemoura/lean,fpvandoorn/lean,fpvandoorn/lean,avigad/lean,rlewis1988/lean,johoelzl/lean,leanprover/lean,rlewis1988/lean,fpvandoorn/lean,leanprover/lean,digama0/lean,fgdorais/lean,leanprover-community/lean,digama0/lean,johoelzl/lean,Kha/lean,Kha/lean,avigad/lean,fgdorais/lean,Kha/lean,rlewis1988/lean,leanprover-community/lean,johoelzl/lean,digama0/lean,avigad/lean,leanprover/lean,johoelzl/lean,digama0/lean,avigad/lean,fgdorais/lean,Kha/lean,leanprover-community/lean,rlewis1988/lean,digama0/lean,dselsam/lean,leodemoura/lean,rlewis1988/lean,Kha/lean,leanprover-community/lean,johoelzl/lean,leanprover/lean,leanprover/lean,fgdorais/lean,dselsam/lean,leanprover-community/lean,fpvandoorn/lean,dselsam/lean,dselsam/lean,rlewis1988/lean,fgdorais/lean,fpvandoorn/lean,leodemoura/lean,leodemoura/lean,digama0/lean,dselsam/lean,dselsam/lean,avigad/lean,leanprover/lean