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

gapt.proofs.context.facet.Definitions.scala Maven / Gradle / Ivy

The newest version!
package gapt.proofs.context.facet

import gapt.expr.Expr
import gapt.proofs.context.update.Definition

/** Definitions that define a constant by an expression of the same type. */
case class Definitions(definitions: Map[String, Expr]) {
  def +(defn: Definition) = {
    require(!definitions.contains(defn.what.name))
    copy(definitions + (defn.what.name -> defn.by))
  }

  override def toString = definitions.toSeq.sortBy(_._1).map { case (w, b) => s"$w -> $b" }.mkString("\n")

  def filter(p: ((String, Expr)) => Boolean): Definitions =
    copy(definitions.filter(p))
}
object Definitions {
  implicit val defsFacet: Facet[Definitions] = Facet(Definitions(Map()))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy