diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Equivalence.scala b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Equivalence.scala new file mode 100644 index 000000000..1a5e83641 --- /dev/null +++ b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Equivalence.scala @@ -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 +) diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Expr.scala b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Expr.scala new file mode 100644 index 000000000..5898b4d0d --- /dev/null +++ b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Expr.scala @@ -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 +} diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Optimization.scala b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Optimization.scala new file mode 100644 index 000000000..d6fee072c --- /dev/null +++ b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Optimization.scala @@ -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 +) diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Reduction.scala b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Reduction.scala new file mode 100644 index 000000000..b574ab55c --- /dev/null +++ b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/logic/Reduction.scala @@ -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 +) diff --git a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/meta/Constrain.scala b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/meta/Constrain.scala index 55799d1f2..53509372d 100644 --- a/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/meta/Constrain.scala +++ b/kyo-llm/shared/src/main/scala/kyo/llm/thoughts/meta/Constrain.scala @@ -4,11 +4,11 @@ import kyo.llm.ais._ @desc( p""" - The Constrain thought applies specific constraints to the AI's reasoning. - - Outlines constraints in the 'Apply specific constraints to the value generation' field. - - 'value' is where the AI applies these constraints in its process. - - Aims to enhance output precision and relevance. - - Example: Constrain["Adhere to ethical guidelines", EthicalReasoning] guides the AI to follow ethical standards. + The Constrain thought applies specific constraints to the AI's reasoning. + - Outlines constraints in the 'Apply specific constraints to the value generation' field. + - 'value' is where the AI applies these constraints in its process. + - Aims to enhance output precision and relevance. + - Example: Constrain["Adhere to ethical guidelines", EthicalReasoning] guides the AI to follow ethical standards. """ ) case class Constrain[C <: String, T](