Skip to content

Instantly share code, notes, and snippets.

View ichistmeinname's full-sized avatar

Sandra Dylus ichistmeinname

View GitHub Profile
(* The following two examples fulfill the (strict) positivity condition *)
Inductive Switch (A : Type) : Type :=
| switch : Switch A -> Switch A.
Inductive UseSwitch :=
| useSwitch : Switch UseSwitch -> UseSwitch.
Inductive SwitchSP (A : Type) : Type :=
--------------------------------
-- Pretty Printing type class --
--------------------------------
class Pretty a where
pretty :: a -> String
pprint :: a -> IO ()
pprint = putStrLn . pretty
instance Pretty Int where
@ichistmeinname
ichistmeinname / leftpad.v
Created April 23, 2018 20:48
Proofs about leftpad inspired by ezrakilty -- https://github.com/ezrakilty/hillel-challenge
Require Import Lists.List.
Require Import Arith.Arith.
Require Import Omega.
Set Implicit Arguments.
Fixpoint replicate A (n : nat) (x : A) : list A :=
match n with
| O => nil
Set Implicit Arguments.
Inductive Simple (A: Type) := simple : Simple A.
Inductive Wrap (A: Type) :=
| wrap : A -> Wrap A
| funWrap : forall X, Simple X -> (X -> Wrap A) -> Wrap A.
Definition anotherWrap A : Wrap A :=
funWrap (simple A) (fun x => wrap x).
Require Import Coq.Arith.PeanoNat.
Definition VarIndex := nat.
Parameter atom : Set.
Parameter eq_atom_dec : forall x y : atom, {x = y} + {x <> y}.
Section expr_ind.
Inductive Expr : Type :=
| BVar : VarIndex -> VarIndex -> Expr
@ichistmeinname
ichistmeinname / sort.rb
Last active January 22, 2016 14:48 — forked from universal/sort.rb
# min_sort
def min_sort(to_sort)
length = to_sort.length - 1
min_index = nil
for i in 0..length
min_index = i
for j in i..length
if to_sort[j] < to_sort[min_index]
min_index = j
@ichistmeinname
ichistmeinname / uebung2.rb
Created November 12, 2015 10:52
Übung vom 12.11.2015
# Language: Ruby, Level: Level 1
# Präsenzaufgabe - Programmsimulation
n = 10; #1
sum = 0; #2
zaehler = 1; #3
while zaehler <= n do
sum = sum + zaehler; #4
zaehler = zaehler + 1; #5
@ichistmeinname
ichistmeinname / uebung2.rb
Last active November 12, 2015 07:38
Übung vom 11.11.2015
# Language: Ruby, Level: Level 1
# Präsenzaufgabe 1 - Programmsimulation
n = 10; #1
sum = 0; #2
zaehler = 1; #3
while zaehler <= n do
sum = sum + zaehler; #4
zaehler = zaehler + 1; #5
@ichistmeinname
ichistmeinname / uebung1.rb
Last active November 5, 2015 13:28
Übung vom 4.11.2015
# Language: Ruby, Level: Level 1
##
## Übungsbetrieb vom 4.11.2015
##
## alle mit `#` beginnenden Zeilen sind Kommentare
##
## Präsenzaufgabe 1
x = true;
@ichistmeinname
ichistmeinname / uebung1.rb
Last active November 5, 2015 13:20
Übung vom 5.11.2015
# Language: Ruby, Level: Level 1
##
## Übungsbetrieb vom 5.11.2015
##
## alle mit `#` beginnenden Zeilen sind Kommentare
##
## Präsenzaufgabe 1