This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/docs/tut.ipynb

619 lines
380 KiB
Plaintext
Raw Normal View History

2018-02-08 10:46:22 +00:00
{
"cells": [
{
"attachments": {
"yap.ico": {
"image/vnd.microsoft.icon": "AAABAAYAAAAAAAEAGAAoIAMAZgAAAICAAAABABgAKMgAAI4gAwBAQAAAAQAYACgyAAC26AMAMDAAAAEAGACoHAAA3hoEACAgAAABABgAqAwAAIY3BAAQEAAAAQAIAGgFAAAuRAQAKAAAAAABAAAAAgAAAQAYAAAAAAAAAAMAAAAAAAAAAAAAAAAAAAAAAIE7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4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O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O4E7O
}
},
"cell_type": "markdown",
"metadata": {},
"source": [
"# YAP Jupyter Interface ![yap.ico](attachment:yap.ico)\n",
"\n",
"## Walkthrough and User Guide\n",
"\n",
"The next cells show examples of input output interaction with Prolog and Jupyter. We assume basic knowledge of both Prolog and Python/R/Jupyter. Notice that this is experimental software, subject to bugs and change. Also remember that \n",
" - all cells in the same page belong to the same process;\n",
" - _magic_ refers to annotations that perform extra, non-trivial work\n",
" - check the top=right ball right to the side of `YAP 6`: if empty the system is avsilable; otherwise, it is busy, \n",
"\n",
"### Basic Usage\n",
"\n",
"Any Prolog system should be able to unify two terms:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"X = s\n",
"No (more) answers\n"
]
}
],
"source": [
"X= s"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"X = 2\n",
"No (more) answers\n"
]
}
],
"source": [
"X = 2\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No (more) answers\n"
]
}
],
"source": [
"f(X,['olá',X] = f(`hello`,Z)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"X = \"hello\",\n",
"Z = ['ol<6F><6C><EFBFBD><EFBFBD>',\"hello\"]\n",
"No (more) answers\n"
]
}
],
"source": [
"f(X,['olá',X]) = f(`hello`,Z)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"X = Y\n",
"No (more) answers\n"
]
}
],
"source": [
"X=Y"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You observe that the first time you press `shift-enter` or `ctl-enter`, YAP/Jupyter writes down `X=2`, the answer. If you press down `shift-enter` again, it writes `No (more) answers` Pressing again returns you to the first answer, `X=2`:\n",
"\n",
"- In YAP/Jupyter cells have a state that depends on how many answers you generated.\n",
"\n",
"The next example shows a more complex notion of state:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"between(1,100,I), J is I^I"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The YAP `^` operator generates floating-point numbers for large exponentials. You can try replacing `^` by `**` in the cell: notice that the cell state is reset, as changes in the text of a cell may mean anything. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you want to look at all solutions, you can place an `*` at the end of cell:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"between(1,20,I), J is 20-I, IJ is I*J *\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"NB: in the current version, the states in a page are single-threaded, meaning only one cell is active at a rime."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Programming with cells\n",
"\n",
"Cells can store programs: in fact, by default that is what they should do. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The next cell shows a program to recognise state-checking predicates:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" % reconsulting jupyter cell...\n",
" % reconsulted ??? in module user, 7 msec 0 bytes\n",
"No (more) answers\n"
]
}
],
"source": [
"state_info(Name/Arity) :- \n",
" current_predicate(Name/Arity), \n",
" atom_concat(current,_,Name).\n",
"state_info(Name/Arity) :- \n",
" system_predicate(Name/Arity),\n",
" atom_concat(current,_,Name)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A query cell follows:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"P = current_mutex/3\n",
"P = current_module/2\n",
"P = current_module/1\n",
"P = current_atom/1\n",
"P = current_key/2\n",
"P = current_predicate/1\n",
"P = current_predicate/2\n",
"P = current_thread/2\n",
"P = current_char_conversion/2\n",
"P = current_line_number/2\n",
"P = current_line_number/1\n",
"P = current_stream/3\n",
"P = current_op/3\n",
"P = current_prolog_flag/2\n",
"P = current_source_module/2\n",
"P = current_host/1\n",
"P = current_output/1\n",
"P = current_input/1\n",
"P = current_reference_count/2\n",
"No (more) answers\n"
]
}
],
"source": [
" state_info(P)*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notice that you need to consult the program cell first. Of course, we can just do both: "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" % reconsulting jupyter cell...\n",
" % reconsulted ??? in module user, 15 msec 0 bytes\n",
"T = [5],\n",
"X = 3\n",
"No (more) answers\n"
]
}
],
"source": [
"\n",
"generate_ith(I, I, [Head|Tail], Head, Tail).\n",
"generate_ith(I, IN, [_|List], El, Tail) :-\n",
"\tI1 is I+1,\n",
"\tgenerate_ith(I1, IN, List, El, Tail).\n",
"\n",
"ith(V, In, Element, Tail) :- var(V), !,\n",
"\tgenerate_ith(0, V, In, Element, Tail).\n",
"ith(0, [Head|Tail], Head, Tail) :- !.\n",
"ith(N, [Head|Tail], Elem, [Head|Rest]) :-\n",
"\tM is N-1,\n",
"\tith(M, Tail, Elem, Rest).\n",
"\n",
"ith(X,[1,2,3,4,5],4, T)\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"#y#\n",
"CMakeCache.txt\n",
"CMakeCache.txt~\n",
"CMakeDoxyfile.in\n",
"CMakeDoxyfile.tpl.bak\n",
"CMakeDoxygenDefaults.cmake\n",
"CMakeFiles\n",
"CXX\n",
"FindPackageLog.txt\n",
"GitSHA1.c\n",
"H\n",
"Makefile\n",
"OPTYap\n",
"PropsOfAE\n",
"Untitled.ipynb\n",
"Untitled1.ipynb\n",
"Untitled10.ipynb\n",
"Untitled11.ipynb\n",
"Untitled2.ipynb\n",
"Untitled3.ipynb\n",
"Untitled4.ipynb\n",
"Untitled5.ipynb\n",
"Untitled6.ipynb\n",
"Untitled7.ipynb\n",
"Untitled8.ipynb\n",
"Untitled9.ipynb\n",
"YAP.cbp\n",
"YapConfig.h\n",
"YapIOConfig.h\n",
"YapTermConfig.h\n",
"cmake_install.cmake\n",
"compile_commands.json\n",
"config.h\n",
"cudd_config.h\n",
"dlocals.h\n",
"docs\n",
"i\n",
"install_manifest.txt\n",
"libYap.6.3.5.dylib\n",
"libYap.6.3.5.dylib.dSYM\n",
"libYap.6.3.dylib\n",
"libYap.dylib\n",
"library\n",
"m\n",
"meta.js\n",
"myddas.yap\n",
"new~~cc\n",
"os\n",
"packages\n",
"pl\n",
"swiLibrary\n",
"temp-dir\n",
"test2.png\n",
"untitled.txt\n",
"utf8proc\n",
"x\n",
"x.yap\n",
"y\n",
"yap\n",
"yap.dSYM\n",
"y~\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"bash: line 1: fg: no job control\n"
]
}
],
"source": [
"%%bash\n",
"\n",
"ls"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Magic\n",
"\n",
"YAP allows the standard magics, buth with line and cell:\n",
"\n",
"- line magics should be the first non-empty line, and must start with `%` followed immediately by the name.\n",
"\n",
"- cell magaics start with `%%` and must be the only magic in the cell.\n",
"\n",
"You can use the completion mechanism to list all magics.\n",
"\n",
"The next cell shows a cell magic that starts a bash shell."
]
},
{
"cell_type": "code",
2018-03-19 11:44:16 +00:00
"execution_count": 1,
2018-02-08 10:46:22 +00:00
"metadata": {},
"outputs": [
{
2018-03-19 11:44:16 +00:00
"name": "stderr",
2018-02-08 10:46:22 +00:00
"output_type": "stream",
"text": [
" % reconsulting jupyter cell...\n",
2018-03-19 11:44:16 +00:00
"charsio:3:0 warning: singleton variable Np in user:main/0.\n",
2018-02-08 10:46:22 +00:00
"\n",
2018-03-19 11:44:16 +00:00
" % reconsulted memStream in module user, 2 msec 0 bytes\n",
"charsio:1:0 error in prolog:'$handle_error'/3: error: procedure import/1 could not be found,\n",
" goal was prolog:context(user:import([matplotlib|pyplot]),prolog:'$gated_call'/4)\n",
" exception raised from prolog:'$handle_error':3, /Users/vsc/github/yap-6.3/pl/undefined.yap:0:0: \n",
"\n",
"\n"
2018-02-08 10:46:22 +00:00
]
}
],
"source": [
"%matplotlib inline\n",
"\n",
"main :- \n",
2018-03-12 15:11:59 +00:00
" import( matplotlib.pyplot ),\n",
" import( numpy ),\n",
" Plt := matplotlib.pyplot,\n",
" Np := numpy,\n",
" t := np.arange(0.0, 2.0, 0.01),\n",
" s := 1 + np.sin(2*np.pi*t),\n",
" Plt.plot(t, s),\n",
" Plt.xlabel(`time (s)`),\n",
" Plt.ylabel(`voltage (mV)`),\n",
" Plt.title(`About as simple as it gets, folks`),\n",
" Plt.grid(true),\n",
" Plt.savefig(`test2.png`),\n",
" Plt.show().\n",
2018-02-08 10:46:22 +00:00
"\n",
"main"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "bracket or operator expected. (<string>, line 8)",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<string>\"\u001b[0;36m, line \u001b[0;32m8\u001b[0m\n\u001b[0;31m lt = bqplot.pyplot,\n Np = numpy,\n := Plt.figure(1, title=`Line\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m bracket or operator expected.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" % reconsulting jupyter cell...\n",
" % reconsulted ??? in module user, 20 msec 0 bytes\n",
"No (more) answers\n"
]
}
],
"source": [
"\n",
"main2 :-\n",
" python_import( numpy),\n",
" python_import( matplotlib.mlab),\n",
" python_import( matplotlib.pyplot ),\n",
" NP = numpy,\n",
" Mlab = matplotlib.mlab,\n",
" Plt = matplotlib.pyplot,\n",
"\n",
" /* example data */\n",
" Mu = 100, /* mean of distribution, */\n",
" Sigma = 15, /* standard deviation of distribution, */\n",
" x := Mu + Sigma * NP.random.randn(10000),\n",
" NumBins = 50,\n",
"/* the histogram of the data */\n",
"t(n, bins, patches) := Plt.hist(x, NumBins, normed=1, facecolor= `green`, alpha=0.5),\n",
"/* add a `best fit` line */\n",
"y := Mlab.normpdf(bins, mu, sigma),\n",
":= Plt.plot(bins, y, `r--`),\n",
":= Plt.xlabel(`Smarts`),\n",
":= Plt.ylabel(`Probability`),\n",
":=Plt.title(`Histogram of IQ: $\\\\mu=100$, $\\\\sigma=15$ `),\n",
"/* Tweak spacing to prevent clipping of ylabel, */\n",
":= Plt.show().\n",
" \n",
" main2\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
" File \"<stdin>\", line 1\n",
" %%python3\n",
" ^\n",
"SyntaxError: invalid syntax\n"
]
}
],
"source": [
"%%python3\n",
"\n",
"dir(__root__)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
2018-03-19 11:44:16 +00:00
"name": "stderr",
2018-02-08 10:46:22 +00:00
"output_type": "stream",
"text": [
" % reconsulting jupyter cell...\n",
2018-03-19 11:44:16 +00:00
":- user:python:python_import(numoy) failed.\n",
"none:6:0 warning: syntax error bracket or operator expected.\n",
"- Plt = bqplot.pyplot,\n",
" Np = numpy,\n",
" := Plt.figure(1, title= <<<< at line 6 \n",
"\n",
"\n",
" % reconsulted memStream in module user, 145 msec 0 bytes\n"
2018-02-08 10:46:22 +00:00
]
}
],
"source": [
":- python_import(bqplot).\n",
":- python_import(numoy).\n",
"\n",
":- Plt = bqplot.pyplot,\n",
" Np = numpy,\n",
" := Plt.figure(1, title=`Line Chart`),\n",
" := Np.random.seed(0),\n",
"n = 200,\n",
"x = Np.linspace(0.0, 10.0, n).\n",
"y = Np.cumsum(np.random.randn(n)),\n",
":= Plt.plot(x, y),\n",
":= Plt.show().\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"No (more) answers\n"
]
}
],
"source": [
":-[library(real)].\n",
"\n",
"X <- c(1:10), Y := sin(X)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"X:=x"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%% javascript\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "YAP 6",
"language": "prolog",
"name": "yap_kernel"
},
"language_info": {
"codemirror_mode": {
"name": "prolog"
},
"file_extension": "yap",
"mimetype": "text/x-prolog",
"name": "prolog",
"nbconvert_exporter": "python",
"pygments_lexer": "prolog",
"version": "6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}