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

gapt.proofs.lk.rules.SkolemQuantifierRule.scala Maven / Gradle / Ivy

The newest version!
package gapt.proofs.lk.rules

import gapt.expr.Apps
import gapt.expr.BetaReduction
import gapt.expr.Const
import gapt.expr.Expr
import gapt.expr.Var
import gapt.expr.formula.Formula
import gapt.expr.formula.hol.instantiate
import gapt.proofs.SequentIndex

trait SkolemQuantifierRule extends UnaryLKProof with CommonRule {
  def aux: SequentIndex
  def mainFormula: Formula
  def skolemTerm: Expr

  //  require( freeVariables( skolemDef ).isEmpty )

  val (auxFormula, context) = premise focus aux

  def quantifiedVariable: Var
  def subFormula: Formula

  val Apps(skolemConst: Const, skolemArgs) = skolemTerm: @unchecked

  //  {
  //    val expectedMain = BetaReduction.betaNormalize( skolemDef( skolemArgs: _* ) )
  //    if ( expectedMain != mainFormula )
  //      throw LKRuleCreationException( s"Main formula should be $expectedMain, but is $mainFormula" )
  //  }

  {
    val expectedAux = BetaReduction.betaNormalize(instantiate(mainFormula, skolemTerm))
    if (expectedAux != auxFormula)
      throw LKRuleCreationException(
        s"Aux formula should be $subFormula[$quantifiedVariable\\$skolemTerm] = $expectedAux, but is $auxFormula."
      )
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy