termination

Termination check on unionWith

柔情痞子 提交于 2019-12-02 13:55:04
问题 I'm having a problem with termination checking, very similar to the one described in this question and also this Agda bug report/feature request. The problem is convincing the compiler that the following unionWith terminates. Using a combining function for duplicate keys, unionWith merges two maps represented as lists of (key, value) pairs sorted by key. The Key parameter of a finite map is a (non-tight) lower bound on the keys contained in the map. (One reason for defining this data type is

Intercept WM_CLOSE for cleanup operations

寵の児 提交于 2019-12-02 02:38:55
问题 I have an external application that calls my application and is supposed to end it when the job is done. The log from this external application claims it uses WM_CLOSE on my app. How can I intercept the WM_CLOSE message in my application to do some cleanup operations? I tried at_exit() and wrapping it in a class, but I think I have the wrong approach. 回答1: You could just handle WM_CLOSE in your message loop to do whatever cleanup is necessary, or even abort the close (by returning 1 instead

Intercept WM_CLOSE for cleanup operations

醉酒当歌 提交于 2019-12-02 02:16:25
I have an external application that calls my application and is supposed to end it when the job is done. The log from this external application claims it uses WM_CLOSE on my app. How can I intercept the WM_CLOSE message in my application to do some cleanup operations? I tried at_exit() and wrapping it in a class, but I think I have the wrong approach. You could just handle WM_CLOSE in your message loop to do whatever cleanup is necessary, or even abort the close (by returning 1 instead of 0). See e.g. this: http://cboard.cprogramming.com/windows-programming/141438-handling-wm_close-wm_destroy

_DebugHeapDelete Access Violation at termination

99封情书 提交于 2019-12-02 00:56:53
I'm getting a weird access violation at the end of my main whose cause I'm having some difficulties finding. When shutting down my application I get an access violation in the following: xdebug // TEMPLATE FUNCTION _DebugHeapDelete template<class _Ty> void __CLRCALL_OR_CDECL _DebugHeapDelete(_Ty *_Ptr) { // delete from the debug CRT heap even if operator delete exists if (_Ptr != 0) { // worth deleting _Ptr->~_Ty(); // delete as _NORMAL_BLOCK, not _CRT_BLOCK, since we might have // facets allocated by normal new. free(_Ptr); // **ACCESS VIOLATION** } } Stack trace: > msvcp100d.dll!std::

Make automatic termination proof use different size function

南笙酒味 提交于 2019-12-01 04:48:18
问题 I have written a custom size function size2 for my datatype. Using this function I can manually prove the termination of my function: termination apply (relation "measure (λ(a,b,c). size2 c)") apply auto done Is there a way to make fun use my alternative size function for the automatic termination proof? 回答1: A function f can be registered as a measure function for the termination prover by declaring the lemma is_measure f with the attribute measure_function . In your case, this looks as

Nested recursion and `Program Fixpoint` or `Function`

送分小仙女□ 提交于 2019-11-30 14:02:21
I’d like to define the following function using Program Fixpoint or Function in Coq: Require Import Coq.Lists.List. Import ListNotations. Require Import Coq.Program.Wf. Require Import Recdef. Inductive Tree := Node : nat -> list Tree -> Tree. Fixpoint height (t : Tree) : nat := match t with | Node x ts => S (fold_right Nat.max 0 (map height ts)) end. Program Fixpoint mapTree (f : nat -> nat) (t : Tree) {measure (height t)} : Tree := match t with Node x ts => Node (f x) (map (fun t => mapTree f t) ts) end. Next Obligation. Unfortunately, at this point I have a proof obligation height t < height

Termination-checking of function over a trie

限于喜欢 提交于 2019-11-29 14:52:12
I'm having difficulty convincing Agda to termination-check the function fmap below and similar functions defined recursively over the structure of a Trie . A Trie is a trie whose domain is a Type , an object-level type formed from unit, products and fixed points (I've omitted coproducts to keep the code minimal). The problem seems to relate to a type-level substitution I use in the definition of Trie . (The expression const (μₜ τ) * τ means apply the substitution const (μₜ τ) to the type τ .) module Temp where open import Data.Unit open import Category.Functor open import Function open import

How terminate child processes when parent process terminated in C#

五迷三道 提交于 2019-11-28 20:39:14
Task: Auto kill all child processes if parent process terminate. Parent procees can be terminated not only in correct way, but also by killing in ProcessExplorer, for example. How can I do it? Similar question in С topic advice to use Job objects. How to use it in C# without exporting external DLL? I tried to use Job Objects. But this code doesn't work properly: var job = PInvoke.CreateJobObject(null, null); var jobli = new PInvoke.JOBOBJECT_BASIC_LIMIT_INFORMATION(); jobli.LimitFlags = PInvoke.LimitFlags.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | PInvoke.LimitFlags.JOB_OBJECT_LIMIT_PRIORITY_CLASS |

How to stop/terminate a python script from running?

核能气质少年 提交于 2019-11-28 20:03:44
I wrote a program in IDLE to tokenize text files and it starts to tokeniza 349 text files! How can I stop it? How can I stop a running Python program? To stop your program, just press Control + C . You can also do it if you use the exit() function in your code. More ideally, you can do sys.exit() . sys.exit() might terminate Python even if you are running things in parallel through the multiprocessing package. Ctrl-Break it is more powerful than Ctrl-C wpp To stop a python script just press Ctrl + C . Inside a script with exit() , you can do it. You can do it in an interactive script with just

Termination-checking of function over a trie

戏子无情 提交于 2019-11-28 08:59:20
问题 I'm having difficulty convincing Agda to termination-check the function fmap below and similar functions defined recursively over the structure of a Trie . A Trie is a trie whose domain is a Type , an object-level type formed from unit, products and fixed points (I've omitted coproducts to keep the code minimal). The problem seems to relate to a type-level substitution I use in the definition of Trie . (The expression const (μₜ τ) * τ means apply the substitution const (μₜ τ) to the type τ .)