finish occursIn
This commit is contained in:
parent
102b5efc46
commit
5b5601f5ee
1 changed files with 7 additions and 0 deletions
7
main.ts
7
main.ts
|
@ -259,6 +259,13 @@ function occursIn(x: variable, e: expr): boolean {
|
||||||
return isEqual(e.x, x);
|
return isEqual(e.x, x);
|
||||||
case "universe":
|
case "universe":
|
||||||
return false;
|
return false;
|
||||||
|
case "pi":
|
||||||
|
case "lambda":
|
||||||
|
if (occursIn(x, e.abs.type)) return true;
|
||||||
|
if (!isEqual(e.abs.x, x)) return occursIn(x, e.abs.body);
|
||||||
|
return false;
|
||||||
|
case "app":
|
||||||
|
return occursIn(x, e.left) || occursIn(x, e.right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue