QArith中的平等

时间:2015-12-10 16:47:00

标签: coq

我想使用QArith的交换性适当性来替换另一个表达式:

Require Import QArith.

Variable q1 q2 : Q.
Lemma l1 : q1 + q2 = q2 + q1.
Proof.
rewrite Qplus_comm. (* Fail *)

有没有办法将“Qeq”等式用作“=”?

1 个答案:

答案 0 :(得分:0)

from collections import OrderedDict import numpy as np import bokeh.plotting as bk from bokeh.plotting import figure, show, output_file from bokeh.models import HoverTool, ColumnDataSource bk.output_notebook() #for viz within ipython notebook N = 20 arr2d = np.random.randint(0,10,size=(N,N)) predicted = [] actual = [] count = [] color = [] alpha = [] the_color = '#cc0000' for col in range(N): for rowi in range(N): predicted.append(str(rowi)) actual.append(str(col)) count.append(arr2d[rowi,col]) a = arr2d[rowi,col]/10.0 alpha.append(a) color.append(the_color) source = ColumnDataSource( data=dict(predicted=predicted, actual=actual, count=count, alphas=alpha, colors=color) ) #THE FIX IS HERE! use `set` to dedup correct_y_range = sorted(list(set(actual)), reverse=True) correct_x_range = sorted(list(set(predicted))) p = figure(title='Confusion Matrix', x_axis_location="above", tools="resize,hover,save", y_range=correct_y_range, x_range=correct_x_range) p.plot_width = 600 p.plot_height = p.plot_width rectwidth = 0.9 p.rect('predicted', 'actual', rectwidth, rectwidth, source=source, color='colors', alpha='alphas',line_width=1, line_color='k') p.axis.major_label_text_font_size = "12pt" p.axis.major_label_standoff = 1 p.xaxis.major_label_orientation = np.pi/3 hover = p.select(dict(type=HoverTool)) hover.tooltips = OrderedDict([ ('predicted', '@predicted'), ('actual', '@actual'), ('count', '@count'), ]) show(p) import matplotlib.pyplot as plt import numpy as np # define four sets of data here: x1, y1, yerr1, x2, y2, yerr2, etc... fit1 = np.poly1d(np.polyfit(x1,y1,1)) xrange = np.linspace(min(x1), max(x1), num = 1000) f, axarr = plt.subplots(2,2) axarr[0,0].plot(xrange, fit1(xrange)) axarr[0,0].errorbar(x1, y1, yerr = yerr1, fmt = 'r.') # and for the rest just the errorbar portion plt.show() 不同。这是一个证明,假设它们相等导致q1 == q2,这是一个矛盾。

q1 = q2

请参阅Conversion of nat to Q in Coq,其中Arthur A A显示False,并解释原因。