Skip to content

Instantly share code, notes, and snippets.

View tchajed's full-sized avatar

Tej Chajed tchajed

View GitHub Profile
@tchajed
tchajed / iteration.dfy
Created October 15, 2019 15:31
Iterating over sequences and sets in Dafny
method sum_seq(xs: seq<int>) returns (z:int) {
var sum := 0;
var i := 0;
while i < |xs|
invariant i <= |xs|
{
sum := sum + xs[i];
i := i + 1;
}
return sum;
@tchajed
tchajed / bash-colors.sh
Created April 7, 2020 15:28
ANSI escapes for colors in bash
#!/bin/bash
info() {
echo -e "\033[34m$1\033[0m"
}
error() {
echo -e "\033[31m$1\033[0m"
}
@tchajed
tchajed / iris-release.sh
Last active April 12, 2024 10:19
Script to release Iris and std++
#!/usr/bin/env bash
# iris-release.sh prepares a commit for https://github.com/coq/opam to
# add a new version of std++ and Iris to the Coq opam repository.
#
# Requires a clone of opam-coq-archive. The opam files from std++ and Iris are
# retrieved by downloading their releases by tag.
set -eu
@tchajed
tchajed / _dafny_to_smt2.sh
Last active October 18, 2023 16:13
Getting SMT2 verification condition from Dafny
#!/bin/sh
dafny verify --solver-log example.smt2 --boogie /normalizeNames:0 example.dfy
@tchajed
tchajed / _verus_to_smt2.sh
Created October 18, 2023 16:16
Generate SMT2 from Verus
#!/bin/sh
verus --log-smt example.rs
# output is in .verus-log/root.smt2