Type theory with agda

Notes from MGS 2022 (full course code files)

Day 2

Operations on Types/Sets

A, B: Set

A -> B : Set
A x B: Set  -- product
A + B: Set  -- labelled sum
			-- symbol is disjoint union or coproduct

Day 3

Natural numbers

Nat:

data nat: Set where
	zero: nat
	suc: nat -> nat

Annductive type is defined by its constructors

pred: nat -> Maybe nat
pred zero = nothing
pred (suc n) = just n

zerosuc: Maybe nat -> nat
zerosuc nothing = zero
zerosuc (just n) = n

Conatural numbers

A coinductive type is defined by the destructors Structural greater is a criteria for inductive type For coinductive type a criteria is productivity: e.g. (predinf inf will always be productive, the result will never be nothing)

record natinf : Set where
	coinducuctive
	field
		predinf : Maybe ninf

zeroinf : natinf
predinf zeroinf = nothing

sucinf : natinf -> natinf
predinf (sucinf x) = just x

-- we can define conatural numbers that are not natural numbers
inf : natinf
predinf inf = just inf


_+inf_ : natinf -> natinf -> natinf
predinf (m +inf n) with predinf m
... | nothing = predinf n
... | just m' = just (m' +inf n)

There are no notes linking to this note.

There are no papers linking to this note.


Here are all the notes in this garden, along with their links, visualized as a graph.

Adversarial perturbation to...Can we (and should we)...Certified compilers and proof...Constructive logicCurry Howard correspondenceDuelling banjos drama in the...Equivalence checkingExporting ocaml from imandraHalf marathon afterthoughtsHow to set up a plausible...How to make a sunrise alarm...How to make a sunrise alarm...How to make a sunrise alarm...Jupyter notebook launch...Lairg to john'o'groats bike...Marabou Imandra interfacingMarkov process modelMethodologyMonte carlo processNeural network verification ...Ocaml decoder libraryProof production for neural...Reading listType theory with agdaUbuntu housekeepingUseful imandra tipsUseful git commandsUseful vim tips and tricksUsefull miscellaneous snippetsVerifying an algorithm with...On the Dangers of Stochastic...Intuitionistic Type TheorySpinoza on ModalityAttention is All you NeedFormal Monotony Analysis...