proof

Using the value of a computed function for a proof in agda

跟風遠走 提交于 2019-12-22 08:24:44
问题 I'm still trying to wrap my head around agda, so I wrote a little tic-tac-toe game Type data Game : Player -> Vec Square 9 -> Set where start : Game x ( - ∷ - ∷ - ∷ - ∷ - ∷ - ∷ - ∷ - ∷ - ∷ [] ) xturn : {gs : Vec Square 9} -> (n : ℕ) -> Game x gs -> n < (#ofMoves gs) -> Game o (makeMove gs x n ) oturn : {gs : Vec Square 9} -> (n : ℕ) -> Game o gs -> n < (#ofMoves gs) -> Game x (makeMove gs o n ) Which will hold a valid game path. Here #ofMoves gs would return the number of empty Square s, n <

Proof assistant for mathematics only

旧巷老猫 提交于 2019-12-21 01:18:29
问题 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? 回答1: Coq has extensive libraries covering real

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

前提是你 提交于 2019-12-20 08:29:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . 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? 回答1: I've only scanned through the paper, but here's a rough summary of how it all hangs together. From

Number of binary search trees over n distinct elements

只愿长相守 提交于 2019-12-17 22:20:53
问题 How many binary search trees can be constructed from n distinct elements? And how can we find a mathematically proved formula for it? Example: If we have 3 distinct elements, say 1, 2, 3, there are 5 binary search trees. 回答1: Given n elements, the number of binary search trees that can be made from those elements is given by the nth Catalan number (denoted C n ). This is equal to Intuitively, the Catalan numbers represent the number of ways that you can create a structure out of n elements

Proof time complexity for recursive function

大憨熊 提交于 2019-12-13 18:11:45
问题 I'm trying to determine the complexity of this function, where D and element are integers and list is an ordered list of integers. Note from this that (otherElement-element) will be strictly positive. def doFunc(element, D, list): x = 0 if(D > 0): for otherElement in list: if otherElement == element: x += 1 if otherElement > element: return x + (doFunc (otherElement,D-(otherElement-element) , list)) return x Given that the list will not be always fully iterated, I don't know how can I

Generalizing fold such that it becomes expressive enough to define any finite recursion?

孤街醉人 提交于 2019-12-12 09:37:31
问题 So, there is something known as a "universal property of fold", stating exactly following: g [] = i; g (x:xs) = f x (g xs) <=> g = fold f i However, as you probably now, there are rare cases like dropWhile , which can not be redefined as fold f i unless you generalize it . The simplest yet obvious way to generalize is to redefine universal property: g' y [] = j y; g' y (x:xs) = h y x xs (g' y xs) <=> g' y = fold (?) l At this point I can make my assumption: I assume existence of somewhat

Explain why x == ~(~x + 1) + 1 (two's complement and back!)

两盒软妹~` 提交于 2019-12-12 08:55:42
问题 As we all know usually negative numbers in memory represents as two's complement numbers like that from x to ~x + 1 and to get back we don't do the obvious thing like ~([~x + 1] - 1) but instead we do ~[~x + 1] + 1 can someone explain why does it always work? I think I can proof it with 1-bit, 2-bit, 3-bit numbers and then use Mathematical induction but it doesn't help me understand how exactly that works. Thanks! 回答1: That's the same thing anyway. That is, ~x + 1 == ~(x - 1) . But let's put

longest common subsequence with linear memory usage [closed]

雨燕双飞 提交于 2019-12-12 06:48:12
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I'm trying to find an algorithm which uses linear space of memory for: Given two strings x and y over an arbitrary alphabet, determine their longest common sub sequence. 回答1: Note that when you're calculating the

Prove that a binary tree with n leaves has a height of at least log n

孤人 提交于 2019-12-11 23:20:50
问题 I know that the number of leaves in a binary tree of height h can be at most 2^h , and I also know how to prove this using induction. Where do I go from here? I found this previously answered question, but this doesn't make any sense to me because I don't understand what the proof by contradiction in the theorem section has anything to do with a binary tree's height being at least log(n) . I was expecting him to talk about how log(n) relates to the number of leaves and height, but instead he

A different way to do induction on lists that needs a proof

余生长醉 提交于 2019-12-11 16:36:39
问题 I have defined an inductive definition of lists (called listkind ) in order make it easy for me to prove a specific theorem by induction on listkind rather than on list. Inductive listkind {X}: list X -> Prop := | l_nil : listkind [] | l_one : forall a:X, listkind [a] | l_app : forall l, listkind l -> forall a b, listkind ([a]++l++[b]). (With this property, to prove things about lists, I have to prove the cases where a list is [], [a], or [a]++l++[b], rather than the cases where a list is []