We continue to explore the use of Bots. Here we prove Modus Ponens but without islands. Instead we use backward reasoning to introduce variables. This time we build a session and launch, generalizing both manual and automatic cases.
import $cp.bin.`provingground-core-jvm-ac7ee25c26.fat.jar`
import provingground._ , interface._, HoTT._, learning._
repl.pprinter() = {
val p = repl.pprinter()
p.copy(
additionalHandlers = p.additionalHandlers.orElse {
translation.FansiShow.fansiHandler
}
)
}
Utils.logger = {
import scribe._, writer._, Utils._
logger.withHandler(writer = FileWriter().path(file.LogPath.simple("modus-ponens.log"))).replace()
}
First we set things up.
import provingground._ , learning._, interface._, translation._, HoTT._
import monix.execution.Scheduler.Implicits.global
val A = Type.sym
val B = Type.sym
val MP = A ~>: (B ~>: (A ->: (A ->: B) ->: B))
val ts = TermState(FiniteDistribution.unif(Type), FiniteDistribution.unif(Type))
val tg = TermGenParams.zero.copy(appW = 0.1, unAppW = 0.1)
val lp = LocalProver(ts, tg)
import HoTTMessages._
Next we post stuff. Note that this is still manual bot mode, but a session will only have a couple of useless triggers.
val web = new HoTTPostWeb()
val ws = WebState[HoTTPostWeb, HoTTPostWeb.ID](web)
val ws1 = ws.post(lp, Set())
val ws2 = ws1.flatMap(w => w.postApex(SeekGoal(MP, Context.Empty)))
import HoTTBot._
val sessF = ws2.map(w => HoTTWebSession.launch(w, Vector(fullGoalInContext , goalToProver(0.3, 0.7), lpToFinalState, reportSuccesses)))
Utils.reportText