ivy/notebooks/updr_leader.ipynb

216 строки
4.2 KiB
Plaintext
Исходник Обычный вид История

2015-12-29 00:09:12 +03:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%qtconsole"
]
},
{
"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": false
},
"outputs": [],
"source": [
"updr()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from collections import OrderedDict\n",
"from concept import get_initial_concept_domain\n",
"cd = get_initial_concept_domain(session.analysis_state.ivy_interp.sig)\n",
"cd.output()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from logic import Or, And\n",
"from concept_interactive_session import ConceptInteractiveSession\n",
"w._concept.concept_session = ConceptInteractiveSession(cd, And(), session.analysis_state.ivy_interp.background_theory().to_formula(),[])\n",
"w._concept.concept_session.widget = w._concept\n",
"w._concept.concept_session.recompute()"
]
},
{
"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._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": [
"print 1"
]
}
],
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}