Skip to content

Instantly share code, notes, and snippets.

View takahisa's full-sized avatar

Takahisa Watanabe takahisa

  • Cybozu, Inc
  • Tokyo, Japan
View GitHub Profile
@takahisa
takahisa / gist:4010551
Created November 4, 2012 06:20
Coqで加算の可換性の証明
Lemma plus_a_0 : forall n : nat, n + 0 = n.
Proof.
intros.
induction n.
simpl.
reflexivity.
simpl.
rewrite IHn.
reflexivity.
Qed.
.intel_syntax noprefix
.text
.align 4
.global main
main:
mov eax, 1
mov ebx, 2
#include <Matrix.h>
#include <Sprite.h>
const int censorPin = 1;
Matrix mtx = Matrix(10, 12, 11);
void setup() {
pinMode(censorPin, INPUT);
#include <stdio.h>
int n;
int route[100][100];
int dtable[100];
int distance (int i, int j);
int main(void)
#include <stdio.h>
void swap(int* a, int* b) {
int tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
int euclid(int a, int b) {
#include <stdio.h>
#include <stdlib.h>
#define MAX(x, y) ((x == M) ? x : (y == M) ? y : (x > y) ? x : y)
#define MIN(x, y) ((x == M) ? y : (y == M) ? x : (x < y) ? x : y)
typedef int Weight;
#define M (-1)
#define N (6)
Require Import List Arith.
Require Import Recdef.
Lemma lemma1:
forall (a : Type) (f : a -> bool) (n : a) (xs : list a),
length (filter f (n :: xs)) = if f n then 1 + length (filter f xs)
else length (filter f xs).
Proof.
intros a f n xs.
simpl.
$PSVersionTable
Name Value
---- -----
CLRVersion 2.0.50727.5477
BuildVersion 6.1.7601.17514
PSVersion 2.0
WSManStackVersion 2.0
PSCompatibleVersions {1.0, 2.0}
var any = Chars.Any();
var newline = Combinator.Choice(Chars.Sequence("\u000d\u000a"),
Chars.Sequence("\u000d"),
Chars.Sequence("\u000a"))
.Ignore();
var lineCommentBegin = Chars.Sequence("//");
var lineComment = lineCommentBegin
.Right(Flows.Until(any, eof.Or(newline)))
.Ignore();
let quad_eq a b c =
let eq = b * b - 4 * a * c in
let ret = begin
if eq > 0 then
2
else if eq = 0 then
1
else
0
end in