I'm new to Jaseci world. Here I'm trying to figure out how the chaining edge connections between nodes works in jaseci. In the following code snippet was taken from the Jaseci Bible.
node person;
edge friend;
edge family;
walker init {
node1 = spawn node::person;
node2 = spawn node::person;
node2 <-[friend]- here -[friend]-> node1 <-[family]-> node2;
}
According to the bible the graph is as follows;
The chain connection works left to right. I don't get how the line node2 <-[friend]- here -[friend]-> node1 <-[family]-> node2; creates the e1 edge. Can someone help me to understand this?.
It appears the diagram doesn't match the code. Must be an error in the Bible. I just plopped your code example in a file and ran it with jsctl -m jac dot nextion.jac. I got this output:
strict digraph root {
"n0" [ label="n0:root" ]
"n1" [ label="n1:person" ]
"n2" [ label="n2:person" ]
"n0" -> "n1" [ label="e0:friend" ]
"n0" -> "n2" [ label="e1:friend" ]
"n1" -> "n2" [ label="e2:family", dir="both" ]
}
If you render this in graphviz online it looks like
I am a student and try to customize the system calls in gVisor. I have successfully compiled the gVisor on go-branch. And I have got the right message when I change the pkg/sentry/kernel/syslog.go file. Here is the result that can show I have successfully compiled the runsc (the runtime of gVisor).
sudo docker run --runtime=runsc -it ubuntu dmesg
[ 0.000000] asdf Starting gVisor...
[ 0.360765] 6666...
[ 0.529799] 5555...
[ 0.959593] iiiiii...
[ 1.343602] 7777...
[ 1.347068] 4444...
[ 1.424063] 00000...
[ 1.470641] 22222...
[ 1.858755] 99999...
[ 2.213219] 8888...
[ 2.679995] cccccc ..
[ 2.943468] asdf asdf Setting up VFS2...
[ 3.429006] Ready!
And I have noticed the package gvisor/pkg/sentry/syscalls/linux which contains all the syscalls and they are registered in file gvisor/pkg/sentry/syscalls/linux/linux64.go. However, I failed to customize the syscalls in gVisor.
Thanks very much.
These are the contents of my ~/.vscode-server/server-env-setup
function _update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
... gives this error
[2019-12-10 13:49:39.763] /mnt/c/Users/cber/.vscode/extensions/ms-vscode-remote.remote-wsl-0.40.3/scripts/wslServer.sh: 1: /home/cber/.vscode-server/server-env-setup: Syntax error: "(" unexpected
[2019-12-10 13:49:39.805] VS Code Server for WSL closed unexpectedly.
UPDATE
This version (stripped of windows line endings) does not produce any errors, but unfortunately also does not display anything in the prompt in a git repo:
GOPATH=$HOME/go
_update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $?)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
I have the following environment:
/usr/share/logstash# bin/logstash --path.settings=/etc/logstash -f /etc/logstash/conf.d/stream.conf -V
Sending Logstash logs to /var/log/logstash which is now configured via log4j2.properties.
logstash 5.0.0
jruby 1.7.25 (1.9.3p551) 2016-04-13 867cb81 on Java HotSpot(TM) 64-Bit Server VM 1.8.0_111-b14 +jit [linux-amd64]
java 1.8.0_111 (Oracle Corporation)
jvm Java HotSpot(TM) 64-Bit Server VM / 25.111-b14
I installed the following 2 repos
logstash-input-websocket version 3.0.2
ruby-ftw http://github.com/jordansissel/ruby-ftw"
I created both gems by running gem install .gemspec file.
My Gemfile under /usr/share/logstash folder was modified to add those 2 lines.
gem "logstash-input-websocket", :path => "/home/xav/source/logstash-input-websocket-master"
gem "ftw", :path => "/home/xav/source/ruby-ftw-master"
I know my logstash configuration is ok ( I checked it with -t option).
Furthermore, on purpose I modified my stream.conf file to omit the url definition for the input websocket to make sure the plugin was being used.
I got the expected error in the /var/log/logstash/logstash-plain.log file as below:
xav#xav-VirtualBox:/var/log/logstash$ tail -f logstash-plain.log
[2016-11-01T11:40:28,998][ERROR][logstash.inputs.websocket] Missing a required setting for the websocket input plugin:
input {
websocket {
url => # SETTING MISSING
...
}
}
[2016-11-01T11:40:29,011][ERROR][logstash.agent ] fetched an invalid config {:config=>"\ninput {\n websocket {\n mode => client\n}\n}\n\noutput {\n\n stdout { }\n}\n\n", :reason=>"Something is wrong with your configuration."
I edited the stream.conf file to add the wss url I want to read the json
output from with:
input {
websocket {
mode => client
url => "wss://<my-url-to-websocket/something"}
}
output {
stdout { }
}
I run logstash again. Everything seems to be working fine BUT I don't get anything in my stdout. The log file output is:
11-01T12:09:25,968][DEBUG][logstash.runner ] -------- Logstash Settings (* means modified) ---------
11-01T12:09:25,980][DEBUG][logstash.runner ] node.name: "xav-VirtualBox"
11-01T12:09:25,981][DEBUG][logstash.runner ] *path.config: "/etc/logstash/conf.d/stream.conf"
11-01T12:09:25,981][DEBUG][logstash.runner ] *path.data: "/var/lib/logstash" (default: "/usr/share/logstash/data")
11-01T12:09:25,981][DEBUG][logstash.runner ] config.test_and_exit: false
11-01T12:09:25,981][DEBUG][logstash.runner ] config.reload.automatic: false
11-01T12:09:25,981][DEBUG][logstash.runner ] config.reload.interval: 3
11-01T12:09:25,982][DEBUG][logstash.runner ] metric.collect: true
11-01T12:09:25,982][DEBUG][logstash.runner ] pipeline.id: "main"
11-01T12:09:25,982][DEBUG][logstash.runner ] pipeline.workers: 1
11-01T12:09:25,982][DEBUG][logstash.runner ] pipeline.output.workers: 1
11-01T12:09:25,983][DEBUG][logstash.runner ] pipeline.batch.size: 125
11-01T12:09:25,983][DEBUG][logstash.runner ] pipeline.batch.delay: 5
11-01T12:09:25,983][DEBUG][logstash.runner ] pipeline.unsafe_shutdown: false
11-01T12:09:25,983][DEBUG][logstash.runner ] path.plugins: []
11-01T12:09:25,984][DEBUG][logstash.runner ] config.debug: false
11-01T12:09:25,984][DEBUG][logstash.runner ] *log.level: "debug" (default: "info")
11-01T12:09:25,984][DEBUG][logstash.runner ] version: false
11-01T12:09:25,984][DEBUG][logstash.runner ] help: false
11-01T12:09:25,984][DEBUG][logstash.runner ] log.format: "plain"
11-01T12:09:25,984][DEBUG][logstash.runner ] http.host: "127.0.0.1"
11-01T12:09:25,984][DEBUG][logstash.runner ] http.port: 9600..9700
11-01T12:09:25,986][DEBUG][logstash.runner ] http.environment: "production"
11-01T12:09:25,986][DEBUG][logstash.runner ] *path.settings: "/etc/logstash" (default: "/usr/share/logstash/config")
11-01T12:09:25,986][DEBUG][logstash.runner ] *path.logs: "/var/log/logstash" (default: "/usr/share/logstash/logs")
11-01T12:09:25,987][DEBUG][logstash.runner ] --------------- Logstash Settings -------------------
11-01T12:09:26,039][DEBUG][logstash.agent ] Agent: Configuring metric collection
11-01T12:09:26,043][DEBUG][logstash.instrument.periodicpoller.os] PeriodicPoller: Starting {:polling_interval=>1, :polling_timeout=>60}
11-01T12:09:26,049][DEBUG][logstash.instrument.periodicpoller.jvm] PeriodicPoller: Starting {:polling_interval=>1, :polling_timeout=>60}
11-01T12:09:26,122][DEBUG][logstash.agent ] Reading config file {:config_file=>"/etc/logstash/conf.d/stream.conf"}
11-01T12:09:26,197][DEBUG][logstash.codecs.json ] config LogStash::Codecs::JSON/#id = "json_982d8975-bd47-4f64-8a68-0da7e7a59a55"
11-01T12:09:26,198][DEBUG][logstash.codecs.json ] config LogStash::Codecs::JSON/#enable_metric = true
11-01T12:09:26,198][DEBUG][logstash.codecs.json ] config LogStash::Codecs::JSON/#charset = "UTF-8"
11-01T12:09:26,202][DEBUG][logstash.inputs.websocket] config LogStash::Inputs::Websocket/#mode = "client"
11-01T12:09:26,202][DEBUG][logstash.inputs.websocket] config LogStash::Inputs::Websocket/#url = "wss://REDACTED"
11-01T12:09:26,202][DEBUG][logstash.inputs.websocket] config LogStash::Inputs::Websocket/#id = "93ebfb1d0936097ee295b418952f2dab3abb3ef8-1"
11-01T12:09:26,203][DEBUG][logstash.inputs.websocket] config LogStash::Inputs::Websocket/#enable_metric = true
11-01T12:09:26,203][DEBUG][logstash.inputs.websocket] config LogStash::Inputs::Websocket/#codec = <LogStash::Codecs::JSON id=>"json_982d8975-bd47-4f64-8a68-0da7e7a59a55", enable_metric=>true, charset=>"UTF-8">
11-01T12:09:26,203][DEBUG][logstash.inputs.websocket] config LogStash::Inputs::Websocket/#add_field = {}
11-01T12:09:26,211][DEBUG][logstash.codecs.line ] config LogStash::Codecs::Line/#id = "line_a255b752-4d76-4933-b4d3-e76e427bbddb"
11-01T12:09:26,214][DEBUG][logstash.codecs.line ] config LogStash::Codecs::Line/#enable_metric = true
11-01T12:09:26,215][DEBUG][logstash.codecs.line ] config LogStash::Codecs::Line/#charset = "UTF-8"
11-01T12:09:26,215][DEBUG][logstash.codecs.line ] config LogStash::Codecs::Line/#delimiter = "\n"
11-01T12:09:26,218][DEBUG][logstash.outputs.stdout ] config LogStash::Outputs::Stdout/#id = "93ebfb1d0936097ee295b418952f2dab3abb3ef8-2"
11-01T12:09:26,219][DEBUG][logstash.outputs.stdout ] config LogStash::Outputs::Stdout/#enable_metric = true
11-01T12:09:26,219][DEBUG][logstash.outputs.stdout ] config LogStash::Outputs::Stdout/#codec = <LogStash::Codecs::Line id=>"line_a255b752-4d76-4933-b4d3-e76e427bbddb", enable_metric=>true, charset=>"UTF-8", delimiter=>"\n">
11-01T12:09:26,219][DEBUG][logstash.outputs.stdout ] config LogStash::Outputs::Stdout/#workers = 1
11-01T12:09:26,238][DEBUG][logstash.agent ] starting agent
11-01T12:09:26,242][DEBUG][logstash.agent ] starting pipeline {:id=>"main"}
11-01T12:09:26,650][INFO ][logstash.pipeline ] Starting pipeline {"id"=>"main", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>125}
11-01T12:09:26,654][INFO ][logstash.pipeline ] Pipeline main started
11-01T12:09:26,676][DEBUG][logstash.agent ] Starting puma
11-01T12:09:26,682][DEBUG][logstash.agent ] Trying to start WebServer {:port=>9600}
11-01T12:09:26,688][DEBUG][logstash.api.service ] [api-service] start
11-01T12:09:26,748][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
11-01T12:09:27,038][DEBUG][logstash.instrument.collector] Collector: Sending snapshot to observers {:created_at=>2016-11-01 12:09:27 -0400}
11-01T12:09:28,053][DEBUG][logstash.instrument.collector] Collector: Sending snapshot to observers {:created_at=>2016-11-01 12:09:28 -0400}
11-01T12:09:29,060][DEBUG][logstash.instrument.collector] Collector: Sending snapshot to observers {:created_at=>2016-11-01 12:09:29 -0400}
11-01T12:09:30,100][DEBUG][logstash.instrument.collector] Collector: Sending snapshot to observers {:created_at=>2016-11-01 12:09:30 -0400}
What am I missing?
While working on rational numbers with leon, I have to add as requirement isRational pretty much everywhere.
For example:
import leon.lang._
case class Rational (n: BigInt, d: BigInt) {
def +(that: Rational): Rational = {
require(isRational && that.isRational)
Rational(n * that.d + that.n * d, d * that.d)
} ensuring { _.isRational }
def *(that: Rational): Rational = {
require(isRational && that.isRational)
Rational(n * that.n, d * that.d)
} ensuring { _.isRational }
// ...
def isRational = !(d == 0)
def nonZero = n != 0
}
Is it possible to add a require statement in a class constructor to DRY this code so that it applies to all instances of the data structure? I tried adding it on the first line of the class body but it seems to have no effect...
case class Rational (n: BigInt, d: BigInt) {
require(isRational) // NEW
// ... as before ...
def lemma(other: Rational): Rational = {
Rational(n * other.d + other.n * d, d * other.d)
}.ensuring{_.isRational}
def lemmb(other: Rational): Boolean = {
require(other.d * other.n >= 0)
this <= (other + this)
}.holds
}
This does not prevent leon from creating a Rational(0, 0) for example as the report suggest:
[ Info ] - Now considering 'postcondition' VC for Rational$$plus #9:16...
[ Info ] => VALID
[ Info ] - Now considering 'postcondition' VC for Rational$$times #14:16...
[ Info ] => VALID
[ Info ] - Now considering 'postcondition' VC for Rational$lemma #58:14...
[ Error ] => INVALID
[ Error ] Found counter-example:
[ Error ] $this -> Rational(1, 0)
[ Error ] other -> Rational(1888, -1)
[ Info ] - Now considering 'postcondition' VC for Rational$lemmb #60:41...
[ Error ] => INVALID
[ Error ] Found counter-example:
[ Error ] $this -> Rational(-974, 0)
[ Error ] other -> Rational(-5904, -1)
[ Info ] - Now considering 'precond. (call $this.<=((other + $this)))' VC for Rational$lemmb #62:5...
[ Error ] => INVALID
[ Error ] Found counter-example:
[ Error ] $this -> Rational(-1, 0)
[ Error ] other -> Rational(0, -1)
[ Info ] - Now considering 'precond. (call other + $this)' VC for Rational$lemmb #62:14...
[ Error ] => INVALID
[ Error ] Found counter-example:
[ Error ] $this -> Rational(1, 2)
[ Error ] other -> Rational(7719, 0)
[ Info ] ┌──────────────────────┐
[ Info ] ╔═╡ Verification Summary ╞═══════════════════════════════════════════════════════════════════╗
[ Info ] ║ └──────────────────────┘ ║
[ Info ] ║ Rational$$plus postcondition 9:16 valid U:smt-z3 0.010 ║
[ Info ] ║ Rational$$times postcondition 14:16 valid U:smt-z3 0.012 ║
[ Info ] ║ Rational$lemma postcondition 58:14 invalid U:smt-z3 0.011 ║
[ Info ] ║ Rational$lemmb postcondition 60:41 invalid U:smt-z3 0.018 ║
[ Info ] ║ Rational$lemmb precond. (call $this.<=((ot... 62:5 invalid U:smt-z3 0.015 ║
[ Info ] ║ Rational$lemmb precond. (call other + $this) 62:14 invalid U:smt-z3 0.011 ║
[ Info ] ╟┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╢
[ Info ] ║ total: 6 valid: 2 invalid: 4 unknown 0 0.077 ║
[ Info ] ╚════════════════════════════════════════════════════════════════════════════════════════════╝
(this and other don't always meet the constructor requirement.)
Am I missing something?
The main difficulty with invariants can be decomposed in two problems:
Problem 1
Given
case class A(v: BigInt) {
require(v > 0)
}
Leon would have to inject this requirement in preconditions of all functions taking A as argument, so
def foo(a: A) = {
a.v
} ensuring { _ > 0 }
will need to become:
def foo(a: A) = {
require(a.v > 0)
a.v
} ensuring { _ > 0 }
While trivial for this case, consider the following functions:
def foo2(as: List[A]) = {
require(as.nonEmpty)
a.head.v
} ensuring { _ > 0 }
or
def foo3(as: Set[A], a: A) = {
as contains a
} ensuring { _ > 0 }
Here it is not so easy to constraint foo2 so that the list contains only valid As. Leon would have to synthesize traversal functions on ADTs so that these preconditions can be injected.
Moreover, it is impossible to specify that the Set[A] contains only valid As as Leon lacks capabilities to traverse&constraint the set.
Problem 2
While it would be practical to write the following function:
case class A(a: BigInt) {
require(invariant)
def invariant: Boolean = // ...
}
You have a chicken-and-egg issue, where invariant would be injected with a precondition checking invariant on this.
I believe both problems can be solved (or we can restrict the usage of these invariants), but they constitute the reasons why class invariants have you been trivially implemented yet.