gapt.proofs.lkt.package.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gapt_3 Show documentation
Show all versions of gapt_3 Show documentation
General Architecture for Proof Theory
The newest version!
package gapt.proofs
import gapt.logic.Polarity
package object lkt extends ImplicitInstances {
implicit class HypSet(private val set: Set[Hyp]) extends AnyVal {
private def freshIdx: Int =
if (set.isEmpty) 1 else set.view.map(h => math.abs(h.idx)).max + 1
def freshSuc: Hyp = Hyp(freshIdx)
def freshAnt: Hyp = Hyp(-freshIdx)
def fresh(p: Polarity): Hyp = if (p.inAnt) freshAnt else freshSuc
def freshSameSide(h: Hyp): Hyp = if (h.inAnt) freshAnt else freshSuc
def freshSameSide(hs: List[Hyp]): List[Hyp] =
freshIdx
.until(Int.MaxValue)
.lazyZip(hs)
.map((i, h) => if (h.inAnt) Hyp(-i) else Hyp(i))
.toList
}
}