Documentation

Strips.PlanningTask

Basic definitions for the STRIPS formalism #

We define some basic definitions of the STRIPS formalism for automated planning. More specifically, this file implements:

States and sets of states #

@[reducible, inline]
abbrev STRIPS.State (n : ) :

A state is a set of variables, containing all variables that are true.

Equations
Instances For
    @[reducible, inline]
    abbrev STRIPS.States (n : ) :

    A set of states

    Equations
    Instances For

      Actions and sets of actions #

      structure STRIPS.Action (n : ) :

      Actions in the STRIPS formalism

      • name : String

        The name of the action.

      • pre : VarSet n

        The preconditions of the action.

      • add : VarSet n

        The adding effects of the action.

      • del : VarSet n

        The deleting effects of the action.

      • cost :

        The cost of the action.

      Instances For
        def STRIPS.instDecidableEqAction.decEq {n✝ : } (x✝ x✝¹ : Action n✝) :
        Decidable (x✝ = x✝¹)
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[implicit_reducible]
          Equations
          • One or more equations did not get rendered due to their size.
          @[implicit_reducible]
          Equations
          @[reducible, inline]
          abbrev STRIPS.Actions (n : ) :

          A set of actions

          Equations
          Instances For

            Applicability and successor states #

            @[reducible, inline]
            abbrev STRIPS.Applicable {n : } (s : State n) (a : Action n) :

            An action is applicable in a state if all its preconditions are true in the state.

            Equations
            Instances For
              @[reducible, inline]
              abbrev STRIPS.Successor {n : } (a : Action n) (s s' : State n) :

              If an action a is applicable in a state s, then s[a] := (s \ a.del) ∪ a.add is the successor of s.

              Equations
              Instances For

                STRIPS planning problems #

                structure STRIPS.PlanningTask (n : ) :

                A planning problem in the STRIPS formalism. The variables of the planning task are all elements of Fin n. Note that most fields have two version:

                • an primed version which uses a representation that is efficient at run-time, and
                • an unprimed version which is more suited for theoretical results
                Instances For
                  @[implicit_reducible]
                  Equations
                  • One or more equations did not get rendered due to their size.
                  @[implicit_reducible]
                  Equations

                  The set of actions of the planning task.

                  Equations
                  Instances For

                    The initial state of the planning task.

                    Equations
                    Instances For
                      theorem STRIPS.PlanningTask.mem_init' {n : } {pt : PlanningTask n} {i : Fin n} :
                      i pt.init' i pt.init

                      A state is a goal state if it contains all goal variables.

                      Equations
                      Instances For

                        The set of all goal states of the given planning task.

                        Equations
                        Instances For

                          Path #

                          inductive STRIPS.PlanningTask.Path {n : } (pt : PlanningTask n) :
                          State nState nType

                          Given a STRIPS planning task pt, Path s1 s2 is a path form the state s1 to the state s2 in the state space of pt.

                          Instances For

                            snoc #

                            def STRIPS.PlanningTask.Path.snoc {n : } {pt : PlanningTask n} (a : Action n) {s1 : State n} (s2 : State n) {s3 : State n} (ha : a pt.actions) (π : pt.Path s1 s2) (succ : Successor a s2 s3) :
                            pt.Path s1 s3

                            In Path.cons, paths are expanded by adding states at the front of the path (leaving the last state unchanged). Path.snoc allows to extend the path at the back, leaving the first state unchanged. The name snoc comes from reading cons in reverse order.

                            Equations
                            Instances For
                              def STRIPS.PlanningTask.Path.length {n : } {pt : PlanningTask n} {s s' : State n} :
                              pt.Path s s'

                              The length of a path.

                              Equations
                              Instances For
                                @[simp]
                                theorem STRIPS.PlanningTask.Path.length_snoc {n : } {pt : PlanningTask n} {a : Action n} {s1 s2 s3 : State n} {ha : a pt.actions} {π : pt.Path s1 s2} {succ : Successor a s2 s3} :
                                (snoc a s2 ha π succ).length = π.length + 1
                                theorem STRIPS.PlanningTask.Path.cons_to_snoc {n : } {pt : PlanningTask n} {a : Action n} {s1 s2 s3 : State n} (ha : a pt.actions) (succ : Successor a s1 s2) (π : pt.Path s2 s3) :
                                (s2' : State n), (a' : Action n), (ha' : a' pt.actions), (π' : pt.Path s1 s2'), (succ' : Successor a' s2' s3), cons a s2 ha succ π = snoc a' s2' ha' π' succ' π.length = π'.length

                                Convert Path.cons, where we have access to the first action and the second state of the path, to Path.snoc, where we have access to the last action and the second to last state of the path.

                                theorem STRIPS.PlanningTask.Path.snocCases {n : } {pt : PlanningTask n} {motive : (s s' : State n) → pt.Path s s'Prop} {s s' : State n} (π : pt.Path s s') (empty : ∀ (s : State n), motive s s (empty s)) (snoc : ∀ (a : Action n) {s1 : State n} (s2 : State n) {s3 : State n} (ha : a pt.actions) (π' : pt.Path s1 s2) (succ : Successor a s2 s3), motive s1 s3 (snoc a s2 ha π' succ)) :
                                motive s s' π

                                Allows to perform cases with Path.empty and Path.snoc instead of Path.empty and Path.cons.

                                Mem #

                                def STRIPS.PlanningTask.Path.Mem {n : } {pt : PlanningTask n} {s1 s2 : State n} (s : State n) (π : pt.Path s1 s2) :

                                A state s is a member of a path π if π traverses through s.

                                Equations
                                Instances For
                                  @[implicit_reducible]
                                  instance STRIPS.PlanningTask.Path.instMembershipState {n : } {pt : PlanningTask n} {s1 s2 : State n} :
                                  Membership (State n) (pt.Path s1 s2)
                                  Equations
                                  @[simp]
                                  theorem STRIPS.PlanningTask.Path.mem_eq {n : } {pt : PlanningTask n} {s1 s2 : State n} (π : pt.Path s1 s2) (s : State n) :
                                  Mem s π = (s π)
                                  @[simp]
                                  theorem STRIPS.PlanningTask.Path.mem_empty {n : } {pt : PlanningTask n} {s s' : State n} :
                                  s empty s' s = s'
                                  @[simp]
                                  theorem STRIPS.PlanningTask.Path.mem_cons {n : } {pt : PlanningTask n} {a : Action n} {s1 s2 s3 : State n} {ha : a pt.actions} {succ : Successor a s1 s2} {π : pt.Path s2 s3} {s : State n} :
                                  s cons a s2 ha succ π s = s1 s π
                                  @[simp]
                                  theorem STRIPS.PlanningTask.Path.mem_snoc {n : } {pt : PlanningTask n} {a : Action n} {s1 s2 s3 : State n} {ha : a pt.actions} {π : pt.Path s1 s2} {succ : Successor a s2 s3} {s : State n} :
                                  s snoc a s2 ha π succ s = s3 s π
                                  theorem STRIPS.PlanningTask.Path.first_mem {n : } {pt : PlanningTask n} {s1 s2 : State n} (π : pt.Path s1 s2) :
                                  s1 π
                                  theorem STRIPS.PlanningTask.Path.last_mem {n : } {pt : PlanningTask n} {s1 s2 : State n} (π : pt.Path s1 s2) :
                                  s2 π

                                  append #

                                  def STRIPS.PlanningTask.Path.append {n : } {pt : PlanningTask n} {s1 s2 s3 : State n} :
                                  pt.Path s1 s2pt.Path s2 s3pt.Path s1 s3

                                  Given a path form a s1 to s2 and a path from s2 to s3, we obtain a path from s1 to s3.

                                  Equations
                                  Instances For
                                    @[implicit_reducible]
                                    instance STRIPS.PlanningTask.Path.instHAppend {n : } {pt : PlanningTask n} {s1 s2 s3 : State n} :
                                    HAppend (pt.Path s1 s2) (pt.Path s2 s3) (pt.Path s1 s3)
                                    Equations
                                    @[simp]
                                    theorem STRIPS.PlanningTask.Path.append_eq {n : } {pt : PlanningTask n} {s1 s2 s3 : State n} (π₁ : pt.Path s1 s2) (π₂ : pt.Path s2 s3) :
                                    π₁.append π₂ = π₁ ++ π₂
                                    theorem STRIPS.PlanningTask.Path.mem_append {n : } {pt : PlanningTask n} {s1 s2 s3 : State n} (π₁ : pt.Path s1 s2) (π₂ : pt.Path s2 s3) (s : State n) :
                                    s π₁ ++ π₂ s π₁ s π₂

                                    split #

                                    theorem STRIPS.PlanningTask.Path.split {n : } {pt : PlanningTask n} {s1 s2 s : State n} (π : pt.Path s1 s2) (h : s π) :
                                    Nonempty (pt.Path s1 s × pt.Path s s2)

                                    If a state s lies on a path π from s1 to s2, then there is a path from the s1 to s and a path from s to s2.

                                    Reachablility, Plans and Unsolvability #

                                    @[reducible, inline]
                                    abbrev STRIPS.PlanningTask.Reachable {n : } (pt : PlanningTask n) (s s' : State n) :

                                    A state s' is reachable from s if there is a path from s to s'. This is the Prop version of Path.

                                    Equations
                                    Instances For
                                      structure STRIPS.PlanningTask.Plan {n : } (pt : PlanningTask n) (s : State n) :

                                      A plan for a state s for a planning task pt is a path from s to a goal state of pt.

                                      • last : State n

                                        The goal state in pt.

                                      • path : pt.Path s self.last

                                        The path from s to the goal state.

                                      • goal : pt.GoalState self.last

                                        The proof that last is a goal state.

                                      Instances For
                                        @[reducible, inline]

                                        A state is unsolvable if there is no plan for that state.

                                        Equations
                                        Instances For
                                          @[reducible, inline]

                                          A planning task is unsolvable if the initial state is unsolvable.

                                          Equations
                                          Instances For

                                            progression and regression #

                                            def STRIPS.progression' {n : } (S : States n) (a : Action n) :

                                            The progression of a set of states S by an action a.

                                            Equations
                                            Instances For
                                              def STRIPS.progression {n : } (S : States n) (A : Actions n) :

                                              The progression of a set of states S by a set of actions A.

                                              Equations
                                              Instances For
                                                def STRIPS.regression' {n : } (S : States n) (a : Action n) :

                                                The regression of a set of states S by an action a.

                                                Equations
                                                Instances For
                                                  def STRIPS.regression {n : } (S : States n) (A : Actions n) :

                                                  The regression of a set of states S by a set of actions A.

                                                  Equations
                                                  Instances For
                                                    theorem STRIPS.mem_progression' {n : } {a : Action n} {S : States n} (s : State n) :
                                                    s progression' S a (s' : State n), s' S Successor a s' s
                                                    theorem STRIPS.mem_progression {n : } {A : Actions n} {S : States n} (s : State n) :
                                                    s progression S A (a : Action n), a A (s' : State n), s' S Successor a s' s
                                                    theorem STRIPS.mem_progression_of_successor {n : } {S : States n} {s s' : State n} {A : Actions n} {a : Action n} (hs : s S) (ha : a A) (h : Successor a s s') :
                                                    theorem STRIPS.progression_union_states {n : } {S1 S2 : States n} {A : Actions n} :
                                                    theorem STRIPS.progression_union_actions {n : } {S : States n} {A1 A2 : Actions n} :
                                                    theorem STRIPS.mem_regression' {n : } {S : States n} {a : Action n} (s : State n) :
                                                    s regression' S a (s' : State n), s' S Successor a s s'
                                                    theorem STRIPS.mem_regression {n : } {S : States n} {A : Actions n} (s : State n) :
                                                    s regression S A (a : Action n), a A (s' : State n), s' S Successor a s s'
                                                    theorem STRIPS.mem_regression_of_successor {n : } {S : States n} {s s' : State n} {A : Actions n} {a : Action n} (hs : s S) (ha : a A) (h : Successor a s' s) :
                                                    theorem STRIPS.sub_progression_iff_sub_regression {n : } {S S' : States n} {A : Actions n} :
                                                    progression S AS' regression S' AS