logic

Modeling a completely connected graph in Alloy

安稳与你 提交于 2019-12-23 20:13:18
问题 I'm trying to get my feet wet with Alloy (also relatively new-ish to formal logic as well), and I'm trying to start with a completely connected graph of nodes. sig Node { adj : set Node } fact { adj = ~adj -- symmetrical no iden & adj -- no loops all n : Node | Node in n.*adj -- connected } pred ex { } run ex for exactly 3 Node As you can see from the image, Nodes 0 and 1 aren't connected. I thought that my fact was enough to make it completely connected...but perhaps I missed something. 回答1:

Is z3 the most efficient solver for quantifier-free integer propositional logic? [closed]

北城以北 提交于 2019-12-23 15:44:34
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 12 months ago . Sorry that this question is subjective, but given that the Stack Overflow has the largest Z3 user base, I want to give it a try. I have a big constraint satisfaction problem that consists of many integer propositional logic formulas and a few first order logic formulas that

isabelle proving commutativity for add

被刻印的时光 ゝ 提交于 2019-12-23 14:56:11
问题 Im trying to prove commutativity in Isabelle/HOL for a self-defined add function. I managed to prove associativity but I'm stuck on this. The definition of add : fun add :: "nat ⇒ nat ⇒ nat" where "add 0 n = n" | "add (Suc m) n = Suc(add m n)" The proof of associativity: lemma add_Associative: "add(add k m) z = add k (add m z)" apply(induction k) apply(auto) done The proof of commutativity: theorem add_commutativity: "add k m = add m k" apply(induction k) apply(induction m) apply(auto) I get

Is there an automatic parallel prolog implementation?

萝らか妹 提交于 2019-12-23 13:04:53
问题 I'm currently doing some research in theoretical computer science, and one of the main tools I'm using is prolog. I've found it particularly handy for writing very quick tests to disprove conjectures. However, I've gotten to a point where the brute-force search is getting too slow. While I could use a different language, the whole point of my using prolog is that it's extremely fast/simple to write code to test a hypothesis. I'm wondering, is there an implementation of Prolog that allows for

What does index in jquery functions means

谁说我不能喝 提交于 2019-12-23 12:27:43
问题 I am a jQuery started so if it is not of good quality forgive me. I want to know what does index means in the function and what exactly it refers too. Previously i thought it refers to the index number like 0,1,2,3 etc but when i passed 1,2 ,3 in place of index my code stops working. I checked the type of this and it is showing me number data type. Let me now what exactly im doing wrong and the concept of index and Element in jQuery as most places i found something like this -- function(e){ }

Logically Impossible to fetch this particular string.?

痴心易碎 提交于 2019-12-23 05:37:10
问题 I have 3 strings which are random and look somewhat like this 1) ENTL.COMPENSATION REM REVERSE PAYMENT COUPON ON ISIN //IT0004889033 IN A TRIPARTY //TRANSACTION WITH 95724 2) 01P ISIN DE000A1H36U5 QTY 44527000, //C/P 19696 3) COUPON ISIN XS0820547742 QTY 466750, Now what is expected is to fetch the values IT0004889033 or DE000A1H36U5 or XS0820547742 . If you observe the 3 strings, these 3 expected values come rite after the ISIN. So we can take isin as a reference and then fetch the values

How to create family relation logic?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 05:23:16
问题 I'm trying to make this but for a different language. In this language there are different kinds of names for uncles and aunts. We call paternal aunt something else and maternal aunt something else. I came across a graph database 'neo4j'. I created 5 members. I got this approach to work just like I want. But the problem in this is that I've to create n * (n-1) relationships. I'm create a full tree here and not just 5 members of a family. Also, this is more like brute force. I'm creating all

Price Calculation based on the distance covered

一曲冷凌霜 提交于 2019-12-23 05:20:03
问题 I need to calculate price this is what i've got case1: if a car travels between 1-15 miles then price for first mile is £3 and then for every mile after it price will be £1.60 so for this case i'm calculating like this miles= 1-15 rate=1.60; emile=miles-1; totalprice=miles*passenger*1.60+3; case2 if a car travels between 15-30 miles then price will be £ 1.20/mile+previous formula so for this case i'm calculating like this rate=1.20; rate2=1.60; cmile=(miles-14)*rate; fmile=(14*rate2+3);

How to convert newick tree format to tree like Hierarchical javascript object

青春壹個敷衍的年華 提交于 2019-12-23 04:48:21
问题 I am currently studying newick format. https://en.wikipedia.org/wiki/Newick_format I have a newick string of a tree (A,B,(C,D)E)F; How to convert this string into a hierarchical javascript object like tree = { name: 'F', children: [{ name: 'A' }, { name: 'B' }, { name: 'E', children: [{ name: 'C' }, { name: 'D' }] }] } 回答1: The code below should work correctly with any input similar to your example. However, it assumes that each node is identified with a single character. You'd have to modify

R data.table how to replace positive values with column names across multiple binary data columns

故事扮演 提交于 2019-12-23 04:42:17
问题 I'm using R v. 3.2.1 and data.table v 1.9.6. I have a data.table like the example below, which contains some coded binary columns classed as character with the values "0" and "1" and also a string vector that contains phrases with some of the same words as the binary column names. My ultimate goal is to create a wordcloud using both the words in the string vector and also the positive responses in the binary vectors. To do this, I first need to convert the positive responses in the binary