See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
import Lean | |
opaque g (n : Nat) : Nat | |
@[simp] def f (i n m : Nat) := | |
if i < n then | |
f (i+1) n (g m) | |
else | |
m | |
termination_by n - i |
open import Data.Unit | |
open import Data.Product | |
infixr 4 _⇒_ _*_ ⟨_,_⟩ _∘_ | |
data Obj : Set where | |
∙ : Obj | |
base : Obj | |
_*_ : Obj → Obj → Obj |
(** "Landin's Knot" - implements recursion by backpatching *) | |
let landins_knot f = | |
let r = ref (fun x -> assert false) in | |
let fixedpoint = f (fun x -> !r x) in | |
r := fixedpoint; | |
fixedpoint | |
let factorial = | |
let g f x = | |
if x = 0 then |
From N1256: (See http://port70.net/~nsz/c/c99/n1256.html#J.2)
main
using one of the specified forms (5.1.2.2.1).(** | |
Dybjer and Setzer provide a logical framework in which Induction-Recursion — | |
mutual definition of an (A : Type) and a (B : A -> V), in which constructors for A can talk about values of B, and B is defined by case analysis on members of A — | |
becomes equivalent to supposing initial algebras for certain functors on { X : Set & X -> V }. However, this latter family is, up to equivalences over V, the same as ordinary maps V -> Set. The universal case, in which V = Set, becomes somewhat trickier, for universe level reasons. | |
In any case, here is one way to define a "large" universe ("large" in the sense: we allow all externally definable functions) with naturals, dependent sums, and dependent products. A more careful presentation might work on a fibration over functions, | |
{ AB : Type * Type & fst AB -> snd AB } -> Type | |
instead, but good luck with that. | |
*) |
all: | |
@echo "gcc-4.4 && -fdelete-null-pointer-checks" | |
@gcc-4.4 -O2 -ggdb -Wall -Wundef -fno-strict-aliasing -fno-common -fdelete-null-pointer-checks test-deref.c -o test-deref | |
@./test-deref || true && | |
@echo "gcc-4.5 && -fdelete-null-pointer-checks" | |
@gcc-4.5 -O2 -ggdb -Wall -Wundef -fno-strict-aliasing -fno-common -fdelete-null-pointer-checks test-deref.c -o test-deref | |
@./test-deref || true | |
@echo "gcc-4.4 && -fno-delete-null-pointer-checks" | |
@gcc-4.4 -O2 -ggdb -Wall -Wundef -fno-strict-aliasing -fno-common -fno-delete-null-pointer-checks test-deref.c -o test-deref | |
@./test-deref || true |