The goal is to keep generating distributions from just Type
, Zero
, One
and Star
till we timeout
import $cp.bin.`provingground-core-jvm-09effc3.fat.jar`
import provingground._ , interface._, HoTT._, learning._
repl.pprinter() = {
val p = repl.pprinter()
p.copy(
additionalHandlers = p.additionalHandlers.orElse {
translation.FansiShow.fansiHandler
}
)
}
val terms = FiniteDistribution.unif[Term](Type, Unit, Zero, Star)
val typs = FiniteDistribution[Typ[Term]](Type -> 0.8, Unit -> 0.05, Zero -> 0.15)
val ts = TermState(terms, typs)
import monix.execution.Scheduler.Implicits.global
def lp(n: Int) = LocalProver(ts).sharpen(math.pow(2, n))
def ns(n: Int) = lp(n).nextState.map{ns => n -> ns}
val bt = Utils.bestTask((1 to 30).map(ns))
val bf = bt.runToFuture
val A = "A" :: Type
val tsT = bt.map(_.get._2)
val typT = tsT.map(_.typs)
val tpEntF = typT.map(_.entropyVec).runToFuture
val B = "B" :: Type
val MP = A ~>: (B ~>: (A ->: (A ->: B) ->: B))
typT.map(_(MP)).runToFuture
val idTyp = A ~>: (A ->: A)
typT.map(_(idTyp)).runToFuture
def lp1(n: Int) = LocalProver(TermState(FiniteDistribution.unif(A, B), FiniteDistribution.unif(A, B))).sharpen(math.pow(2, n))
def ns1(n: Int) = lp1(n).nextState.map{ns => n -> ns}
val bT1 = Utils.bestTask((1 to 30).map(ns1))
val bF1 = bT1.runToFuture
val mp1T = bT1.map(_.get._2.typs(A ->: (A ->: B) ->: B))
val mp1F = mp1T.runToFuture
val typs1T = bT1.map(_.get._2.typs)
typs1T.map(_(A ->: B)).runToFuture
When we had variables $A$ and $B$ this did discover Modus Ponens (though it took a long time to run as it ran through 12 steps).