Documentation

Init.Internal.Order.Basic

This module contains some basic definitions and results from domain theory, intended to be used as the underlying construction of the partial_fixpoint feature. It is not meant to be used as a general purpose library for domain theory, but can be of interest to users who want to extend the partial_fixpoint machinery (e.g. mark more functions as monotone or register more monads).

This follows the corresponding Isabelle development, as also described in Alexander Krauss: Recursive Definitions of Monadic Functions.

class Lean.Order.PartialOrder (α : Sort u) :
Sort (max 1 u)

A partial order is a reflexive, transitive and antisymmetric relation.

This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

Instances

    A “less-or-equal-to” or “approximates” relation.

    This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

    Equations
    Instances For
      def Lean.Order.chain {α : Sort u} [Lean.Order.PartialOrder α] (c : α → Prop) :

      A chain is a totally ordered set (representing a set as a predicate).

      This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

      Equations
      Instances For
        class Lean.Order.CCPO (α : Sort u) extends Lean.Order.PartialOrder α :
        Sort (max 1 u)

        A chain-complete partial order (CCPO) is a partial order where every chain a least upper bound.

        This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

        Instances
          theorem Lean.Order.csup_le {α : Sort u} [Lean.Order.CCPO α] {x : α} {c : α → Prop} (hchain : Lean.Order.chain c) :
          theorem Lean.Order.le_csup {α : Sort u} [Lean.Order.CCPO α] {c : α → Prop} (hchain : Lean.Order.chain c) {y : α} (hy : c y) :
          def Lean.Order.bot {α : Sort u} [Lean.Order.CCPO α] :
          α

          The bottom element is the least upper bound of the empty chain.

          This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

          Equations
          Instances For
            def Lean.Order.monotone {α : Sort u} [Lean.Order.PartialOrder α] {β : Sort v} [Lean.Order.PartialOrder β] (f : α → β) :

            A function is monotone if if it maps related elements to releated elements.

            This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

            Equations
            Instances For
              theorem Lean.Order.monotone_compose {α : Sort u} [Lean.Order.PartialOrder α] {β : Sort v} [Lean.Order.PartialOrder β] {γ : Sort w} [Lean.Order.PartialOrder γ] {f : α → β} {g : β → γ} (hf : Lean.Order.monotone f) (hg : Lean.Order.monotone g) :
              Lean.Order.monotone fun (x : α) => g (f x)
              def Lean.Order.admissible {α : Sort u} [Lean.Order.CCPO α] (P : α → Prop) :

              A predicate is admissable if it can be transferred from the elements of a chain to the chains least upper bound. Such predicates can be used in fixpoint induction.

              This definition implies P ⊥. Sometimes (e.g. in Isabelle) the empty chain is excluded from this definition, and P ⊥ is a separate condition of the induction predicate.

              This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

              Equations
              Instances For
                theorem Lean.Order.admissible_and {α : Sort u} [Lean.Order.CCPO α] (P Q : α → Prop) (hadm₁ : Lean.Order.admissible P) (hadm₂ : Lean.Order.admissible Q) :
                Lean.Order.admissible fun (x : α) => P x ∧ Q x
                theorem Lean.Order.chain_conj {α : Sort u} [Lean.Order.CCPO α] (c P : α → Prop) (hchain : Lean.Order.chain c) :
                Lean.Order.chain fun (x : α) => c x ∧ P x
                theorem Lean.Order.csup_conj {α : Sort u} [Lean.Order.CCPO α] (c P : α → Prop) (hchain : Lean.Order.chain c) (h : ∀ (x : α), c x → ∃ (y : α), c y ∧ Lean.Order.PartialOrder.rel x y ∧ P y) :
                theorem Lean.Order.admissible_or {α : Sort u} [Lean.Order.CCPO α] (P Q : α → Prop) (hadm₁ : Lean.Order.admissible P) (hadm₂ : Lean.Order.admissible Q) :
                Lean.Order.admissible fun (x : α) => P x ∨ Q x
                def Lean.Order.admissible_pi {α : Sort u} [Lean.Order.CCPO α] {β : Sort u_1} (P : α → β → Prop) (hadm₁ : ∀ (y : β), Lean.Order.admissible fun (x : α) => P x y) :
                Lean.Order.admissible fun (x : α) => ∀ (y : β), P x y
                Equations
                • ⋯ = ⋯
                Instances For
                  inductive Lean.Order.iterates {α : Sort u} [Lean.Order.CCPO α] (f : α → α) :
                  α → Prop

                  The transfinite iteration of a function f is a set that is ⊥ and is closed under application of f and csup.

                  This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

                  Instances For
                    theorem Lean.Order.rel_f_of_iterates {α : Sort u} [Lean.Order.CCPO α] {f : α → α} (hf : Lean.Order.monotone f) {x : α} (hx : Lean.Order.iterates f x) :
                    def Lean.Order.fix {α : Sort u} [Lean.Order.CCPO α] (f : α → α) (hmono : Lean.Order.monotone f) :
                    α

                    The least fixpoint of a monotone function is the least upper bound of its transfinite iteration.

                    The monotone f assumption is not strictly necessarily for the definition, but without this the definition is not very meaningful and it simplifies applying theorems like fix_eq if every use of fix already has the monotonicty requirement.

                    This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

                    Equations
                    Instances For
                      theorem Lean.Order.fix_eq {α : Sort u} [Lean.Order.CCPO α] {f : α → α} (hf : Lean.Order.monotone f) :

                      The main fixpoint theorem for fixedpoints of monotone functions in chain-complete partial orders.

                      This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

                      theorem Lean.Order.fix_induct {α : Sort u} [Lean.Order.CCPO α] {f : α → α} (hf : Lean.Order.monotone f) (motive : α → Prop) (hadm : Lean.Order.admissible motive) (h : ∀ (x : α), motive x → motive (f x)) :
                      motive (Lean.Order.fix f hf)

                      The fixpoint induction theme: An admissible predicate holds for a least fixpoint if it is preserved by the fixpoint's function.

                      This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

                      instance Lean.Order.instOrderPi {α : Sort u} {β : α → Sort v} [(x : α) → Lean.Order.PartialOrder (β x)] :
                      Lean.Order.PartialOrder ((x : α) → β x)
                      Equations
                      theorem Lean.Order.monotone_of_monotone_apply {α : Sort u} {β : α → Sort v} {γ : Sort w} [Lean.Order.PartialOrder γ] [(x : α) → Lean.Order.PartialOrder (β x)] (f : γ → (x : α) → β x) (h : ∀ (y : α), Lean.Order.monotone fun (x : γ) => f x y) :
                      theorem Lean.Order.monotone_apply {α : Sort u} {β : α → Sort v} {γ : Sort w} [Lean.Order.PartialOrder γ] [(x : α) → Lean.Order.PartialOrder (β x)] (a : α) (f : γ → (x : α) → β x) (h : Lean.Order.monotone f) :
                      Lean.Order.monotone fun (x : γ) => f x a
                      theorem Lean.Order.chain_apply {α : Sort u} {β : α → Sort v} [(x : α) → Lean.Order.PartialOrder (β x)] {c : ((x : α) → β x) → Prop} (hc : Lean.Order.chain c) (x : α) :
                      Lean.Order.chain fun (y : β x) => ∃ (f : (x : α) → β x), c f ∧ f x = y
                      def Lean.Order.fun_csup {α : Sort u} {β : α → Sort v} [(x : α) → Lean.Order.CCPO (β x)] (c : ((x : α) → β x) → Prop) (x : α) :
                      β x
                      Equations
                      Instances For
                        instance Lean.Order.instCCPOPi {α : Sort u} {β : α → Sort v} [(x : α) → Lean.Order.CCPO (β x)] :
                        Lean.Order.CCPO ((x : α) → β x)
                        Equations
                        def Lean.Order.admissible_apply {α : Sort u} {β : α → Sort v} [(x : α) → Lean.Order.CCPO (β x)] (P : (x : α) → β x → Prop) (x : α) (hadm : Lean.Order.admissible (P x)) :
                        Lean.Order.admissible fun (f : (x : α) → β x) => P x (f x)
                        Equations
                        • ⋯ = ⋯
                        Instances For
                          def Lean.Order.admissible_pi_apply {α : Sort u} {β : α → Sort v} [(x : α) → Lean.Order.CCPO (β x)] (P : (x : α) → β x → Prop) (hadm : ∀ (x : α), Lean.Order.admissible (P x)) :
                          Lean.Order.admissible fun (f : (x : α) → β x) => ∀ (x : α), P x (f x)
                          Equations
                          • ⋯ = ⋯
                          Instances For
                            theorem Lean.Order.monotone_letFun {α : Sort u} {β : Sort v} {γ : Sort w} [Lean.Order.PartialOrder α] [Lean.Order.PartialOrder β] (v : γ) (k : α → γ → β) (hmono : ∀ (y : γ), Lean.Order.monotone fun (x : α) => k x y) :
                            Lean.Order.monotone fun (x : α) => letFun v (k x)
                            theorem Lean.Order.monotone_ite {α : Sort u} {β : Sort v} [Lean.Order.PartialOrder α] [Lean.Order.PartialOrder β] (c : Prop) [Decidable c] (k₁ k₂ : α → β) (hmono₁ : Lean.Order.monotone k₁) (hmono₂ : Lean.Order.monotone k₂) :
                            Lean.Order.monotone fun (x : α) => if c then k₁ x else k₂ x
                            theorem Lean.Order.monotone_dite {α : Sort u} {β : Sort v} [Lean.Order.PartialOrder α] [Lean.Order.PartialOrder β] (c : Prop) [Decidable c] (k₁ : α → c → β) (k₂ : α → ¬c → β) (hmono₁ : Lean.Order.monotone k₁) (hmono₂ : Lean.Order.monotone k₂) :
                            Lean.Order.monotone fun (x : α) => dite c (k₁ x) (k₂ x)
                            Equations
                            • One or more equations did not get rendered due to their size.
                            theorem Lean.Order.monotone_pprod {α : Sort u} {β : Sort v} {γ : Sort w} [Lean.Order.PartialOrder α] [Lean.Order.PartialOrder β] [Lean.Order.PartialOrder γ] {f : γ → α} {g : γ → β} (hf : Lean.Order.monotone f) (hg : Lean.Order.monotone g) :
                            Lean.Order.monotone fun (x : γ) => ⟨f x, g x⟩
                            theorem Lean.Order.monotone_pprod_fst {α : Sort u} {β : Sort v} {γ : Sort w} [Lean.Order.PartialOrder α] [Lean.Order.PartialOrder β] [Lean.Order.PartialOrder γ] {f : γ → α ×' β} (hf : Lean.Order.monotone f) :
                            Lean.Order.monotone fun (x : γ) => (f x).fst
                            theorem Lean.Order.monotone_pprod_snd {α : Sort u} {β : Sort v} {γ : Sort w} [Lean.Order.PartialOrder α] [Lean.Order.PartialOrder β] [Lean.Order.PartialOrder γ] {f : γ → α ×' β} (hf : Lean.Order.monotone f) :
                            Lean.Order.monotone fun (x : γ) => (f x).snd
                            def Lean.Order.chain_pprod_fst {α : Sort u} {β : Sort v} [Lean.Order.CCPO α] [Lean.Order.CCPO β] (c : α ×' β → Prop) :
                            α → Prop
                            Equations
                            Instances For
                              def Lean.Order.chain_pprod_snd {α : Sort u} {β : Sort v} [Lean.Order.CCPO α] [Lean.Order.CCPO β] (c : α ×' β → Prop) :
                              β → Prop
                              Equations
                              Instances For
                                theorem Lean.Order.admissible_pprod_fst {α : Sort u} {β : Sort v} [Lean.Order.CCPO α] [Lean.Order.CCPO β] (P : α → Prop) (hadm : Lean.Order.admissible P) :
                                Lean.Order.admissible fun (x : α ×' β) => P x.fst
                                theorem Lean.Order.admissible_pprod_snd {α : Sort u} {β : Sort v} [Lean.Order.CCPO α] [Lean.Order.CCPO β] (P : β → Prop) (hadm : Lean.Order.admissible P) :
                                Lean.Order.admissible fun (x : α ×' β) => P x.snd
                                def Lean.Order.FlatOrder {α : Sort u} (b : α) :

                                FlatOrder b wraps the type α with the flat partial order generated by ∀ x, b ⊑ x.

                                This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

                                Equations
                                Instances For
                                  inductive Lean.Order.FlatOrder.rel {α : Sort u} {b : α} (x y : Lean.Order.FlatOrder b) :

                                  The flat partial order generated by ∀ x, b ⊑ x.

                                  This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

                                  Instances For
                                    Equations
                                    noncomputable def Lean.Order.flat_csup {α : Sort u} {b : α} (c : Lean.Order.FlatOrder b → Prop) :
                                    Equations
                                    Instances For
                                      theorem Lean.Order.admissible_flatOrder {α : Sort u} {b : α} (P : Lean.Order.FlatOrder b → Prop) (hnot : P b) :
                                      class Lean.Order.MonoBind (m : Type u → Type v) [Bind m] [(α : Type u) → Lean.Order.PartialOrder (m α)] :

                                      The class MonoBind m indicates that every m α has a PartialOrder, and that the bind operation on m is monotone in both arguments with regard to that order.

                                      This is intended to be used in the construction of partial_fixpoint, and not meant to be used otherwise.

                                      Instances
                                        theorem Lean.Order.monotone_bind (m : Type u → Type v) [Bind m] [(α : Type u) → Lean.Order.PartialOrder (m α)] [Lean.Order.MonoBind m] {α β : Type u} {γ : Type w} [Lean.Order.PartialOrder γ] (f : γ → m α) (g : γ → α → m β) (hmono₁ : Lean.Order.monotone f) (hmono₂ : Lean.Order.monotone g) :
                                        Lean.Order.monotone fun (x : γ) => f x >>= g x
                                        theorem Lean.Order.admissible_eq_some {α : Type u_1} (P : Prop) (y : α) :
                                        Lean.Order.admissible fun (x : Option α) => x = some y → P
                                        instance Lean.Order.instPartialOrderExceptTOfMonad {m : Type u_1 → Type u_2} {ε α : Type u_1} [Monad m] [inst : (α : Type u_1) → Lean.Order.PartialOrder (m α)] :
                                        Equations
                                        instance Lean.Order.instCCPOExceptTOfMonadOfPartialOrder {m : Type u_1 → Type u_2} {ε α : Type u_1} [Monad m] [(α : Type u_1) → Lean.Order.PartialOrder (m α)] [inst : (α : Type u_1) → Lean.Order.CCPO (m α)] :
                                        Equations
                                        instance Lean.Order.instMonoBindExceptTOfCCPO {m : Type u_1 → Type u_2} {ε : Type u_1} [Monad m] [(α : Type u_1) → Lean.Order.PartialOrder (m α)] [(α : Type u_1) → Lean.Order.CCPO (m α)] [Lean.Order.MonoBind m] :
                                        def Lean.Order.Example.findF (P : Nat → Bool) (rec : Nat → Option Nat) (x : Nat) :
                                        Equations
                                        Instances For