DML is a programming language that has been custom designed for teaching discrete math. It offers several operators and constructs unavailable in typical languages, such as quantification and boolean formula satisfaction checking. While DML's syntax for these new constructs closely matches the notation used in discrete math texts, it aims for syntactic consistency with existing languages (specifically, Python) for the concepts that are already included in these languages. Here are some examples of DML formulas:
The DML language is described in a separate document. This document is only about its installation and use.
Although students tend to work on several platforms, including MacOS, Windows and Linux, DML runs only on Ubuntu Linux. In order to allow it to be run across all these platforms, DML has been packaged into a Docker container. Docker packages the DML system together with the underlying Linux environment into a self-contained application that you can download and run.
Before using DML, you need to install the DML container. This consists of a few steps.
dmlhome
in your home directory. This is the only folder
on your computer that will be shared with the DML container. It provides the
sole means for moving files between your laptop and the DML
container. Some of the features of DML will not work without this shared
folder, so don't skip this step. For more information on how to use
this folder to move files between the container and your laptop, see
below.
/home/sekar 08:42$ docker Command 'docker' not found, but can be installed with: sudo snap install docker # version 24.0.5, or sudo apt install docker.io # version 24.0.7-0ubuntu4.1You can proceed to install one of the suggested options. (If you don't get a prompt for how to install docker, follow the instructions here.)
Pay attention to the presence of spaces in these commands. In some instances, there is a space following the two dashes, and in other instances, there isn't. If you mix these up, you will get an error. (You can avoid all this by cut/pasting these commands instead of retyping them.)
At this point, DML is set up, and you can proceed to the next section to run it. But you should return to this download step periodically in order to ensure that you have the latest version of DML. For this update, run these commands:
docker pull
will
immediately tell you this, and you won't have to wait for a download. However,
if you already went through the first two steps, you will still need to rerun
the create command.
If you mistakenly run the create
command twice without removing
the old container, you will get an error. (If you get this error, you can
simply proceed to the next step to run DML.)
The following command runs the container you just made and connects the terminal to that container.
ubuntu@container:~$
, where container
is a
random-looking string of characters. From here, you can run either run DML
directly using the command dml
, or use a more user-friendly DML shell
using the command dmlsh
. We recommend dmlsh
because it
provides helpful editing capabilities, including the ability to
You can press Tab
for a full list of available commands. For
additional help on DML, see its documentation. Here, we
focus on checking that everything is OK. For this purpose, you can try
cut/pasting the examples from the top of this page. Here is how such
a session should look like:
dml> {x for x in 0..100 if x % 2 = 0} {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100} ________________________________________________________________________ dml> valid (x->y) || (y->z) || (z->x) true ________________________________________________________________________ dml> { x for x in 2..1000 if forall (y in 2..(x-1)) x % y != 0 } {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997} ________________________________________________________________________ dml>
dmlhome
in your home directory. To access the home directory, follow the
appropriate instructions for your platform:
C:\Users\your-username-here\
and press Enter. Drag the files
you want to import into the dmlhome
folder.
Go
> Home
. Drag the files you want to import into the dmlhome
folder.
dmlhome
on the commandline using the cp
command,
or using the file explorer application that comes with your Linux distribution.
dmlhome
folder, are available to your container. Thus, any
sharing of files between the DML container and the host must be explicit: you
must explicit action to bring files into or out of the DML container.
Note that file syncing is two-way: changes made on the host platform to
dmlhome
folder are all visible in the /home/ubuntu
folder within the container. Similarly, changes made within the container
to the folder /home/ubuntu
are reflected in the files on the
host folder dmlhome
. To get a list of files available in
the container, you can use the following command:
ubuntu@container:~$ ls (your list of files appear here...)
docker run
...
twice. If you see this error, you can remove the container with the
following command:
sudo
on Linux.