Documentation

Foundation.Vorspiel.Computability.Primrec

The rules of the primrec tactic #

Pointwise forms Primrec fun a ↦ F (f a) (g a) of Mathlib's combinators: the head F is what lets Aesop key a rule.

The leaves #

theorem Primrec.id' (α : Type u_1) [Primcodable α] :
Primrec fun (a : α) => a

Products #

theorem Primrec.fst' {α : Type u_1} {β : Type u_2} {γ : Type u_3} [Primcodable α] [Primcodable β] [Primcodable γ] {f : α → β × γ} (hf : Primrec f) :
Primrec fun (a : α) => (f a).1
theorem Primrec.snd' {α : Type u_1} {β : Type u_2} {γ : Type u_3} [Primcodable α] [Primcodable β] [Primcodable γ] {f : α → β × γ} (hf : Primrec f) :
Primrec fun (a : α) => (f a).2

Arithmetic #

theorem Primrec.succ' {α : Type u_1} [Primcodable α] {f : α → ℕ} (hf : Primrec f) :
Primrec fun (a : α) => (f a).succ
theorem Primrec.nat_add' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => f a + g a
theorem Primrec.nat_sub' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => f a - g a
theorem Primrec.nat_mul' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => f a * g a
theorem Primrec.nat_div' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => f a / g a
theorem Primrec.nat_mod' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => f a % g a
theorem Primrec.nat_max' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => max (f a) (g a)
theorem Primrec.nat_min' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => min (f a) (g a)
theorem Primrec.nat_pair' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => Nat.pair (f a) (g a)
theorem Primrec.unpair' {α : Type u_1} [Primcodable α] {f : α → ℕ} (hf : Primrec f) :
Primrec fun (a : α) => Nat.unpair (f a)
theorem Primrec.nat_pow' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
Primrec fun (a : α) => f a ^ g a
theorem Primrec.nat_le' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
PrimrecPred fun (a : α) => f a ≤ g a
theorem Primrec.nat_lt' {α : Type u_1} [Primcodable α] {f g : α → ℕ} (hf : Primrec f) (hg : Primrec g) :
PrimrecPred fun (a : α) => f a < g a

Lists and vectors #

theorem Primrec.list_cons' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {f : α → β} {l : α → List β} (hf : Primrec f) (hl : Primrec l) :
Primrec fun (a : α) => f a :: l a
theorem Primrec.list_append' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {l m : α → List β} (hl : Primrec l) (hm : Primrec m) :
Primrec fun (a : α) => l a ++ m a
theorem Primrec.list_length' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {l : α → List β} (hl : Primrec l) :
Primrec fun (a : α) => (l a).length
theorem Primrec.list_getD' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {l : α → List β} (d : β) {n : α → ℕ} (hl : Primrec l) (hn : Primrec n) :
Primrec fun (a : α) => (l a).getD (n a) d
theorem Primrec.list_getElem?' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {l : α → List β} {n : α → ℕ} (hl : Primrec l) (hn : Primrec n) :
Primrec fun (a : α) => (l a)[n a]?
theorem Primrec.vector_cons' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {f : α → β} {n : ℕ} {v : α → List.Vector β n} (hf : Primrec f) (hv : Primrec v) :
Primrec fun (a : α) => f a ::ᵥ v a
theorem Primrec.vector_toList' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {n : ℕ} {v : α → List.Vector β n} (hv : Primrec v) :
Primrec fun (a : α) => (v a).toList
theorem Primrec.vector_get'' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {n : ℕ} {v : α → List.Vector β n} {i : α → Fin n} (hv : Primrec v) (hi : Primrec i) :
Primrec fun (a : α) => (v a).get (i a)

Equality #

theorem Primrec.eq' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {f g : α → β} (hf : Primrec f) (hg : Primrec g) :
PrimrecPred fun (a : α) => f a = g a

Encodings #

theorem Primrec.encode' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {f : α → β} (hf : Primrec f) :
Primrec fun (a : α) => Encodable.encode (f a)
theorem Primrec.decode' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {n : α → ℕ} (hn : Primrec n) :
Primrec fun (a : α) => Encodable.decode (n a)
theorem Primrec.decode₂' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {n : α → ℕ} (hn : Primrec n) :
Primrec fun (a : α) => Encodable.decode₂ β (n a)
theorem Primrec.encdec' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {n : α → ℕ} (hn : Primrec n) :
Primrec fun (a : α) => Encodable.encode (Encodable.decode (n a))
theorem Primrec.option_some' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {f : α → β} (hf : Primrec f) :
Primrec fun (a : α) => some (f a)
theorem Primrec.option_isSome' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {o : α → Option β} (ho : Primrec o) :
Primrec fun (a : α) => (o a).isSome
theorem Primrec.option_getD' {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {f : α → β} {o : α → Option β} (ho : Primrec o) (hf : Primrec f) :
Primrec fun (a : α) => (o a).getD (f a)

Predicates #

theorem PrimrecPred.imp {α : Type u_1} [Primcodable α] {p q : α → Prop} (hp : PrimrecPred p) (hq : PrimrecPred q) :
PrimrecPred fun (a : α) => p a → q a
theorem PrimrecPred.iff {α : Type u_1} [Primcodable α] {p q : α → Prop} (hp : PrimrecPred p) (hq : PrimrecPred q) :
PrimrecPred fun (a : α) => p a ↔ q a
theorem PrimrecPred.const {α : Type u_1} [Primcodable α] (p : Prop) :
PrimrecPred fun (x : α) => p

Bounded quantifiers #

Mathlib's PrimrecRel.exists_lt and forall_lt fix the parameter at ℕ.

theorem PrimrecRel.exists_lt' {β : Type u_2} [Primcodable β] {R : ℕ → β → Prop} (h : PrimrecRel R) :
PrimrecRel fun (n : ℕ) (y : β) => ∃ x < n, R x y
theorem PrimrecRel.forall_lt' {β : Type u_2} [Primcodable β] {R : ℕ → β → Prop} (h : PrimrecRel R) :
PrimrecRel fun (n : ℕ) (y : β) => ∀ x < n, R x y
theorem PrimrecPred.exists_lt' {α : Type u_1} [Primcodable α] {n : α → ℕ} {R : α → ℕ → Prop} (hn : Primrec n) (hR : PrimrecRel R) :
PrimrecPred fun (a : α) => ∃ x < n a, R a x
theorem PrimrecPred.forall_lt' {α : Type u_1} [Primcodable α] {n : α → ℕ} {R : α → ℕ → Prop} (hn : Primrec n) (hR : PrimrecRel R) :
PrimrecPred fun (a : α) => ∀ x < n a, R a x
theorem PrimrecRel.mk {α : Type u_1} {β : Type u_2} [Primcodable α] [Primcodable β] {r : α → β → Prop} (h : PrimrecPred fun (p : α × β) => r p.1 p.2) :

The rule set #

Rules match at reducible transparency: at default, a failed match unfolds Nat.unpair and Nat.sqrt, which costs minutes.