The primary goal is to test exporting an expression evaluator with respect to variables, in particular to obtain Modus ponens. A secondary goal is to test having empty initial term distribution
import $cp.bin.`provingground-core-jvm-13d7adec62.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
val MP = A ~>: (B ~>: MPAB)
val lp = LocalProver(TermState(FiniteDistribution(), FiniteDistribution.unif(A, B))).sharpen(2)
import monix.execution.Scheduler.Implicits.global
val nsT = lp.nextState
val nsF = nsT.runToFuture
val mpABpF = nsT.map(_.typs(MPAB)).runToFuture
The secondary test was passed, but the variable weight is based on distribution in terms (at least in the current version). So we continue testing with a local prover with terms.
val lp0 = LocalProver(TermState(FiniteDistribution.unif(A, B), FiniteDistribution.unif(A, B))).sharpen(2)
val expEvT = lp0.expressionEval
val outerExpEvT = expEvT.map{ev => ExpressionEval.export(ev, Vector(A, B))}
val outTypsT = outerExpEvT.map(_.finalTyps)
val outTypsEF = outTypsT.map(_.entropyVec).runToFuture
val mpWtF = outTypsT.map(_(MP)).runToFuture
As a coda, we compare the generated final types with the ones generated by equations.
val gExpEvT = lp.expressionEval.map(_.generateTyps)
val mpABgenF = gExpEvT.map(_.finalTyps.safeNormalized(MPAB)).runToFuture
val eF = nsT.map(_.typs.entropyVec).runToFuture
val egF = gExpEvT.map(_.finalTyps.safeNormalized.entropyVec).runToFuture
There seems to be better distribution if we generate from equations (though we have to be careful to normalize)