summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-10-31 17:13:20 +0000
committeraarne <aarne@cs.chalmers.se>2007-10-31 17:13:20 +0000
commit59e432812829a106d6719f2490e3f64ef77abbff (patch)
tree9a465fe52a377494a706cb289d2012ce65727818 /examples
parent3f4d3e69cf8755b31cbc92e779e29cc2ac5dc71b (diff)
mock up math extended with Agda
Diffstat (limited to 'examples')
-rw-r--r--examples/math/MathAgd.gf53
-rw-r--r--examples/math/MathEnz.gf23
-rw-r--r--examples/math/MathSwz.gf23
3 files changed, 73 insertions, 26 deletions
diff --git a/examples/math/MathAgd.gf b/examples/math/MathAgd.gf
new file mode 100644
index 000000000..9b723c26e
--- /dev/null
+++ b/examples/math/MathAgd.gf
@@ -0,0 +1,53 @@
+--# -path=.:prelude
+
+concrete MathAgd of Mathw = open Prelude in {
+
+flags lexer = codelit ; unlexer = codelit ;
+
+-- lincat Section ; Context ; Typ ;
+ lincat Obj, Prop = {s,name : Str} ;
+-- Proof ; Var ;
+
+lin
+ SDefObj cont obj typ df =
+ ss (obj.name ++ "::" ++ cont.s ++ typ.s ++
+ "=" ++ df.s ++ ";") ;
+ SDefProp cont prop df =
+ ss (prop.name ++ "::" ++ cont.s ++ "Prop" ++
+ "=" ++ df.s ++ ";") ;
+ SAxiom cont prop =
+ ss ("ax" ++ "::" ++ cont.s ++ prop.s ++ ";") ;
+ STheorem cont prop proof =
+ ss ("thm" ++ "::" ++ cont.s ++ prop.s ++
+ "=" ++ proof.s ++ ";") ;
+
+ CEmpty = ss [] ;
+ CObj vr typ co = ss ("(" ++ vr.s ++ "::" ++ typ.s ++ ")" ++ co.s) ;
+ CProp prop co = ss ("(" ++ "_" ++ "::" ++ prop.s ++ ")" ++ co.s) ;
+
+ OVar v = obj v.s [] ;
+
+ V_x = ss "x" ;
+ V_y = ss "y" ;
+ V_z = ss "z" ;
+
+oper
+ obj : Str -> Str -> {s,name : Str} = \f,xs -> {
+ s = f ++ xs ;
+ name = f
+ } ;
+
+-- lexicon
+lin
+ Set = ss "set" ;
+ Nat = ss ["Nat"] ;
+ Zero = obj "Zero" [] ;
+ Succ x = obj "Succ" x.s ;
+ One = obj "one" [] ;
+ Two = obj "two" [] ;
+ Even x = obj "Even" x.s ;
+ Odd x = obj "Odd" x.s ;
+ Prime x = obj "Prime" x.s ;
+ Divisible x y = obj "Div" (x.s ++ y.s) ;
+
+}
diff --git a/examples/math/MathEnz.gf b/examples/math/MathEnz.gf
index 394e90e36..2e3525032 100644
--- a/examples/math/MathEnz.gf
+++ b/examples/math/MathEnz.gf
@@ -4,28 +4,25 @@ concrete MathEnz of Mathw = open Prelude in {
flags lexer = textlit ; unlexer = textlit ;
--- lincat Section ; Label ; Context ; Typ ; Obj ; Prop ; Proof ; Var ;
+-- lincat Section ; Context ; Typ ; Obj ; Prop ; Proof ; Var ;
lin
- SDefObj lab cont obj typ df =
- ss ("Definition" ++ lab.s ++ "." ++ cont.s ++
+ SDefObj cont obj typ df =
+ ss ("Definition" ++ "." ++ cont.s ++
obj.s ++ "is" ++ "a" ++ typ.s ++ "," ++ "defined" ++ "as" ++ df.s ++ ".") ;
- SDefProp lab cont prop df =
- ss ("Definition" ++ lab.s ++ "." ++ cont.s ++ "we" ++ "say" ++
- "that" ++ prop.s ++ "to" ++ "mean" ++ "that" ++ df.s ++ ".") ;
- SAxiom lab cont prop =
- ss ("Axiom" ++ lab.s ++ "." ++ cont.s ++ prop.s ++ ".") ;
- STheorem lab cont prop proof =
- ss ("Theorem" ++ lab.s ++ "." ++ cont.s ++ prop.s ++ "." ++ proof.s ++ ".") ;
+ SDefProp cont prop df =
+ ss ("Definition" ++ "." ++ cont.s ++ "we" ++ "say" ++
+ "that" ++ prop.s ++ "if" ++ df.s ++ ".") ;
+ SAxiom cont prop =
+ ss ("Axiom" ++ "." ++ cont.s ++ prop.s ++ ".") ;
+ STheorem cont prop proof =
+ ss ("Theorem" ++ "." ++ cont.s ++ prop.s ++ "." ++ proof.s ++ ".") ;
CEmpty = ss [] ;
CObj vr typ co = ss ("let" ++ vr.s ++ "be" ++ "a" ++ typ.s ++ "." ++ co.s) ;
CProp prop co = ss ("assume" ++ prop.s ++ "." ++ co.s) ;
OVar v = v ;
- LNone = ss [] ;
- LString s = s ;
- VString s = s ;
V_x = ss "x" ;
V_y = ss "y" ;
diff --git a/examples/math/MathSwz.gf b/examples/math/MathSwz.gf
index 72e81ae06..0d12a29e0 100644
--- a/examples/math/MathSwz.gf
+++ b/examples/math/MathSwz.gf
@@ -4,28 +4,25 @@ concrete MathSwz of Mathw = open Prelude in {
flags lexer = textlit ; unlexer = textlit ;
--- lincat Section ; Label ; Context ; Typ ; Obj ; Prop ; Proof ; Var ;
+-- lincat Section ; Context ; Typ ; Obj ; Prop ; Proof ; Var ;
lin
- SDefObj lab cont obj typ df =
- ss ("Definition" ++ lab.s ++ "." ++ cont.s ++
+ SDefObj cont obj typ df =
+ ss ("Definition" ++ "." ++ cont.s ++
obj.s ++ "är" ++ "ett" ++ typ.s ++ "," ++ "definierat" ++ "som" ++ df.s ++ ".") ;
- SDefProp lab cont prop df =
- ss ("Definition" ++ lab.s ++ "." ++ cont.s ++ "vi" ++ "säger" ++
- "att" ++ prop.s ++ "vilket" ++ "menar" ++ "att" ++ df.s ++ ".") ;
- SAxiom lab cont prop =
- ss ("Axiom" ++ lab.s ++ "." ++ cont.s ++ prop.s ++ ".") ;
- STheorem lab cont prop proof =
- ss ("Theorem" ++ lab.s ++ "." ++ cont.s ++ prop.s ++ "." ++ proof.s ++ ".") ;
+ SDefProp cont prop df =
+ ss ("Definition" ++ "." ++ cont.s ++ "vi" ++ "säger" ++
+ "att" ++ prop.s ++ "om" ++ df.s ++ ".") ;
+ SAxiom cont prop =
+ ss ("Axiom" ++ "." ++ cont.s ++ prop.s ++ ".") ;
+ STheorem cont prop proof =
+ ss ("Theorem" ++ "." ++ cont.s ++ prop.s ++ "." ++ proof.s ++ ".") ;
CEmpty = ss [] ;
CObj vr typ co = ss ("låt" ++ vr.s ++ "vara" ++ "ett" ++ typ.s ++ "." ++ co.s) ;
CProp prop co = ss ("anta" ++ "att" ++ prop.s ++ "." ++ co.s) ;
OVar v = v ;
- LNone = ss [] ;
- LString s = s ;
- VString s = s ;
V_x = ss "x" ;
V_y = ss "y" ;