Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ variable {Var : Type u}

/-- `LcAt k M` is satisfied when all bound indices of M are smaller than `k`. -/
@[simp, scoped grind =]
def LcAt (k : ℕ) : Term Var → Prop
def LcAt (k : ℕ) : Term Var → Bool
| bvar i => i < k
| fvar _ => True
| app t₁ t₂ => LcAt k t₁ LcAt k t₂
| fvar _ => true
| app t₁ t₂ => LcAt k t₁ && LcAt k t₂
| abs t => LcAt (k + 1) t

/-- `depth` counts the maximum number of the lambdas that are enclosing variables. -/
Expand Down Expand Up @@ -83,6 +83,10 @@ theorem lcAt_iff_LC (M : Term Var) [HasFresh Var] : LcAt 0 M ↔ M.LC := by
grind [fresh_exists L]
| _ => grind [cases LC]

instance [HasFresh Var] (t : Term Var) : Decidable t.LC := by
rw [← lcAt_iff_LC]
infer_instance

/- Opening for some term at i-th bound variable increments `LcAt` by one -/
lemma lcAt_openRec_lcAt (M N : Term Var) (i : ℕ) :
LcAt i (M⟦i ↝ N⟧) → LcAt (i + 1) M := by
Expand Down
Loading