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

Module iter.
  Module adapters.
    Module map.
      (* StructRecord
        {
          name := "Map";
          const_params := [];
          ty_params := [ "I"; "F" ];
          fields := [ ("iter", I); ("f", F) ];
        } *)
      
      Module Impl_core_clone_Clone_where_core_clone_Clone_I_where_core_clone_Clone_F_for_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (* Clone *)
        Definition clone (I F : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              Value.StructRecord
                "core::iter::adapters::map::Map"
                [
                  ("iter",
                    M.call_closure (|
                      M.get_trait_method (| "core::clone::Clone", I, [], "clone", [] |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::map::Map",
                          "iter"
                        |)
                      ]
                    |));
                  ("f",
                    M.call_closure (|
                      M.get_trait_method (| "core::clone::Clone", F, [], "clone", [] |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::map::Map",
                          "f"
                        |)
                      ]
                    |))
                ]))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I F : Ty.t),
          M.IsTraitInstance
            "core::clone::Clone"
            (Self I F)
            (* Trait polymorphic types *) []
            (* Instance *) [ ("clone", InstanceField.Method (clone I F)) ].
      End Impl_core_clone_Clone_where_core_clone_Clone_I_where_core_clone_Clone_F_for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*
            pub(in crate::iter) fn new(iter: I, f: F) -> Map<I, F> {
                Map { iter, f }
            }
        *)
        Definition new (I F : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I F in
          match ε, τ, α with
          | [], [], [ iter; f ] =>
            ltac:(M.monadic
              (let iter := M.alloc (| iter |) in
              let f := M.alloc (| f |) in
              Value.StructRecord
                "core::iter::adapters::map::Map"
                [ ("iter", M.read (| iter |)); ("f", M.read (| f |)) ]))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_new :
          forall (I F : Ty.t),
          M.IsAssociatedFunction (Self I F) "new" (new I F).
        
        (*
            pub(crate) fn into_inner(self) -> I {
                self.iter
            }
        *)
        Definition into_inner
            (I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.read (|
                M.SubPointer.get_struct_record_field (|
                  self,
                  "core::iter::adapters::map::Map",
                  "iter"
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom AssociatedFunction_into_inner :
          forall (I F : Ty.t),
          M.IsAssociatedFunction (Self I F) "into_inner" (into_inner I F).
      End Impl_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_fmt_Debug_where_core_fmt_Debug_I_for_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*
            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
                f.debug_struct("Map").field("iter", &self.iter).finish()
            }
        *)
        Definition fmt (I F : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self I F in
          match ε, τ, α with
          | [], [], [ self; f ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let f := M.alloc (| f |) in
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "core::fmt::builders::DebugStruct",
                  "finish",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "core::fmt::builders::DebugStruct",
                      "field",
                      []
                    |),
                    [
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "core::fmt::Formatter",
                            "debug_struct",
                            []
                          |),
                          [ M.read (| f |); M.read (| Value.String "Map" |) ]
                        |)
                      |);
                      M.read (| Value.String "iter" |);
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::map::Map",
                        "iter"
                      |)
                    ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I F : Ty.t),
          M.IsTraitInstance
            "core::fmt::Debug"
            (Self I F)
            (* Trait polymorphic types *) []
            (* Instance *) [ ("fmt", InstanceField.Method (fmt I F)) ].
      End Impl_core_fmt_Debug_where_core_fmt_Debug_I_for_core_iter_adapters_map_Map_I_F.
      
      (*
      fn map_fold<T, B, Acc>(
          mut f: impl FnMut(T) -> B,
          mut g: impl FnMut(Acc, B) -> Acc,
      ) -> impl FnMut(Acc, T) -> Acc {
          move |acc, elt| g(acc, f(elt))
      }
      *)
      Definition map_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [], [ T; B; Acc; impl_FnMut_T__arrow_B; impl_FnMut_Acc__B__arrow_Acc ], [ f; g ] =>
          ltac:(M.monadic
            (let f := M.alloc (| f |) in
            let g := M.alloc (| g |) in
            M.closure
              (fun γ =>
                ltac:(M.monadic
                  match γ with
                  | [ α0; α1 ] =>
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| α0 |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let acc := M.copy (| γ |) in
                              M.match_operator (|
                                M.alloc (| α1 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let elt := M.copy (| γ |) in
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::function::FnMut",
                                          impl_FnMut_Acc__B__arrow_Acc,
                                          [ Ty.tuple [ Acc; B ] ],
                                          "call_mut",
                                          []
                                        |),
                                        [
                                          g;
                                          Value.Tuple
                                            [
                                              M.read (| acc |);
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::FnMut",
                                                  impl_FnMut_T__arrow_B,
                                                  [ Ty.tuple [ T ] ],
                                                  "call_mut",
                                                  []
                                                |),
                                                [ f; Value.Tuple [ M.read (| elt |) ] ]
                                              |)
                                            ]
                                        ]
                                      |)))
                                ]
                              |)))
                        ]
                      |)))
                  | _ => M.impossible "wrong number of arguments"
                  end))))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Function_map_fold : M.IsFunction "core::iter::adapters::map::map_fold" map_fold.
      
      Module map_fold.
        (* Error OpaqueTy *)
      End map_fold.
      
      (*
      fn map_try_fold<'a, T, B, Acc, R>(
          f: &'a mut impl FnMut(T) -> B,
          mut g: impl FnMut(Acc, B) -> R + 'a,
      ) -> impl FnMut(Acc, T) -> R + 'a {
          move |acc, elt| g(acc, f(elt))
      }
      *)
      Definition map_try_fold (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
        match ε, τ, α with
        | [],
            [ T; B; Acc; R; impl_FnMut_T__arrow_B; impl_FnMut_Acc__B__arrow_R__plus__'a ],
            [ f; g ] =>
          ltac:(M.monadic
            (let f := M.alloc (| f |) in
            let g := M.alloc (| g |) in
            M.closure
              (fun γ =>
                ltac:(M.monadic
                  match γ with
                  | [ α0; α1 ] =>
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| α0 |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let acc := M.copy (| γ |) in
                              M.match_operator (|
                                M.alloc (| α1 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let elt := M.copy (| γ |) in
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::function::FnMut",
                                          impl_FnMut_Acc__B__arrow_R__plus__'a,
                                          [ Ty.tuple [ Acc; B ] ],
                                          "call_mut",
                                          []
                                        |),
                                        [
                                          g;
                                          Value.Tuple
                                            [
                                              M.read (| acc |);
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::ops::function::FnMut",
                                                  impl_FnMut_T__arrow_B,
                                                  [ Ty.tuple [ T ] ],
                                                  "call_mut",
                                                  []
                                                |),
                                                [ M.read (| f |); Value.Tuple [ M.read (| elt |) ] ]
                                              |)
                                            ]
                                        ]
                                      |)))
                                ]
                              |)))
                        ]
                      |)))
                  | _ => M.impossible "wrong number of arguments"
                  end))))
        | _, _, _ => M.impossible "wrong number of arguments"
        end.
      
      Axiom Function_map_try_fold :
        M.IsFunction "core::iter::adapters::map::map_try_fold" map_try_fold.
      
      Module map_try_fold.
        (* Error OpaqueTy *)
      End map_try_fold.
      
      Module Impl_core_iter_traits_iterator_Iterator_where_core_iter_traits_iterator_Iterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
        Definition Self (B I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*     type Item = B; *)
        Definition _Item (B I F : Ty.t) : Ty.t := B.
        
        (*
            fn next(&mut self) -> Option<B> {
                self.iter.next().map(&mut self.f)
            }
        *)
        Definition next (B I F : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_associated_function (|
                  Ty.apply (Ty.path "core::option::Option") [] [ Ty.associated ],
                  "map",
                  [ B; Ty.apply (Ty.path "&mut") [] [ F ] ]
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      I,
                      [],
                      "next",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::map::Map",
                        "iter"
                      |)
                    ]
                  |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "f"
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn size_hint(&self) -> (usize, Option<usize>) {
                self.iter.size_hint()
            }
        *)
        Definition size_hint
            (B I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::iterator::Iterator",
                  I,
                  [],
                  "size_hint",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "iter"
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn try_fold<Acc, G, R>(&mut self, init: Acc, g: G) -> R
            where
                Self: Sized,
                G: FnMut(Acc, Self::Item) -> R,
                R: Try<Output = Acc>,
            {
                self.iter.try_fold(init, map_try_fold(&mut self.f, g))
            }
        *)
        Definition try_fold
            (B I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [ Acc; G; R ], [ self; init; g ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let g := M.alloc (| g |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::iterator::Iterator",
                  I,
                  [],
                  "try_fold",
                  [ Acc; Ty.associated; R ]
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "iter"
                  |);
                  M.read (| init |);
                  M.call_closure (|
                    M.get_function (|
                      "core::iter::adapters::map::map_try_fold",
                      [ Ty.associated; B; Acc; R; F; G ]
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::map::Map",
                        "f"
                      |);
                      M.read (| g |)
                    ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn fold<Acc, G>(self, init: Acc, g: G) -> Acc
            where
                G: FnMut(Acc, Self::Item) -> Acc,
            {
                self.iter.fold(init, map_fold(self.f, g))
            }
        *)
        Definition fold (B I F : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [ Acc; G ], [ self; init; g ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let g := M.alloc (| g |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::iterator::Iterator",
                  I,
                  [],
                  "fold",
                  [ Acc; Ty.associated ]
                |),
                [
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      self,
                      "core::iter::adapters::map::Map",
                      "iter"
                    |)
                  |);
                  M.read (| init |);
                  M.call_closure (|
                    M.get_function (|
                      "core::iter::adapters::map::map_fold",
                      [ Ty.associated; B; Acc; F; G ]
                    |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          self,
                          "core::iter::adapters::map::Map",
                          "f"
                        |)
                      |);
                      M.read (| g |)
                    ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> B
            where
                Self: TrustedRandomAccessNoCoerce,
            {
                // SAFETY: the caller must uphold the contract for
                // `Iterator::__iterator_get_unchecked`.
                unsafe { (self.f)(try_get_unchecked(&mut self.iter, idx)) }
            }
        *)
        Definition __iterator_get_unchecked
            (B I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [], [ self; idx ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let idx := M.alloc (| idx |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::function::FnMut",
                  F,
                  [ Ty.tuple [ Ty.associated ] ],
                  "call_mut",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "f"
                  |);
                  Value.Tuple
                    [
                      M.call_closure (|
                        M.get_function (| "core::iter::adapters::zip::try_get_unchecked", [ I ] |),
                        [
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "core::iter::adapters::map::Map",
                            "iter"
                          |);
                          M.read (| idx |)
                        ]
                      |)
                    ]
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (B I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::iterator::Iterator"
            (Self B I F)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("Item", InstanceField.Ty (_Item B I F));
              ("next", InstanceField.Method (next B I F));
              ("size_hint", InstanceField.Method (size_hint B I F));
              ("try_fold", InstanceField.Method (try_fold B I F));
              ("fold", InstanceField.Method (fold B I F));
              ("__iterator_get_unchecked", InstanceField.Method (__iterator_get_unchecked B I F))
            ].
      End Impl_core_iter_traits_iterator_Iterator_where_core_iter_traits_iterator_Iterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_traits_double_ended_DoubleEndedIterator_where_core_iter_traits_double_ended_DoubleEndedIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
        Definition Self (B I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*
            fn next_back(&mut self) -> Option<B> {
                self.iter.next_back().map(&mut self.f)
            }
        *)
        Definition next_back
            (B I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_associated_function (|
                  Ty.apply (Ty.path "core::option::Option") [] [ Ty.associated ],
                  "map",
                  [ B; Ty.apply (Ty.path "&mut") [] [ F ] ]
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::double_ended::DoubleEndedIterator",
                      I,
                      [],
                      "next_back",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::map::Map",
                        "iter"
                      |)
                    ]
                  |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "f"
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn try_rfold<Acc, G, R>(&mut self, init: Acc, g: G) -> R
            where
                Self: Sized,
                G: FnMut(Acc, Self::Item) -> R,
                R: Try<Output = Acc>,
            {
                self.iter.try_rfold(init, map_try_fold(&mut self.f, g))
            }
        *)
        Definition try_rfold
            (B I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [ Acc; G; R ], [ self; init; g ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let g := M.alloc (| g |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::double_ended::DoubleEndedIterator",
                  I,
                  [],
                  "try_rfold",
                  [ Acc; Ty.associated; R ]
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "iter"
                  |);
                  M.read (| init |);
                  M.call_closure (|
                    M.get_function (|
                      "core::iter::adapters::map::map_try_fold",
                      [ Ty.associated; B; Acc; R; F; G ]
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::map::Map",
                        "f"
                      |);
                      M.read (| g |)
                    ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn rfold<Acc, G>(self, init: Acc, g: G) -> Acc
            where
                G: FnMut(Acc, Self::Item) -> Acc,
            {
                self.iter.rfold(init, map_fold(self.f, g))
            }
        *)
        Definition rfold (B I F : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [ Acc; G ], [ self; init; g ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              let init := M.alloc (| init |) in
              let g := M.alloc (| g |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::double_ended::DoubleEndedIterator",
                  I,
                  [],
                  "rfold",
                  [ Acc; Ty.associated ]
                |),
                [
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      self,
                      "core::iter::adapters::map::Map",
                      "iter"
                    |)
                  |);
                  M.read (| init |);
                  M.call_closure (|
                    M.get_function (|
                      "core::iter::adapters::map::map_fold",
                      [ Ty.associated; B; Acc; F; G ]
                    |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          self,
                          "core::iter::adapters::map::Map",
                          "f"
                        |)
                      |);
                      M.read (| g |)
                    ]
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (B I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::double_ended::DoubleEndedIterator"
            (Self B I F)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("next_back", InstanceField.Method (next_back B I F));
              ("try_rfold", InstanceField.Method (try_rfold B I F));
              ("rfold", InstanceField.Method (rfold B I F))
            ].
      End Impl_core_iter_traits_double_ended_DoubleEndedIterator_where_core_iter_traits_double_ended_DoubleEndedIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_traits_exact_size_ExactSizeIterator_where_core_iter_traits_exact_size_ExactSizeIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
        Definition Self (B I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*
            fn len(&self) -> usize {
                self.iter.len()
            }
        *)
        Definition len (B I F : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::exact_size::ExactSizeIterator",
                  I,
                  [],
                  "len",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "iter"
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        (*
            fn is_empty(&self) -> bool {
                self.iter.is_empty()
            }
        *)
        Definition is_empty
            (B I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::exact_size::ExactSizeIterator",
                  I,
                  [],
                  "is_empty",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "iter"
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (B I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::exact_size::ExactSizeIterator"
            (Self B I F)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("len", InstanceField.Method (len B I F));
              ("is_empty", InstanceField.Method (is_empty B I F))
            ].
      End Impl_core_iter_traits_exact_size_ExactSizeIterator_where_core_iter_traits_exact_size_ExactSizeIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_traits_marker_FusedIterator_where_core_iter_traits_marker_FusedIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
        Definition Self (B I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        Axiom Implements :
          forall (B I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::marker::FusedIterator"
            (Self B I F)
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_iter_traits_marker_FusedIterator_where_core_iter_traits_marker_FusedIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_traits_marker_TrustedFused_where_core_iter_traits_marker_TrustedFused_I_for_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        Axiom Implements :
          forall (I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::marker::TrustedFused"
            (Self I F)
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_iter_traits_marker_TrustedFused_where_core_iter_traits_marker_TrustedFused_I_for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_traits_marker_TrustedLen_where_core_iter_traits_marker_TrustedLen_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
        Definition Self (B I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        Axiom Implements :
          forall (B I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::marker::TrustedLen"
            (Self B I F)
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_iter_traits_marker_TrustedLen_where_core_iter_traits_marker_TrustedLen_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_traits_unchecked_iterator_UncheckedIterator_where_core_iter_traits_unchecked_iterator_UncheckedIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
        Definition Self (B I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*
            unsafe fn next_unchecked(&mut self) -> B {
                // SAFETY: `Map` is 1:1 with the inner iterator, so if the caller promised
                // that there's an element left, the inner iterator has one too.
                let item = unsafe { self.iter.next_unchecked() };
                (self.f)(item)
            }
        *)
        Definition next_unchecked
            (B I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self B I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.read (|
                let~ item :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::unchecked_iterator::UncheckedIterator",
                        I,
                        [],
                        "next_unchecked",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          M.read (| self |),
                          "core::iter::adapters::map::Map",
                          "iter"
                        |)
                      ]
                    |)
                  |) in
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::function::FnMut",
                      F,
                      [ Ty.tuple [ Ty.associated ] ],
                      "call_mut",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "core::iter::adapters::map::Map",
                        "f"
                      |);
                      Value.Tuple [ M.read (| item |) ]
                    ]
                  |)
                |)
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (B I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::unchecked_iterator::UncheckedIterator"
            (Self B I F)
            (* Trait polymorphic types *) []
            (* Instance *) [ ("next_unchecked", InstanceField.Method (next_unchecked B I F)) ].
      End Impl_core_iter_traits_unchecked_iterator_UncheckedIterator_where_core_iter_traits_unchecked_iterator_UncheckedIterator_I_where_core_ops_function_FnMut_F_Tuple_associated_type__for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_adapters_zip_TrustedRandomAccess_where_core_iter_adapters_zip_TrustedRandomAccess_I_for_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        Axiom Implements :
          forall (I F : Ty.t),
          M.IsTraitInstance
            "core::iter::adapters::zip::TrustedRandomAccess"
            (Self I F)
            (* Trait polymorphic types *) []
            (* Instance *) [].
      End Impl_core_iter_adapters_zip_TrustedRandomAccess_where_core_iter_adapters_zip_TrustedRandomAccess_I_for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_adapters_zip_TrustedRandomAccessNoCoerce_where_core_iter_adapters_zip_TrustedRandomAccessNoCoerce_I_for_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*     const MAY_HAVE_SIDE_EFFECT: bool = true; *)
        (* Ty.path "bool" *)
        Definition value_MAY_HAVE_SIDE_EFFECT (I F : Ty.t) : Value.t :=
          let Self : Ty.t := Self I F in
          M.run ltac:(M.monadic (M.alloc (| Value.Bool true |))).
        
        Axiom Implements :
          forall (I F : Ty.t),
          M.IsTraitInstance
            "core::iter::adapters::zip::TrustedRandomAccessNoCoerce"
            (Self I F)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("value_MAY_HAVE_SIDE_EFFECT",
                InstanceField.Constant (value_MAY_HAVE_SIDE_EFFECT I F))
            ].
      End Impl_core_iter_adapters_zip_TrustedRandomAccessNoCoerce_where_core_iter_adapters_zip_TrustedRandomAccessNoCoerce_I_for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_adapters_SourceIter_where_core_iter_adapters_SourceIter_I_for_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*     type Source = I::Source; *)
        Definition _Source (I F : Ty.t) : Ty.t := Ty.associated.
        
        (*
            unsafe fn as_inner(&mut self) -> &mut I::Source {
                // SAFETY: unsafe function forwarding to unsafe function with the same requirements
                unsafe { SourceIter::as_inner(&mut self.iter) }
            }
        *)
        Definition as_inner
            (I F : Ty.t)
            (ε : list Value.t)
            (τ : list Ty.t)
            (α : list Value.t)
            : M :=
          let Self : Ty.t := Self I F in
          match ε, τ, α with
          | [], [], [ self ] =>
            ltac:(M.monadic
              (let self := M.alloc (| self |) in
              M.call_closure (|
                M.get_trait_method (| "core::iter::adapters::SourceIter", I, [], "as_inner", [] |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "core::iter::adapters::map::Map",
                    "iter"
                  |)
                ]
              |)))
          | _, _, _ => M.impossible "wrong number of arguments"
          end.
        
        Axiom Implements :
          forall (I F : Ty.t),
          M.IsTraitInstance
            "core::iter::adapters::SourceIter"
            (Self I F)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("Source", InstanceField.Ty (_Source I F));
              ("as_inner", InstanceField.Method (as_inner I F))
            ].
      End Impl_core_iter_adapters_SourceIter_where_core_iter_adapters_SourceIter_I_for_core_iter_adapters_map_Map_I_F.
      
      Module Impl_core_iter_traits_marker_InPlaceIterable_where_core_iter_traits_marker_InPlaceIterable_I_for_core_iter_adapters_map_Map_I_F.
        Definition Self (I F : Ty.t) : Ty.t :=
          Ty.apply (Ty.path "core::iter::adapters::map::Map") [] [ I; F ].
        
        (*     const EXPAND_BY: Option<NonZero<usize>> = I::EXPAND_BY; *)
        (* Ty.apply
          (Ty.path "core::option::Option")
          []
          [ Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ] ] *)
        Definition value_EXPAND_BY (I F : Ty.t) : Value.t :=
          let Self : Ty.t := Self I F in
          M.run
            ltac:(M.monadic
              (M.get_constant (| "core::iter::traits::marker::InPlaceIterable::EXPAND_BY" |))).
        
        (*     const MERGE_BY: Option<NonZero<usize>> = I::MERGE_BY; *)
        (* Ty.apply
          (Ty.path "core::option::Option")
          []
          [ Ty.apply (Ty.path "core::num::nonzero::NonZero") [] [ Ty.path "usize" ] ] *)
        Definition value_MERGE_BY (I F : Ty.t) : Value.t :=
          let Self : Ty.t := Self I F in
          M.run
            ltac:(M.monadic
              (M.get_constant (| "core::iter::traits::marker::InPlaceIterable::MERGE_BY" |))).
        
        Axiom Implements :
          forall (I F : Ty.t),
          M.IsTraitInstance
            "core::iter::traits::marker::InPlaceIterable"
            (Self I F)
            (* Trait polymorphic types *) []
            (* Instance *)
            [
              ("value_EXPAND_BY", InstanceField.Constant (value_EXPAND_BY I F));
              ("value_MERGE_BY", InstanceField.Constant (value_MERGE_BY I F))
            ].
      End Impl_core_iter_traits_marker_InPlaceIterable_where_core_iter_traits_marker_InPlaceIterable_I_for_core_iter_adapters_map_Map_I_F.
    End map.
  End adapters.
End iter.
