formal language derivations
This commit is contained in:
parent
e2aae59499
commit
8a85dcfc8f
4 changed files with 143 additions and 20 deletions
|
@ -1,6 +1,9 @@
|
|||
module Logic.Language where
|
||||
|
||||
type List a = [a]
|
||||
-- Convenience newtype so strings of symbols are less ugly
|
||||
newtype ConcatShowList symbol = ConcatShowList [symbol]
|
||||
instance Show a => Show (ConcatShowList a) where
|
||||
show (ConcatShowList xs) = concat $ map show xs
|
||||
|
||||
-- Formal language (/grammar/production system/whatever)
|
||||
class (Eq symbol, Show symbol) => Language symbol where
|
||||
|
@ -9,24 +12,28 @@ class (Eq symbol, Show symbol) => Language symbol where
|
|||
-- If Haskell had dependent types these could be generalized.
|
||||
|
||||
-- axiomN : N wffs -> theorem
|
||||
axiom0 :: [[symbol]]
|
||||
axiom1 :: [[symbol] -> [symbol]]
|
||||
axiom2 :: [[symbol] -> [symbol] -> [symbol]]
|
||||
axiom3 :: [[symbol] -> [symbol] -> [symbol] -> [symbol]]
|
||||
|
||||
-- inferN : N theorems -> theorem
|
||||
-- (axiom0 and infer0 would mean the same thing.)
|
||||
infer1 :: [[symbol] -> List [symbol]]
|
||||
infer2 :: [[symbol] -> [symbol] -> List [symbol]]
|
||||
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 = []
|
||||
|
||||
-- Convenience newtype so strings are less ugly
|
||||
newtype Seq symbol = Seq [symbol]
|
||||
instance Show a => Show (Seq a) where
|
||||
show (Seq xs) = concat $ map show xs
|
||||
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