ivy/notebooks/updr.ipynb

197 строки
4.2 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/ivy/client_server_sorted.ivy', w)\n",
"updr = UPDR(session)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"updr()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"w"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from collections import OrderedDict\n",
"from concept import Concept, ConceptDomain, get_standard_combiners, get_standard_combinations\n",
"from concept_interactive_session import ConceptInteractiveSession\n",
"from logic import *\n",
"\n",
"client_sort = UninterpretedSort('client')\n",
"server_sort = UninterpretedSort('server')\n",
"\n",
"c = Const('c', FunctionSort(client_sort, server_sort, Boolean))\n",
"s = Const('s', FunctionSort(server_sort, Boolean))\n",
"\n",
"X = Var('X', client_sort)\n",
"Y = Var('Y', server_sort)\n",
"A0 = Var('A0', client_sort)\n",
"B0 = Var('B0', server_sort)\n",
"C0 = Var('C0', c.sort)\n",
"S0 = Var('S0', s.sort)\n",
"\n",
"concepts = OrderedDict()\n",
"concepts['client'] = Concept([X], Eq(X,X))\n",
"concepts['server'] = Concept([Y], Eq(Y,Y))\n",
"concepts['s'] = Concept([Y], s(Y))\n",
"concepts['c'] = Concept([X,Y], c(X,Y))\n",
"concepts['nodes'] = ['client', 'server']\n",
"concepts['edges'] = ['c']\n",
"concepts['node_labels'] = ['s']\n",
"\n",
"cd = ConceptDomain(concepts, get_standard_combiners(), get_standard_combinations())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from logic import Or, And\n",
"w._concept.concept_session = ConceptInteractiveSession(cd, And(), [])\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('server', 's')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"print w._concept.concept_session.state"
]
},
{
"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": [
"from time import sleep\n",
"i = 0\n",
"while True:\n",
" print i\n",
" i += 1\n",
" sleep(1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"i"
]
}
],
"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
}