Documentation

CatCryptCore.Relational.Basic

Relational Assertions #

This file defines relational preconditions and postconditions for pRHL.

Main definitions #

Notation #

Basic types #

@[reducible, inline]

Relational precondition: predicate on pairs of heaps

Equations
Instances For
    @[reducible, inline]
    abbrev CatCrypt.Relational.RPost (α : Type u_1) (β : Type u_2) :
    Type (max u_1 u_2)

    Relational postcondition: predicate on pairs of (result, heap)

    Equations
    Instances For
      structure CatCrypt.Relational.RSpec (α : Type u_1) (β : Type u_2) :
      Type (max u_1 u_2)

      Relational specification

      Instances For

        Standard preconditions #

        Equality precondition: heaps must be equal

        Equations
        Instances For
          theorem CatCrypt.Relational.eqPre_eq (h₁ h₂ : Core.Heap) :
          eqPre h₁ h₂ = (h₁ = h₂)

          Grind normalization for eqPre

          True precondition: always holds

          Equations
          Instances For

            False precondition: never holds

            Equations
            Instances For

              Standard postconditions #

              def CatCrypt.Relational.eqPost {α : Type u_1} :
              RPost α α

              Equality postcondition: results and heaps must be equal

              Equations
              Instances For
                theorem CatCrypt.Relational.eqPost_eq {α : Type u_1} (a₁ a₂ : α) (h₁ h₂ : Core.Heap) :
                eqPost a₁ h₁ a₂ h₂ = (a₁ = a₂ h₁ = h₂)

                Grind normalization for eqPost

                def CatCrypt.Relational.truePost {α : Type u_1} {β : Type u_2} :
                RPost α β

                True postcondition: always holds

                Equations
                Instances For
                  theorem CatCrypt.Relational.truePost_eq {α : Type u_1} {β : Type u_2} (a₁ : α) (h₁ : Core.Heap) (a₂ : β) (h₂ : Core.Heap) :
                  truePost a₁ h₁ a₂ h₂ = True

                  Combinators #

                  Conjunction of preconditions

                  Equations
                  • (P Q) h₁ h₂ = (P h₁ h₂ Q h₁ h₂)
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Disjunction of preconditions

                      Equations
                      • (P Q) h₁ h₂ = (P h₁ h₂ Q h₁ h₂)
                      Instances For
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Implication of preconditions

                          Equations
                          • (P Q) h₁ h₂ = (P h₁ h₂Q h₁ h₂)
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              def CatCrypt.Relational.andPost {α : Type u_1} {β : Type u_2} (P Q : RPost α β) :
                              RPost α β

                              Conjunction of postconditions

                              Equations
                              Instances For

                                EasyCrypt-style ⟨1⟩/⟨2⟩ accessors #

                                def CatCrypt.Relational.lhs {γ : Type u_3} (f : Core.Heapγ) :
                                Core.HeapCore.Heapγ

                                Access left heap in relational assertion

                                Equations
                                Instances For
                                  def CatCrypt.Relational.rhs {γ : Type u_3} (f : Core.Heapγ) :
                                  Core.HeapCore.Heapγ

                                  Access right heap in relational assertion

                                  Equations
                                  Instances For

                                    Location-based assertions #

                                    Left heap has value v at location l

                                    Equations
                                    Instances For
                                      theorem CatCrypt.Relational.leftHas_eq (l : Core.Location) (v : l.ty) (h₁ h₂ : Core.Heap) :
                                      leftHas l v h₁ h₂ = (h₁.get l = v)

                                      Right heap has value v at location l

                                      Equations
                                      Instances For
                                        theorem CatCrypt.Relational.rightHas_eq (l : Core.Location) (v : l.ty) (h₁ h₂ : Core.Heap) :
                                        rightHas l v h₁ h₂ = (h₂.get l = v)

                                        Lemmas #

                                        @[simp]
                                        theorem CatCrypt.Relational.eqPre_iff (h₁ h₂ : Core.Heap) :
                                        eqPre h₁ h₂ h₁ = h₂
                                        @[simp]
                                        theorem CatCrypt.Relational.truePre_iff (h₁ h₂ : Core.Heap) :
                                        truePre h₁ h₂ True
                                        @[simp]
                                        theorem CatCrypt.Relational.eqPost_iff {α : Type u_1} (a₁ : α) (h₁ : Core.Heap) (a₂ : α) (h₂ : Core.Heap) :
                                        eqPost a₁ h₁ a₂ h₂ a₁ = a₂ h₁ = h₂
                                        theorem CatCrypt.Relational.andPre_iff (P Q : RPre) (h₁ h₂ : Core.Heap) :
                                        (P Q) h₁ h₂ P h₁ h₂ Q h₁ h₂