summaryrefslogtreecommitdiff
path: root/examples/logic/Prooftext.gf
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-11-27 10:54:26 +0000
committeraarne <aarne@cs.chalmers.se>2006-11-27 10:54:26 +0000
commita5232f7e5b8f6ca988696f3870f019113edb8d90 (patch)
tree7e9d543ac07c037c0f86dcc00937a4bbc7a8cc63 /examples/logic/Prooftext.gf
parentc75688651e95d1fe69175ca3e4859e6d753b2b8c (diff)
part of Logic implemented generically
Diffstat (limited to 'examples/logic/Prooftext.gf')
-rw-r--r--examples/logic/Prooftext.gf79
1 files changed, 79 insertions, 0 deletions
diff --git a/examples/logic/Prooftext.gf b/examples/logic/Prooftext.gf
new file mode 100644
index 000000000..e6a6c710c
--- /dev/null
+++ b/examples/logic/Prooftext.gf
@@ -0,0 +1,79 @@
+interface Prooftext = open
+ Grammar,
+ LexTheory,
+ Symbolic,
+ Symbol,
+ (C=ConstructX),
+ Constructors,
+ Combinators
+ in {
+
+oper
+ Chapter = Text ;
+ Section = Text ;
+ Sections = Text ;
+ Decl = Text ;
+ Decls = Text ;
+ Prop = S ;
+ Branching= S ;
+ Proof = Text ;
+ Proofs = Text ;
+ Typ = CN ;
+ Object = NP ;
+ Label = NP ;
+ Adverb = PConj ;
+ Ref = NP ;
+ Refs = [NP] ;
+ Number = Num ;
+
+ chapter : Label -> Sections -> Chapter
+ = \title,jments ->
+ appendText (mkText (mkPhr (mkUtt title)) TEmpty) jments ;
+
+ definition : Decls -> Object -> Object -> Section
+ = \decl,a,b ->
+ appendText decl (mkUtt (mkS (pred b a))) ;
+
+ assumption : Prop -> Decl
+ = \p ->
+ mkText (mkPhr (mkUtt (mkImp (mkVP assume_VS p)))) TEmpty ;
+
+ declaration : Object -> Typ -> Decl
+ = \a,ty ->
+ mkText (mkPhr (mkUtt (mkImp (mkVP assume_VS (mkS (pred ty a)))))) TEmpty ;
+
+ proof = overload {
+ proof : Prop -> Proof
+ = \p -> mkText (mkPhr p) TEmpty ;
+ proof : Adverb -> Prop -> Proof
+ = \a,p -> mkText (mkPhr a (mkUtt p) NoVoc) TEmpty ;
+ proof : Decl -> Proof
+ = \d -> d ;
+ proof : Proof -> Proof -> Proof
+ = \p,q -> appendText p q ;
+ proof : Branching -> Proofs -> Proof
+ = \b,ps -> mkText (mkPhr b) ps
+ } ;
+
+ proofs : Proof -> Proof -> Proofs
+ = appendText ;
+
+ cases : Num -> Branching
+ = \nu ->
+ mkS (pred have_V2 (mkNP we_Pron) (mkNP (mkDet nu) case_N)) ;
+
+ by : Ref -> Adverb
+ = \h -> mkAdv by8means_Prep h ;
+ therefore : Adverb
+ = therefore_PConj ;
+ afortiori : Adverb
+ = C.mkPConj ["a fortiori"] ;
+ hypothesis : Adverb
+ = mkAdv by8means_Prep (mkNP (mkDet DefArt) hypothesis_N) ;
+
+ ref : Label -> Ref
+ = \h -> h ;
+ refs : Refs -> Ref
+ = \rs -> mkNP and_Conj rs ;
+
+}