]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_notation/doc/samples.ma
snapshot (minor changes)
[helm.git] / helm / ocaml / cic_notation / doc / samples.ma
diff --git a/helm/ocaml/cic_notation/doc/samples.ma b/helm/ocaml/cic_notation/doc/samples.ma
new file mode 100644 (file)
index 0000000..f0a7566
--- /dev/null
@@ -0,0 +1,45 @@
+# sample mappings level 1 <--> level 2
+
+notation \[ \TERM a ++ \OPT \NUM i \] for 'assign \TERM a ('plus \TERM a \DEFAULT \[\NUM i\] \[1\]).
+print 1 ++ 2.
+
+notation \[ + \LIST0 \NUM a \] for \FOLD right \[ 'zero \] \LAMBDA acc \[ 'plus \NUM a \TERM acc \].
+print + 1 2 3 4.
+
+notation \[ [ \LIST0 \TERM a \SEP ; ] \] for \FOLD right \[ 'nil \] \LAMBDA acc \[ 'cons \TERM a \TERM acc \].
+print [].
+print [1;2;3;4].
+
+notation \[ [ \LIST0 \[ \TERM a ; \TERM b \] \SEP ; ] \] for \FOLD right \[ 'nil \] \LAMBDA acc \[ 'cons \TERM a ( 'cons \TERM b \TERM acc) \] .
+print [].
+print [1;2].
+print [1;2;3;4].
+
+notation \[ | \LIST0 \[ \TERM a \OPT \[ , \TERM b \] \] \SEP ; | \] for \FOLD right \[ 'nil \] \LAMBDA acc \[ 'cons \DEFAULT \[ \TERM a \] \[ ('pair \TERM a \TERM b) \] \TERM acc \] .  
+
+notation \[ | \LIST0 \[ \OPT \[ \NUM i \] \] \SEP ; | \] for \FOLD right \[ 'nil \] \LAMBDA acc \[ 'cons \DEFAULT \[ 'Some \NUM i \] \[ 'None \] \TERM acc \] .
+
+# sample mappings level 2 <--> level 3
+
+interpretation 'plus x y = (cic:/Coq/Init/Peano/plus.con x y).
+interpretation 'mult x y = (cic:/Coq/Init/Peano/mult.con x y).
+render cic:/Coq/Arith/Mult/mult_plus_distr_r.con.
+
+interpretation 'megacoso x y z w = (cic:/Coq/Init/Logic/eq.ind#xpointer(1/1) cic:/Coq/Init/Datatypes/nat.ind#xpointer(1/1) (cic:/Coq/Init/Peano/plus.con x y) (cic:/Coq/Init/Peano/plus.con z w)).
+render cic:/Coq/Arith/Plus/plus_comm.con.
+
+# full samples
+
+notation \[ \TERM a + \TERM b \] for 'plus \TERM a \TERM b.
+print 1 + 2.
+interpretation 'plus x y = (cic:/Coq/Init/Peano/plus.con x y).
+render cic:/Coq/Arith/Plus/plus_comm.con.
+
+notation \[ \TERM a + \TERM b \] for 'plus \TERM a \TERM b.
+notation \[ \TERM a * \TERM b \] for 'mult \TERM a \TERM b.
+interpretation 'plus x y = (cic:/Coq/Init/Peano/plus.con x y).
+interpretation 'mult x y = (cic:/Coq/Init/Peano/mult.con x y).
+render cic:/Coq/Arith/Mult/mult_plus_distr_r.con.
+
+notation \[ \LIST \NUM a \] for \FOLD left \[ 'a \] \LAMBDA acc \[ 'b \NUM a \].
+