(* Generated by coq-of-rust *)
Require Import CoqOfRust.CoqOfRust.

Module task.
  Module poll.
    (*
    Enum Poll
    {
      const_params := [];
      ty_params := [ "T" ];
      variants :=
        [
          {
            name := "Ready";
            item := StructTuple [ T ];
            discriminant := None;
          };
          {
            name := "Pending";
            item := StructTuple [];
            discriminant := None;
          }
        ];
    }
    *)
    
    Module Impl_core_marker_Copy_where_core_marker_Copy_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::marker::Copy"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [].
    End Impl_core_marker_Copy_where_core_marker_Copy_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_clone_Clone_where_core_clone_Clone_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (* Clone *)
      Definition clone (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let __self_0 := M.alloc (| γ1_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            M.call_closure (|
                              M.get_trait_method (| "core::clone::Clone", T, [], "clone", [] |),
                              [ M.read (| __self_0 |) ]
                            |)
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (| Value.StructTuple "core::task::poll::Poll::Pending" [] |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::clone::Clone"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [ ("clone", InstanceField.Method (clone T)) ].
    End Impl_core_clone_Clone_where_core_clone_Clone_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_fmt_Debug_where_core_fmt_Debug_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (* Debug *)
      Definition fmt (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let __self_0 := M.alloc (| γ1_0 |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "core::fmt::Formatter",
                            "debug_tuple_field1_finish",
                            []
                          |),
                          [ M.read (| f |); M.read (| Value.String "Ready" |); __self_0 ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "core::fmt::Formatter",
                            "write_str",
                            []
                          |),
                          [ M.read (| f |); M.read (| Value.String "Pending" |) ]
                        |)
                      |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::fmt::Debug"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [ ("fmt", InstanceField.Method (fmt T)) ].
    End Impl_core_fmt_Debug_where_core_fmt_Debug_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_cmp_Eq_where_core_cmp_Eq_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (* Eq *)
      Definition assert_receiver_is_total_eq
          (T : Ty.t)
          (ε : list Value.t)
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (|
              M.match_operator (|
                Value.DeclaredButUndefined,
                [ fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |))) ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::cmp::Eq"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *)
          [ ("assert_receiver_is_total_eq", InstanceField.Method (assert_receiver_is_total_eq T)) ].
    End Impl_core_cmp_Eq_where_core_cmp_Eq_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_marker_StructuralPartialEq_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::marker::StructuralPartialEq"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [].
    End Impl_core_marker_StructuralPartialEq_for_core_task_poll_Poll_T.
    
    Module Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (* PartialEq *)
      Definition eq (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ __self_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ] ]
                    |),
                    [ M.read (| self |) ]
                  |)
                |) in
              let~ __arg1_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ] ]
                    |),
                    [ M.read (| other |) ]
                  |)
                |) in
              M.alloc (|
                LogicalOp.and (|
                  BinOp.eq (| M.read (| __self_discr |), M.read (| __arg1_discr |) |),
                  ltac:(M.monadic
                    (M.read (|
                      M.match_operator (|
                        M.alloc (| Value.Tuple [ M.read (| self |); M.read (| other |) ] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                              let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                              let γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "core::task::poll::Poll::Ready",
                                  0
                                |) in
                              let __self_0 := M.alloc (| γ2_0 |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_1,
                                  "core::task::poll::Poll::Ready",
                                  0
                                |) in
                              let __arg1_0 := M.alloc (| γ2_0 |) in
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::cmp::PartialEq",
                                    Ty.apply (Ty.path "&") [] [ T ],
                                    [ Ty.apply (Ty.path "&") [] [ T ] ],
                                    "eq",
                                    []
                                  |),
                                  [ __self_0; __arg1_0 ]
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Bool true |)))
                        ]
                      |)
                    |)))
                |)
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::cmp::PartialEq"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [ ("eq", InstanceField.Method (eq T)) ].
    End Impl_core_cmp_PartialEq_where_core_cmp_PartialEq_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_cmp_Ord_where_core_cmp_Ord_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (* Ord *)
      Definition cmp (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ __self_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ] ]
                    |),
                    [ M.read (| self |) ]
                  |)
                |) in
              let~ __arg1_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ] ]
                    |),
                    [ M.read (| other |) ]
                  |)
                |) in
              M.match_operator (|
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (| "core::cmp::Ord", Ty.path "isize", [], "cmp", [] |),
                    [ __self_discr; __arg1_discr ]
                  |)
                |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::cmp::Ordering::Equal" |) in
                      M.match_operator (|
                        M.alloc (| Value.Tuple [ M.read (| self |); M.read (| other |) ] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                              let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                              let γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "core::task::poll::Poll::Ready",
                                  0
                                |) in
                              let __self_0 := M.alloc (| γ2_0 |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_1,
                                  "core::task::poll::Poll::Ready",
                                  0
                                |) in
                              let __arg1_0 := M.alloc (| γ2_0 |) in
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (| "core::cmp::Ord", T, [], "cmp", [] |),
                                  [ M.read (| __self_0 |); M.read (| __arg1_0 |) ]
                                |)
                              |)));
                          fun γ =>
                            ltac:(M.monadic
                              (M.alloc (| Value.StructTuple "core::cmp::Ordering::Equal" [] |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let cmp := M.copy (| γ |) in
                      cmp))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::cmp::Ord"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [ ("cmp", InstanceField.Method (cmp T)) ].
    End Impl_core_cmp_Ord_where_core_cmp_Ord_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_cmp_PartialOrd_where_core_cmp_PartialOrd_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (* PartialOrd *)
      Definition partial_cmp (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self; other ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let other := M.alloc (| other |) in
            M.read (|
              let~ __self_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ] ]
                    |),
                    [ M.read (| self |) ]
                  |)
                |) in
              let~ __arg1_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ] ]
                    |),
                    [ M.read (| other |) ]
                  |)
                |) in
              M.match_operator (|
                M.alloc (| Value.Tuple [ M.read (| self |); M.read (| other |) ] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                      let γ0_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                      let γ0_0 := M.read (| γ0_0 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let __self_0 := M.alloc (| γ2_0 |) in
                      let γ0_1 := M.read (| γ0_1 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_1,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let __arg1_0 := M.alloc (| γ2_0 |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::cmp::PartialOrd",
                            T,
                            [ T ],
                            "partial_cmp",
                            []
                          |),
                          [ M.read (| __self_0 |); M.read (| __arg1_0 |) ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::cmp::PartialOrd",
                            Ty.path "isize",
                            [ Ty.path "isize" ],
                            "partial_cmp",
                            []
                          |),
                          [ __self_discr; __arg1_discr ]
                        |)
                      |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::cmp::PartialOrd"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [ ("partial_cmp", InstanceField.Method (partial_cmp T)) ].
    End Impl_core_cmp_PartialOrd_where_core_cmp_PartialOrd_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_hash_Hash_where_core_hash_Hash_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (* Hash *)
      Definition hash (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [ __H ], [ self; state ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let state := M.alloc (| state |) in
            M.read (|
              let~ __self_discr :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (|
                      "core::intrinsics::discriminant_value",
                      [ Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ] ]
                    |),
                    [ M.read (| self |) ]
                  |)
                |) in
              let~ _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::hash::Hash",
                      Ty.path "isize",
                      [],
                      "hash",
                      [ __H ]
                    |),
                    [ __self_discr; M.read (| state |) ]
                  |)
                |) in
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let __self_0 := M.alloc (| γ1_0 |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (| "core::hash::Hash", T, [], "hash", [ __H ] |),
                          [ M.read (| __self_0 |); M.read (| state |) ]
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::hash::Hash"
          (Self T)
          (* Trait polymorphic types *) []
          (* Instance *) [ ("hash", InstanceField.Method (hash T)) ].
    End Impl_core_hash_Hash_where_core_hash_Hash_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (*
          pub fn map<U, F>(self, f: F) -> Poll<U>
          where
              F: FnOnce(T) -> U,
          {
              match self {
                  Poll::Ready(t) => Poll::Ready(f(t)),
                  Poll::Pending => Poll::Pending,
              }
          }
      *)
      Definition map (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [ U; F ], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let t := M.copy (| γ0_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::function::FnOnce",
                                F,
                                [ Ty.tuple [ T ] ],
                                "call_once",
                                []
                              |),
                              [ M.read (| f |); Value.Tuple [ M.read (| t |) ] ]
                            |)
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (| Value.StructTuple "core::task::poll::Poll::Pending" [] |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_map :
        forall (T : Ty.t),
        M.IsAssociatedFunction (Self T) "map" (map T).
      
      (*
          pub const fn is_ready(&self) -> bool {
              matches!( *self, Poll::Ready(_))
          }
      *)
      Definition is_ready (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (|
              M.match_operator (|
                M.read (| self |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      M.alloc (| Value.Bool true |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Bool false |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_is_ready :
        forall (T : Ty.t),
        M.IsAssociatedFunction (Self T) "is_ready" (is_ready T).
      
      (*
          pub const fn is_pending(&self) -> bool {
              !self.is_ready()
          }
      *)
      Definition is_pending (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            UnOp.not (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ],
                  "is_ready",
                  []
                |),
                [ M.read (| self |) ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_is_pending :
        forall (T : Ty.t),
        M.IsAssociatedFunction (Self T) "is_pending" (is_pending T).
    End Impl_core_task_poll_Poll_T.
    
    Module Impl_core_task_poll_Poll_core_result_Result_T_E.
      Definition Self (T E : Ty.t) : Ty.t :=
        Ty.apply
          (Ty.path "core::task::poll::Poll")
          []
          [ Ty.apply (Ty.path "core::result::Result") [] [ T; E ] ].
      
      (*
          pub fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>>
          where
              F: FnOnce(T) -> U,
          {
              match self {
                  Poll::Ready(Ok(t)) => Poll::Ready(Ok(f(t))),
                  Poll::Ready(Err(e)) => Poll::Ready(Err(e)),
                  Poll::Pending => Poll::Pending,
              }
          }
      *)
      Definition map_ok (T E : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [ U; F ], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::result::Result::Ok",
                          0
                        |) in
                      let t := M.copy (| γ1_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::result::Result::Ok"
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::function::FnOnce",
                                    F,
                                    [ Ty.tuple [ T ] ],
                                    "call_once",
                                    []
                                  |),
                                  [ M.read (| f |); Value.Tuple [ M.read (| t |) ] ]
                                |)
                              ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ1_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [ Value.StructTuple "core::result::Result::Err" [ M.read (| e |) ] ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (| Value.StructTuple "core::task::poll::Poll::Pending" [] |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_map_ok :
        forall (T E : Ty.t),
        M.IsAssociatedFunction (Self T E) "map_ok" (map_ok T E).
      
      (*
          pub fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>>
          where
              F: FnOnce(E) -> U,
          {
              match self {
                  Poll::Ready(Ok(t)) => Poll::Ready(Ok(t)),
                  Poll::Ready(Err(e)) => Poll::Ready(Err(f(e))),
                  Poll::Pending => Poll::Pending,
              }
          }
      *)
      Definition map_err (T E : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [ U; F ], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::result::Result::Ok",
                          0
                        |) in
                      let t := M.copy (| γ1_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [ Value.StructTuple "core::result::Result::Ok" [ M.read (| t |) ] ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ1_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::result::Result::Err"
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::function::FnOnce",
                                    F,
                                    [ Ty.tuple [ E ] ],
                                    "call_once",
                                    []
                                  |),
                                  [ M.read (| f |); Value.Tuple [ M.read (| e |) ] ]
                                |)
                              ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (| Value.StructTuple "core::task::poll::Poll::Pending" [] |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_map_err :
        forall (T E : Ty.t),
        M.IsAssociatedFunction (Self T E) "map_err" (map_err T E).
    End Impl_core_task_poll_Poll_core_result_Result_T_E.
    
    Module Impl_core_task_poll_Poll_core_option_Option_core_result_Result_T_E.
      Definition Self (T E : Ty.t) : Ty.t :=
        Ty.apply
          (Ty.path "core::task::poll::Poll")
          []
          [
            Ty.apply
              (Ty.path "core::option::Option")
              []
              [ Ty.apply (Ty.path "core::result::Result") [] [ T; E ] ]
          ].
      
      (*
          pub fn map_ok<U, F>(self, f: F) -> Poll<Option<Result<U, E>>>
          where
              F: FnOnce(T) -> U,
          {
              match self {
                  Poll::Ready(Some(Ok(t))) => Poll::Ready(Some(Ok(f(t)))),
                  Poll::Ready(Some(Err(e))) => Poll::Ready(Some(Err(e))),
                  Poll::Ready(None) => Poll::Ready(None),
                  Poll::Pending => Poll::Pending,
              }
          }
      *)
      Definition map_ok (T E : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [ U; F ], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::option::Option::Some",
                          0
                        |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ1_0,
                          "core::result::Result::Ok",
                          0
                        |) in
                      let t := M.copy (| γ2_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::option::Option::Some"
                              [
                                Value.StructTuple
                                  "core::result::Result::Ok"
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::function::FnOnce",
                                        F,
                                        [ Ty.tuple [ T ] ],
                                        "call_once",
                                        []
                                      |),
                                      [ M.read (| f |); Value.Tuple [ M.read (| t |) ] ]
                                    |)
                                  ]
                              ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::option::Option::Some",
                          0
                        |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ1_0,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ2_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::option::Option::Some"
                              [ Value.StructTuple "core::result::Result::Err" [ M.read (| e |) ] ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let _ := M.is_struct_tuple (| γ0_0, "core::option::Option::None" |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [ Value.StructTuple "core::option::Option::None" [] ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (| Value.StructTuple "core::task::poll::Poll::Pending" [] |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_map_ok :
        forall (T E : Ty.t),
        M.IsAssociatedFunction (Self T E) "map_ok" (map_ok T E).
      
      (*
          pub fn map_err<U, F>(self, f: F) -> Poll<Option<Result<T, U>>>
          where
              F: FnOnce(E) -> U,
          {
              match self {
                  Poll::Ready(Some(Ok(t))) => Poll::Ready(Some(Ok(t))),
                  Poll::Ready(Some(Err(e))) => Poll::Ready(Some(Err(f(e)))),
                  Poll::Ready(None) => Poll::Ready(None),
                  Poll::Pending => Poll::Pending,
              }
          }
      *)
      Definition map_err (T E : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [ U; F ], [ self; f ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            let f := M.alloc (| f |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::option::Option::Some",
                          0
                        |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ1_0,
                          "core::result::Result::Ok",
                          0
                        |) in
                      let t := M.copy (| γ2_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::option::Option::Some"
                              [ Value.StructTuple "core::result::Result::Ok" [ M.read (| t |) ] ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::option::Option::Some",
                          0
                        |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ1_0,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ2_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::option::Option::Some"
                              [
                                Value.StructTuple
                                  "core::result::Result::Err"
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::function::FnOnce",
                                        F,
                                        [ Ty.tuple [ E ] ],
                                        "call_once",
                                        []
                                      |),
                                      [ M.read (| f |); Value.Tuple [ M.read (| e |) ] ]
                                    |)
                                  ]
                              ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let _ := M.is_struct_tuple (| γ0_0, "core::option::Option::None" |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [ Value.StructTuple "core::option::Option::None" [] ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (| Value.StructTuple "core::task::poll::Poll::Pending" [] |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom AssociatedFunction_map_err :
        forall (T E : Ty.t),
        M.IsAssociatedFunction (Self T E) "map_err" (map_err T E).
    End Impl_core_task_poll_Poll_core_option_Option_core_result_Result_T_E.
    
    Module Impl_core_convert_From_T_for_core_task_poll_Poll_T.
      Definition Self (T : Ty.t) : Ty.t := Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (*
          fn from(t: T) -> Poll<T> {
              Poll::Ready(t)
          }
      *)
      Definition from (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T in
        match ε, τ, α with
        | [], [], [ t ] =>
          ltac:(M.monadic
            (let t := M.alloc (| t |) in
            Value.StructTuple "core::task::poll::Poll::Ready" [ M.read (| t |) ]))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T : Ty.t),
        M.IsTraitInstance
          "core::convert::From"
          (Self T)
          (* Trait polymorphic types *) [ (* T *) T ]
          (* Instance *) [ ("from", InstanceField.Method (from T)) ].
    End Impl_core_convert_From_T_for_core_task_poll_Poll_T.
    
    Module Impl_core_ops_try_trait_Try_for_core_task_poll_Poll_core_result_Result_T_E.
      Definition Self (T E : Ty.t) : Ty.t :=
        Ty.apply
          (Ty.path "core::task::poll::Poll")
          []
          [ Ty.apply (Ty.path "core::result::Result") [] [ T; E ] ].
      
      (*     type Output = Poll<T>; *)
      Definition _Output (T E : Ty.t) : Ty.t :=
        Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ].
      
      (*     type Residual = Result<convert::Infallible, E>; *)
      Definition _Residual (T E : Ty.t) : Ty.t :=
        Ty.apply (Ty.path "core::result::Result") [] [ Ty.path "core::convert::Infallible"; E ].
      
      (*
          fn from_output(c: Self::Output) -> Self {
              c.map(Ok)
          }
      *)
      Definition from_output
          (T E : Ty.t)
          (ε : list Value.t)
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [], [ c ] =>
          ltac:(M.monadic
            (let c := M.alloc (| c |) in
            M.call_closure (|
              M.get_associated_function (|
                Ty.apply (Ty.path "core::task::poll::Poll") [] [ T ],
                "map",
                [
                  Ty.apply (Ty.path "core::result::Result") [] [ T; E ];
                  Ty.function [ T ] (Ty.apply (Ty.path "core::result::Result") [] [ T; E ])
                ]
              |),
              [ M.read (| c |); M.constructor_as_closure "core::result::Result::Ok" ]
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      (*
          fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {
              match self {
                  Poll::Ready(Ok(x)) => ControlFlow::Continue(Poll::Ready(x)),
                  Poll::Ready(Err(e)) => ControlFlow::Break(Err(e)),
                  Poll::Pending => ControlFlow::Continue(Poll::Pending),
              }
          }
      *)
      Definition branch (T E : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::result::Result::Ok",
                          0
                        |) in
                      let x := M.copy (| γ1_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::ops::control_flow::ControlFlow::Continue"
                          [ Value.StructTuple "core::task::poll::Poll::Ready" [ M.read (| x |) ] ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ1_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::ops::control_flow::ControlFlow::Break"
                          [ Value.StructTuple "core::result::Result::Err" [ M.read (| e |) ] ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::ops::control_flow::ControlFlow::Continue"
                          [ Value.StructTuple "core::task::poll::Poll::Pending" [] ]
                      |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T E : Ty.t),
        M.IsTraitInstance
          "core::ops::try_trait::Try"
          (Self T E)
          (* Trait polymorphic types *) []
          (* Instance *)
          [
            ("Output", InstanceField.Ty (_Output T E));
            ("Residual", InstanceField.Ty (_Residual T E));
            ("from_output", InstanceField.Method (from_output T E));
            ("branch", InstanceField.Method (branch T E))
          ].
    End Impl_core_ops_try_trait_Try_for_core_task_poll_Poll_core_result_Result_T_E.
    
    Module Impl_core_ops_try_trait_FromResidual_where_core_convert_From_F_E_core_result_Result_core_convert_Infallible_E_for_core_task_poll_Poll_core_result_Result_T_F.
      Definition Self (T E F : Ty.t) : Ty.t :=
        Ty.apply
          (Ty.path "core::task::poll::Poll")
          []
          [ Ty.apply (Ty.path "core::result::Result") [] [ T; F ] ].
      
      (*
          fn from_residual(x: Result<convert::Infallible, E>) -> Self {
              match x {
                  Err(e) => Poll::Ready(Err(From::from(e))),
              }
          }
      *)
      Definition from_residual
          (T E F : Ty.t)
          (ε : list Value.t)
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        let Self : Ty.t := Self T E F in
        match ε, τ, α with
        | [], [], [ x ] =>
          ltac:(M.monadic
            (let x := M.alloc (| x |) in
            M.read (|
              M.match_operator (|
                x,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ0_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::result::Result::Err"
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::convert::From",
                                    F,
                                    [ E ],
                                    "from",
                                    []
                                  |),
                                  [ M.read (| e |) ]
                                |)
                              ]
                          ]
                      |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T E F : Ty.t),
        M.IsTraitInstance
          "core::ops::try_trait::FromResidual"
          (Self T E F)
          (* Trait polymorphic types *)
          [
            (* R *)
            Ty.apply (Ty.path "core::result::Result") [] [ Ty.path "core::convert::Infallible"; E ]
          ]
          (* Instance *) [ ("from_residual", InstanceField.Method (from_residual T E F)) ].
    End Impl_core_ops_try_trait_FromResidual_where_core_convert_From_F_E_core_result_Result_core_convert_Infallible_E_for_core_task_poll_Poll_core_result_Result_T_F.
    
    Module Impl_core_ops_try_trait_Try_for_core_task_poll_Poll_core_option_Option_core_result_Result_T_E.
      Definition Self (T E : Ty.t) : Ty.t :=
        Ty.apply
          (Ty.path "core::task::poll::Poll")
          []
          [
            Ty.apply
              (Ty.path "core::option::Option")
              []
              [ Ty.apply (Ty.path "core::result::Result") [] [ T; E ] ]
          ].
      
      (*     type Output = Poll<Option<T>>; *)
      Definition _Output (T E : Ty.t) : Ty.t :=
        Ty.apply
          (Ty.path "core::task::poll::Poll")
          []
          [ Ty.apply (Ty.path "core::option::Option") [] [ T ] ].
      
      (*     type Residual = Result<convert::Infallible, E>; *)
      Definition _Residual (T E : Ty.t) : Ty.t :=
        Ty.apply (Ty.path "core::result::Result") [] [ Ty.path "core::convert::Infallible"; E ].
      
      (*
          fn from_output(c: Self::Output) -> Self {
              c.map(|x| x.map(Ok))
          }
      *)
      Definition from_output
          (T E : Ty.t)
          (ε : list Value.t)
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [], [ c ] =>
          ltac:(M.monadic
            (let c := M.alloc (| c |) in
            M.call_closure (|
              M.get_associated_function (|
                Ty.apply
                  (Ty.path "core::task::poll::Poll")
                  []
                  [ Ty.apply (Ty.path "core::option::Option") [] [ T ] ],
                "map",
                [
                  Ty.apply
                    (Ty.path "core::option::Option")
                    []
                    [ Ty.apply (Ty.path "core::result::Result") [] [ T; E ] ];
                  Ty.function
                    [ Ty.tuple [ Ty.apply (Ty.path "core::option::Option") [] [ T ] ] ]
                    (Ty.apply
                      (Ty.path "core::option::Option")
                      []
                      [ Ty.apply (Ty.path "core::result::Result") [] [ T; E ] ])
                ]
              |),
              [
                M.read (| c |);
                M.closure
                  (fun γ =>
                    ltac:(M.monadic
                      match γ with
                      | [ α0 ] =>
                        ltac:(M.monadic
                          (M.match_operator (|
                            M.alloc (| α0 |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let x := M.copy (| γ |) in
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply (Ty.path "core::option::Option") [] [ T ],
                                      "map",
                                      [
                                        Ty.apply (Ty.path "core::result::Result") [] [ T; E ];
                                        Ty.function
                                          [ T ]
                                          (Ty.apply (Ty.path "core::result::Result") [] [ T; E ])
                                      ]
                                    |),
                                    [
                                      M.read (| x |);
                                      M.constructor_as_closure "core::result::Result::Ok"
                                    ]
                                  |)))
                            ]
                          |)))
                      | _ => M.impossible "wrong number of arguments"
                      end))
              ]
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      (*
          fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {
              match self {
                  Poll::Ready(Some(Ok(x))) => ControlFlow::Continue(Poll::Ready(Some(x))),
                  Poll::Ready(Some(Err(e))) => ControlFlow::Break(Err(e)),
                  Poll::Ready(None) => ControlFlow::Continue(Poll::Ready(None)),
                  Poll::Pending => ControlFlow::Continue(Poll::Pending),
              }
          }
      *)
      Definition branch (T E : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        let Self : Ty.t := Self T E in
        match ε, τ, α with
        | [], [], [ self ] =>
          ltac:(M.monadic
            (let self := M.alloc (| self |) in
            M.read (|
              M.match_operator (|
                self,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::option::Option::Some",
                          0
                        |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ1_0,
                          "core::result::Result::Ok",
                          0
                        |) in
                      let x := M.copy (| γ2_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::ops::control_flow::ControlFlow::Continue"
                          [
                            Value.StructTuple
                              "core::task::poll::Poll::Ready"
                              [ Value.StructTuple "core::option::Option::Some" [ M.read (| x |) ] ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "core::option::Option::Some",
                          0
                        |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ1_0,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ2_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::ops::control_flow::ControlFlow::Break"
                          [ Value.StructTuple "core::result::Result::Err" [ M.read (| e |) ] ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::task::poll::Poll::Ready",
                          0
                        |) in
                      let _ := M.is_struct_tuple (| γ0_0, "core::option::Option::None" |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::ops::control_flow::ControlFlow::Continue"
                          [
                            Value.StructTuple
                              "core::task::poll::Poll::Ready"
                              [ Value.StructTuple "core::option::Option::None" [] ]
                          ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::task::poll::Poll::Pending" |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::ops::control_flow::ControlFlow::Continue"
                          [ Value.StructTuple "core::task::poll::Poll::Pending" [] ]
                      |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T E : Ty.t),
        M.IsTraitInstance
          "core::ops::try_trait::Try"
          (Self T E)
          (* Trait polymorphic types *) []
          (* Instance *)
          [
            ("Output", InstanceField.Ty (_Output T E));
            ("Residual", InstanceField.Ty (_Residual T E));
            ("from_output", InstanceField.Method (from_output T E));
            ("branch", InstanceField.Method (branch T E))
          ].
    End Impl_core_ops_try_trait_Try_for_core_task_poll_Poll_core_option_Option_core_result_Result_T_E.
    
    Module Impl_core_ops_try_trait_FromResidual_where_core_convert_From_F_E_core_result_Result_core_convert_Infallible_E_for_core_task_poll_Poll_core_option_Option_core_result_Result_T_F.
      Definition Self (T E F : Ty.t) : Ty.t :=
        Ty.apply
          (Ty.path "core::task::poll::Poll")
          []
          [
            Ty.apply
              (Ty.path "core::option::Option")
              []
              [ Ty.apply (Ty.path "core::result::Result") [] [ T; F ] ]
          ].
      
      (*
          fn from_residual(x: Result<convert::Infallible, E>) -> Self {
              match x {
                  Err(e) => Poll::Ready(Some(Err(From::from(e)))),
              }
          }
      *)
      Definition from_residual
          (T E F : Ty.t)
          (ε : list Value.t)
          (τ : list Ty.t)
          (α : list Value.t)
          : M :=
        let Self : Ty.t := Self T E F in
        match ε, τ, α with
        | [], [], [ x ] =>
          ltac:(M.monadic
            (let x := M.alloc (| x |) in
            M.read (|
              M.match_operator (|
                x,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::result::Result::Err",
                          0
                        |) in
                      let e := M.copy (| γ0_0 |) in
                      M.alloc (|
                        Value.StructTuple
                          "core::task::poll::Poll::Ready"
                          [
                            Value.StructTuple
                              "core::option::Option::Some"
                              [
                                Value.StructTuple
                                  "core::result::Result::Err"
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::convert::From",
                                        F,
                                        [ E ],
                                        "from",
                                        []
                                      |),
                                      [ M.read (| e |) ]
                                    |)
                                  ]
                              ]
                          ]
                      |)))
                ]
              |)
            |)))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Implements :
        forall (T E F : Ty.t),
        M.IsTraitInstance
          "core::ops::try_trait::FromResidual"
          (Self T E F)
          (* Trait polymorphic types *)
          [
            (* R *)
            Ty.apply (Ty.path "core::result::Result") [] [ Ty.path "core::convert::Infallible"; E ]
          ]
          (* Instance *) [ ("from_residual", InstanceField.Method (from_residual T E F)) ].
    End Impl_core_ops_try_trait_FromResidual_where_core_convert_From_F_E_core_result_Result_core_convert_Infallible_E_for_core_task_poll_Poll_core_option_Option_core_result_Result_T_F.
  End poll.
End task.
