Here we illustrate running a sequence of tasks till either some criterion for success is met or we have an error (usually a timeout) or all tasks run with no success. Here we seek the statement of Modus Ponens, but with two types in the distribution.
import $cp.bin.`provingground-core-jvm-3d48753.fat.jar`
import provingground._ , interface._, HoTT._, learning._
repl.pprinter() = {
val p = repl.pprinter()
p.copy(
additionalHandlers = p.additionalHandlers.orElse {
translation.FansiShow.fansiHandler
}
)
}
val A = "A" :: Type
val B = "B" :: Type
val MPAB = A ->: (A ->: B) ->: B
def lp(n: Int) = LocalProver(TermState(FiniteDistribution.unif(A, B), FiniteDistribution.unif(A, B))).sharpen(math.pow(2, n))
def ns(n: Int) = lp(n).nextState.map{ns => n -> ns}
val bT = Utils.bestTask[(Int, TermState)]((1 to 30).map(ns), {case (_, s) => s.typs(MPAB) > 0} )
import monix.execution.Scheduler.Implicits.global
val bF = bT.runToFuture
bF.map(_.get._2.typs(MPAB))
val bT2 = Utils.bestTask[(Int, TermState)]((-5 to 25).map(ns), {case (_, s) => s.typs(MPAB) > 0} )
val bF2 = bT2.runToFuture