proof

I can't prove (n - 0) = n with Idris

≡放荡痞女 提交于 2019-12-03 11:27:20
I am trying to prove, what to my mind is a reasonable theorem: theorem1 : (n : Nat) -> (m : Nat) -> (n + (m - n)) = m Proof by induction gets to the point where me need to prove this: lemma1 : (n : Nat) -> (n - 0) = n This is what happens when I try to prove it (the lemma, for simplicity sake) using the interactive prover: ---------- Goal: ---------- {hole0} : (n : Nat) -> minus n 0 = n > intros ---------- Other goals: ---------- {hole0} ---------- Assumptions: ---------- n : Nat ---------- Goal: ---------- {hole1} : minus n 0 = n > trivial Can't unify n = n with minus n 0 = n Specifically:

Open Type Level Proofs in Haskell/Idris

人走茶凉 提交于 2019-12-03 08:08:08
问题 In Idris/Haskell, one can prove properties of data by annotating the types and using GADT constructors, such as with Vect, however, this requires hardcoding the property into the type (e.g. a Vect has to be a separate type from a List). Is it possible to have types with an open set of properties (such as list carrying both a length and running average), for example by overloading constructors or using something in the vein of Effect? 回答1: I believe that McBride has answered that question (for

Proof assistant for mathematics only

风格不统一 提交于 2019-12-03 07:40:30
Most proof assistants are functional programming languages with dependent types. They can proof programs/algorithms. I'm interested, instead, in proof assistant suitable best for mathematics and only (calculus for instance). Can you recommend one? I heard about Mizar but I don’t like that the source code is closed, but if it is best for math I will use it. How well the new languages such as Agda and Idris are suited for mathematical proofs? Coq has extensive libraries covering real analysis. Various developments come to mind: the standard library and projects building on it such as the now

Find subset with elements that are furthest apart from eachother

五迷三道 提交于 2019-12-03 07:26:33
问题 I have an interview question that I can't seem to figure out. Given an array of size N, find the subset of size k such that the elements in the subset are the furthest apart from each other. In other words, maximize the minimum pairwise distance between the elements. Example: Array = [1,2,6,10] k = 3 answer = [1,6,10] The bruteforce way requires finding all subsets of size k which is exponential in runtime. One idea I had was to take values evenly spaced from the array. What I mean by this is

Proof by Induction of Pseudo Code

帅比萌擦擦* 提交于 2019-12-03 04:35:04
问题 I don't really understand how one uses proof by induction on psuedocode. It doesn't seem to work the same way as using it on mathematical equations. I'm trying to count the number of integers that are divisible by k in an array. Algorithm: divisibleByK (a, k) Input: array a of n size, number to be divisible by k Output: number of numbers divisible by k int count = 0; for i <- 0 to n do if (check(a[i],k) = true) count = count + 1 return count; Algorithm: Check (a[i], k) Input: specific number

What is the Pumping Lemma in Layman's terms?

二次信任 提交于 2019-12-03 00:07:07
问题 I saw this question, and was curious as to what the pumping lemma was (Wikipedia didn't help much). I understand that it's basically a theoretical proof that must be true in order for a language to be in a certain class, but beyond that I don't really get it. Anyone care to try to explain it at a fairly granular level in a way understandable by non mathematicians/comp sci doctorates? 回答1: The pumping lemma is a simple proof to show that a language is not regular, meaning that a Finite State

Should code be short/concise? [closed]

混江龙づ霸主 提交于 2019-12-02 20:55:30
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . When writing a mathematical proof, one goal is to continue compressing the proof. The proof gets more elegant but not necessarily more readable. Compression translates to better understanding, as you weed out unnecessary characters and verbosity. I often hear developers say you should make your code foot print as small as possible. This can very quickly yield unreadable code. In

Open Type Level Proofs in Haskell/Idris

僤鯓⒐⒋嵵緔 提交于 2019-12-02 20:45:15
In Idris/Haskell, one can prove properties of data by annotating the types and using GADT constructors, such as with Vect, however, this requires hardcoding the property into the type (e.g. a Vect has to be a separate type from a List). Is it possible to have types with an open set of properties (such as list carrying both a length and running average), for example by overloading constructors or using something in the vein of Effect? I believe that McBride has answered that question (for Type Theory) in his ornament paper (pdf) . The concept you are looking for is the one of an algebraic

Explain the proof by Vinay Deolalikar that P != NP [closed]

怎甘沉沦 提交于 2019-12-02 13:55:41
Recently there has been a paper floating around by Vinay Deolalikar at HP Labs which claims to have proved that P != NP . Could someone explain how this proof works for us less mathematically inclined people? Michael Anderson I've only scanned through the paper, but here's a rough summary of how it all hangs together. From page 86 of the paper. ... polynomial time algorithms succeed by successively “breaking up” the problem into smaller subproblems that are joined to each other through conditional independence. Consequently, polynomial time algorithms cannot solve problems in regimes where

What is the Pumping Lemma in Layman's terms?

一个人想着一个人 提交于 2019-12-02 13:53:39
I saw this question , and was curious as to what the pumping lemma was ( Wikipedia didn't help much). I understand that it's basically a theoretical proof that must be true in order for a language to be in a certain class, but beyond that I don't really get it. Anyone care to try to explain it at a fairly granular level in a way understandable by non mathematicians/comp sci doctorates? Graphics Noob The pumping lemma is a simple proof to show that a language is not regular, meaning that a Finite State Machine cannot be built for it. The canonical example is the language (a^n)(b^n) . This is