Skip to content

Instantly share code, notes, and snippets.

View koehlma's full-sized avatar

Maximilian Köhl koehlma

View GitHub Profile
Require Import Relations.
Set Implicit Arguments.
Section LTL.
Variable State : Type.
(* Traces *)
CoInductive Trace : Type :=
| Cons : State -> Trace -> Trace.
@koehlma
koehlma / aig.py
Created January 20, 2017 19:20
Verification Project – Python Libraries
# -*- coding: utf-8 -*-
# Copyright (C) 2017, Maximilian Köhl <mail@koehlma.de>
def _literal(string):
literal = int(string)
return -(literal // 2) if literal & 1 else literal // 2
@koehlma
koehlma / modelsim.py
Last active July 30, 2024 07:19
Python interface to the ModelSim simulator.
# -*- coding: utf-8 -*-
# Copyright (C) 2016, Maximilian Köhl <mail@koehlma.de>
"""
Python interface to the ModelSim simulator. The simulator is instrumented using FIFO pipes
such that it becomes fully controllable from within Python using TCL commands.
"""
import contextlib
@koehlma
koehlma / gc.log
Last active January 24, 2016 10:59
gc: collecting generation 2...
gc: objects in each generation: 13 0 5824
gc: collectable <B 0x7f8c86b4ec50>
gc: collectable <dict 0x7f8c86b57248>
finalize b <__main__.A object at 0x7f8c86b4ec18>
gc: done, 3 unreachable, 0 uncollectable, 0.0005s elapsed
gc: collecting generation 2...
gc: objects in each generation: 1 0 5831
gc: done, 0.0005s elapsed
gc: collecting generation 2...
@koehlma
koehlma / g19.py
Last active August 29, 2015 14:15
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015, Maximilian Köhl <mail@koehlma.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
Quicksort:
A=[23, 11, 8, 4, 15], pivot=15
Partition:
Vertausche 23(0) mit 23(0)
[23, 11, 8, 4, 15] -> [23, 11, 8, 4, 15]
Vergleiche 23(0) mit 15(pivot)
Vertausche 11(1) mit 23(0)
[23, 11, 8, 4, 15] -> [11, 23, 8, 4, 15]
Vergleiche 11(0) mit 15(pivot)
b++
def partition(liste, links, rechts, pivot):
b = links - 1
counter = 0
for k in range(links, rechts + 1):
liste[k], liste[b + 1] = liste[b + 1], liste[k]
counter += 1
if liste[b + 1] <= pivot:
b += 1
return b, counter
def insertionsort(liste):
counter = 0
for i in range(1, len(liste)):
x, j = liste[i], i
while j > 0:
counter += 1
if not liste[j - 1] > x: break
liste[j] = liste[j - 1]
j -= 1
liste[j] = x
@koehlma
koehlma / moneymgr.py
Last active August 29, 2015 14:05
MoneyManager
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import argparse
import collections
import csv
import datetime
import os
import os.path
import subprocess
# -*- coding:utf-8 -*-
#
# Copyright (C) 2013, Maximilian Köhl <linuxmaxi@googlemail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,