Skip to content

Instantly share code, notes, and snippets.

@AndrasKovacs
Last active December 24, 2015 08:19
Show Gist options
  • Save AndrasKovacs/6769513 to your computer and use it in GitHub Desktop.
Save AndrasKovacs/6769513 to your computer and use it in GitHub Desktop.
Minimal agda definition for induction on natural numbers. (I realize that it's actually just dependent foldr).
module NatInduction where
data ℕ : Set where
zero : ℕ
suc : ℕ → ℕ
ℕ-ind : (prop : ℕ → Set)
→ (zero_proof : prop zero)
→ (ind_hyp : ∀ n → prop n → prop (suc n))
→ (n : ℕ)
→ prop n
ℕ-ind prop zp hyp zero = zp
ℕ-ind prop zp hyp (suc n) = hyp n (ℕ-ind prop zp hyp n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment