cabal
only doing this because Data.Set is not in the stdlib
This commit is contained in:
parent
30941456a2
commit
dff5b9f365
19 changed files with 101 additions and 16 deletions
40
lib/Logic/Language.hs
Normal file
40
lib/Logic/Language.hs
Normal file
|
@ -0,0 +1,40 @@
|
|||
module Logic.Language where
|
||||
|
||||
-- Convenience newtype so strings of symbols are less ugly
|
||||
newtype ConcatShowList symbol = ConcatShowList [symbol]
|
||||
instance Show symbol => Show (ConcatShowList symbol) where
|
||||
show (ConcatShowList xs) = concat $ map show xs
|
||||
|
||||
-- Formal language (/grammar/production system/whatever)
|
||||
-- https://en.wikipedia.org/wiki/Post_canonical_system
|
||||
class Show symbol => Language symbol where
|
||||
isWellFormed :: [symbol] -> Bool
|
||||
|
||||
-- If Haskell had dependent types these could be generalized.
|
||||
|
||||
-- axiomN : N wffs -> theorem
|
||||
axiom0 :: [TypeAxiom0 symbol]
|
||||
axiom1 :: [TypeAxiom1 symbol]
|
||||
axiom2 :: [TypeAxiom2 symbol]
|
||||
axiom3 :: [TypeAxiom3 symbol]
|
||||
|
||||
axiom0 = []
|
||||
axiom1 = []
|
||||
axiom2 = []
|
||||
axiom3 = []
|
||||
|
||||
-- inferN : N theorems -> theorem
|
||||
-- (axiom0 and infer0 would mean the same thing.)
|
||||
infer1 :: [TypeInfer1 symbol]
|
||||
infer2 :: [TypeInfer2 symbol]
|
||||
|
||||
infer1 = []
|
||||
infer2 = []
|
||||
|
||||
type TypeAxiom0 s = [s]
|
||||
type TypeAxiom1 s = [s] -> [s]
|
||||
type TypeAxiom2 s = [s] -> [s] -> [s]
|
||||
type TypeAxiom3 s = [s] -> [s] -> [s] -> [s]
|
||||
|
||||
type TypeInfer1 s = [s] -> [[s]]
|
||||
type TypeInfer2 s = [s] -> [s] -> [[s]]
|
Loading…
Add table
Add a link
Reference in a new issue