зеркало из https://github.com/microsoft/ivy.git
203 строки
4.8 KiB
Plaintext
203 строки
4.8 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stderr",
|
|
"output_type": "stream",
|
|
"text": [
|
|
":0: FutureWarning: IPython widgets are experimental and may change in the future.\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from proof import AnalysisSession\n",
|
|
"from widget_analysis_session import AnalysisSessionWidget\n",
|
|
"from tactics import UPDR"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"w = AnalysisSessionWidget()\n",
|
|
"session = AnalysisSession('../examples/ivy/learning_sorted_e.ivy', w)\n",
|
|
"updr = UPDR(session)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"w"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 20,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"from tactics_api import *"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 21,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"set_context(session)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 22,
|
|
"metadata": {
|
|
"collapsed": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"init = arg_add_initial_node()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 23,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"session.step({})"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 26,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"post state 2: (dst(p0, t0) & e(X, X) & rp(s0, sw0, sw1) & rp(H, X, X) & src(p0, s0) & ~e(s0, sw1) & ~pending(P, S, T) & n0 ~= n1 & n0 ~= n2 & n1 ~= n2 & sw0 ~= sw1 & (pending(p0, sw0, sw1) | (s0 = sw1 & sw0 = sw1)) & (X = n0 | X = n1 | X = n2) & (X = Y | ~e(X, Y)) & (X = Y | ~rp(H, X, Y)))\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"e1 = arg_add_action_node(init, session.analysis_state.ivy_ag.actions['error'])\n",
|
|
"session.step({})"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 25,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"Applying tactic: RecalculateFacts\n",
|
|
"Applying tactic: RecalculateFacts resulted in None\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from logic import Or\n",
|
|
"from tactics import RecalculateFacts\n",
|
|
"recalculate_facts = RecalculateFacts()\n",
|
|
"recalculate_facts(e1, [Or()]) "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 17,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"(e(X, X) & rp(H, X, X) & ~pending(P, S, T) & __n0 ~= __n1 & __n0 ~= __n2 & __n1 ~= __n2 & (X = __n0 | X = __n1 | X = __n2) & (X = Y | ~e(X, Y)) & (X = Y | ~rp(H, X, Y)))"
|
|
]
|
|
},
|
|
"execution_count": 17,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"init.clauses"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {
|
|
"collapsed": false
|
|
},
|
|
"outputs": [
|
|
{
|
|
"ename": "NameError",
|
|
"evalue": "name 'execute_action' is not defined",
|
|
"output_type": "error",
|
|
"traceback": [
|
|
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
|
|
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
|
|
"\u001b[1;32m<ipython-input-4-d9ad68ed280e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mexecute_action\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0marg_node\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mget_action\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'receive'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mta\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mAbstractors\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtop_bottom\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
|
|
"\u001b[1;31mNameError\u001b[0m: name 'execute_action' is not defined"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"execute_action(arg_node(0), get_action('receive'), ta.Abstractors.top_bottom)"
|
|
]
|
|
}
|
|
],
|
|
"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
|
|
}
|