core

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicEvaluationContext

type BasicEvaluationContext struct {
	// contains filtered or unexported fields
}

BasicEvaluationContext implements EvaluationContext

func NewEvaluationContext

func NewEvaluationContext() *BasicEvaluationContext

func (*BasicEvaluationContext) Clone

func (*BasicEvaluationContext) Get

func (ctx *BasicEvaluationContext) Get(variable string) (interface{}, bool)

func (*BasicEvaluationContext) Set

func (ctx *BasicEvaluationContext) Set(variable string, value interface{})

func (*BasicEvaluationContext) Variables

func (ctx *BasicEvaluationContext) Variables() []string

type CircuitSimulator

type CircuitSimulator interface {
	AddNode(nodeID string, gate Gate, inputs []string) error
	SetOutputs(outputs []string) error
	Simulate(inputs map[string]interface{}) (map[string]interface{}, error)
}

CircuitSimulator can simulate logical circuits

type ConfidenceInterval

type ConfidenceInterval struct {
	Lower float64
	Upper float64
}

ConfidenceInterval represents a graded interval of belief or confidence, primarily used by paraconsistent and fuzzy evaluation systems.

func (ConfidenceInterval) IsDegraded

func (c ConfidenceInterval) IsDegraded(epsilon float64) bool

IsDegraded returns true if the confidence interval is wider than epsilon.

func (ConfidenceInterval) Width

func (c ConfidenceInterval) Width() float64

Width returns the size of the confidence interval.

type ContradictionError

type ContradictionError struct {
	*LogicError
	DegradedResult interface{}
}

ContradictionError represents an error where contradictory beliefs were encountered. Instead of a hard failure, it carries the degraded result so the system can continue operating.

func NewContradictionError

func NewContradictionError(system, operation, message string, degradedResult interface{}) *ContradictionError

func (*ContradictionError) Error

func (e *ContradictionError) Error() string

type Engine

type Engine interface {
	RegisterSystem(name string, system LogicSystem)
	GetSystem(name string) (LogicSystem, bool)
	ListSystems() []string
	ConvertBetween(expr string, fromSystem, toSystem string) (string, error)
}

Engine coordinates multiple logic systems

type EvaluationContext

type EvaluationContext interface {
	Get(variable string) (interface{}, bool)
	Set(variable string, value interface{})
	Clone() EvaluationContext
	Variables() []string
}

EvaluationContext provides variable bindings for evaluation

type Gate

type Gate interface {
	Evaluate(inputs ...interface{}) interface{}
	String() string
	InputCount() int // -1 for variadic
	OutputCount() int
}

Gate represents a logical gate

type LogicEngine

type LogicEngine struct {
	// contains filtered or unexported fields
}

LogicEngine implements Engine

func NewLogicEngine

func NewLogicEngine() *LogicEngine

func (*LogicEngine) ConvertBetween

func (e *LogicEngine) ConvertBetween(expr string, fromSystem, toSystem string) (string, error)

func (*LogicEngine) GetSystem

func (e *LogicEngine) GetSystem(name string) (LogicSystem, bool)

func (*LogicEngine) ListSystems

func (e *LogicEngine) ListSystems() []string

func (*LogicEngine) RegisterSystem

func (e *LogicEngine) RegisterSystem(name string, system LogicSystem)

type LogicError

type LogicError struct {
	System   string
	Op       string
	Message  string
	Position int
}

LogicError represents an error in logic operations

func NewError

func NewError(operation, message string) *LogicError

Backwards compatibility

func NewLogicError

func NewLogicError(system, operation, message string) *LogicError

func (*LogicError) Error

func (e *LogicError) Error() string

type LogicSystem

type LogicSystem interface {
	Name() string
	Evaluate(expr string, ctx EvaluationContext) (interface{}, error)
	Validate(expr string) error
	SupportedOperators() []string
}

LogicSystem represents any logical reasoning system

type TruthTable

type TruthTable interface {
	Variables() []string
	Rows() []TruthTableRow
	String() string
}

TruthTable represents a generic truth table

type TruthTableGenerator

type TruthTableGenerator interface {
	GenerateTable(variables []string, fn func(...interface{}) interface{}) (TruthTable, error)
}

TruthTableGenerator can generate truth tables

type TruthTableRow

type TruthTableRow interface {
	Inputs() map[string]interface{}
	Output() interface{}
}

TruthTableRow represents a single row

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL