lean4-htt/src/Lean/Data/Occurrences.lean
Leonardo de Moura f31b0d7d19 chore: cleanup
2020-10-29 09:35:12 -07:00

37 lines
810 B
Text

/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
-/
namespace Lean
inductive Occurrences
| all
| pos (idxs : List Nat)
| neg (idxs : List Nat)
namespace Occurrences
instance : Inhabited Occurrences := ⟨all⟩
def contains : Occurrences → Nat → Bool
| all, _ => true
| pos idxs, idx => idxs.contains idx
| neg idxs, idx => !idxs.contains idx
def isAll : Occurrences → Bool
| all => true
| _ => false
def beq : Occurrences → Occurrences → Bool
| all, all => true
| pos is₁, pos is₂ => is₁ == is₂
| neg is₁, neg is₂ => is₁ == is₂
| _, _ => false
instance : BEq Occurrences := ⟨beq⟩
end Occurrences
end Lean