Documentation

PfsProgs25.Unit06.MyInductives

Inductive types for numbers, data, propositions. #

What makes the foundations we use work are that the mathematical objects we need as well as their properties can be constructed in terms of inductive types and dependent function types. Similarly, proofs and terms need only a few rules to be constructed.

We will see how to define inductive types for many basic constructions: natural numbers, products, sums (disjoint unions) etc. We will also see the logical connectives and or as well as quantifiers constructed as inductive types. Further, we see how specific relations like can be defined as (indexed) inductive types.

inductive MyNat :

The natural numbers are defined inductively.

Instances For
    Equations
    def MyNat.add :
    MyNatMyNatMyNat

    The addition function on natural numbers.

    Equations
    Instances For

      The addition operation + on natural numbers.

      Equations
      theorem MyNat.zero_add (n : MyNat) :

      Addition on the left by zero. This is by definition.

      theorem MyNat.add_zero (n : MyNat) :

      Addition on the right by zero. This is by induction on n.

      inductive MyProd (α : Type u) (β : Type v) :
      Type (max u v)

      The product type is defined as an inductive type.

      Instances For
        structure MyProd' (α : Type u) (β : Type v) :
        Type (max u v)

        The product type is defined as a structure.

        • fst : α
        • snd : β
        Instances For
          def MyProd.fst {α : Type u} {β : Type v} :
          MyProd α βα

          The first projection of a product.

          Equations
          Instances For
            def MyProd.snd {α : Type u} {β : Type v} :
            MyProd α ββ

            The second projection of a product.

            Equations
            Instances For
              inductive MySum (α : Type u) (β : Type v) :
              Type (max u v)

              The sum type, i.e., disjoint union is defined as an inductive type.

              Instances For

                An example of a term in a sum type.

                Equations
                Instances For

                  An example of a term in a sum type.

                  Equations
                  Instances For
                    inductive MyUnit :

                    The Unit type, with a unique element, is defined inductively.

                    Instances For
                      Equations
                      Instances For
                        inductive MyEmpty :

                        The empty type is defined inductively.

                          Instances For
                            inductive MyFalse :

                            The false proposition is defined as an inductive type.

                              Instances For
                                inductive MyAnd (a b : Prop) :

                                The conjunction of two propositions is defined as an inductive type.

                                • mk {a b : Prop} (left : a) (right : b) : MyAnd a b
                                Instances For
                                  inductive MyOr (a b : Prop) :

                                  The disjunction of two propositions is defined as an inductive type.

                                  Instances For
                                    inductive MyTrue :

                                    The true proposition is defined as an inductive type.

                                    Instances For
                                      inductive MyExists {α : Type u} (p : αProp) :

                                      The existential quantifier is defined as an inductive type.

                                      Instances For