dumb-cas-0.2.0.0: A computer “algebra” system that knows nothing about algebra, at the core.

Copyright(c) Justus Sagemüller 2017
LicenseGPL v3
Maintainer(@) jsagemue $ uni-koeln.de
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

CAS.Dumb.Tree

Description

 

Synopsis

Documentation

data CAS' γ s² s¹ s⁰ Source #

Constructors

Symbol !s⁰ 
Function !s¹ (CAS' γ s² s¹ s⁰) 
Operator !s² (CAS' γ s² s¹ s⁰) (CAS' γ s² s¹ s⁰) 
OperatorChain (CAS' γ s² s¹ s⁰) [(s², CAS' γ s² s¹ s⁰)] 
Gap 

Instances

(UnicodeSymbols c, RenderableEncapsulations c) => Show (Pattern c) # 

Methods

showsPrec :: Int -> Pattern c -> ShowS #

show :: Pattern c -> String #

showList :: [Pattern c] -> ShowS #

(UnicodeSymbols c, RenderableEncapsulations c) => Show (Expression c) # 
(SymbolClass σ, SCConstraint σ String) => Floating (AlgebraExpr' γ σ String) # 
(SymbolClass σ, SCConstraint σ String) => Fractional (AlgebraExpr' γ σ String) # 
Functor (CAS' γ s² s¹) Source # 

Methods

fmap :: (a -> b) -> CAS' γ s² s¹ a -> CAS' γ s² s¹ b #

(<$) :: a -> CAS' γ s² s¹ b -> CAS' γ s² s¹ a #

(SymbolClass σ, SCConstraint σ String) => Num (AlgebraExpr' γ σ String) # 
(ASCIISymbols c, RenderableEncapsulations c) => Show (CAS (Infix c) (Encapsulation c) (Symbol c)) # 

Methods

showsPrec :: Int -> CAS (Infix c) (Encapsulation c) (Symbol c) -> ShowS #

show :: CAS (Infix c) (Encapsulation c) (Symbol c) -> String #

showList :: [CAS (Infix c) (Encapsulation c) (Symbol c)] -> ShowS #

(Unwieldy s², Unwieldy s¹, Unwieldy s⁰) => Unwieldy (CAS s² s¹ s⁰) Source # 

Methods

unwieldiness :: CAS s² s¹ s⁰ -> Unwieldiness Source #

(Eq γ, Eq s², Eq s¹, Eq s⁰) => Eq (CAS' γ s² s¹ s⁰) Source # 

Methods

(==) :: CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> Bool #

(/=) :: CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> Bool #

(ASCIISymbols c, RenderableEncapsulations c, Monoid c) => Show (CAS' GapId (Infix c) (Encapsulation c) (Symbol c)) # 
Generic (CAS' γ s² s¹ s⁰) Source # 

Associated Types

type Rep (CAS' γ s² s¹ s⁰) :: * -> * #

Methods

from :: CAS' γ s² s¹ s⁰ -> Rep (CAS' γ s² s¹ s⁰) x #

to :: Rep (CAS' γ s² s¹ s⁰) x -> CAS' γ s² s¹ s⁰ #

(Hashable γ, Hashable s⁰, Hashable s¹, Hashable s²) => Hashable (CAS' γ s² s¹ s⁰) Source # 

Methods

hashWithSalt :: Int -> CAS' γ s² s¹ s⁰ -> Int #

hash :: CAS' γ s² s¹ s⁰ -> Int #

type Rep (CAS' γ s² s¹ s⁰) Source # 

chainableInfixL Source #

Arguments

:: (s² -> Bool)

Condition that all operators in the chain must fulfill to be joined by this one

-> s²

The operator we want to add

-> CAS' γ s² s¹ s⁰ 
-> CAS' γ s² s¹ s⁰ 
-> CAS' γ s² s¹ s⁰ 

chainableInfixR Source #

Arguments

:: (s² -> Bool)

Condition that all operators in the chain must fulfill to be joined by this one

-> s²

The operator we want to add

-> CAS' γ s² s¹ s⁰ 
-> CAS' γ s² s¹ s⁰ 
-> CAS' γ s² s¹ s⁰ 

chainableInfix Source #

Arguments

:: (s² -> Bool)

Condition that all operators in the chain must fulfill to be joined by this one

-> s²

The operator we want to add

-> CAS' γ s² s¹ s⁰ 
-> CAS' γ s² s¹ s⁰ 
-> CAS' γ s² s¹ s⁰ 

associativeOperator :: Eq s² => s² -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ -> CAS' γ s² s¹ s⁰ Source #

data Equality' γ s² s¹ s⁰ Source #

Constructors

(:=) infixr 4 

Fields

(:=:) infixr 4 

Fields

type GapId = Int Source #

type Expattern s² s¹ s⁰ = CAS' GapId s² s¹ s⁰ Source #

type Eqspattern s² s¹ s⁰ = Equality' GapId s² s¹ s⁰ Source #

matchPattern :: forall s⁰ s¹ s². (Eq s⁰, Eq s¹, Eq s²) => Expattern s² s¹ s⁰ -> CAS s² s¹ s⁰ -> Maybe (Map GapId (CAS s² s¹ s⁰)) Source #

(&~:) :: (Eq s⁰, Eq s¹, Eq s²) => CAS s² s¹ s⁰ -> Eqspattern s² s¹ s⁰ -> CAS s² s¹ s⁰ infixl 1 Source #

expr &~: pat :=: rep replaces every occurence of pat within expr with rep.

For example, 𝑎·𝑏𝑐·𝑑 &~: · :=: ㄘ·ㄅ yields 𝑏·𝑎 − 𝑑·𝑐.

(&~?) :: (Eq s⁰, Eq s¹, Eq s²) => CAS s² s¹ s⁰ -> Eqspattern s² s¹ s⁰ -> [CAS s² s¹ s⁰] infixl 1 Source #

expr &~? pat :=: rep gives every possible way pat can be replaced exactly once within expr.

For example, 𝑎·𝑏𝑐·𝑑 &~? · :=: ㄘ·ㄅ yields [𝑏·𝑎 − 𝑐·𝑑, 𝑎·𝑏 − 𝑑·𝑐].

(&~!) :: (Eq s⁰, Eq s¹, Eq s², Show (CAS s² s¹ s⁰), Show (CAS' GapId s² s¹ s⁰)) => CAS s² s¹ s⁰ -> Eqspattern s² s¹ s⁰ -> CAS s² s¹ s⁰ infixl 1 Source #

expr &~! pat :=: rep replaces pat exactly once in expr. If this is not possible, an error is raised. If multiple occurences match, the leftmost is preferred.

fillGaps :: Map GapId (CAS s² s¹ s⁰) -> Expattern s² s¹ s⁰ -> Maybe (CAS s² s¹ s⁰) Source #

exploreEquality :: (Eq s⁰, Eq s¹, Eq s²) => [Expattern s² s¹ s⁰] -> CAS s² s¹ s⁰ -> Equality s² s¹ s⁰ Source #

showStructure :: CAS' γ s² s¹ s⁰ -> String Source #

class Unwieldy e where Source #

Minimal complete definition

unwieldiness

Instances

Unwieldy c => Unwieldy (Symbol c) Source # 
Unwieldy c => Unwieldy (Symbol c) Source # 
(Unwieldy s², Unwieldy s¹, Unwieldy s⁰) => Unwieldy (CAS s² s¹ s⁰) Source # 

Methods

unwieldiness :: CAS s² s¹ s⁰ -> Unwieldiness Source #

bigFirstPreference :: Unwieldiness Source #

How much it is preferred to start an operator-chain with the most complex subexpression (e.g. with the highest-order monomial).