Commit 19d0a809 authored by jfschaefer's avatar jfschaefer
Browse files

more work

parent a825c1b4
-- abstract grammar for formulae
abstract FGrammar = MCats ** {
cat
FIdentifier; -- identifier literals in formulae (e.g. "n")
FNumeral; -- numeral (e.g. "1")
FBinRelation; -- binary relations (e.g. "<")
FComplexIdentifier; -- complex identifier in formuale (e.g. "x_1")
FExpression; -- expression
FStatement; -- statement
fun
fidentifier_to_fcomplexidentifier : FIdentifier -> FComplexIdentifier; -- n -> mi ( n )
fnumeral_to_fexpression : FNumeral -> FExpression; -- 1 -> mn ( 1 )
......
......@@ -2,6 +2,16 @@ concrete FGrammarEng of FGrammar = MCatsEng, CatEng ** open ParadigmsEng, ResEng
oper
wrap_mml : Str -> Str -> Str = \wrapper,content -> wrapper + "(" ++ content ++ ")";
mkMathCN_sg : Str -> CN = \s -> lin CN { s = table { Sg => table { _ => s }; _ => table { _ => "???" } }; g = nonhuman };
lincat
FIdentifier = Str;
FNumeral = Str;
FBinRelation = Str;
FComplexIdentifier = Str;
FExpression = Str;
FStatement = Str;
lin
fidentifier_to_fcomplexidentifier i = wrap_mml "mi" i;
fnumeral_to_fexpression n = wrap_mml "mn" n;
......@@ -17,8 +27,8 @@ concrete FGrammarEng of FGrammar = MCatsEng, CatEng ** open ParadigmsEng, ResEng
_ => table { _ => table { _ => "???" } } };
_ => table { _ => table { _ => table { _ => "???" } } } } };
fcomplexidentifier_to_identifer fci = { s = "$" ++ fci ++ "$" }; -- mkMathCN_sg ("$" ++ fci ++ "$");
fcomplexidentifier_to_identifer fci = { s = "$" ++ fci ++ "$"; m = one };
fexpr_fbinrel_fcid_fbinrel_fexpr_to_identifier a r1 b r2 c =
{ s = "$" ++ (wrap_mml "mrow" (a ++ (wrap_mml "mo" r1) ++ b ++ (wrap_mml "mo" r2) ++ c)) ++ "$" };
{ s = "$" ++ (wrap_mml "mrow" (a ++ (wrap_mml "mo" r1) ++ b ++ (wrap_mml "mo" r2) ++ c)) ++ "$"; m = one };
-- mkMathCN_sg ("$" ++ (wrap_mml "mrow" (a ++ (wrap_mml "mo" r1) ++ b ++ (wrap_mml "mo" r2) ++ c)) ++ "$");
}
-- lexicon for formulae (identifiers, operatores, ...)
abstract FLexicon = MCats ** {
abstract FLexicon = FGrammar ** {
fun
n_FIdentifier : FIdentifier;
m_FIdentifier : FIdentifier;
......@@ -8,6 +8,7 @@ abstract FLexicon = MCats ** {
a_FIdentifier : FIdentifier;
one_FNumeral : FNumeral;
two_FNumeral : FNumeral;
lessThan_FBinRelation : FBinRelation;
divides_FBinRelation : FBinRelation;
......
concrete FLexiconEng of FLexicon = MCatsEng ** {
concrete FLexiconEng of FLexicon = FGrammarEng ** {
lin
n_FIdentifier = "n";
m_FIdentifier = "m";
......@@ -6,6 +6,7 @@ concrete FLexiconEng of FLexicon = MCatsEng ** {
a_FIdentifier = "a";
one_FNumeral = "1";
two_FNumeral = "2";
lessThan_FBinRelation = "<";
divides_FBinRelation = "|";
......
......@@ -4,25 +4,17 @@ abstract MCats = {
-- natural language
PosNegPol; -- category for the polarity of a statement (is the case vs is not the case)
DefMObj; -- definite math object ("the largest element", ...)
-- DefMObj; -- definite math object ("the largest element", ...)
MObj; -- math object ("prime number", "group", ...)
MObjProp; -- math object properties ("eve", "prime", "divisble by 2", ...)
-- Decl; -- declaration
Statement; -- statement ("every prime number is an integer")
StatementFin; -- finished statement
Definition; -- definition
Declaration; -- declaration ("let n be a ...")
Utterance; -- (finished) statement or definition
-- formulae
FIdentifier; -- identifier literals in formulae (e.g. "n")
FNumeral; -- numeral (e.g. "1")
FBinRelation; -- binary relations (e.g. "<")
FComplexIdentifier; -- complex identifier in formuale (e.g. "x_1")
FExpression; -- expression
FStatement; -- statement
MathCN; -- math common noun (e.g. $ mo ( n ) $)
Identifier; -- identifier (more restricted than MathCN)
}
concrete MCatsEng of MCats = open SyntaxEng, ParamX in {
param
boolean = true | false;
multiplicity = one | many;
lincat
-- natural language
PosNegPol = Pol;
DefMObj = NP;
-- DefMObj = NP;
MObj = {
core : CN; -- core of the declaration (e.g. "continuous function")
suffix : Number => Str; -- suffix (usually starting with a preposition, e.g. "on the real numbers") (number required for relative clauses)
......@@ -15,23 +16,16 @@ concrete MCatsEng of MCats = open SyntaxEng, ParamX in {
hasp1 : boolean;
hasp2 : boolean;
};
MObjProp = AP;
Statement = Cl;
-- statement as sentence or relative sentence ("such that ...")
StatementFin = { s : S ; rs : RS };
Definition = S;
Declaration = S;
Utterance = Utt;
-- formulae
FIdentifier = Str;
FNumeral = Str;
FBinRelation = Str;
FComplexIdentifier = Str;
FExpression = Str;
FStatement = Str;
MathCN = CN;
Identifier = { s : Str };
Identifier = { s : Str; m : multiplicity };
}
......@@ -26,6 +26,9 @@ abstract NGrammar = MCats, Grammar, Extra, ExtraEngAbs ** {
iff_definition : Definition -> StatementFin -> Definition; -- "... is called ... iff ..."
def_mobj_is_mobj : MObj -> MObj -> Definition; -- "an alphabet $A$ is a finite set
let_id_be_a_mobj : Identifier -> MObj -> Declaration;
utter_statement : StatementFin -> Utterance; -- essentially identity
utter_definition : Definition -> Utterance; -- essentially identity
utter_declaration : Declaration -> Utterance; -- essentially identity
}
......@@ -6,7 +6,7 @@ concrete NGrammarEng of NGrammar = MCatsEng, GrammarEng, ExtraEng ** open Syntax
PosPol = GrammarEng.PPos;
NegPol = GrammarEng.PNeg;
no_identifier = { s = ""};
no_identifier = { s = ""; m = one | many };
restrict_mobj prop obj = mobjPrepMObjProp obj prop;
mobj_such_that obj restr = mobjAddSuffix obj restr.rs;
......@@ -35,8 +35,12 @@ concrete NGrammarEng of NGrammar = MCatsEng, GrammarEng, ExtraEng ** open Syntax
mkS (mkCl (DetCN aSg_Det (mobjToCN definiendum)) (mobjToCN definiens));
-- mkS (mkCl (DetCN {- mkNP is for some reason ambiguous -}
-- aSg_Det (appo_mobj definiendum representative)) definiens);
--
let_id_be_a_mobj id obj = ImpP3 (identifierToNP id) (mkVP (mobjToCN obj));
utter_statement s = mkUtt s.s;
utter_declaration s = mkUtt s;
utter_definition s = mkUtt s;
--
--
......
......@@ -53,4 +53,6 @@ resource UtilsEng = MCatsEng ** open SyntaxEng, ParadigmsEng, ResEng, ParamX in
mobjToCN : MObj -> Identifier -> CN = \mobj,id ->
lin CN { s = \\number,case_ => mobj.core.s ! number ! case_ ++ id.s ++ mobj.suffix ! number; g = mobj.core.g };
};
identifierToNP : Identifier -> NP = \id -> lin NP { s = table { _ => id.s }; a = table { one => AgP3Sg Neutr; many => AgP3Pl Neutr } ! id.m };
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment