ivy/notebooks/updr_leader_dialogs.ipynb

313 строки
5.7 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from proof import AnalysisSession\n",
"from widget_analysis_session import AnalysisSessionWidget\n",
"from tactics import UPDR"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w = AnalysisSessionWidget()\n",
"session = AnalysisSession('../examples/pldi16/leader_sorted.ivy', w)\n",
"updr = UPDR(session)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept._graph.cy_layout = {'name': 'dagre'}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"w._concept._graph.cy_layout = {'name': 'circle'}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept._graph.height = '300px'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept.concept_session.split('number', '=zero')\n",
"w._concept.concept_session.split('node', '=ring_tail')\n",
"w._concept.concept_session.split('(node-=ring_tail)', '=ring_head')\n",
"w._concept.concept_session.split('((node-=ring_tail)-=ring_head)', 'leader')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept.concept_session.domain.concepts['edges'].append('id')\n",
"w._concept.concept_session.recompute()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"updr()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept._graph.height = '700px'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept.concept_session.state = Or()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept.concept_session.recompute()\n",
"w._concept.concept_session.abstract_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w._concept.concept_session.undo_stack"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"session.analysis_state.ivy_interp.sig.sorts"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"session.analysis_state.ivy_interp.sig.symbols"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from IPython.html import widgets"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"widgets.Dropdown(\n",
" options=['<b>1</b>', '$a$', '3'],\n",
" value='3',\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"widgets.Select(\n",
" description='$a \\\\ne 0$',\n",
" options=['Linux', 'Windows', '$a \\\\ne 0$'],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = widgets.Checkbox( \n",
" #description='+',\n",
" value=True,\n",
" width='100px'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"def p(arg):\n",
" print arg\n",
"x.f = lambda self: p('f')\n",
"x.on_trait_change(x.f, 'value')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"widgets.Latex(value='pendingxxxxx', background_color=\"green\", margin='5px', color=\"red\", width='100px')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = widgets.HTML(value='+', width='100px')\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"x._css = (('color', 'red'),)\n",
"x"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}