All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gapt.proofs.lkt.package.scala Maven / Gradle / Ivy

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
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy