Coq:类型类与依赖记录(Coq: typeclasses vs dependent records)
我无法理解Coq中类型类和依赖记录之间的区别。 参考手册给出了类型类的语法,但没有说明它们到底是什么以及如何使用它们。 一些思考和搜索揭示了类型类本质上是具有一些语法糖的依赖记录,允许Coq自动推断一些隐式实例和参数。 似乎类型数组的算法在任何给定的上下文中只有一个或多或少一个可能的实例时效果更好,但这不是一个大问题,因为我们总是可以将类型类的所有字段移动到它的参数,消除歧义。 此外,
Instance
声明会自动添加到Hints数据库中,这通常可以简化证明,但如果实例过于笼统并导致证明搜索循环或爆炸,有时也会破坏它们。 还有其他我应该注意的问题吗? 在两者之间进行选择的启发式是什么? 例如,如果我只使用记录并尽可能将其实例设置为隐式参数,我会失去任何东西吗?I can't understand the difference between typeclasses and dependent records in Coq. The reference manual gives the syntax of typeclasses, but says nothing about what they really are and how should you use them. A bit of thinking and searching reveals that typeclasses essentially are dependent records with a bit of syntactic sugar that allows Coq to automatically infer some implicit instances and parameters. It seems that the algorithm for typeclasses works better when there is more or a less only one possible instance of it in any given context, but that's not a big issue since we can always move all fields of typeclass to its parameters, removing ambiguity. Also the
Instance
declaration is automatically added to the Hints database which can often ease the proofs but will also sometimes break them, if the instances were too general and caused proof search loops or explosions. Are there any other issues I should be aware of? What is the heuristic for choosing between the two? E.g. would I lose anything if I use only records and set their instances as implicit parameters whenever possible?
原文:https://stackoverflow.com/questions/29872260
最满意答案
根据此链接 ,某些消息很难用对话框捕获,因为Windows在内部处理它们并且它们永远不会到达
DialogProc
。 以下是我能想到的两个选项:
- 在
WM_COMMAND
事件上使用GetAsyncKeyState
- 创建一个自定义对话框,
DialogProc
将处理WM_KEYDOWN
等消息。According to this link, certain messages are hard to trap with dialog boxes because Windows processes them internally and they never get to the
DialogProc
. Here are two of the options I can think of:
- Use
GetAsyncKeyState
on aWM_COMMAND
event- Create a custom dialog box, the
DialogProc
for which will handleWM_KEYDOWN
etc. messages.
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
几个问题:1)是MFC窗口的WPF对话框的所有者? 如果你没有明确地做任何事情,它不是默认的。 2)当wpf对话框启动时,主窗口是否被禁用? 如果不是,可能是因为问题1。 你需要像这样的东西: var hlpr = new System.Windows.Interop.WindowInteropHelper( xaml_window ); hlpr.Owner = mfc_window_handle; Couple of questions: 1) is the owner of the WPF dial ...
-
在winapi中拖放(Drag and drop in winapi)[2022-12-31]
我的建议是,如果应用程序是在纯winapi,保持这种方式。 仅仅为一个包含可拖动项目的对话框启动一个.NET框架运行时就像托管一个WebBrowser控件一样糟糕,并且使用JQuery来实现这一功能 - 至少是thedailywtf.com - 如果你问我,那么值得一试(但是再一次,你不是问我 ;) )。 否则,你会把自己(和其他人)变成一些可维护性的噩梦,而最快的方式将成为最成问题的方式。 编辑:也许这 两篇文章将有助于实现拖放 - 他们是关于行重新排序在ListViews,但可能有助于获得这个想法。 M ... -
检查ReadFile的“字节读取”输出参数,以便知道字符串的长度,然后在该偏移处放置一个终止的NUL(“\ 0”)字符。 Check the "Bytes Read" output argument of ReadFile so you know how long the string is, then put a terminating NUL (`'\0') character at that offset.
-
调用该对话框,只需要很长时间,因为PointsProc()正在循环... 问题是break; 在PointsProc()处理WM_PAINT ,它会跳过调用DefWindowProc() ,因此窗口不断获取WM_PAINT消息,因为窗口仍然无效。 // case WM_PAINT: // break; The dialog box is called, only it takes a long time because PointsProc() is looping.. ...
-
根据此链接 ,某些消息很难用对话框捕获,因为Windows在内部处理它们并且它们永远不会到达DialogProc 。 以下是我能想到的两个选项: 在WM_COMMAND事件上使用GetAsyncKeyState 创建一个自定义对话框, DialogProc 将处理WM_KEYDOWN等消息。 According to this link, certain messages are hard to trap with dialog boxes because Windows processes them in ...
-
您手动创建的控件(通过CreateWindowEx)不会自动设置其字体,并默认为“系统字体”(这是您在屏幕截图中看到的)。 相反,您需要在控件的字体创建后设置它。 例如, SendMessage(hGroup2, WM_SETFONT, (WPARAM)SendMessage(hGroup1, WM_GETFONT, 0, 0), TRUE); Controls you create manually (via CreateWindowEx) do not get their font set autom ...
-
如果您打算使用本机Win32 API,那么使用GLFW并没有多大好处。 GLFW的重点是隐藏下面的系统API。 使用单独的Win32创建一个OpenGL窗口并不是那么难: #include
#include namespace viewwnd { HWND hWnd; HDC hDC; HGLRC hRC; }; namespace render { int win_width; int win_hei ... -
几个月后我解决了这个问题;) 基本上。 我完全摆脱了对话框,并在FrameLayout (在活动的布局中)中添加了visiblity="gone" LinearLayout。 每当我想要弹出对话框时,我都会将对话框的可见性设置为visibility="visible" 。 I solved this, after a few months ;) Basically. I got rid of the dialog entirely, and added a visiblity="gone" LinearLa ...
-
编写一个控制台处理程序例程来检测CTRL_CLOSE_EVENT(和CTRL_C_EVENT,如果需要),并使用SetConsoleCtrlHandler将处理程序例程添加到您的进程中。 Write a console handler routine that detects CTRL_CLOSE_EVENT (and CTRL_C_EVENT, if desired), and use SetConsoleCtrlHandler to add the handler routine to your pro ...