{-# OPTIONS --cubical-compatible --safe #-}
module Induction where
open import Level
open import Relation.Unary
open import Relation.Unary.PredicateTransformer using (PT)
private
variable
a ℓ ℓ₁ ℓ₂ : Level
A : Set a
Q : Pred A ℓ
Rec : PT A A ℓ₁ ℓ₂
RecStruct : Set a → (ℓ₁ ℓ₂ : Level) → Set _
RecStruct A = PT A A
RecursorBuilder : RecStruct A ℓ₁ ℓ₂ → Set _
RecursorBuilder Rec = ∀ P → Rec P ⊆′ P → Universal (Rec P)
Recursor : RecStruct A ℓ₁ ℓ₂ → Set _
Recursor Rec = ∀ P → Rec P ⊆′ P → Universal P
build : RecursorBuilder Rec → Recursor Rec
build builder P f x = f x (builder P f x)
SubsetRecursorBuilder : Pred A ℓ → RecStruct A ℓ₁ ℓ₂ → Set _
SubsetRecursorBuilder Q Rec = ∀ P → Rec P ⊆′ P → Q ⊆′ Rec P
SubsetRecursor : Pred A ℓ → RecStruct A ℓ₁ ℓ₂ → Set _
SubsetRecursor Q Rec = ∀ P → Rec P ⊆′ P → Q ⊆′ P
subsetBuild : SubsetRecursorBuilder Q Rec → SubsetRecursor Q Rec
subsetBuild builder P f x q = f x (builder P f x q)