forked from GitHub/gf-core
MAth
This commit is contained in:
@@ -6,7 +6,8 @@ abstract Lang =
|
||||
Structural,
|
||||
Basic,
|
||||
Time,
|
||||
Country
|
||||
Country,
|
||||
Math
|
||||
|
||||
** {
|
||||
fun
|
||||
|
||||
52
lib/resource/abstract/Math.gf
Normal file
52
lib/resource/abstract/Math.gf
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
|
||||
abstract Math = Categories ** {
|
||||
|
||||
--3 Noun phrases with symbols
|
||||
|
||||
fun
|
||||
SymbPN : String -> PN ; -- "x"
|
||||
IntPN : Int -> PN ; -- "27"
|
||||
IntNP : CN -> Int -> NP ; -- "level 53"
|
||||
|
||||
IndefSymbNumNP : Num -> CN -> SymbList -> NP ; -- "(2) numbers x and y"
|
||||
DefSymbNumNP : Num -> CN -> SymbList -> NP ; -- "the (2) numbers x and y"
|
||||
NDetSymbNP : NDet -> Num -> CN -> SymbList -> NP ; -- "some (3) points x, y and z"
|
||||
|
||||
--3 Symbol lists
|
||||
|
||||
-- A symbol list has at least two elements. The last two are separated
|
||||
-- by a conjunction ("and" in English), the others by commas.
|
||||
-- This produces "x, y and z", in English.
|
||||
|
||||
cat
|
||||
SymbList ;
|
||||
|
||||
fun
|
||||
SymbTwo : String -> String -> SymbList ;
|
||||
SymbMore : String -> SymbList -> SymbList ;
|
||||
|
||||
--3 Special forms of expression
|
||||
|
||||
-- These expression forms are typical of mathematical texts.
|
||||
|
||||
LetCN : String -> CN -> Imp ; -- Let x be a number.
|
||||
LetNumCN : SymbList -> Num -> CN -> Imp ; -- Let x and y be (2) numbers.
|
||||
|
||||
-- This rule is slightly overgenerating: "there exists every number x".
|
||||
-- The problem seems to be of semantic nature. By this we avoid having many rules.
|
||||
|
||||
ExistNP : NP -> Cl ; -- there exist (2) number(s) x and y
|
||||
|
||||
--3 Rules moved from $Rules$.
|
||||
|
||||
-- This rule is powerful but overgenerating.
|
||||
|
||||
SymbCN : CN -> String -> CN ; -- "number x"
|
||||
|
||||
-- This rule is simply wrong, and will be deprecated: the correct
|
||||
-- value type is $NP$.
|
||||
|
||||
IntCN : CN -> Int -> CN ; -- "level 53"
|
||||
|
||||
}
|
||||
@@ -17,9 +17,12 @@ fun
|
||||
UseN : N -> CN ; -- "car"
|
||||
UsePN : PN -> NP ; -- "John"
|
||||
|
||||
-- These three rules have been moved to the module $Math$.
|
||||
{-
|
||||
SymbPN : String -> PN ; -- "x"
|
||||
SymbCN : CN -> String -> CN ; -- "number x"
|
||||
IntCN : CN -> Int -> CN ; -- "number 53"
|
||||
-}
|
||||
|
||||
IndefOneNP : CN -> NP ; -- "a car", "cars"
|
||||
IndefNumNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||
|
||||
Reference in New Issue
Block a user