really rename it MIU system

This commit is contained in:
hi 2025-08-12 07:54:03 +00:00
parent 93e2f8d5e9
commit 113aab0fcb

View file

@ -19,41 +19,41 @@ instance Language AlphaMIU where
axiom0 = [[M, I]] axiom0 = [[M, I]]
infer1 = infer1 =
[ mRule1 [ miuRule1
, mRule2 , miuRule2
, mRule3 , miuRule3
, mRule4 , miuRule4
] ]
-- RULE I: If you possess a string whose last letter is I, you can add on a U at the end. -- RULE I: If you possess a string whose last letter is I, you can add on a U at the end.
mRule1 :: StringMIU -> [StringMIU] miuRule1 :: StringMIU -> [StringMIU]
mRule1 [I] = [[I, U]] miuRule1 [I] = [[I, U]]
mRule1 (x:xs) = (x:) <$> mRule1 xs miuRule1 (x:xs) = (x:) <$> miuRule1 xs
mRule1 _ = [] miuRule1 _ = []
-- RULE II: Suppose you have Mx. Then you may add Mxx to your collection. -- RULE II: Suppose you have Mx. Then you may add Mxx to your collection.
mRule2 :: StringMIU -> [StringMIU] miuRule2 :: StringMIU -> [StringMIU]
mRule2 string@(M:xs) = [string ++ xs] miuRule2 string@(M:xs) = [string ++ xs]
mRule2 _ = [] miuRule2 _ = []
-- RULE III: If III occurs in one of the strings in your collection, you may -- RULE III: If III occurs in one of the strings in your collection, you may
-- make a new string with U in place of III. -- make a new string with U in place of III.
mRule3 :: StringMIU -> [StringMIU] miuRule3 :: StringMIU -> [StringMIU]
mRule3 string@(M:xs) = (M:) <$> aux xs miuRule3 string@(M:xs) = (M:) <$> aux xs
where where
aux (x@I:xs@(I:I:xs')) = (U:xs'):((x:) <$> aux xs) aux (x@I:xs@(I:I:xs')) = (U:xs'):((x:) <$> aux xs)
aux (x:xs) = (x:) <$> aux xs aux (x:xs) = (x:) <$> aux xs
aux _ = [] aux _ = []
mRule3 _ = [] miuRule3 _ = []
-- RULE IV: If UU occurs inside one of your strings, you can drop it. -- RULE IV: If UU occurs inside one of your strings, you can drop it.
mRule4 :: StringMIU -> [StringMIU] miuRule4 :: StringMIU -> [StringMIU]
mRule4 string@(M:xs) = (M:) <$> aux xs miuRule4 string@(M:xs) = (M:) <$> aux xs
where where
aux (x@U:xs@(U:xs')) = xs':((x:) <$> aux xs) aux (x@U:xs@(U:xs')) = xs':((x:) <$> aux xs)
aux (x:xs) = (x:) <$> aux xs aux (x:xs) = (x:) <$> aux xs
aux _ = [] aux _ = []
mRule4 _ = [] miuRule4 _ = []
{- {-
ghci> map ConcatShowList infer0 :: [ConcatShowList AlphaMIU] ghci> map ConcatShowList infer0 :: [ConcatShowList AlphaMIU]