-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
103 additions
and
5 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Equivalence.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package kyo.llm.thoughts.logic | ||
|
||
import kyo.llm.ais._ | ||
|
||
@desc( | ||
p""" | ||
The EquivalenceChecking thought guides the LLM in determining if two boolean expressions are equivalent. | ||
- Involves step-by-step transformations and comparisons of the expressions. | ||
- Each step includes descriptions and results of transformations. | ||
- Continuously assesses the equivalence of the transformed expressions. | ||
- Concludes with a final determination of equivalence. | ||
""" | ||
) | ||
case class EquivalenceChecking( | ||
initialExpr1: Expr, | ||
initialExpr2: Expr, | ||
equivalenceSteps: List[EquivalenceStep], | ||
finalEquivalence: Boolean | ||
) | ||
|
||
case class EquivalenceStep( | ||
stepDescription: String, | ||
expr1Transformation: Expr, | ||
expr2Transformation: Expr, | ||
areEquivalent: Boolean | ||
) |
26 changes: 26 additions & 0 deletions
26
kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Expr.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package kyo.llm.thoughts.logic | ||
|
||
sealed trait Expr | ||
|
||
sealed trait BooleanExpr extends Expr | ||
object BooleanExpr { | ||
case object True extends BooleanExpr | ||
case object False extends BooleanExpr | ||
case class Not(BooleanExpr: BooleanExpr) extends BooleanExpr | ||
case class And(left: BooleanExpr, right: BooleanExpr) extends BooleanExpr | ||
case class Or(left: BooleanExpr, right: BooleanExpr) extends BooleanExpr | ||
case class Var(name: String) extends BooleanExpr | ||
} | ||
|
||
sealed trait MathExpr extends Expr | ||
|
||
object MathExpr { | ||
case class Constant(value: Double) extends MathExpr | ||
case class Variable(name: String) extends MathExpr | ||
case class Add(left: MathExpr, right: MathExpr) extends MathExpr | ||
case class Subtract(left: MathExpr, right: MathExpr) extends MathExpr | ||
case class Multiply(left: MathExpr, right: MathExpr) extends MathExpr | ||
case class Divide(left: MathExpr, right: MathExpr) extends MathExpr | ||
case class Power(base: MathExpr, exponent: MathExpr) extends MathExpr | ||
case class Root(MathExpression: MathExpr, degree: MathExpr) extends MathExpr | ||
} |
23 changes: 23 additions & 0 deletions
23
kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Optimization.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package kyo.llm.thoughts.logic | ||
|
||
import kyo.llm.ais._ | ||
|
||
@desc( | ||
p""" | ||
The ExpressionOptimization thought process aims to simplify a boolean expression. | ||
- Involves applying logical simplification steps to the expression. | ||
- Each step aims to reduce the complexity and size of the expression. | ||
- Results in an optimized expression that is logically equivalent to the original. | ||
""" | ||
) | ||
case class ExpressionOptimization( | ||
originalExpression: Expr, | ||
optimizationSteps: List[OptimizationStep], | ||
optimizedExpression: Expr | ||
) | ||
|
||
case class OptimizationStep( | ||
stepDescription: String, | ||
inputExpression: Expr, | ||
outputExpression: Expr | ||
) |
23 changes: 23 additions & 0 deletions
23
kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Reduction.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package kyo.llm.thoughts.logic | ||
|
||
import kyo.llm.ais._ | ||
|
||
@desc( | ||
p""" | ||
The Boolean thought applies algebraic principles to simplify a boolean expression. | ||
- Outlines each step of the reduction process with rule descriptions and expression transformations. | ||
- Iteratively simplifies the expression using boolean algebra rules. | ||
- Aimed at reducing the expression to True or False. | ||
""" | ||
) | ||
case class Reduction( | ||
initialExpression: Expr, | ||
reductionSteps: List[ReductionStep], | ||
finalOutcome: Expr | ||
) | ||
|
||
case class ReductionStep( | ||
ruleDescription: String, | ||
inputExpression: Expr, | ||
outputExpression: Expr | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters