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

Module string.
  (* StructRecord
    {
      name := "String";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("vec",
            Ty.apply
              (Ty.path "alloc::vec::Vec")
              []
              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ])
        ];
    } *)
  
  Module Impl_core_marker_StructuralPartialEq_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::StructuralPartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_StructuralPartialEq_for_alloc_string_String.
  
  Module Impl_core_cmp_PartialEq_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (* PartialEq *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              [
                Ty.apply
                  (Ty.path "alloc::vec::Vec")
                  []
                  [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]
              ],
              "eq",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.SubPointer.get_struct_record_field (|
                M.read (| other |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("eq", InstanceField.Method eq) ].
  End Impl_core_cmp_PartialEq_for_alloc_string_String.
  
  Module Impl_core_cmp_PartialOrd_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (* PartialOrd *)
    Definition partial_cmp (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialOrd",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              [
                Ty.apply
                  (Ty.path "alloc::vec::Vec")
                  []
                  [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]
              ],
              "partial_cmp",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.SubPointer.get_struct_record_field (|
                M.read (| other |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialOrd"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("partial_cmp", InstanceField.Method partial_cmp) ].
  End Impl_core_cmp_PartialOrd_for_alloc_string_String.
  
  Module Impl_core_cmp_Eq_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (* Eq *)
    Definition assert_receiver_is_total_eq
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      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 :
      M.IsTraitInstance
        "core::cmp::Eq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [ ("assert_receiver_is_total_eq", InstanceField.Method assert_receiver_is_total_eq) ].
  End Impl_core_cmp_Eq_for_alloc_string_String.
  
  Module Impl_core_cmp_Ord_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (* Ord *)
    Definition cmp (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::Ord",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              [],
              "cmp",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.SubPointer.get_struct_record_field (|
                M.read (| other |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::Ord"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("cmp", InstanceField.Method cmp) ].
  End Impl_core_cmp_Ord_for_alloc_string_String.
  
  (* StructRecord
    {
      name := "FromUtf8Error";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("bytes",
            Ty.apply
              (Ty.path "alloc::vec::Vec")
              []
              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]);
          ("error", Ty.path "core::str::error::Utf8Error")
        ];
    } *)
  
  Module Impl_core_fmt_Debug_for_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    (* Debug *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      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::Formatter",
              "debug_struct_field2_finish",
              []
            |),
            [
              M.read (| f |);
              M.read (| Value.String "FromUtf8Error" |);
              M.read (| Value.String "bytes" |);
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::FromUtf8Error",
                "bytes"
              |);
              M.read (| Value.String "error" |);
              M.alloc (|
                M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "alloc::string::FromUtf8Error",
                  "error"
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_alloc_string_FromUtf8Error.
  
  Module Impl_core_marker_StructuralPartialEq_for_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::StructuralPartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_StructuralPartialEq_for_alloc_string_FromUtf8Error.
  
  Module Impl_core_cmp_PartialEq_for_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    (* PartialEq *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          LogicalOp.and (|
            M.call_closure (|
              M.get_trait_method (|
                "core::cmp::PartialEq",
                Ty.apply
                  (Ty.path "alloc::vec::Vec")
                  []
                  [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                [
                  Ty.apply
                    (Ty.path "alloc::vec::Vec")
                    []
                    [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ]
                ],
                "eq",
                []
              |),
              [
                M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "alloc::string::FromUtf8Error",
                  "bytes"
                |);
                M.SubPointer.get_struct_record_field (|
                  M.read (| other |),
                  "alloc::string::FromUtf8Error",
                  "bytes"
                |)
              ]
            |),
            ltac:(M.monadic
              (M.call_closure (|
                M.get_trait_method (|
                  "core::cmp::PartialEq",
                  Ty.path "core::str::error::Utf8Error",
                  [ Ty.path "core::str::error::Utf8Error" ],
                  "eq",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "alloc::string::FromUtf8Error",
                    "error"
                  |);
                  M.SubPointer.get_struct_record_field (|
                    M.read (| other |),
                    "alloc::string::FromUtf8Error",
                    "error"
                  |)
                ]
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("eq", InstanceField.Method eq) ].
  End Impl_core_cmp_PartialEq_for_alloc_string_FromUtf8Error.
  
  Module Impl_core_cmp_Eq_for_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    (* Eq *)
    Definition assert_receiver_is_total_eq
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.match_operator (|
              Value.DeclaredButUndefined,
              [
                fun γ =>
                  ltac:(M.monadic
                    (M.match_operator (|
                      Value.DeclaredButUndefined,
                      [ fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |))) ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::Eq"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [ ("assert_receiver_is_total_eq", InstanceField.Method assert_receiver_is_total_eq) ].
  End Impl_core_cmp_Eq_for_alloc_string_FromUtf8Error.
  
  Module Impl_core_clone_Clone_for_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    (* Clone *)
    Definition clone (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          Value.StructRecord
            "alloc::string::FromUtf8Error"
            [
              ("bytes",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::FromUtf8Error",
                      "bytes"
                    |)
                  ]
                |));
              ("error",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.path "core::str::error::Utf8Error",
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::FromUtf8Error",
                      "error"
                    |)
                  ]
                |))
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::clone::Clone"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("clone", InstanceField.Method clone) ].
  End Impl_core_clone_Clone_for_alloc_string_FromUtf8Error.
  
  (* StructTuple
    {
      name := "FromUtf16Error";
      const_params := [];
      ty_params := [];
      fields := [ Ty.tuple [] ];
    } *)
  
  Module Impl_core_fmt_Debug_for_alloc_string_FromUtf16Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf16Error".
    
    (* Debug *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      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::Formatter",
              "debug_tuple_field1_finish",
              []
            |),
            [
              M.read (| f |);
              M.read (| Value.String "FromUtf16Error" |);
              M.alloc (|
                M.SubPointer.get_struct_tuple_field (|
                  M.read (| self |),
                  "alloc::string::FromUtf16Error",
                  0
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_alloc_string_FromUtf16Error.
  
  Module Impl_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        pub const fn new() -> String {
            String { vec: Vec::new() }
        }
    *)
    Definition new (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [] =>
        ltac:(M.monadic
          (Value.StructRecord
            "alloc::string::String"
            [
              ("vec",
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "new",
                    []
                  |),
                  []
                |))
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_new : M.IsAssociatedFunction Self "new" new.
    
    (*
        pub fn with_capacity(capacity: usize) -> String {
            String { vec: Vec::with_capacity(capacity) }
        }
    *)
    Definition with_capacity (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ capacity ] =>
        ltac:(M.monadic
          (let capacity := M.alloc (| capacity |) in
          Value.StructRecord
            "alloc::string::String"
            [
              ("vec",
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "with_capacity",
                    []
                  |),
                  [ M.read (| capacity |) ]
                |))
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_with_capacity :
      M.IsAssociatedFunction Self "with_capacity" with_capacity.
    
    (*
        pub fn try_with_capacity(capacity: usize) -> Result<String, TryReserveError> {
            Ok(String { vec: Vec::try_with_capacity(capacity)? })
        }
    *)
    Definition try_with_capacity (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ capacity ] =>
        ltac:(M.monadic
          (let capacity := M.alloc (| capacity |) in
          M.catch_return (|
            ltac:(M.monadic
              (Value.StructTuple
                "core::result::Result::Ok"
                [
                  Value.StructRecord
                    "alloc::string::String"
                    [
                      ("vec",
                        M.read (|
                          M.match_operator (|
                            M.alloc (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::try_trait::Try",
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "alloc::vec::Vec")
                                        []
                                        [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ];
                                      Ty.path "alloc::collections::TryReserveError"
                                    ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "alloc::vec::Vec")
                                        []
                                        [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                                      "try_with_capacity",
                                      []
                                    |),
                                    [ M.read (| capacity |) ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Break",
                                      0
                                    |) in
                                  let residual := M.copy (| γ0_0 |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.read (|
                                        M.return_ (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::try_trait::FromResidual",
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "alloc::string::String";
                                                  Ty.path "alloc::collections::TryReserveError"
                                                ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path "alloc::collections::TryReserveError"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |)
                        |))
                    ]
                ]))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_try_with_capacity :
      M.IsAssociatedFunction Self "try_with_capacity" try_with_capacity.
    
    (*
        pub fn from_utf8(vec: Vec<u8>) -> Result<String, FromUtf8Error> {
            match str::from_utf8(&vec) {
                Ok(..) => Ok(String { vec }),
                Err(e) => Err(FromUtf8Error { bytes: vec, error: e }),
            }
        }
    *)
    Definition from_utf8 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ vec ] =>
        ltac:(M.monadic
          (let vec := M.alloc (| vec |) in
          M.read (|
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::str::converts::from_utf8", [] |),
                  [
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::deref::Deref",
                        Ty.apply
                          (Ty.path "alloc::vec::Vec")
                          []
                          [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                        [],
                        "deref",
                        []
                      |),
                      [ vec ]
                    |)
                  ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_struct_tuple (| γ, "core::result::Result::Ok" |) in
                    M.alloc (|
                      Value.StructTuple
                        "core::result::Result::Ok"
                        [ Value.StructRecord "alloc::string::String" [ ("vec", M.read (| vec |)) ] ]
                    |)));
                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::result::Result::Err"
                        [
                          Value.StructRecord
                            "alloc::string::FromUtf8Error"
                            [ ("bytes", M.read (| vec |)); ("error", M.read (| e |)) ]
                        ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf8 : M.IsAssociatedFunction Self "from_utf8" from_utf8.
    
    (*
        pub fn from_utf8_lossy(v: &[u8]) -> Cow<'_, str> {
            let mut iter = v.utf8_chunks();
    
            let first_valid = if let Some(chunk) = iter.next() {
                let valid = chunk.valid();
                if chunk.invalid().is_empty() {
                    debug_assert_eq!(valid.len(), v.len());
                    return Cow::Borrowed(valid);
                }
                valid
            } else {
                return Cow::Borrowed("");
            };
    
            const REPLACEMENT: &str = "\u{FFFD}";
    
            let mut res = String::with_capacity(v.len());
            res.push_str(first_valid);
            res.push_str(REPLACEMENT);
    
            for chunk in iter {
                res.push_str(chunk.valid());
                if !chunk.invalid().is_empty() {
                    res.push_str(REPLACEMENT);
                }
            }
    
            Cow::Owned(res)
        }
    *)
    Definition from_utf8_lossy (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ iter :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                        "utf8_chunks",
                        []
                      |),
                      [ M.read (| v |) ]
                    |)
                  |) in
                let~ first_valid :=
                  M.copy (|
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::iter::traits::iterator::Iterator",
                                    Ty.path "core::str::lossy::Utf8Chunks",
                                    [],
                                    "next",
                                    []
                                  |),
                                  [ iter ]
                                |)
                              |) in
                            let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::option::Option::Some",
                                0
                              |) in
                            let chunk := M.copy (| γ0_0 |) in
                            let~ valid :=
                              M.alloc (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "core::str::lossy::Utf8Chunk",
                                    "valid",
                                    []
                                  |),
                                  [ chunk ]
                                |)
                              |) in
                            let~ _ :=
                              M.match_operator (|
                                M.alloc (| Value.Tuple [] |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ :=
                                        M.use
                                          (M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                                "is_empty",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path "core::str::lossy::Utf8Chunk",
                                                    "invalid",
                                                    []
                                                  |),
                                                  [ chunk ]
                                                |)
                                              ]
                                            |)
                                          |)) in
                                      let _ :=
                                        M.is_constant_or_break_match (|
                                          M.read (| γ |),
                                          Value.Bool true
                                        |) in
                                      M.alloc (|
                                        M.never_to_any (|
                                          M.read (|
                                            let~ _ :=
                                              M.match_operator (|
                                                M.alloc (| Value.Tuple [] |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ :=
                                                        M.use (M.alloc (| Value.Bool true |)) in
                                                      let _ :=
                                                        M.is_constant_or_break_match (|
                                                          M.read (| γ |),
                                                          Value.Bool true
                                                        |) in
                                                      let~ _ :=
                                                        M.match_operator (|
                                                          M.alloc (|
                                                            Value.Tuple
                                                              [
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.path "str",
                                                                      "len",
                                                                      []
                                                                    |),
                                                                    [ M.read (| valid |) ]
                                                                  |)
                                                                |);
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.apply
                                                                        (Ty.path "slice")
                                                                        []
                                                                        [ Ty.path "u8" ],
                                                                      "len",
                                                                      []
                                                                    |),
                                                                    [ M.read (| v |) ]
                                                                  |)
                                                                |)
                                                              ]
                                                          |),
                                                          [
                                                            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 left_val := M.copy (| γ0_0 |) in
                                                                let right_val :=
                                                                  M.copy (| γ0_1 |) in
                                                                M.match_operator (|
                                                                  M.alloc (| Value.Tuple [] |),
                                                                  [
                                                                    fun γ =>
                                                                      ltac:(M.monadic
                                                                        (let γ :=
                                                                          M.use
                                                                            (M.alloc (|
                                                                              UnOp.not (|
                                                                                BinOp.eq (|
                                                                                  M.read (|
                                                                                    M.read (|
                                                                                      left_val
                                                                                    |)
                                                                                  |),
                                                                                  M.read (|
                                                                                    M.read (|
                                                                                      right_val
                                                                                    |)
                                                                                  |)
                                                                                |)
                                                                              |)
                                                                            |)) in
                                                                        let _ :=
                                                                          M.is_constant_or_break_match (|
                                                                            M.read (| γ |),
                                                                            Value.Bool true
                                                                          |) in
                                                                        M.alloc (|
                                                                          M.never_to_any (|
                                                                            M.read (|
                                                                              let~ kind :=
                                                                                M.alloc (|
                                                                                  Value.StructTuple
                                                                                    "core::panicking::AssertKind::Eq"
                                                                                    []
                                                                                |) in
                                                                              M.alloc (|
                                                                                M.call_closure (|
                                                                                  M.get_function (|
                                                                                    "core::panicking::assert_failed",
                                                                                    [
                                                                                      Ty.path
                                                                                        "usize";
                                                                                      Ty.path
                                                                                        "usize"
                                                                                    ]
                                                                                  |),
                                                                                  [
                                                                                    M.read (|
                                                                                      kind
                                                                                    |);
                                                                                    M.read (|
                                                                                      left_val
                                                                                    |);
                                                                                    M.read (|
                                                                                      right_val
                                                                                    |);
                                                                                    Value.StructTuple
                                                                                      "core::option::Option::None"
                                                                                      []
                                                                                  ]
                                                                                |)
                                                                              |)
                                                                            |)
                                                                          |)
                                                                        |)));
                                                                    fun γ =>
                                                                      ltac:(M.monadic
                                                                        (M.alloc (|
                                                                          Value.Tuple []
                                                                        |)))
                                                                  ]
                                                                |)))
                                                          ]
                                                        |) in
                                                      M.alloc (| Value.Tuple [] |)));
                                                  fun γ =>
                                                    ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                                ]
                                              |) in
                                            M.return_ (|
                                              Value.StructTuple
                                                "alloc::borrow::Cow::Borrowed"
                                                [ M.read (| valid |) ]
                                            |)
                                          |)
                                        |)
                                      |)));
                                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                ]
                              |) in
                            valid));
                        fun γ =>
                          ltac:(M.monadic
                            (M.alloc (|
                              M.never_to_any (|
                                M.read (|
                                  M.return_ (|
                                    Value.StructTuple
                                      "alloc::borrow::Cow::Borrowed"
                                      [ M.read (| Value.String "" |) ]
                                  |)
                                |)
                              |)
                            |)))
                      ]
                    |)
                  |) in
                let~ res :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "alloc::string::String",
                        "with_capacity",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                            "len",
                            []
                          |),
                          [ M.read (| v |) ]
                        |)
                      ]
                    |)
                  |) in
                let~ _ :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "alloc::string::String",
                        "push_str",
                        []
                      |),
                      [ res; M.read (| first_valid |) ]
                    |)
                  |) in
                let~ _ :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "alloc::string::String",
                        "push_str",
                        []
                      |),
                      [
                        res;
                        M.read (|
                          M.get_constant (| "alloc::string::from_utf8_lossy::REPLACEMENT" |)
                        |)
                      ]
                    |)
                  |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.path "core::str::lossy::Utf8Chunks",
                            [],
                            "into_iter",
                            []
                          |),
                          [ M.read (| iter |) ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.path "core::str::lossy::Utf8Chunks",
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let chunk := M.copy (| γ0_0 |) in
                                          let~ _ :=
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "alloc::string::String",
                                                  "push_str",
                                                  []
                                                |),
                                                [
                                                  res;
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path "core::str::lossy::Utf8Chunk",
                                                      "valid",
                                                      []
                                                    |),
                                                    [ chunk ]
                                                  |)
                                                ]
                                              |)
                                            |) in
                                          M.match_operator (|
                                            M.alloc (| Value.Tuple [] |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ :=
                                                    M.use
                                                      (M.alloc (|
                                                        UnOp.not (|
                                                          M.call_closure (|
                                                            M.get_associated_function (|
                                                              Ty.apply
                                                                (Ty.path "slice")
                                                                []
                                                                [ Ty.path "u8" ],
                                                              "is_empty",
                                                              []
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path
                                                                    "core::str::lossy::Utf8Chunk",
                                                                  "invalid",
                                                                  []
                                                                |),
                                                                [ chunk ]
                                                              |)
                                                            ]
                                                          |)
                                                        |)
                                                      |)) in
                                                  let _ :=
                                                    M.is_constant_or_break_match (|
                                                      M.read (| γ |),
                                                      Value.Bool true
                                                    |) in
                                                  let~ _ :=
                                                    M.alloc (|
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.path "alloc::string::String",
                                                          "push_str",
                                                          []
                                                        |),
                                                        [
                                                          res;
                                                          M.read (|
                                                            M.get_constant (|
                                                              "alloc::string::from_utf8_lossy::REPLACEMENT"
                                                            |)
                                                          |)
                                                        ]
                                                      |)
                                                    |) in
                                                  M.alloc (| Value.Tuple [] |)));
                                              fun γ =>
                                                ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                M.alloc (| Value.StructTuple "alloc::borrow::Cow::Owned" [ M.read (| res |) ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf8_lossy :
      M.IsAssociatedFunction Self "from_utf8_lossy" from_utf8_lossy.
    
    (*
        pub fn from_utf8_lossy_owned(v: Vec<u8>) -> String {
            if let Cow::Owned(string) = String::from_utf8_lossy(&v) {
                string
            } else {
                // SAFETY: `String::from_utf8_lossy`'s contract ensures that if
                // it returns a `Cow::Borrowed`, it is a valid UTF-8 string.
                // Otherwise, it returns a new allocation of an owned `String`, with
                // replacement characters for invalid sequences, which is returned
                // above.
                unsafe { String::from_utf8_unchecked(v) }
            }
        }
    *)
    Definition from_utf8_lossy_owned (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.read (|
            M.match_operator (|
              M.alloc (| Value.Tuple [] |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "alloc::string::String",
                            "from_utf8_lossy",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::deref::Deref",
                                Ty.apply
                                  (Ty.path "alloc::vec::Vec")
                                  []
                                  [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                                [],
                                "deref",
                                []
                              |),
                              [ v ]
                            |)
                          ]
                        |)
                      |) in
                    let γ0_0 :=
                      M.SubPointer.get_struct_tuple_field (| γ, "alloc::borrow::Cow::Owned", 0 |) in
                    let string := M.copy (| γ0_0 |) in
                    string));
                fun γ =>
                  ltac:(M.monadic
                    (M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "alloc::string::String",
                          "from_utf8_unchecked",
                          []
                        |),
                        [ M.read (| v |) ]
                      |)
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf8_lossy_owned :
      M.IsAssociatedFunction Self "from_utf8_lossy_owned" from_utf8_lossy_owned.
    
    (*
        pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
            // This isn't done via collect::<Result<_, _>>() for performance reasons.
            // FIXME: the function can be simplified again when #48994 is closed.
            let mut ret = String::with_capacity(v.len());
            for c in char::decode_utf16(v.iter().cloned()) {
                if let Ok(c) = c {
                    ret.push(c);
                } else {
                    return Err(FromUtf16Error(()));
                }
            }
            Ok(ret)
        }
    *)
    Definition from_utf16 (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ ret :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "alloc::string::String",
                        "with_capacity",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u16" ],
                            "len",
                            []
                          |),
                          [ M.read (| v |) ]
                        |)
                      ]
                    |)
                  |) in
                let~ _ :=
                  M.use
                    (M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            Ty.apply
                              (Ty.path "core::char::decode::DecodeUtf16")
                              []
                              [
                                Ty.apply
                                  (Ty.path "core::iter::adapters::cloned::Cloned")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "core::slice::iter::Iter")
                                      []
                                      [ Ty.path "u16" ]
                                  ]
                              ],
                            [],
                            "into_iter",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "char",
                                "decode_utf16",
                                [
                                  Ty.apply
                                    (Ty.path "core::iter::adapters::cloned::Cloned")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "core::slice::iter::Iter")
                                        []
                                        [ Ty.path "u16" ]
                                    ]
                                ]
                              |),
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::iter::traits::iterator::Iterator",
                                    Ty.apply
                                      (Ty.path "core::slice::iter::Iter")
                                      []
                                      [ Ty.path "u16" ],
                                    [],
                                    "cloned",
                                    [ Ty.path "u16" ]
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply (Ty.path "slice") [] [ Ty.path "u16" ],
                                        "iter",
                                        []
                                      |),
                                      [ M.read (| v |) ]
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let iter := M.copy (| γ |) in
                            M.loop (|
                              ltac:(M.monadic
                                (let~ _ :=
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::char::decode::DecodeUtf16")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::iter::adapters::cloned::Cloned")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::slice::iter::Iter")
                                                    []
                                                    [ Ty.path "u16" ]
                                                ]
                                            ],
                                          [],
                                          "next",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let _ :=
                                            M.is_struct_tuple (|
                                              γ,
                                              "core::option::Option::None"
                                            |) in
                                          M.alloc (|
                                            M.never_to_any (| M.read (| M.break (||) |) |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::option::Option::Some",
                                              0
                                            |) in
                                          let c := M.copy (| γ0_0 |) in
                                          M.match_operator (|
                                            M.alloc (| Value.Tuple [] |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ := c in
                                                  let γ0_0 :=
                                                    M.SubPointer.get_struct_tuple_field (|
                                                      γ,
                                                      "core::result::Result::Ok",
                                                      0
                                                    |) in
                                                  let c := M.copy (| γ0_0 |) in
                                                  let~ _ :=
                                                    M.alloc (|
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.path "alloc::string::String",
                                                          "push",
                                                          []
                                                        |),
                                                        [ ret; M.read (| c |) ]
                                                      |)
                                                    |) in
                                                  M.alloc (| Value.Tuple [] |)));
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (M.alloc (|
                                                    M.never_to_any (|
                                                      M.read (|
                                                        M.return_ (|
                                                          Value.StructTuple
                                                            "core::result::Result::Err"
                                                            [
                                                              Value.StructTuple
                                                                "alloc::string::FromUtf16Error"
                                                                [ Value.Tuple [] ]
                                                            ]
                                                        |)
                                                      |)
                                                    |)
                                                  |)))
                                            ]
                                          |)))
                                    ]
                                  |) in
                                M.alloc (| Value.Tuple [] |)))
                            |)))
                      ]
                    |)) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ M.read (| ret |) ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf16 : M.IsAssociatedFunction Self "from_utf16" from_utf16.
    
    (*
        pub fn from_utf16_lossy(v: &[u16]) -> String {
            char::decode_utf16(v.iter().cloned())
                .map(|r| r.unwrap_or(char::REPLACEMENT_CHARACTER))
                .collect()
        }
    *)
    Definition from_utf16_lossy (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::iter::traits::iterator::Iterator",
              Ty.apply
                (Ty.path "core::iter::adapters::map::Map")
                []
                [
                  Ty.apply
                    (Ty.path "core::char::decode::DecodeUtf16")
                    []
                    [
                      Ty.apply
                        (Ty.path "core::iter::adapters::cloned::Cloned")
                        []
                        [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u16" ] ]
                    ];
                  Ty.function
                    [
                      Ty.tuple
                        [
                          Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [ Ty.path "char"; Ty.path "core::char::decode::DecodeUtf16Error" ]
                        ]
                    ]
                    (Ty.path "char")
                ],
              [],
              "collect",
              [ Ty.path "alloc::string::String" ]
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::iterator::Iterator",
                  Ty.apply
                    (Ty.path "core::char::decode::DecodeUtf16")
                    []
                    [
                      Ty.apply
                        (Ty.path "core::iter::adapters::cloned::Cloned")
                        []
                        [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u16" ] ]
                    ],
                  [],
                  "map",
                  [
                    Ty.path "char";
                    Ty.function
                      [
                        Ty.tuple
                          [
                            Ty.apply
                              (Ty.path "core::result::Result")
                              []
                              [ Ty.path "char"; Ty.path "core::char::decode::DecodeUtf16Error" ]
                          ]
                      ]
                      (Ty.path "char")
                  ]
                |),
                [
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "char",
                      "decode_utf16",
                      [
                        Ty.apply
                          (Ty.path "core::iter::adapters::cloned::Cloned")
                          []
                          [ Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u16" ] ]
                      ]
                    |),
                    [
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::iterator::Iterator",
                          Ty.apply (Ty.path "core::slice::iter::Iter") [] [ Ty.path "u16" ],
                          [],
                          "cloned",
                          [ Ty.path "u16" ]
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply (Ty.path "slice") [] [ Ty.path "u16" ],
                              "iter",
                              []
                            |),
                            [ M.read (| v |) ]
                          |)
                        ]
                      |)
                    ]
                  |);
                  M.closure
                    (fun γ =>
                      ltac:(M.monadic
                        match γ with
                        | [ α0 ] =>
                          ltac:(M.monadic
                            (M.match_operator (|
                              M.alloc (| α0 |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let r := M.copy (| γ |) in
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "char";
                                            Ty.path "core::char::decode::DecodeUtf16Error"
                                          ],
                                        "unwrap_or",
                                        []
                                      |),
                                      [
                                        M.read (| r |);
                                        M.read (|
                                          M.get_constant (|
                                            "core::char::methods::REPLACEMENT_CHARACTER"
                                          |)
                                        |)
                                      ]
                                    |)))
                              ]
                            |)))
                        | _ => M.impossible "wrong number of arguments"
                        end))
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf16_lossy :
      M.IsAssociatedFunction Self "from_utf16_lossy" from_utf16_lossy.
    
    (*
        pub fn from_utf16le(v: &[u8]) -> Result<String, FromUtf16Error> {
            if v.len() % 2 != 0 {
                return Err(FromUtf16Error(()));
            }
            match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) {
                (true, ([], v, [])) => Self::from_utf16(v),
                _ => char::decode_utf16(v.array_chunks::<2>().copied().map(u16::from_le_bytes))
                    .collect::<Result<_, _>>()
                    .map_err(|_| FromUtf16Error(())),
            }
        }
    *)
    Definition from_utf16le (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.ne (|
                                  BinOp.Wrap.rem (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                        "len",
                                        []
                                      |),
                                      [ M.read (| v |) ]
                                    |),
                                    Value.Integer IntegerKind.Usize 2
                                  |),
                                  Value.Integer IntegerKind.Usize 0
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.read (|
                                M.return_ (|
                                  Value.StructTuple
                                    "core::result::Result::Err"
                                    [
                                      Value.StructTuple
                                        "alloc::string::FromUtf16Error"
                                        [ Value.Tuple [] ]
                                    ]
                                |)
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.match_operator (|
                  M.alloc (|
                    Value.Tuple
                      [
                        Value.Bool true;
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                            "align_to",
                            [ Ty.path "u16" ]
                          |),
                          [ M.read (| v |) ]
                        |)
                      ]
                  |),
                  [
                    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 _ :=
                          M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Bool true |) in
                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_1, 0 |) in
                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_1, 1 |) in
                        let γ1_2 := M.SubPointer.get_tuple_field (| γ0_1, 2 |) in
                        let γ1_0 := M.read (| γ1_0 |) in
                        let v := M.copy (| γ1_1 |) in
                        let γ1_2 := M.read (| γ1_2 |) in
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "from_utf16",
                              []
                            |),
                            [ M.read (| v |) ]
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::result::Result")
                                []
                                [
                                  Ty.path "alloc::string::String";
                                  Ty.path "core::char::decode::DecodeUtf16Error"
                                ],
                              "map_err",
                              [
                                Ty.path "alloc::string::FromUtf16Error";
                                Ty.function
                                  [ Ty.tuple [ Ty.path "core::char::decode::DecodeUtf16Error" ] ]
                                  (Ty.path "alloc::string::FromUtf16Error")
                              ]
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::iterator::Iterator",
                                  Ty.apply
                                    (Ty.path "core::char::decode::DecodeUtf16")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::map::Map")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::copied::Copied")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::slice::iter::ArrayChunks")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ]
                                            ];
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [
                                                  M.unevaluated_const
                                                    (M.get_constant (|
                                                      "core::num::from_le_bytes_discriminant"
                                                    |))
                                                ]
                                                [ Ty.path "u8" ]
                                            ]
                                            (Ty.path "u16")
                                        ]
                                    ],
                                  [],
                                  "collect",
                                  [
                                    Ty.apply
                                      (Ty.path "core::result::Result")
                                      []
                                      [
                                        Ty.path "alloc::string::String";
                                        Ty.path "core::char::decode::DecodeUtf16Error"
                                      ]
                                  ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "char",
                                      "decode_utf16",
                                      [
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::map::Map")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::iter::adapters::copied::Copied")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ];
                                            Ty.function
                                              [
                                                Ty.apply
                                                  (Ty.path "array")
                                                  [
                                                    M.unevaluated_const
                                                      (M.get_constant (|
                                                        "core::num::from_le_bytes_discriminant"
                                                      |))
                                                  ]
                                                  [ Ty.path "u8" ]
                                              ]
                                              (Ty.path "u16")
                                          ]
                                      ]
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::copied::Copied")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::slice::iter::ArrayChunks")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ]
                                            ],
                                          [],
                                          "map",
                                          [
                                            Ty.path "u16";
                                            Ty.function
                                              [
                                                Ty.apply
                                                  (Ty.path "array")
                                                  [
                                                    M.unevaluated_const
                                                      (M.get_constant (|
                                                        "core::num::from_le_bytes_discriminant"
                                                      |))
                                                  ]
                                                  [ Ty.path "u8" ]
                                              ]
                                              (Ty.path "u16")
                                          ]
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::iterator::Iterator",
                                              Ty.apply
                                                (Ty.path "core::slice::iter::ArrayChunks")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ],
                                              [],
                                              "copied",
                                              [
                                                Ty.apply
                                                  (Ty.path "array")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                                  "array_chunks",
                                                  []
                                                |),
                                                [ M.read (| v |) ]
                                              |)
                                            ]
                                          |);
                                          M.get_associated_function (|
                                            Ty.path "u16",
                                            "from_le_bytes",
                                            []
                                          |)
                                        ]
                                      |)
                                    ]
                                  |)
                                ]
                              |);
                              M.closure
                                (fun γ =>
                                  ltac:(M.monadic
                                    match γ with
                                    | [ α0 ] =>
                                      ltac:(M.monadic
                                        (M.match_operator (|
                                          M.alloc (| α0 |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (Value.StructTuple
                                                  "alloc::string::FromUtf16Error"
                                                  [ Value.Tuple [] ]))
                                          ]
                                        |)))
                                    | _ => M.impossible "wrong number of arguments"
                                    end))
                            ]
                          |)
                        |)))
                  ]
                |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf16le : M.IsAssociatedFunction Self "from_utf16le" from_utf16le.
    
    (*
        pub fn from_utf16le_lossy(v: &[u8]) -> String {
            match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) {
                (true, ([], v, [])) => Self::from_utf16_lossy(v),
                (true, ([], v, [_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}",
                _ => {
                    let mut iter = v.array_chunks::<2>();
                    let string = char::decode_utf16(iter.by_ref().copied().map(u16::from_le_bytes))
                        .map(|r| r.unwrap_or(char::REPLACEMENT_CHARACTER))
                        .collect();
                    if iter.remainder().is_empty() { string } else { string + "\u{FFFD}" }
                }
            }
        }
    *)
    Definition from_utf16le_lossy (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.read (|
            M.match_operator (|
              M.alloc (|
                Value.Tuple
                  [
                    Value.Bool true;
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                        "align_to",
                        [ Ty.path "u16" ]
                      |),
                      [ M.read (| v |) ]
                    |)
                  ]
              |),
              [
                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 _ :=
                      M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Bool true |) in
                    let γ1_0 := M.SubPointer.get_tuple_field (| γ0_1, 0 |) in
                    let γ1_1 := M.SubPointer.get_tuple_field (| γ0_1, 1 |) in
                    let γ1_2 := M.SubPointer.get_tuple_field (| γ0_1, 2 |) in
                    let γ1_0 := M.read (| γ1_0 |) in
                    let v := M.copy (| γ1_1 |) in
                    let γ1_2 := M.read (| γ1_2 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "alloc::string::String",
                          "from_utf16_lossy",
                          []
                        |),
                        [ M.read (| v |) ]
                      |)
                    |)));
                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 _ :=
                      M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Bool true |) in
                    let γ1_0 := M.SubPointer.get_tuple_field (| γ0_1, 0 |) in
                    let γ1_1 := M.SubPointer.get_tuple_field (| γ0_1, 1 |) in
                    let γ1_2 := M.SubPointer.get_tuple_field (| γ0_1, 2 |) in
                    let γ1_0 := M.read (| γ1_0 |) in
                    let v := M.copy (| γ1_1 |) in
                    let γ1_2 := M.read (| γ1_2 |) in
                    let γ3_0 := M.SubPointer.get_slice_index (| γ1_2, 0 |) in
                    let _remainder := M.alloc (| γ3_0 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::arith::Add",
                          Ty.path "alloc::string::String",
                          [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
                          "add",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "from_utf16_lossy",
                              []
                            |),
                            [ M.read (| v |) ]
                          |);
                          M.read (| Value.String (String.String "253" "") |)
                        ]
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let~ iter :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                            "array_chunks",
                            []
                          |),
                          [ M.read (| v |) ]
                        |)
                      |) in
                    let~ string :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply
                              (Ty.path "core::iter::adapters::map::Map")
                              []
                              [
                                Ty.apply
                                  (Ty.path "core::char::decode::DecodeUtf16")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::map::Map")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::copied::Copied")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                          ];
                                        Ty.function
                                          [
                                            Ty.apply
                                              (Ty.path "array")
                                              [
                                                M.unevaluated_const
                                                  (M.get_constant (|
                                                    "core::num::from_le_bytes_discriminant"
                                                  |))
                                              ]
                                              [ Ty.path "u8" ]
                                          ]
                                          (Ty.path "u16")
                                      ]
                                  ];
                                Ty.function
                                  [
                                    Ty.tuple
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "char";
                                            Ty.path "core::char::decode::DecodeUtf16Error"
                                          ]
                                      ]
                                  ]
                                  (Ty.path "char")
                              ],
                            [],
                            "collect",
                            [ Ty.path "alloc::string::String" ]
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::iterator::Iterator",
                                Ty.apply
                                  (Ty.path "core::char::decode::DecodeUtf16")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::map::Map")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::copied::Copied")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                          ];
                                        Ty.function
                                          [
                                            Ty.apply
                                              (Ty.path "array")
                                              [
                                                M.unevaluated_const
                                                  (M.get_constant (|
                                                    "core::num::from_le_bytes_discriminant"
                                                  |))
                                              ]
                                              [ Ty.path "u8" ]
                                          ]
                                          (Ty.path "u16")
                                      ]
                                  ],
                                [],
                                "map",
                                [
                                  Ty.path "char";
                                  Ty.function
                                    [
                                      Ty.tuple
                                        [
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.path "char";
                                              Ty.path "core::char::decode::DecodeUtf16Error"
                                            ]
                                        ]
                                    ]
                                    (Ty.path "char")
                                ]
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "char",
                                    "decode_utf16",
                                    [
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::map::Map")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::copied::Copied")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::slice::iter::ArrayChunks")
                                                    [ Value.Integer IntegerKind.Usize 2 ]
                                                    [ Ty.path "u8" ]
                                                ]
                                            ];
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [
                                                  M.unevaluated_const
                                                    (M.get_constant (|
                                                      "core::num::from_le_bytes_discriminant"
                                                    |))
                                                ]
                                                [ Ty.path "u8" ]
                                            ]
                                            (Ty.path "u16")
                                        ]
                                    ]
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::copied::Copied")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                          ],
                                        [],
                                        "map",
                                        [
                                          Ty.path "u16";
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [
                                                  M.unevaluated_const
                                                    (M.get_constant (|
                                                      "core::num::from_le_bytes_discriminant"
                                                    |))
                                                ]
                                                [ Ty.path "u8" ]
                                            ]
                                            (Ty.path "u16")
                                        ]
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::iter::traits::iterator::Iterator",
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ],
                                            [],
                                            "copied",
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ]
                                            ]
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::iter::traits::iterator::Iterator",
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ],
                                                [],
                                                "by_ref",
                                                []
                                              |),
                                              [ iter ]
                                            |)
                                          ]
                                        |);
                                        M.get_associated_function (|
                                          Ty.path "u16",
                                          "from_le_bytes",
                                          []
                                        |)
                                      ]
                                    |)
                                  ]
                                |);
                                M.closure
                                  (fun γ =>
                                    ltac:(M.monadic
                                      match γ with
                                      | [ α0 ] =>
                                        ltac:(M.monadic
                                          (M.match_operator (|
                                            M.alloc (| α0 |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let r := M.copy (| γ |) in
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "char";
                                                          Ty.path
                                                            "core::char::decode::DecodeUtf16Error"
                                                        ],
                                                      "unwrap_or",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| r |);
                                                      M.read (|
                                                        M.get_constant (|
                                                          "core::char::methods::REPLACEMENT_CHARACTER"
                                                        |)
                                                      |)
                                                    ]
                                                  |)))
                                            ]
                                          |)))
                                      | _ => M.impossible "wrong number of arguments"
                                      end))
                              ]
                            |)
                          ]
                        |)
                      |) in
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                      "is_empty",
                                      []
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::slice::iter::ArrayChunks")
                                            [ Value.Integer IntegerKind.Usize 2 ]
                                            [ Ty.path "u8" ],
                                          "remainder",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    ]
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            string));
                        fun γ =>
                          ltac:(M.monadic
                            (M.alloc (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::arith::Add",
                                  Ty.path "alloc::string::String",
                                  [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
                                  "add",
                                  []
                                |),
                                [
                                  M.read (| string |);
                                  M.read (| Value.String (String.String "253" "") |)
                                ]
                              |)
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf16le_lossy :
      M.IsAssociatedFunction Self "from_utf16le_lossy" from_utf16le_lossy.
    
    (*
        pub fn from_utf16be(v: &[u8]) -> Result<String, FromUtf16Error> {
            if v.len() % 2 != 0 {
                return Err(FromUtf16Error(()));
            }
            match (cfg!(target_endian = "big"), unsafe { v.align_to::<u16>() }) {
                (true, ([], v, [])) => Self::from_utf16(v),
                _ => char::decode_utf16(v.array_chunks::<2>().copied().map(u16::from_be_bytes))
                    .collect::<Result<_, _>>()
                    .map_err(|_| FromUtf16Error(())),
            }
        }
    *)
    Definition from_utf16be (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ _ :=
                  M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.ne (|
                                  BinOp.Wrap.rem (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                        "len",
                                        []
                                      |),
                                      [ M.read (| v |) ]
                                    |),
                                    Value.Integer IntegerKind.Usize 2
                                  |),
                                  Value.Integer IntegerKind.Usize 0
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.read (|
                                M.return_ (|
                                  Value.StructTuple
                                    "core::result::Result::Err"
                                    [
                                      Value.StructTuple
                                        "alloc::string::FromUtf16Error"
                                        [ Value.Tuple [] ]
                                    ]
                                |)
                              |)
                            |)
                          |)));
                      fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                    ]
                  |) in
                M.match_operator (|
                  M.alloc (|
                    Value.Tuple
                      [
                        Value.Bool false;
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                            "align_to",
                            [ Ty.path "u16" ]
                          |),
                          [ M.read (| v |) ]
                        |)
                      ]
                  |),
                  [
                    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 _ :=
                          M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Bool true |) in
                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_1, 0 |) in
                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_1, 1 |) in
                        let γ1_2 := M.SubPointer.get_tuple_field (| γ0_1, 2 |) in
                        let γ1_0 := M.read (| γ1_0 |) in
                        let v := M.copy (| γ1_1 |) in
                        let γ1_2 := M.read (| γ1_2 |) in
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "from_utf16",
                              []
                            |),
                            [ M.read (| v |) ]
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "core::result::Result")
                                []
                                [
                                  Ty.path "alloc::string::String";
                                  Ty.path "core::char::decode::DecodeUtf16Error"
                                ],
                              "map_err",
                              [
                                Ty.path "alloc::string::FromUtf16Error";
                                Ty.function
                                  [ Ty.tuple [ Ty.path "core::char::decode::DecodeUtf16Error" ] ]
                                  (Ty.path "alloc::string::FromUtf16Error")
                              ]
                            |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::iter::traits::iterator::Iterator",
                                  Ty.apply
                                    (Ty.path "core::char::decode::DecodeUtf16")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::map::Map")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::copied::Copied")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::slice::iter::ArrayChunks")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ]
                                            ];
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [
                                                  M.unevaluated_const
                                                    (M.get_constant (|
                                                      "core::num::from_be_bytes_discriminant"
                                                    |))
                                                ]
                                                [ Ty.path "u8" ]
                                            ]
                                            (Ty.path "u16")
                                        ]
                                    ],
                                  [],
                                  "collect",
                                  [
                                    Ty.apply
                                      (Ty.path "core::result::Result")
                                      []
                                      [
                                        Ty.path "alloc::string::String";
                                        Ty.path "core::char::decode::DecodeUtf16Error"
                                      ]
                                  ]
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "char",
                                      "decode_utf16",
                                      [
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::map::Map")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::iter::adapters::copied::Copied")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ];
                                            Ty.function
                                              [
                                                Ty.apply
                                                  (Ty.path "array")
                                                  [
                                                    M.unevaluated_const
                                                      (M.get_constant (|
                                                        "core::num::from_be_bytes_discriminant"
                                                      |))
                                                  ]
                                                  [ Ty.path "u8" ]
                                              ]
                                              (Ty.path "u16")
                                          ]
                                      ]
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::iter::traits::iterator::Iterator",
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::copied::Copied")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "core::slice::iter::ArrayChunks")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ]
                                            ],
                                          [],
                                          "map",
                                          [
                                            Ty.path "u16";
                                            Ty.function
                                              [
                                                Ty.apply
                                                  (Ty.path "array")
                                                  [
                                                    M.unevaluated_const
                                                      (M.get_constant (|
                                                        "core::num::from_be_bytes_discriminant"
                                                      |))
                                                  ]
                                                  [ Ty.path "u8" ]
                                              ]
                                              (Ty.path "u16")
                                          ]
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::iterator::Iterator",
                                              Ty.apply
                                                (Ty.path "core::slice::iter::ArrayChunks")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ],
                                              [],
                                              "copied",
                                              [
                                                Ty.apply
                                                  (Ty.path "array")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                                  "array_chunks",
                                                  []
                                                |),
                                                [ M.read (| v |) ]
                                              |)
                                            ]
                                          |);
                                          M.get_associated_function (|
                                            Ty.path "u16",
                                            "from_be_bytes",
                                            []
                                          |)
                                        ]
                                      |)
                                    ]
                                  |)
                                ]
                              |);
                              M.closure
                                (fun γ =>
                                  ltac:(M.monadic
                                    match γ with
                                    | [ α0 ] =>
                                      ltac:(M.monadic
                                        (M.match_operator (|
                                          M.alloc (| α0 |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (Value.StructTuple
                                                  "alloc::string::FromUtf16Error"
                                                  [ Value.Tuple [] ]))
                                          ]
                                        |)))
                                    | _ => M.impossible "wrong number of arguments"
                                    end))
                            ]
                          |)
                        |)))
                  ]
                |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf16be : M.IsAssociatedFunction Self "from_utf16be" from_utf16be.
    
    (*
        pub fn from_utf16be_lossy(v: &[u8]) -> String {
            match (cfg!(target_endian = "big"), unsafe { v.align_to::<u16>() }) {
                (true, ([], v, [])) => Self::from_utf16_lossy(v),
                (true, ([], v, [_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}",
                _ => {
                    let mut iter = v.array_chunks::<2>();
                    let string = char::decode_utf16(iter.by_ref().copied().map(u16::from_be_bytes))
                        .map(|r| r.unwrap_or(char::REPLACEMENT_CHARACTER))
                        .collect();
                    if iter.remainder().is_empty() { string } else { string + "\u{FFFD}" }
                }
            }
        }
    *)
    Definition from_utf16be_lossy (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ v ] =>
        ltac:(M.monadic
          (let v := M.alloc (| v |) in
          M.read (|
            M.match_operator (|
              M.alloc (|
                Value.Tuple
                  [
                    Value.Bool false;
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                        "align_to",
                        [ Ty.path "u16" ]
                      |),
                      [ M.read (| v |) ]
                    |)
                  ]
              |),
              [
                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 _ :=
                      M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Bool true |) in
                    let γ1_0 := M.SubPointer.get_tuple_field (| γ0_1, 0 |) in
                    let γ1_1 := M.SubPointer.get_tuple_field (| γ0_1, 1 |) in
                    let γ1_2 := M.SubPointer.get_tuple_field (| γ0_1, 2 |) in
                    let γ1_0 := M.read (| γ1_0 |) in
                    let v := M.copy (| γ1_1 |) in
                    let γ1_2 := M.read (| γ1_2 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "alloc::string::String",
                          "from_utf16_lossy",
                          []
                        |),
                        [ M.read (| v |) ]
                      |)
                    |)));
                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 _ :=
                      M.is_constant_or_break_match (| M.read (| γ0_0 |), Value.Bool true |) in
                    let γ1_0 := M.SubPointer.get_tuple_field (| γ0_1, 0 |) in
                    let γ1_1 := M.SubPointer.get_tuple_field (| γ0_1, 1 |) in
                    let γ1_2 := M.SubPointer.get_tuple_field (| γ0_1, 2 |) in
                    let γ1_0 := M.read (| γ1_0 |) in
                    let v := M.copy (| γ1_1 |) in
                    let γ1_2 := M.read (| γ1_2 |) in
                    let γ3_0 := M.SubPointer.get_slice_index (| γ1_2, 0 |) in
                    let _remainder := M.alloc (| γ3_0 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::arith::Add",
                          Ty.path "alloc::string::String",
                          [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
                          "add",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "from_utf16_lossy",
                              []
                            |),
                            [ M.read (| v |) ]
                          |);
                          M.read (| Value.String (String.String "253" "") |)
                        ]
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let~ iter :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                            "array_chunks",
                            []
                          |),
                          [ M.read (| v |) ]
                        |)
                      |) in
                    let~ string :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply
                              (Ty.path "core::iter::adapters::map::Map")
                              []
                              [
                                Ty.apply
                                  (Ty.path "core::char::decode::DecodeUtf16")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::map::Map")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::copied::Copied")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                          ];
                                        Ty.function
                                          [
                                            Ty.apply
                                              (Ty.path "array")
                                              [
                                                M.unevaluated_const
                                                  (M.get_constant (|
                                                    "core::num::from_be_bytes_discriminant"
                                                  |))
                                              ]
                                              [ Ty.path "u8" ]
                                          ]
                                          (Ty.path "u16")
                                      ]
                                  ];
                                Ty.function
                                  [
                                    Ty.tuple
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.path "char";
                                            Ty.path "core::char::decode::DecodeUtf16Error"
                                          ]
                                      ]
                                  ]
                                  (Ty.path "char")
                              ],
                            [],
                            "collect",
                            [ Ty.path "alloc::string::String" ]
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::iterator::Iterator",
                                Ty.apply
                                  (Ty.path "core::char::decode::DecodeUtf16")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "core::iter::adapters::map::Map")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::copied::Copied")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                          ];
                                        Ty.function
                                          [
                                            Ty.apply
                                              (Ty.path "array")
                                              [
                                                M.unevaluated_const
                                                  (M.get_constant (|
                                                    "core::num::from_be_bytes_discriminant"
                                                  |))
                                              ]
                                              [ Ty.path "u8" ]
                                          ]
                                          (Ty.path "u16")
                                      ]
                                  ],
                                [],
                                "map",
                                [
                                  Ty.path "char";
                                  Ty.function
                                    [
                                      Ty.tuple
                                        [
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.path "char";
                                              Ty.path "core::char::decode::DecodeUtf16Error"
                                            ]
                                        ]
                                    ]
                                    (Ty.path "char")
                                ]
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "char",
                                    "decode_utf16",
                                    [
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::map::Map")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::iter::adapters::copied::Copied")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "&mut")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::slice::iter::ArrayChunks")
                                                    [ Value.Integer IntegerKind.Usize 2 ]
                                                    [ Ty.path "u8" ]
                                                ]
                                            ];
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [
                                                  M.unevaluated_const
                                                    (M.get_constant (|
                                                      "core::num::from_be_bytes_discriminant"
                                                    |))
                                                ]
                                                [ Ty.path "u8" ]
                                            ]
                                            (Ty.path "u16")
                                        ]
                                    ]
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::copied::Copied")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ]
                                          ],
                                        [],
                                        "map",
                                        [
                                          Ty.path "u16";
                                          Ty.function
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [
                                                  M.unevaluated_const
                                                    (M.get_constant (|
                                                      "core::num::from_be_bytes_discriminant"
                                                    |))
                                                ]
                                                [ Ty.path "u8" ]
                                            ]
                                            (Ty.path "u16")
                                        ]
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::iter::traits::iterator::Iterator",
                                            Ty.apply
                                              (Ty.path "&mut")
                                              []
                                              [
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ]
                                              ],
                                            [],
                                            "copied",
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ]
                                            ]
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::iter::traits::iterator::Iterator",
                                                Ty.apply
                                                  (Ty.path "core::slice::iter::ArrayChunks")
                                                  [ Value.Integer IntegerKind.Usize 2 ]
                                                  [ Ty.path "u8" ],
                                                [],
                                                "by_ref",
                                                []
                                              |),
                                              [ iter ]
                                            |)
                                          ]
                                        |);
                                        M.get_associated_function (|
                                          Ty.path "u16",
                                          "from_be_bytes",
                                          []
                                        |)
                                      ]
                                    |)
                                  ]
                                |);
                                M.closure
                                  (fun γ =>
                                    ltac:(M.monadic
                                      match γ with
                                      | [ α0 ] =>
                                        ltac:(M.monadic
                                          (M.match_operator (|
                                            M.alloc (| α0 |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let r := M.copy (| γ |) in
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "char";
                                                          Ty.path
                                                            "core::char::decode::DecodeUtf16Error"
                                                        ],
                                                      "unwrap_or",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| r |);
                                                      M.read (|
                                                        M.get_constant (|
                                                          "core::char::methods::REPLACEMENT_CHARACTER"
                                                        |)
                                                      |)
                                                    ]
                                                  |)))
                                            ]
                                          |)))
                                      | _ => M.impossible "wrong number of arguments"
                                      end))
                              ]
                            |)
                          ]
                        |)
                      |) in
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                                      "is_empty",
                                      []
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.apply
                                            (Ty.path "core::slice::iter::ArrayChunks")
                                            [ Value.Integer IntegerKind.Usize 2 ]
                                            [ Ty.path "u8" ],
                                          "remainder",
                                          []
                                        |),
                                        [ iter ]
                                      |)
                                    ]
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            string));
                        fun γ =>
                          ltac:(M.monadic
                            (M.alloc (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::arith::Add",
                                  Ty.path "alloc::string::String",
                                  [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
                                  "add",
                                  []
                                |),
                                [
                                  M.read (| string |);
                                  M.read (| Value.String (String.String "253" "") |)
                                ]
                              |)
                            |)))
                      ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf16be_lossy :
      M.IsAssociatedFunction Self "from_utf16be_lossy" from_utf16be_lossy.
    
    (*
        pub fn into_raw_parts(self) -> ( *mut u8, usize, usize) {
            self.vec.into_raw_parts()
        }
    *)
    Definition into_raw_parts (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "into_raw_parts",
              []
            |),
            [
              M.read (|
                M.SubPointer.get_struct_record_field (| self, "alloc::string::String", "vec" |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_into_raw_parts :
      M.IsAssociatedFunction Self "into_raw_parts" into_raw_parts.
    
    (*
        pub unsafe fn from_raw_parts(buf: *mut u8, length: usize, capacity: usize) -> String {
            unsafe { String { vec: Vec::from_raw_parts(buf, length, capacity) } }
        }
    *)
    Definition from_raw_parts (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ buf; length; capacity ] =>
        ltac:(M.monadic
          (let buf := M.alloc (| buf |) in
          let length := M.alloc (| length |) in
          let capacity := M.alloc (| capacity |) in
          Value.StructRecord
            "alloc::string::String"
            [
              ("vec",
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "from_raw_parts",
                    []
                  |),
                  [ M.read (| buf |); M.read (| length |); M.read (| capacity |) ]
                |))
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_raw_parts :
      M.IsAssociatedFunction Self "from_raw_parts" from_raw_parts.
    
    (*
        pub unsafe fn from_utf8_unchecked(bytes: Vec<u8>) -> String {
            String { vec: bytes }
        }
    *)
    Definition from_utf8_unchecked (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ bytes ] =>
        ltac:(M.monadic
          (let bytes := M.alloc (| bytes |) in
          Value.StructRecord "alloc::string::String" [ ("vec", M.read (| bytes |)) ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_from_utf8_unchecked :
      M.IsAssociatedFunction Self "from_utf8_unchecked" from_utf8_unchecked.
    
    (*
        pub fn into_bytes(self) -> Vec<u8> {
            self.vec
        }
    *)
    Definition into_bytes (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.SubPointer.get_struct_record_field (| self, "alloc::string::String", "vec" |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_into_bytes : M.IsAssociatedFunction Self "into_bytes" into_bytes.
    
    (*
        pub fn as_str(&self) -> &str {
            self
        }
    *)
    Definition as_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.path "alloc::string::String",
              [],
              "deref",
              []
            |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_as_str : M.IsAssociatedFunction Self "as_str" as_str.
    
    (*
        pub fn as_mut_str(&mut self) -> &mut str {
            self
        }
    *)
    Definition as_mut_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::DerefMut",
              Ty.path "alloc::string::String",
              [],
              "deref_mut",
              []
            |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_as_mut_str : M.IsAssociatedFunction Self "as_mut_str" as_mut_str.
    
    (*
        pub fn push_str(&mut self, string: &str) {
            self.vec.extend_from_slice(string.as_bytes())
        }
    *)
    Definition push_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; string ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let string := M.alloc (| string |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "extend_from_slice",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.call_closure (|
                M.get_associated_function (| Ty.path "str", "as_bytes", [] |),
                [ M.read (| string |) ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_push_str : M.IsAssociatedFunction Self "push_str" push_str.
    
    (*
        pub fn extend_from_within<R>(&mut self, src: R)
        where
            R: RangeBounds<usize>,
        {
            let src @ Range { start, end } = slice::range(src, ..self.len());
    
            assert!(self.is_char_boundary(start));
            assert!(self.is_char_boundary(end));
    
            self.vec.extend_from_within(src);
        }
    *)
    Definition extend_from_within (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ R ], [ self; src ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let src := M.alloc (| src |) in
          M.read (|
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::slice::index::range", [ R ] |),
                  [
                    M.read (| src |);
                    Value.StructRecord
                      "core::ops::range::RangeTo"
                      [
                        ("end_",
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "len",
                              []
                            |),
                            [ M.read (| self |) ]
                          |))
                      ]
                  ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let src := M.copy (| γ |) in
                    let γ1_0 :=
                      M.SubPointer.get_struct_record_field (|
                        γ,
                        "core::ops::range::Range",
                        "start"
                      |) in
                    let γ1_1 :=
                      M.SubPointer.get_struct_record_field (|
                        γ,
                        "core::ops::range::Range",
                        "end"
                      |) in
                    let start := M.copy (| γ1_0 |) in
                    let end_ := M.copy (| γ1_1 |) in
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          M.read (| start |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String
                                          "assertion failed: self.is_char_boundary(start)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          M.read (| end_ |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String "assertion failed: self.is_char_boundary(end)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    let~ _ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            "extend_from_within",
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ]
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "alloc::string::String",
                              "vec"
                            |);
                            M.read (| src |)
                          ]
                        |)
                      |) in
                    M.alloc (| Value.Tuple [] |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_extend_from_within :
      M.IsAssociatedFunction Self "extend_from_within" extend_from_within.
    
    (*
        pub fn capacity(&self) -> usize {
            self.vec.capacity()
        }
    *)
    Definition capacity (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "capacity",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_capacity : M.IsAssociatedFunction Self "capacity" capacity.
    
    (*
        pub fn reserve(&mut self, additional: usize) {
            self.vec.reserve(additional)
        }
    *)
    Definition reserve (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; additional ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let additional := M.alloc (| additional |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "reserve",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.read (| additional |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_reserve : M.IsAssociatedFunction Self "reserve" reserve.
    
    (*
        pub fn reserve_exact(&mut self, additional: usize) {
            self.vec.reserve_exact(additional)
        }
    *)
    Definition reserve_exact (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; additional ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let additional := M.alloc (| additional |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "reserve_exact",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.read (| additional |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_reserve_exact :
      M.IsAssociatedFunction Self "reserve_exact" reserve_exact.
    
    (*
        pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
            self.vec.try_reserve(additional)
        }
    *)
    Definition try_reserve (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; additional ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let additional := M.alloc (| additional |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "try_reserve",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.read (| additional |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_try_reserve : M.IsAssociatedFunction Self "try_reserve" try_reserve.
    
    (*
        pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
            self.vec.try_reserve_exact(additional)
        }
    *)
    Definition try_reserve_exact (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; additional ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let additional := M.alloc (| additional |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "try_reserve_exact",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.read (| additional |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_try_reserve_exact :
      M.IsAssociatedFunction Self "try_reserve_exact" try_reserve_exact.
    
    (*
        pub fn shrink_to_fit(&mut self) {
            self.vec.shrink_to_fit()
        }
    *)
    Definition shrink_to_fit (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "shrink_to_fit",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_shrink_to_fit :
      M.IsAssociatedFunction Self "shrink_to_fit" shrink_to_fit.
    
    (*
        pub fn shrink_to(&mut self, min_capacity: usize) {
            self.vec.shrink_to(min_capacity)
        }
    *)
    Definition shrink_to (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; min_capacity ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let min_capacity := M.alloc (| min_capacity |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "shrink_to",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |);
              M.read (| min_capacity |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_shrink_to : M.IsAssociatedFunction Self "shrink_to" shrink_to.
    
    (*
        pub fn push(&mut self, ch: char) {
            match ch.len_utf8() {
                1 => self.vec.push(ch as u8),
                _ => self.vec.extend_from_slice(ch.encode_utf8(&mut [0; 4]).as_bytes()),
            }
        }
    *)
    Definition push (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; ch ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let ch := M.alloc (| ch |) in
          M.read (|
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "char", "len_utf8", [] |),
                  [ M.read (| ch |) ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let _ :=
                      M.is_constant_or_break_match (|
                        M.read (| γ |),
                        Value.Integer IntegerKind.Usize 1
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "alloc::vec::Vec")
                            []
                            [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                          "push",
                          []
                        |),
                        [
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "alloc::string::String",
                            "vec"
                          |);
                          M.rust_cast (M.read (| ch |))
                        ]
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "alloc::vec::Vec")
                            []
                            [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                          "extend_from_slice",
                          []
                        |),
                        [
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "alloc::string::String",
                            "vec"
                          |);
                          M.call_closure (|
                            M.get_associated_function (| Ty.path "str", "as_bytes", [] |),
                            [
                              M.call_closure (|
                                M.get_associated_function (| Ty.path "char", "encode_utf8", [] |),
                                [
                                  M.read (| ch |);
                                  M.alloc (|
                                    repeat (|
                                      Value.Integer IntegerKind.U8 0,
                                      Value.Integer IntegerKind.Usize 4
                                    |)
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_push : M.IsAssociatedFunction Self "push" push.
    
    (*
        pub fn as_bytes(&self) -> &[u8] {
            &self.vec
        }
    *)
    Definition as_bytes (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              [],
              "deref",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_as_bytes : M.IsAssociatedFunction Self "as_bytes" as_bytes.
    
    (*
        pub fn truncate(&mut self, new_len: usize) {
            if new_len <= self.len() {
                assert!(self.is_char_boundary(new_len));
                self.vec.truncate(new_len)
            }
        }
    *)
    Definition truncate (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; new_len ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let new_len := M.alloc (| new_len |) in
          M.read (|
            M.match_operator (|
              M.alloc (| Value.Tuple [] |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ :=
                      M.use
                        (M.alloc (|
                          BinOp.le (|
                            M.read (| new_len |),
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "alloc::string::String",
                                "len",
                                []
                              |),
                              [ M.read (| self |) ]
                            |)
                          |)
                        |)) in
                    let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          M.read (| new_len |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String
                                          "assertion failed: self.is_char_boundary(new_len)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "alloc::vec::Vec")
                            []
                            [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                          "truncate",
                          []
                        |),
                        [
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "alloc::string::String",
                            "vec"
                          |);
                          M.read (| new_len |)
                        ]
                      |)
                    |)));
                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_truncate : M.IsAssociatedFunction Self "truncate" truncate.
    
    (*
        pub fn pop(&mut self) -> Option<char> {
            let ch = self.chars().rev().next()?;
            let newlen = self.len() - ch.len_utf8();
            unsafe {
                self.vec.set_len(newlen);
            }
            Some(ch)
        }
    *)
    Definition pop (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ ch :=
                  M.copy (|
                    M.match_operator (|
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::try_trait::Try",
                            Ty.apply (Ty.path "core::option::Option") [] [ Ty.path "char" ],
                            [],
                            "branch",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::iterator::Iterator",
                                Ty.apply
                                  (Ty.path "core::iter::adapters::rev::Rev")
                                  []
                                  [ Ty.path "core::str::iter::Chars" ],
                                [],
                                "next",
                                []
                              |),
                              [
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.path "core::str::iter::Chars",
                                      [],
                                      "rev",
                                      []
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_associated_function (| Ty.path "str", "chars", [] |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |)
                                        ]
                                      |)
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::ops::control_flow::ControlFlow::Break",
                                0
                              |) in
                            let residual := M.copy (| γ0_0 |) in
                            M.alloc (|
                              M.never_to_any (|
                                M.read (|
                                  M.return_ (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::FromResidual",
                                        Ty.apply
                                          (Ty.path "core::option::Option")
                                          []
                                          [ Ty.path "char" ],
                                        [
                                          Ty.apply
                                            (Ty.path "core::option::Option")
                                            []
                                            [ Ty.path "core::convert::Infallible" ]
                                        ],
                                        "from_residual",
                                        []
                                      |),
                                      [ M.read (| residual |) ]
                                    |)
                                  |)
                                |)
                              |)
                            |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let γ0_0 :=
                              M.SubPointer.get_struct_tuple_field (|
                                γ,
                                "core::ops::control_flow::ControlFlow::Continue",
                                0
                              |) in
                            let val := M.copy (| γ0_0 |) in
                            val))
                      ]
                    |)
                  |) in
                let~ newlen :=
                  M.alloc (|
                    BinOp.Wrap.sub (|
                      M.call_closure (|
                        M.get_associated_function (| Ty.path "alloc::string::String", "len", [] |),
                        [ M.read (| self |) ]
                      |),
                      M.call_closure (|
                        M.get_associated_function (| Ty.path "char", "len_utf8", [] |),
                        [ M.read (| ch |) ]
                      |)
                    |)
                  |) in
                let~ _ :=
                  let~ _ :=
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "alloc::vec::Vec")
                            []
                            [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                          "set_len",
                          []
                        |),
                        [
                          M.SubPointer.get_struct_record_field (|
                            M.read (| self |),
                            "alloc::string::String",
                            "vec"
                          |);
                          M.read (| newlen |)
                        ]
                      |)
                    |) in
                  M.alloc (| Value.Tuple [] |) in
                M.alloc (| Value.StructTuple "core::option::Option::Some" [ M.read (| ch |) ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_pop : M.IsAssociatedFunction Self "pop" pop.
    
    (*
        pub fn remove(&mut self, idx: usize) -> char {
            let ch = match self[idx..].chars().next() {
                Some(ch) => ch,
                None => panic!("cannot remove a char from the end of a string"),
            };
    
            let next = idx + ch.len_utf8();
            let len = self.len();
            unsafe {
                ptr::copy(self.vec.as_ptr().add(next), self.vec.as_mut_ptr().add(idx), len - next);
                self.vec.set_len(len - (next - idx));
            }
            ch
        }
    *)
    Definition remove (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; idx ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let idx := M.alloc (| idx |) in
          M.read (|
            let~ ch :=
              M.copy (|
                M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        Ty.path "core::str::iter::Chars",
                        [],
                        "next",
                        []
                      |),
                      [
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (| Ty.path "str", "chars", [] |),
                            [
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::index::Index",
                                  Ty.path "alloc::string::String",
                                  [
                                    Ty.apply
                                      (Ty.path "core::ops::range::RangeFrom")
                                      []
                                      [ Ty.path "usize" ]
                                  ],
                                  "index",
                                  []
                                |),
                                [
                                  M.read (| self |);
                                  Value.StructRecord
                                    "core::ops::range::RangeFrom"
                                    [ ("start", M.read (| idx |)) ]
                                ]
                              |)
                            ]
                          |)
                        |)
                      ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::option::Option::Some",
                            0
                          |) in
                        let ch := M.copy (| γ0_0 |) in
                        ch));
                    fun γ =>
                      ltac:(M.monadic
                        (let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.call_closure (|
                              M.get_function (| "core::panicking::panic_fmt", [] |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "core::fmt::Arguments",
                                    "new_const",
                                    []
                                  |),
                                  [
                                    M.alloc (|
                                      Value.Array
                                        [
                                          M.read (|
                                            Value.String
                                              "cannot remove a char from the end of a string"
                                          |)
                                        ]
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          |)
                        |)))
                  ]
                |)
              |) in
            let~ next :=
              M.alloc (|
                BinOp.Wrap.add (|
                  M.read (| idx |),
                  M.call_closure (|
                    M.get_associated_function (| Ty.path "char", "len_utf8", [] |),
                    [ M.read (| ch |) ]
                  |)
                |)
              |) in
            let~ len :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "len", [] |),
                  [ M.read (| self |) ]
                |)
              |) in
            let~ _ :=
              let~ _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_function (| "core::intrinsics::copy", [ Ty.path "u8" ] |),
                    [
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply (Ty.path "*const") [] [ Ty.path "u8" ],
                          "add",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "alloc::vec::Vec")
                                []
                                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                              "as_ptr",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "alloc::string::String",
                                "vec"
                              |)
                            ]
                          |);
                          M.read (| next |)
                        ]
                      |);
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply (Ty.path "*mut") [] [ Ty.path "u8" ],
                          "add",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.apply
                                (Ty.path "alloc::vec::Vec")
                                []
                                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                              "as_mut_ptr",
                              []
                            |),
                            [
                              M.SubPointer.get_struct_record_field (|
                                M.read (| self |),
                                "alloc::string::String",
                                "vec"
                              |)
                            ]
                          |);
                          M.read (| idx |)
                        ]
                      |);
                      BinOp.Wrap.sub (| M.read (| len |), M.read (| next |) |)
                    ]
                  |)
                |) in
              let~ _ :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.apply
                        (Ty.path "alloc::vec::Vec")
                        []
                        [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                      "set_len",
                      []
                    |),
                    [
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "alloc::string::String",
                        "vec"
                      |);
                      BinOp.Wrap.sub (|
                        M.read (| len |),
                        BinOp.Wrap.sub (| M.read (| next |), M.read (| idx |) |)
                      |)
                    ]
                  |)
                |) in
              M.alloc (| Value.Tuple [] |) in
            ch
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_remove : M.IsAssociatedFunction Self "remove" remove.
    
    (*
        pub fn remove_matches<P: Pattern>(&mut self, pat: P) {
            use core::str::pattern::Searcher;
    
            let rejections = {
                let mut searcher = pat.into_searcher(self);
                // Per Searcher::next:
                //
                // A Match result needs to contain the whole matched pattern,
                // however Reject results may be split up into arbitrary many
                // adjacent fragments. Both ranges may have zero length.
                //
                // In practice the implementation of Searcher::next_match tends to
                // be more efficient, so we use it here and do some work to invert
                // matches into rejections since that's what we want to copy below.
                let mut front = 0;
                let rejections: Vec<_> = from_fn(|| {
                    let (start, end) = searcher.next_match()?;
                    let prev_front = front;
                    front = end;
                    Some((prev_front, start))
                })
                .collect();
                rejections.into_iter().chain(core::iter::once((front, self.len())))
            };
    
            let mut len = 0;
            let ptr = self.vec.as_mut_ptr();
    
            for (start, end) in rejections {
                let count = end - start;
                if start != len {
                    // SAFETY: per Searcher::next:
                    //
                    // The stream of Match and Reject values up to a Done will
                    // contain index ranges that are adjacent, non-overlapping,
                    // covering the whole haystack, and laying on utf8
                    // boundaries.
                    unsafe {
                        ptr::copy(ptr.add(start), ptr.add(len), count);
                    }
                }
                len += count;
            }
    
            unsafe {
                self.vec.set_len(len);
            }
        }
    *)
    Definition remove_matches (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ P ], [ self; pat ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let pat := M.alloc (| pat |) in
          M.read (|
            let~ rejections :=
              M.copy (|
                let~ searcher :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::str::pattern::Pattern",
                        P,
                        [],
                        "into_searcher",
                        []
                      |),
                      [
                        M.read (| pat |);
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::deref::Deref",
                            Ty.path "alloc::string::String",
                            [],
                            "deref",
                            []
                          |),
                          [ M.read (| self |) ]
                        |)
                      ]
                    |)
                  |) in
                let~ front := M.alloc (| Value.Integer IntegerKind.Usize 0 |) in
                let~ rejections :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        Ty.apply
                          (Ty.path "core::iter::sources::from_fn::FromFn")
                          []
                          [
                            Ty.function
                              [ Ty.tuple [] ]
                              (Ty.apply
                                (Ty.path "core::option::Option")
                                []
                                [ Ty.tuple [ Ty.path "usize"; Ty.path "usize" ] ])
                          ],
                        [],
                        "collect",
                        [
                          Ty.apply
                            (Ty.path "alloc::vec::Vec")
                            []
                            [
                              Ty.tuple [ Ty.path "usize"; Ty.path "usize" ];
                              Ty.path "alloc::alloc::Global"
                            ]
                        ]
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "core::iter::sources::from_fn::from_fn",
                            [
                              Ty.tuple [ Ty.path "usize"; Ty.path "usize" ];
                              Ty.function
                                [ Ty.tuple [] ]
                                (Ty.apply
                                  (Ty.path "core::option::Option")
                                  []
                                  [ Ty.tuple [ Ty.path "usize"; Ty.path "usize" ] ])
                            ]
                          |),
                          [
                            M.closure
                              (fun γ =>
                                ltac:(M.monadic
                                  match γ with
                                  | [ α0 ] =>
                                    ltac:(M.monadic
                                      (M.match_operator (|
                                        M.alloc (| α0 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (M.read (|
                                                M.match_operator (|
                                                  M.match_operator (|
                                                    M.alloc (|
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::ops::try_trait::Try",
                                                          Ty.apply
                                                            (Ty.path "core::option::Option")
                                                            []
                                                            [
                                                              Ty.tuple
                                                                [ Ty.path "usize"; Ty.path "usize" ]
                                                            ],
                                                          [],
                                                          "branch",
                                                          []
                                                        |),
                                                        [
                                                          M.call_closure (|
                                                            M.get_trait_method (|
                                                              "core::str::pattern::Searcher",
                                                              Ty.associated,
                                                              [],
                                                              "next_match",
                                                              []
                                                            |),
                                                            [ searcher ]
                                                          |)
                                                        ]
                                                      |)
                                                    |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ0_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "core::ops::control_flow::ControlFlow::Break",
                                                              0
                                                            |) in
                                                          let residual := M.copy (| γ0_0 |) in
                                                          M.alloc (|
                                                            M.never_to_any (|
                                                              M.read (|
                                                                M.return_ (|
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::try_trait::FromResidual",
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "core::option::Option")
                                                                        []
                                                                        [
                                                                          Ty.tuple
                                                                            [
                                                                              Ty.path "usize";
                                                                              Ty.path "usize"
                                                                            ]
                                                                        ],
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::option::Option")
                                                                          []
                                                                          [
                                                                            Ty.path
                                                                              "core::convert::Infallible"
                                                                          ]
                                                                      ],
                                                                      "from_residual",
                                                                      []
                                                                    |),
                                                                    [ M.read (| residual |) ]
                                                                  |)
                                                                |)
                                                              |)
                                                            |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ0_0 :=
                                                            M.SubPointer.get_struct_tuple_field (|
                                                              γ,
                                                              "core::ops::control_flow::ControlFlow::Continue",
                                                              0
                                                            |) in
                                                          let val := M.copy (| γ0_0 |) in
                                                          val))
                                                    ]
                                                  |),
                                                  [
                                                    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 start := M.copy (| γ0_0 |) in
                                                        let end_ := M.copy (| γ0_1 |) in
                                                        let~ prev_front := M.copy (| front |) in
                                                        let~ _ :=
                                                          M.write (| front, M.read (| end_ |) |) in
                                                        M.alloc (|
                                                          Value.StructTuple
                                                            "core::option::Option::Some"
                                                            [
                                                              Value.Tuple
                                                                [
                                                                  M.read (| prev_front |);
                                                                  M.read (| start |)
                                                                ]
                                                            ]
                                                        |)))
                                                  ]
                                                |)
                                              |)))
                                        ]
                                      |)))
                                  | _ => M.impossible "wrong number of arguments"
                                  end))
                          ]
                        |)
                      ]
                    |)
                  |) in
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      Ty.apply
                        (Ty.path "alloc::vec::into_iter::IntoIter")
                        []
                        [
                          Ty.tuple [ Ty.path "usize"; Ty.path "usize" ];
                          Ty.path "alloc::alloc::Global"
                        ],
                      [],
                      "chain",
                      [
                        Ty.apply
                          (Ty.path "core::iter::sources::once::Once")
                          []
                          [ Ty.tuple [ Ty.path "usize"; Ty.path "usize" ] ]
                      ]
                    |),
                    [
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "alloc::vec::Vec")
                            []
                            [
                              Ty.tuple [ Ty.path "usize"; Ty.path "usize" ];
                              Ty.path "alloc::alloc::Global"
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [ M.read (| rejections |) ]
                      |);
                      M.call_closure (|
                        M.get_function (|
                          "core::iter::sources::once::once",
                          [ Ty.tuple [ Ty.path "usize"; Ty.path "usize" ] ]
                        |),
                        [
                          Value.Tuple
                            [
                              M.read (| front |);
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "alloc::string::String",
                                  "len",
                                  []
                                |),
                                [ M.read (| self |) ]
                              |)
                            ]
                        ]
                      |)
                    ]
                  |)
                |)
              |) in
            let~ len := M.alloc (| Value.Integer IntegerKind.Usize 0 |) in
            let~ ptr :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "as_mut_ptr",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::String",
                      "vec"
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.use
                (M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        Ty.apply
                          (Ty.path "core::iter::adapters::chain::Chain")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::vec::into_iter::IntoIter")
                              []
                              [
                                Ty.tuple [ Ty.path "usize"; Ty.path "usize" ];
                                Ty.path "alloc::alloc::Global"
                              ];
                            Ty.apply
                              (Ty.path "core::iter::sources::once::Once")
                              []
                              [ Ty.tuple [ Ty.path "usize"; Ty.path "usize" ] ]
                          ],
                        [],
                        "into_iter",
                        []
                      |),
                      [ M.read (| rejections |) ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let iter := M.copy (| γ |) in
                        M.loop (|
                          ltac:(M.monadic
                            (let~ _ :=
                              M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::chain::Chain")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "alloc::vec::into_iter::IntoIter")
                                            []
                                            [
                                              Ty.tuple [ Ty.path "usize"; Ty.path "usize" ];
                                              Ty.path "alloc::alloc::Global"
                                            ];
                                          Ty.apply
                                            (Ty.path "core::iter::sources::once::Once")
                                            []
                                            [ Ty.tuple [ Ty.path "usize"; Ty.path "usize" ] ]
                                        ],
                                      [],
                                      "next",
                                      []
                                    |),
                                    [ iter ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let _ :=
                                        M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ0_0 :=
                                        M.SubPointer.get_struct_tuple_field (|
                                          γ,
                                          "core::option::Option::Some",
                                          0
                                        |) in
                                      let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                      let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                      let start := M.copy (| γ1_0 |) in
                                      let end_ := M.copy (| γ1_1 |) in
                                      let~ count :=
                                        M.alloc (|
                                          BinOp.Wrap.sub (| M.read (| end_ |), M.read (| start |) |)
                                        |) in
                                      let~ _ :=
                                        M.match_operator (|
                                          M.alloc (| Value.Tuple [] |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ :=
                                                  M.use
                                                    (M.alloc (|
                                                      BinOp.ne (|
                                                        M.read (| start |),
                                                        M.read (| len |)
                                                      |)
                                                    |)) in
                                                let _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ |),
                                                    Value.Bool true
                                                  |) in
                                                let~ _ :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_function (|
                                                        "core::intrinsics::copy",
                                                        [ Ty.path "u8" ]
                                                      |),
                                                      [
                                                        (* MutToConstPointer *)
                                                        M.pointer_coercion
                                                          (M.call_closure (|
                                                            M.get_associated_function (|
                                                              Ty.apply
                                                                (Ty.path "*mut")
                                                                []
                                                                [ Ty.path "u8" ],
                                                              "add",
                                                              []
                                                            |),
                                                            [ M.read (| ptr |); M.read (| start |) ]
                                                          |));
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.apply
                                                              (Ty.path "*mut")
                                                              []
                                                              [ Ty.path "u8" ],
                                                            "add",
                                                            []
                                                          |),
                                                          [ M.read (| ptr |); M.read (| len |) ]
                                                        |);
                                                        M.read (| count |)
                                                      ]
                                                    |)
                                                  |) in
                                                M.alloc (| Value.Tuple [] |)));
                                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |) in
                                      let~ _ :=
                                        let β := len in
                                        M.write (|
                                          β,
                                          BinOp.Wrap.add (| M.read (| β |), M.read (| count |) |)
                                        |) in
                                      M.alloc (| Value.Tuple [] |)))
                                ]
                              |) in
                            M.alloc (| Value.Tuple [] |)))
                        |)))
                  ]
                |)) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "set_len",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::String",
                      "vec"
                    |);
                    M.read (| len |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_remove_matches :
      M.IsAssociatedFunction Self "remove_matches" remove_matches.
    
    (*
        pub fn retain<F>(&mut self, mut f: F)
        where
            F: FnMut(char) -> bool,
        {
            struct SetLenOnDrop<'a> {
                s: &'a mut String,
                idx: usize,
                del_bytes: usize,
            }
    
            impl<'a> Drop for SetLenOnDrop<'a> {
                fn drop(&mut self) {
                    let new_len = self.idx - self.del_bytes;
                    debug_assert!(new_len <= self.s.len());
                    unsafe { self.s.vec.set_len(new_len) };
                }
            }
    
            let len = self.len();
            let mut guard = SetLenOnDrop { s: self, idx: 0, del_bytes: 0 };
    
            while guard.idx < len {
                let ch =
                    // SAFETY: `guard.idx` is positive-or-zero and less that len so the `get_unchecked`
                    // is in bound. `self` is valid UTF-8 like string and the returned slice starts at
                    // a unicode code point so the `Chars` always return one character.
                    unsafe { guard.s.get_unchecked(guard.idx..len).chars().next().unwrap_unchecked() };
                let ch_len = ch.len_utf8();
    
                if !f(ch) {
                    guard.del_bytes += ch_len;
                } else if guard.del_bytes > 0 {
                    // SAFETY: `guard.idx` is in bound and `guard.del_bytes` represent the number of
                    // bytes that are erased from the string so the resulting `guard.idx -
                    // guard.del_bytes` always represent a valid unicode code point.
                    //
                    // `guard.del_bytes` >= `ch.len_utf8()`, so taking a slice with `ch.len_utf8()` len
                    // is safe.
                    ch.encode_utf8(unsafe {
                        crate::slice::from_raw_parts_mut(
                            guard.s.as_mut_ptr().add(guard.idx - guard.del_bytes),
                            ch.len_utf8(),
                        )
                    });
                }
    
                // Point idx to the next char
                guard.idx += ch_len;
            }
    
            drop(guard);
        }
    *)
    Definition retain (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ F ], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.read (|
            let~ len :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "len", [] |),
                  [ M.read (| self |) ]
                |)
              |) in
            let~ guard :=
              M.alloc (|
                Value.StructRecord
                  "alloc::string::retain::SetLenOnDrop"
                  [
                    ("s", M.read (| self |));
                    ("idx", Value.Integer IntegerKind.Usize 0);
                    ("del_bytes", Value.Integer IntegerKind.Usize 0)
                  ]
              |) in
            let~ _ :=
              M.loop (|
                ltac:(M.monadic
                  (M.match_operator (|
                    M.alloc (| Value.Tuple [] |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ :=
                            M.use
                              (M.alloc (|
                                BinOp.lt (|
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      guard,
                                      "alloc::string::retain::SetLenOnDrop",
                                      "idx"
                                    |)
                                  |),
                                  M.read (| len |)
                                |)
                              |)) in
                          let _ :=
                            M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                          let~ ch :=
                            M.alloc (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply (Ty.path "core::option::Option") [] [ Ty.path "char" ],
                                  "unwrap_unchecked",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.path "core::str::iter::Chars",
                                      [],
                                      "next",
                                      []
                                    |),
                                    [
                                      M.alloc (|
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.path "str",
                                            "chars",
                                            []
                                          |),
                                          [
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path "str",
                                                "get_unchecked",
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::ops::range::Range")
                                                    []
                                                    [ Ty.path "usize" ]
                                                ]
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::deref::Deref",
                                                    Ty.path "alloc::string::String",
                                                    [],
                                                    "deref",
                                                    []
                                                  |),
                                                  [
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        guard,
                                                        "alloc::string::retain::SetLenOnDrop",
                                                        "s"
                                                      |)
                                                    |)
                                                  ]
                                                |);
                                                Value.StructRecord
                                                  "core::ops::range::Range"
                                                  [
                                                    ("start",
                                                      M.read (|
                                                        M.SubPointer.get_struct_record_field (|
                                                          guard,
                                                          "alloc::string::retain::SetLenOnDrop",
                                                          "idx"
                                                        |)
                                                      |));
                                                    ("end_", M.read (| len |))
                                                  ]
                                              ]
                                            |)
                                          ]
                                        |)
                                      |)
                                    ]
                                  |)
                                ]
                              |)
                            |) in
                          let~ ch_len :=
                            M.alloc (|
                              M.call_closure (|
                                M.get_associated_function (| Ty.path "char", "len_utf8", [] |),
                                [ M.read (| ch |) ]
                              |)
                            |) in
                          let~ _ :=
                            M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.alloc (|
                                          UnOp.not (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::function::FnMut",
                                                F,
                                                [ Ty.tuple [ Ty.path "char" ] ],
                                                "call_mut",
                                                []
                                              |),
                                              [ f; Value.Tuple [ M.read (| ch |) ] ]
                                            |)
                                          |)
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    let~ _ :=
                                      let β :=
                                        M.SubPointer.get_struct_record_field (|
                                          guard,
                                          "alloc::string::retain::SetLenOnDrop",
                                          "del_bytes"
                                        |) in
                                      M.write (|
                                        β,
                                        BinOp.Wrap.add (| M.read (| β |), M.read (| ch_len |) |)
                                      |) in
                                    M.alloc (| Value.Tuple [] |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.match_operator (|
                                      M.alloc (| Value.Tuple [] |),
                                      [
                                        fun γ =>
                                          ltac:(M.monadic
                                            (let γ :=
                                              M.use
                                                (M.alloc (|
                                                  BinOp.gt (|
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        guard,
                                                        "alloc::string::retain::SetLenOnDrop",
                                                        "del_bytes"
                                                      |)
                                                    |),
                                                    Value.Integer IntegerKind.Usize 0
                                                  |)
                                                |)) in
                                            let _ :=
                                              M.is_constant_or_break_match (|
                                                M.read (| γ |),
                                                Value.Bool true
                                              |) in
                                            let~ _ :=
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path "char",
                                                    "encode_utf8",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| ch |);
                                                    M.call_closure (|
                                                      M.get_function (|
                                                        "core::slice::raw::from_raw_parts_mut",
                                                        [ Ty.path "u8" ]
                                                      |),
                                                      [
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.apply
                                                              (Ty.path "*mut")
                                                              []
                                                              [ Ty.path "u8" ],
                                                            "add",
                                                            []
                                                          |),
                                                          [
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.path "str",
                                                                "as_mut_ptr",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "core::ops::deref::DerefMut",
                                                                    Ty.path "alloc::string::String",
                                                                    [],
                                                                    "deref_mut",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (|
                                                                      M.SubPointer.get_struct_record_field (|
                                                                        guard,
                                                                        "alloc::string::retain::SetLenOnDrop",
                                                                        "s"
                                                                      |)
                                                                    |)
                                                                  ]
                                                                |)
                                                              ]
                                                            |);
                                                            BinOp.Wrap.sub (|
                                                              M.read (|
                                                                M.SubPointer.get_struct_record_field (|
                                                                  guard,
                                                                  "alloc::string::retain::SetLenOnDrop",
                                                                  "idx"
                                                                |)
                                                              |),
                                                              M.read (|
                                                                M.SubPointer.get_struct_record_field (|
                                                                  guard,
                                                                  "alloc::string::retain::SetLenOnDrop",
                                                                  "del_bytes"
                                                                |)
                                                              |)
                                                            |)
                                                          ]
                                                        |);
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.path "char",
                                                            "len_utf8",
                                                            []
                                                          |),
                                                          [ M.read (| ch |) ]
                                                        |)
                                                      ]
                                                    |)
                                                  ]
                                                |)
                                              |) in
                                            M.alloc (| Value.Tuple [] |)));
                                        fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                      ]
                                    |)))
                              ]
                            |) in
                          let~ _ :=
                            let β :=
                              M.SubPointer.get_struct_record_field (|
                                guard,
                                "alloc::string::retain::SetLenOnDrop",
                                "idx"
                              |) in
                            M.write (|
                              β,
                              BinOp.Wrap.add (| M.read (| β |), M.read (| ch_len |) |)
                            |) in
                          M.alloc (| Value.Tuple [] |)));
                      fun γ =>
                        ltac:(M.monadic
                          (M.alloc (|
                            M.never_to_any (|
                              M.read (|
                                let~ _ :=
                                  M.alloc (| M.never_to_any (| M.read (| M.break (||) |) |) |) in
                                M.alloc (| Value.Tuple [] |)
                              |)
                            |)
                          |)))
                    ]
                  |)))
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_function (|
                    "core::mem::drop",
                    [ Ty.path "alloc::string::retain::SetLenOnDrop" ]
                  |),
                  [ M.read (| guard |) ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_retain : M.IsAssociatedFunction Self "retain" retain.
    
    (*
        pub fn insert(&mut self, idx: usize, ch: char) {
            assert!(self.is_char_boundary(idx));
            let mut bits = [0; 4];
            let bits = ch.encode_utf8(&mut bits).as_bytes();
    
            unsafe {
                self.insert_bytes(idx, bits);
            }
        }
    *)
    Definition insert (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; idx; ch ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let idx := M.alloc (| idx |) in
          let ch := M.alloc (| ch |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "str",
                                  "is_char_boundary",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::deref::Deref",
                                      Ty.path "alloc::string::String",
                                      [],
                                      "deref",
                                      []
                                    |),
                                    [ M.read (| self |) ]
                                  |);
                                  M.read (| idx |)
                                ]
                              |)
                            |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      M.alloc (|
                        M.never_to_any (|
                          M.call_closure (|
                            M.get_function (| "core::panicking::panic", [] |),
                            [
                              M.read (|
                                Value.String "assertion failed: self.is_char_boundary(idx)"
                              |)
                            ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ bits :=
              M.alloc (|
                repeat (| Value.Integer IntegerKind.U8 0, Value.Integer IntegerKind.Usize 4 |)
              |) in
            let~ bits :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "str", "as_bytes", [] |),
                  [
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "char", "encode_utf8", [] |),
                      [ M.read (| ch |); bits ]
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "alloc::string::String",
                    "insert_bytes",
                    []
                  |),
                  [ M.read (| self |); M.read (| idx |); M.read (| bits |) ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_insert : M.IsAssociatedFunction Self "insert" insert.
    
    (*
        unsafe fn insert_bytes(&mut self, idx: usize, bytes: &[u8]) {
            let len = self.len();
            let amt = bytes.len();
            self.vec.reserve(amt);
    
            unsafe {
                ptr::copy(self.vec.as_ptr().add(idx), self.vec.as_mut_ptr().add(idx + amt), len - idx);
                ptr::copy_nonoverlapping(bytes.as_ptr(), self.vec.as_mut_ptr().add(idx), amt);
                self.vec.set_len(len + amt);
            }
        }
    *)
    Definition insert_bytes (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; idx; bytes ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let idx := M.alloc (| idx |) in
          let bytes := M.alloc (| bytes |) in
          M.read (|
            let~ len :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "len", [] |),
                  [ M.read (| self |) ]
                |)
              |) in
            let~ amt :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                    "len",
                    []
                  |),
                  [ M.read (| bytes |) ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "reserve",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::String",
                      "vec"
                    |);
                    M.read (| amt |)
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::intrinsics::copy", [ Ty.path "u8" ] |),
                  [
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "*const") [] [ Ty.path "u8" ],
                        "add",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            "as_ptr",
                            []
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "alloc::string::String",
                              "vec"
                            |)
                          ]
                        |);
                        M.read (| idx |)
                      ]
                    |);
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "*mut") [] [ Ty.path "u8" ],
                        "add",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            "as_mut_ptr",
                            []
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "alloc::string::String",
                              "vec"
                            |)
                          ]
                        |);
                        BinOp.Wrap.add (| M.read (| idx |), M.read (| amt |) |)
                      ]
                    |);
                    BinOp.Wrap.sub (| M.read (| len |), M.read (| idx |) |)
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::intrinsics::copy_nonoverlapping", [ Ty.path "u8" ] |),
                  [
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                        "as_ptr",
                        []
                      |),
                      [ M.read (| bytes |) ]
                    |);
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply (Ty.path "*mut") [] [ Ty.path "u8" ],
                        "add",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            "as_mut_ptr",
                            []
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "alloc::string::String",
                              "vec"
                            |)
                          ]
                        |);
                        M.read (| idx |)
                      ]
                    |);
                    M.read (| amt |)
                  ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "set_len",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::String",
                      "vec"
                    |);
                    BinOp.Wrap.add (| M.read (| len |), M.read (| amt |) |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_insert_bytes : M.IsAssociatedFunction Self "insert_bytes" insert_bytes.
    
    (*
        pub fn insert_str(&mut self, idx: usize, string: &str) {
            assert!(self.is_char_boundary(idx));
    
            unsafe {
                self.insert_bytes(idx, string.as_bytes());
            }
        }
    *)
    Definition insert_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; idx; string ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let idx := M.alloc (| idx |) in
          let string := M.alloc (| string |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "str",
                                  "is_char_boundary",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::deref::Deref",
                                      Ty.path "alloc::string::String",
                                      [],
                                      "deref",
                                      []
                                    |),
                                    [ M.read (| self |) ]
                                  |);
                                  M.read (| idx |)
                                ]
                              |)
                            |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      M.alloc (|
                        M.never_to_any (|
                          M.call_closure (|
                            M.get_function (| "core::panicking::panic", [] |),
                            [
                              M.read (|
                                Value.String "assertion failed: self.is_char_boundary(idx)"
                              |)
                            ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "alloc::string::String",
                    "insert_bytes",
                    []
                  |),
                  [
                    M.read (| self |);
                    M.read (| idx |);
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "str", "as_bytes", [] |),
                      [ M.read (| string |) ]
                    |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_insert_str : M.IsAssociatedFunction Self "insert_str" insert_str.
    
    (*
        pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<u8> {
            &mut self.vec
        }
    *)
    Definition as_mut_vec (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.SubPointer.get_struct_record_field (|
            M.read (| self |),
            "alloc::string::String",
            "vec"
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_as_mut_vec : M.IsAssociatedFunction Self "as_mut_vec" as_mut_vec.
    
    (*
        pub fn len(&self) -> usize {
            self.vec.len()
        }
    *)
    Definition len (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "len",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_len : M.IsAssociatedFunction Self "len" len.
    
    (*
        pub fn is_empty(&self) -> bool {
            self.len() == 0
        }
    *)
    Definition is_empty (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          BinOp.eq (|
            M.call_closure (|
              M.get_associated_function (| Ty.path "alloc::string::String", "len", [] |),
              [ M.read (| self |) ]
            |),
            Value.Integer IntegerKind.Usize 0
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_is_empty : M.IsAssociatedFunction Self "is_empty" is_empty.
    
    (*
        pub fn split_off(&mut self, at: usize) -> String {
            assert!(self.is_char_boundary(at));
            let other = self.vec.split_off(at);
            unsafe { String::from_utf8_unchecked(other) }
        }
    *)
    Definition split_off (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; at_ ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let at_ := M.alloc (| at_ |) in
          M.read (|
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            UnOp.not (|
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "str",
                                  "is_char_boundary",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::deref::Deref",
                                      Ty.path "alloc::string::String",
                                      [],
                                      "deref",
                                      []
                                    |),
                                    [ M.read (| self |) ]
                                  |);
                                  M.read (| at_ |)
                                ]
                              |)
                            |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      M.alloc (|
                        M.never_to_any (|
                          M.call_closure (|
                            M.get_function (| "core::panicking::panic", [] |),
                            [
                              M.read (|
                                Value.String "assertion failed: self.is_char_boundary(at)"
                              |)
                            ]
                          |)
                        |)
                      |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ other :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "split_off",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::String",
                      "vec"
                    |);
                    M.read (| at_ |)
                  ]
                |)
              |) in
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "alloc::string::String",
                  "from_utf8_unchecked",
                  []
                |),
                [ M.read (| other |) ]
              |)
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_split_off : M.IsAssociatedFunction Self "split_off" split_off.
    
    (*
        pub fn clear(&mut self) {
            self.vec.clear()
        }
    *)
    Definition clear (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              "clear",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::String",
                "vec"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_clear : M.IsAssociatedFunction Self "clear" clear.
    
    (*
        pub fn drain<R>(&mut self, range: R) -> Drain<'_>
        where
            R: RangeBounds<usize>,
        {
            // Memory safety
            //
            // The String version of Drain does not have the memory safety issues
            // of the vector version. The data is just plain bytes.
            // Because the range removal happens in Drop, if the Drain iterator is leaked,
            // the removal will not happen.
            let Range { start, end } = slice::range(range, ..self.len());
            assert!(self.is_char_boundary(start));
            assert!(self.is_char_boundary(end));
    
            // Take out two simultaneous borrows. The &mut String won't be accessed
            // until iteration is over, in Drop.
            let self_ptr = self as *mut _;
            // SAFETY: `slice::range` and `is_char_boundary` do the appropriate bounds checks.
            let chars_iter = unsafe { self.get_unchecked(start..end) }.chars();
    
            Drain { start, end, iter: chars_iter, string: self_ptr }
        }
    *)
    Definition drain (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ R ], [ self; range ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let range := M.alloc (| range |) in
          M.read (|
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_function (| "core::slice::index::range", [ R ] |),
                  [
                    M.read (| range |);
                    Value.StructRecord
                      "core::ops::range::RangeTo"
                      [
                        ("end_",
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "len",
                              []
                            |),
                            [ M.read (| self |) ]
                          |))
                      ]
                  ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ0_0 :=
                      M.SubPointer.get_struct_record_field (|
                        γ,
                        "core::ops::range::Range",
                        "start"
                      |) in
                    let γ0_1 :=
                      M.SubPointer.get_struct_record_field (|
                        γ,
                        "core::ops::range::Range",
                        "end"
                      |) in
                    let start := M.copy (| γ0_0 |) in
                    let end_ := M.copy (| γ0_1 |) in
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          M.read (| start |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String
                                          "assertion failed: self.is_char_boundary(start)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    let~ _ :=
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          M.read (| end_ |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String "assertion failed: self.is_char_boundary(end)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |) in
                    let~ self_ptr := M.copy (| M.use (M.alloc (| M.read (| self |) |)) |) in
                    let~ chars_iter :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (| Ty.path "str", "chars", [] |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "str",
                                "get_unchecked",
                                [
                                  Ty.apply
                                    (Ty.path "core::ops::range::Range")
                                    []
                                    [ Ty.path "usize" ]
                                ]
                              |),
                              [
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::deref::Deref",
                                    Ty.path "alloc::string::String",
                                    [],
                                    "deref",
                                    []
                                  |),
                                  [ M.read (| self |) ]
                                |);
                                Value.StructRecord
                                  "core::ops::range::Range"
                                  [ ("start", M.read (| start |)); ("end_", M.read (| end_ |)) ]
                              ]
                            |)
                          ]
                        |)
                      |) in
                    M.alloc (|
                      Value.StructRecord
                        "alloc::string::Drain"
                        [
                          ("start", M.read (| start |));
                          ("end_", M.read (| end_ |));
                          ("iter", M.read (| chars_iter |));
                          ("string", M.read (| self_ptr |))
                        ]
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_drain : M.IsAssociatedFunction Self "drain" drain.
    
    (*
        pub fn replace_range<R>(&mut self, range: R, replace_with: &str)
        where
            R: RangeBounds<usize>,
        {
            // Memory safety
            //
            // Replace_range does not have the memory safety issues of a vector Splice.
            // of the vector version. The data is just plain bytes.
    
            // WARNING: Inlining this variable would be unsound (#81138)
            let start = range.start_bound();
            match start {
                Included(&n) => assert!(self.is_char_boundary(n)),
                Excluded(&n) => assert!(self.is_char_boundary(n + 1)),
                Unbounded => {}
            };
            // WARNING: Inlining this variable would be unsound (#81138)
            let end = range.end_bound();
            match end {
                Included(&n) => assert!(self.is_char_boundary(n + 1)),
                Excluded(&n) => assert!(self.is_char_boundary(n)),
                Unbounded => {}
            };
    
            // Using `range` again would be unsound (#81138)
            // We assume the bounds reported by `range` remain the same, but
            // an adversarial implementation could change between calls
            unsafe { self.as_mut_vec() }.splice((start, end), replace_with.bytes());
        }
    *)
    Definition replace_range (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ R ], [ self; range; replace_with ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let range := M.alloc (| range |) in
          let replace_with := M.alloc (| replace_with |) in
          M.read (|
            let~ start :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::range::RangeBounds",
                    R,
                    [ Ty.path "usize" ],
                    "start_bound",
                    []
                  |),
                  [ range ]
                |)
              |) in
            let~ _ :=
              M.match_operator (|
                start,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::ops::range::Bound::Included",
                          0
                        |) in
                      let γ0_0 := M.read (| γ0_0 |) in
                      let n := M.copy (| γ0_0 |) in
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          M.read (| n |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String "assertion failed: self.is_char_boundary(n)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::ops::range::Bound::Excluded",
                          0
                        |) in
                      let γ0_0 := M.read (| γ0_0 |) in
                      let n := M.copy (| γ0_0 |) in
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          BinOp.Wrap.add (|
                                            M.read (| n |),
                                            Value.Integer IntegerKind.Usize 1
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String
                                          "assertion failed: self.is_char_boundary(n + 1)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::ops::range::Bound::Unbounded" |) in
                      M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ end_ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::ops::range::RangeBounds",
                    R,
                    [ Ty.path "usize" ],
                    "end_bound",
                    []
                  |),
                  [ range ]
                |)
              |) in
            let~ _ :=
              M.match_operator (|
                end_,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::ops::range::Bound::Included",
                          0
                        |) in
                      let γ0_0 := M.read (| γ0_0 |) in
                      let n := M.copy (| γ0_0 |) in
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          BinOp.Wrap.add (|
                                            M.read (| n |),
                                            Value.Integer IntegerKind.Usize 1
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String
                                          "assertion failed: self.is_char_boundary(n + 1)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ0_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "core::ops::range::Bound::Excluded",
                          0
                        |) in
                      let γ0_0 := M.read (| γ0_0 |) in
                      let n := M.copy (| γ0_0 |) in
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    UnOp.not (|
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "str",
                                          "is_char_boundary",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ M.read (| self |) ]
                                          |);
                                          M.read (| n |)
                                        ]
                                      |)
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                M.never_to_any (|
                                  M.call_closure (|
                                    M.get_function (| "core::panicking::panic", [] |),
                                    [
                                      M.read (|
                                        Value.String "assertion failed: self.is_char_boundary(n)"
                                      |)
                                    ]
                                  |)
                                |)
                              |)));
                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let _ := M.is_struct_tuple (| γ, "core::ops::range::Bound::Unbounded" |) in
                      M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "splice",
                    [
                      Ty.tuple
                        [
                          Ty.apply
                            (Ty.path "core::ops::range::Bound")
                            []
                            [ Ty.apply (Ty.path "&") [] [ Ty.path "usize" ] ];
                          Ty.apply
                            (Ty.path "core::ops::range::Bound")
                            []
                            [ Ty.apply (Ty.path "&") [] [ Ty.path "usize" ] ]
                        ];
                      Ty.path "core::str::iter::Bytes"
                    ]
                  |),
                  [
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "alloc::string::String",
                        "as_mut_vec",
                        []
                      |),
                      [ M.read (| self |) ]
                    |);
                    Value.Tuple [ M.read (| start |); M.read (| end_ |) ];
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "str", "bytes", [] |),
                      [ M.read (| replace_with |) ]
                    |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_replace_range :
      M.IsAssociatedFunction Self "replace_range" replace_range.
    
    (*
        pub fn into_boxed_str(self) -> Box<str> {
            let slice = self.vec.into_boxed_slice();
            unsafe { from_boxed_utf8_unchecked(slice) }
        }
    *)
    Definition into_boxed_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            let~ slice :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "into_boxed_slice",
                    []
                  |),
                  [
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "alloc::string::String",
                        "vec"
                      |)
                    |)
                  ]
                |)
              |) in
            M.alloc (|
              M.call_closure (|
                M.get_function (| "alloc::str::from_boxed_utf8_unchecked", [] |),
                [ M.read (| slice |) ]
              |)
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_into_boxed_str :
      M.IsAssociatedFunction Self "into_boxed_str" into_boxed_str.
    
    (*
        pub fn leak<'a>(self) -> &'a mut str {
            let slice = self.vec.leak();
            unsafe { from_utf8_unchecked_mut(slice) }
        }
    *)
    Definition leak (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            let~ slice :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    "leak",
                    []
                  |),
                  [
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        self,
                        "alloc::string::String",
                        "vec"
                      |)
                    |)
                  ]
                |)
              |) in
            M.alloc (|
              M.call_closure (|
                M.get_function (| "core::str::converts::from_utf8_unchecked_mut", [] |),
                [ M.read (| slice |) ]
              |)
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_leak : M.IsAssociatedFunction Self "leak" leak.
  End Impl_alloc_string_String.
  
  Module Impl_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    (*
        pub fn as_bytes(&self) -> &[u8] {
            &self.bytes[..]
        }
    *)
    Definition as_bytes (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::index::Index",
              Ty.apply
                (Ty.path "alloc::vec::Vec")
                []
                [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
              [ Ty.path "core::ops::range::RangeFull" ],
              "index",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::FromUtf8Error",
                "bytes"
              |);
              Value.StructTuple "core::ops::range::RangeFull" []
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_as_bytes : M.IsAssociatedFunction Self "as_bytes" as_bytes.
    
    (*
        pub fn into_utf8_lossy(self) -> String {
            const REPLACEMENT: &str = "\u{FFFD}";
    
            let mut res = {
                let mut v = Vec::with_capacity(self.bytes.len());
    
                // `Utf8Error::valid_up_to` returns the maximum index of validated
                // UTF-8 bytes. Copy the valid bytes into the output buffer.
                v.extend_from_slice(&self.bytes[..self.error.valid_up_to()]);
    
                // SAFETY: This is safe because the only bytes present in the buffer
                // were validated as UTF-8 by the call to `String::from_utf8` which
                // produced this `FromUtf8Error`.
                unsafe { String::from_utf8_unchecked(v) }
            };
    
            let iter = self.bytes[self.error.valid_up_to()..].utf8_chunks();
    
            for chunk in iter {
                res.push_str(chunk.valid());
                if !chunk.invalid().is_empty() {
                    res.push_str(REPLACEMENT);
                }
            }
    
            res
        }
    *)
    Definition into_utf8_lossy (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            let~ res :=
              M.copy (|
                let~ v :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "alloc::vec::Vec")
                          []
                          [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                        "with_capacity",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            "len",
                            []
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              self,
                              "alloc::string::FromUtf8Error",
                              "bytes"
                            |)
                          ]
                        |)
                      ]
                    |)
                  |) in
                let~ _ :=
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.apply
                          (Ty.path "alloc::vec::Vec")
                          []
                          [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                        "extend_from_slice",
                        []
                      |),
                      [
                        v;
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::ops::index::Index",
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            [ Ty.apply (Ty.path "core::ops::range::RangeTo") [] [ Ty.path "usize" ]
                            ],
                            "index",
                            []
                          |),
                          [
                            M.SubPointer.get_struct_record_field (|
                              self,
                              "alloc::string::FromUtf8Error",
                              "bytes"
                            |);
                            Value.StructRecord
                              "core::ops::range::RangeTo"
                              [
                                ("end_",
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "core::str::error::Utf8Error",
                                      "valid_up_to",
                                      []
                                    |),
                                    [
                                      M.SubPointer.get_struct_record_field (|
                                        self,
                                        "alloc::string::FromUtf8Error",
                                        "error"
                                      |)
                                    ]
                                  |))
                              ]
                          ]
                        |)
                      ]
                    |)
                  |) in
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "alloc::string::String",
                      "from_utf8_unchecked",
                      []
                    |),
                    [ M.read (| v |) ]
                  |)
                |)
              |) in
            let~ iter :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ],
                    "utf8_chunks",
                    []
                  |),
                  [
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::index::Index",
                        Ty.apply
                          (Ty.path "alloc::vec::Vec")
                          []
                          [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                        [ Ty.apply (Ty.path "core::ops::range::RangeFrom") [] [ Ty.path "usize" ] ],
                        "index",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          self,
                          "alloc::string::FromUtf8Error",
                          "bytes"
                        |);
                        Value.StructRecord
                          "core::ops::range::RangeFrom"
                          [
                            ("start",
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "core::str::error::Utf8Error",
                                  "valid_up_to",
                                  []
                                |),
                                [
                                  M.SubPointer.get_struct_record_field (|
                                    self,
                                    "alloc::string::FromUtf8Error",
                                    "error"
                                  |)
                                ]
                              |))
                          ]
                      ]
                    |)
                  ]
                |)
              |) in
            let~ _ :=
              M.use
                (M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        Ty.path "core::str::lossy::Utf8Chunks",
                        [],
                        "into_iter",
                        []
                      |),
                      [ M.read (| iter |) ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let iter := M.copy (| γ |) in
                        M.loop (|
                          ltac:(M.monadic
                            (let~ _ :=
                              M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.path "core::str::lossy::Utf8Chunks",
                                      [],
                                      "next",
                                      []
                                    |),
                                    [ iter ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let _ :=
                                        M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ0_0 :=
                                        M.SubPointer.get_struct_tuple_field (|
                                          γ,
                                          "core::option::Option::Some",
                                          0
                                        |) in
                                      let chunk := M.copy (| γ0_0 |) in
                                      let~ _ :=
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path "alloc::string::String",
                                              "push_str",
                                              []
                                            |),
                                            [
                                              res;
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "core::str::lossy::Utf8Chunk",
                                                  "valid",
                                                  []
                                                |),
                                                [ chunk ]
                                              |)
                                            ]
                                          |)
                                        |) in
                                      M.match_operator (|
                                        M.alloc (| Value.Tuple [] |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let γ :=
                                                M.use
                                                  (M.alloc (|
                                                    UnOp.not (|
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.apply
                                                            (Ty.path "slice")
                                                            []
                                                            [ Ty.path "u8" ],
                                                          "is_empty",
                                                          []
                                                        |),
                                                        [
                                                          M.call_closure (|
                                                            M.get_associated_function (|
                                                              Ty.path "core::str::lossy::Utf8Chunk",
                                                              "invalid",
                                                              []
                                                            |),
                                                            [ chunk ]
                                                          |)
                                                        ]
                                                      |)
                                                    |)
                                                  |)) in
                                              let _ :=
                                                M.is_constant_or_break_match (|
                                                  M.read (| γ |),
                                                  Value.Bool true
                                                |) in
                                              let~ _ :=
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path "alloc::string::String",
                                                      "push_str",
                                                      []
                                                    |),
                                                    [
                                                      res;
                                                      M.read (|
                                                        M.get_constant (|
                                                          "alloc::string::into_utf8_lossy::REPLACEMENT"
                                                        |)
                                                      |)
                                                    ]
                                                  |)
                                                |) in
                                              M.alloc (| Value.Tuple [] |)));
                                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                        ]
                                      |)))
                                ]
                              |) in
                            M.alloc (| Value.Tuple [] |)))
                        |)))
                  ]
                |)) in
            res
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_into_utf8_lossy :
      M.IsAssociatedFunction Self "into_utf8_lossy" into_utf8_lossy.
    
    (*
        pub fn into_bytes(self) -> Vec<u8> {
            self.bytes
        }
    *)
    Definition into_bytes (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.SubPointer.get_struct_record_field (| self, "alloc::string::FromUtf8Error", "bytes" |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_into_bytes : M.IsAssociatedFunction Self "into_bytes" into_bytes.
    
    (*
        pub fn utf8_error(&self) -> Utf8Error {
            self.error
        }
    *)
    Definition utf8_error (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.SubPointer.get_struct_record_field (|
              M.read (| self |),
              "alloc::string::FromUtf8Error",
              "error"
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_utf8_error : M.IsAssociatedFunction Self "utf8_error" utf8_error.
  End Impl_alloc_string_FromUtf8Error.
  
  Module Impl_core_fmt_Display_for_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    (*
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            fmt::Display::fmt(&self.error, f)
        }
    *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::fmt::Display",
              Ty.path "core::str::error::Utf8Error",
              [],
              "fmt",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::FromUtf8Error",
                "error"
              |);
              M.read (| f |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Display"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Display_for_alloc_string_FromUtf8Error.
  
  Module Impl_core_fmt_Display_for_alloc_string_FromUtf16Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf16Error".
    
    (*
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            fmt::Display::fmt("invalid utf-16: lone surrogate found", f)
        }
    *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.call_closure (|
            M.get_trait_method (| "core::fmt::Display", Ty.path "str", [], "fmt", [] |),
            [ M.read (| Value.String "invalid utf-16: lone surrogate found" |); M.read (| f |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Display"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Display_for_alloc_string_FromUtf16Error.
  
  Module Impl_core_error_Error_for_alloc_string_FromUtf8Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf8Error".
    
    (*
        fn description(&self) -> &str {
            "invalid utf-8"
        }
    *)
    Definition description (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (| Value.String "invalid utf-8" |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::error::Error"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("description", InstanceField.Method description) ].
  End Impl_core_error_Error_for_alloc_string_FromUtf8Error.
  
  Module Impl_core_error_Error_for_alloc_string_FromUtf16Error.
    Definition Self : Ty.t := Ty.path "alloc::string::FromUtf16Error".
    
    (*
        fn description(&self) -> &str {
            "invalid utf-16"
        }
    *)
    Definition description (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (| Value.String "invalid utf-16" |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::error::Error"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("description", InstanceField.Method description) ].
  End Impl_core_error_Error_for_alloc_string_FromUtf16Error.
  
  Module Impl_core_clone_Clone_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn clone(&self) -> Self {
            String { vec: self.vec.clone() }
        }
    *)
    Definition clone (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          Value.StructRecord
            "alloc::string::String"
            [
              ("vec",
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    [],
                    "clone",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::String",
                      "vec"
                    |)
                  ]
                |))
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn clone_from(&mut self, source: &Self) {
            self.vec.clone_from(&source.vec);
        }
    *)
    Definition clone_from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; source ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let source := M.alloc (| source |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::clone::Clone",
                    Ty.apply
                      (Ty.path "alloc::vec::Vec")
                      []
                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                    [],
                    "clone_from",
                    []
                  |),
                  [
                    M.SubPointer.get_struct_record_field (|
                      M.read (| self |),
                      "alloc::string::String",
                      "vec"
                    |);
                    M.SubPointer.get_struct_record_field (|
                      M.read (| source |),
                      "alloc::string::String",
                      "vec"
                    |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::clone::Clone"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [ ("clone", InstanceField.Method clone); ("clone_from", InstanceField.Method clone_from) ].
  End Impl_core_clone_Clone_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_FromIterator_char_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from_iter<I: IntoIterator<Item = char>>(iter: I) -> String {
            let mut buf = String::new();
            buf.extend(iter);
            buf
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ iter ] =>
        ltac:(M.monadic
          (let iter := M.alloc (| iter |) in
          M.read (|
            let~ buf :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
                  []
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::Extend",
                    Ty.path "alloc::string::String",
                    [ Ty.path "char" ],
                    "extend",
                    [ I ]
                  |),
                  [ buf; M.read (| iter |) ]
                |)
              |) in
            buf
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.path "char" ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_char_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_FromIterator_ref__char_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from_iter<I: IntoIterator<Item = &'a char>>(iter: I) -> String {
            let mut buf = String::new();
            buf.extend(iter);
            buf
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ iter ] =>
        ltac:(M.monadic
          (let iter := M.alloc (| iter |) in
          M.read (|
            let~ buf :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
                  []
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::Extend",
                    Ty.path "alloc::string::String",
                    [ Ty.apply (Ty.path "&") [] [ Ty.path "char" ] ],
                    "extend",
                    [ I ]
                  |),
                  [ buf; M.read (| iter |) ]
                |)
              |) in
            buf
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.apply (Ty.path "&") [] [ Ty.path "char" ] ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_ref__char_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_FromIterator_ref__str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> String {
            let mut buf = String::new();
            buf.extend(iter);
            buf
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ iter ] =>
        ltac:(M.monadic
          (let iter := M.alloc (| iter |) in
          M.read (|
            let~ buf :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
                  []
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::Extend",
                    Ty.path "alloc::string::String",
                    [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
                    "extend",
                    [ I ]
                  |),
                  [ buf; M.read (| iter |) ]
                |)
              |) in
            buf
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_ref__str_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_FromIterator_alloc_string_String_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> String {
            let mut iterator = iter.into_iter();
    
            // Because we're iterating over `String`s, we can avoid at least
            // one allocation by getting the first string from the iterator
            // and appending to it all the subsequent strings.
            match iterator.next() {
                None => String::new(),
                Some(mut buf) => {
                    buf.extend(iterator);
                    buf
                }
            }
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ iter ] =>
        ltac:(M.monadic
          (let iter := M.alloc (| iter |) in
          M.read (|
            let~ iterator :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::IntoIterator",
                    I,
                    [],
                    "into_iter",
                    []
                  |),
                  [ M.read (| iter |) ]
                |)
              |) in
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.associated,
                    [],
                    "next",
                    []
                  |),
                  [ iterator ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
                        []
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let γ0_0 :=
                      M.SubPointer.get_struct_tuple_field (|
                        γ,
                        "core::option::Option::Some",
                        0
                      |) in
                    let buf := M.copy (| γ0_0 |) in
                    let~ _ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::Extend",
                            Ty.path "alloc::string::String",
                            [ Ty.path "alloc::string::String" ],
                            "extend",
                            [ Ty.associated ]
                          |),
                          [ buf; M.read (| iterator |) ]
                        |)
                      |) in
                    buf))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_alloc_string_String_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_FromIterator_where_core_alloc_Allocator_A_alloc_boxed_Box_str_A_for_alloc_string_String.
    Definition Self (A : Ty.t) : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from_iter<I: IntoIterator<Item = Box<str, A>>>(iter: I) -> String {
            let mut buf = String::new();
            buf.extend(iter);
            buf
        }
    *)
    Definition from_iter (A : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self A in
      match ε, τ, α with
      | [], [ _ as I ], [ iter ] =>
        ltac:(M.monadic
          (let iter := M.alloc (| iter |) in
          M.read (|
            let~ buf :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
                  []
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::Extend",
                    Ty.path "alloc::string::String",
                    [ Ty.apply (Ty.path "alloc::boxed::Box") [] [ Ty.path "str"; A ] ],
                    "extend",
                    [ I ]
                  |),
                  [ buf; M.read (| iter |) ]
                |)
              |) in
            buf
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      forall (A : Ty.t),
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        (Self A)
        (* Trait polymorphic types *)
        [ (* A *) Ty.apply (Ty.path "alloc::boxed::Box") [] [ Ty.path "str"; A ] ]
        (* Instance *) [ ("from_iter", InstanceField.Method (from_iter A)) ].
  End Impl_core_iter_traits_collect_FromIterator_where_core_alloc_Allocator_A_alloc_boxed_Box_str_A_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_FromIterator_alloc_borrow_Cow_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> String {
            let mut iterator = iter.into_iter();
    
            // Because we're iterating over CoWs, we can (potentially) avoid at least
            // one allocation by getting the first item and appending to it all the
            // subsequent items.
            match iterator.next() {
                None => String::new(),
                Some(cow) => {
                    let mut buf = cow.into_owned();
                    buf.extend(iterator);
                    buf
                }
            }
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ iter ] =>
        ltac:(M.monadic
          (let iter := M.alloc (| iter |) in
          M.read (|
            let~ iterator :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::IntoIterator",
                    I,
                    [],
                    "into_iter",
                    []
                  |),
                  [ M.read (| iter |) ]
                |)
              |) in
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.associated,
                    [],
                    "next",
                    []
                  |),
                  [ iterator ]
                |)
              |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
                        []
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let γ0_0 :=
                      M.SubPointer.get_struct_tuple_field (|
                        γ,
                        "core::option::Option::Some",
                        0
                      |) in
                    let cow := M.copy (| γ0_0 |) in
                    let~ buf :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                            "into_owned",
                            []
                          |),
                          [ M.read (| cow |) ]
                        |)
                      |) in
                    let~ _ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::Extend",
                            Ty.path "alloc::string::String",
                            [ Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ],
                            "extend",
                            [ Ty.associated ]
                          |),
                          [ buf; M.read (| iterator |) ]
                        |)
                      |) in
                    buf))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *)
        [ (* A *) Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_alloc_borrow_Cow_str_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_Extend_char_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I) {
            let iterator = iter.into_iter();
            let (lower_bound, _) = iterator.size_hint();
            self.reserve(lower_bound);
            iterator.for_each(move |c| self.push(c));
        }
    *)
    Definition extend (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ self; iter ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let iter := M.alloc (| iter |) in
          M.read (|
            let~ iterator :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::IntoIterator",
                    I,
                    [],
                    "into_iter",
                    []
                  |),
                  [ M.read (| iter |) ]
                |)
              |) in
            M.match_operator (|
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.associated,
                    [],
                    "size_hint",
                    []
                  |),
                  [ iterator ]
                |)
              |),
              [
                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 lower_bound := M.copy (| γ0_0 |) in
                    let~ _ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "alloc::string::String",
                            "reserve",
                            []
                          |),
                          [ M.read (| self |); M.read (| lower_bound |) ]
                        |)
                      |) in
                    let~ _ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.associated,
                            [],
                            "for_each",
                            [ Ty.function [ Ty.tuple [ Ty.path "char" ] ] (Ty.tuple []) ]
                          |),
                          [
                            M.read (| iterator |);
                            M.closure
                              (fun γ =>
                                ltac:(M.monadic
                                  match γ with
                                  | [ α0 ] =>
                                    ltac:(M.monadic
                                      (M.match_operator (|
                                        M.alloc (| α0 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let c := M.copy (| γ |) in
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path "alloc::string::String",
                                                  "push",
                                                  []
                                                |),
                                                [ M.read (| self |); M.read (| c |) ]
                                              |)))
                                        ]
                                      |)))
                                  | _ => M.impossible "wrong number of arguments"
                                  end))
                          ]
                        |)
                      |) in
                    M.alloc (| Value.Tuple [] |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn extend_one(&mut self, c: char) {
            self.push(c);
        }
    *)
    Definition extend_one (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; c ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let c := M.alloc (| c |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push", [] |),
                  [ M.read (| self |); M.read (| c |) ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn extend_reserve(&mut self, additional: usize) {
            self.reserve(additional);
        }
    *)
    Definition extend_reserve (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; additional ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let additional := M.alloc (| additional |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "reserve", [] |),
                  [ M.read (| self |); M.read (| additional |) ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::Extend"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.path "char" ]
        (* Instance *)
        [
          ("extend", InstanceField.Method extend);
          ("extend_one", InstanceField.Method extend_one);
          ("extend_reserve", InstanceField.Method extend_reserve)
        ].
  End Impl_core_iter_traits_collect_Extend_char_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_Extend_ref__char_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn extend<I: IntoIterator<Item = &'a char>>(&mut self, iter: I) {
            self.extend(iter.into_iter().cloned());
        }
    *)
    Definition extend (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ self; iter ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let iter := M.alloc (| iter |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::collect::Extend",
                    Ty.path "alloc::string::String",
                    [ Ty.path "char" ],
                    "extend",
                    [ Ty.apply (Ty.path "core::iter::adapters::cloned::Cloned") [] [ Ty.associated ]
                    ]
                  |),
                  [
                    M.read (| self |);
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        Ty.associated,
                        [],
                        "cloned",
                        [ Ty.path "char" ]
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::collect::IntoIterator",
                            I,
                            [],
                            "into_iter",
                            []
                          |),
                          [ M.read (| iter |) ]
                        |)
                      ]
                    |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn extend_one(&mut self, &c: &'a char) {
            self.push(c);
        }
    *)
    Definition extend_one (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; β1 ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let β1 := M.alloc (| β1 |) in
          M.match_operator (|
            β1,
            [
              fun γ =>
                ltac:(M.monadic
                  (let γ := M.read (| γ |) in
                  let c := M.copy (| γ |) in
                  M.read (|
                    let~ _ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "alloc::string::String",
                            "push",
                            []
                          |),
                          [ M.read (| self |); M.read (| c |) ]
                        |)
                      |) in
                    M.alloc (| Value.Tuple [] |)
                  |)))
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn extend_reserve(&mut self, additional: usize) {
            self.reserve(additional);
        }
    *)
    Definition extend_reserve (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; additional ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let additional := M.alloc (| additional |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "reserve", [] |),
                  [ M.read (| self |); M.read (| additional |) ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::Extend"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.apply (Ty.path "&") [] [ Ty.path "char" ] ]
        (* Instance *)
        [
          ("extend", InstanceField.Method extend);
          ("extend_one", InstanceField.Method extend_one);
          ("extend_reserve", InstanceField.Method extend_reserve)
        ].
  End Impl_core_iter_traits_collect_Extend_ref__char_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_Extend_ref__str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) {
            iter.into_iter().for_each(move |s| self.push_str(s));
        }
    *)
    Definition extend (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ self; iter ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let iter := M.alloc (| iter |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.associated,
                    [],
                    "for_each",
                    [
                      Ty.function
                        [ Ty.tuple [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ] ]
                        (Ty.tuple [])
                    ]
                  |),
                  [
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        I,
                        [],
                        "into_iter",
                        []
                      |),
                      [ M.read (| iter |) ]
                    |);
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let s := M.copy (| γ |) in
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "alloc::string::String",
                                          "push_str",
                                          []
                                        |),
                                        [ M.read (| self |); M.read (| s |) ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn extend_one(&mut self, s: &'a str) {
            self.push_str(s);
        }
    *)
    Definition extend_one (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; s ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let s := M.alloc (| s |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push_str", [] |),
                  [ M.read (| self |); M.read (| s |) ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::Extend"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *)
        [ ("extend", InstanceField.Method extend); ("extend_one", InstanceField.Method extend_one)
        ].
  End Impl_core_iter_traits_collect_Extend_ref__str_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_Extend_where_core_alloc_Allocator_A_alloc_boxed_Box_str_A_for_alloc_string_String.
    Definition Self (A : Ty.t) : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn extend<I: IntoIterator<Item = Box<str, A>>>(&mut self, iter: I) {
            iter.into_iter().for_each(move |s| self.push_str(&s));
        }
    *)
    Definition extend (A : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self A in
      match ε, τ, α with
      | [], [ _ as I ], [ self; iter ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let iter := M.alloc (| iter |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.associated,
                    [],
                    "for_each",
                    [
                      Ty.function
                        [
                          Ty.tuple
                            [ Ty.apply (Ty.path "alloc::boxed::Box") [] [ Ty.path "str"; A ] ]
                        ]
                        (Ty.tuple [])
                    ]
                  |),
                  [
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        I,
                        [],
                        "into_iter",
                        []
                      |),
                      [ M.read (| iter |) ]
                    |);
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let s := M.copy (| γ |) in
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "alloc::string::String",
                                          "push_str",
                                          []
                                        |),
                                        [ M.read (| self |); M.read (| s |) ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      forall (A : Ty.t),
      M.IsTraitInstance
        "core::iter::traits::collect::Extend"
        (Self A)
        (* Trait polymorphic types *)
        [ (* A *) Ty.apply (Ty.path "alloc::boxed::Box") [] [ Ty.path "str"; A ] ]
        (* Instance *) [ ("extend", InstanceField.Method (extend A)) ].
  End Impl_core_iter_traits_collect_Extend_where_core_alloc_Allocator_A_alloc_boxed_Box_str_A_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_Extend_alloc_string_String_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I) {
            iter.into_iter().for_each(move |s| self.push_str(&s));
        }
    *)
    Definition extend (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ self; iter ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let iter := M.alloc (| iter |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.associated,
                    [],
                    "for_each",
                    [ Ty.function [ Ty.tuple [ Ty.path "alloc::string::String" ] ] (Ty.tuple []) ]
                  |),
                  [
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        I,
                        [],
                        "into_iter",
                        []
                      |),
                      [ M.read (| iter |) ]
                    |);
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let s := M.copy (| γ |) in
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "alloc::string::String",
                                          "push_str",
                                          []
                                        |),
                                        [
                                          M.read (| self |);
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.path "alloc::string::String",
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ s ]
                                          |)
                                        ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn extend_one(&mut self, s: String) {
            self.push_str(&s);
        }
    *)
    Definition extend_one (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; s ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let s := M.alloc (| s |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push_str", [] |),
                  [
                    M.read (| self |);
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::deref::Deref",
                        Ty.path "alloc::string::String",
                        [],
                        "deref",
                        []
                      |),
                      [ s ]
                    |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::Extend"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.path "alloc::string::String" ]
        (* Instance *)
        [ ("extend", InstanceField.Method extend); ("extend_one", InstanceField.Method extend_one)
        ].
  End Impl_core_iter_traits_collect_Extend_alloc_string_String_for_alloc_string_String.
  
  Module Impl_core_iter_traits_collect_Extend_alloc_borrow_Cow_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I) {
            iter.into_iter().for_each(move |s| self.push_str(&s));
        }
    *)
    Definition extend (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ self; iter ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let iter := M.alloc (| iter |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.associated,
                    [],
                    "for_each",
                    [
                      Ty.function
                        [ Ty.tuple [ Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ]
                        ]
                        (Ty.tuple [])
                    ]
                  |),
                  [
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        I,
                        [],
                        "into_iter",
                        []
                      |),
                      [ M.read (| iter |) ]
                    |);
                    M.closure
                      (fun γ =>
                        ltac:(M.monadic
                          match γ with
                          | [ α0 ] =>
                            ltac:(M.monadic
                              (M.match_operator (|
                                M.alloc (| α0 |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let s := M.copy (| γ |) in
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "alloc::string::String",
                                          "push_str",
                                          []
                                        |),
                                        [
                                          M.read (| self |);
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::deref::Deref",
                                              Ty.apply
                                                (Ty.path "alloc::borrow::Cow")
                                                []
                                                [ Ty.path "str" ],
                                              [],
                                              "deref",
                                              []
                                            |),
                                            [ s ]
                                          |)
                                        ]
                                      |)))
                                ]
                              |)))
                          | _ => M.impossible "wrong number of arguments"
                          end))
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn extend_one(&mut self, s: Cow<'a, str>) {
            self.push_str(&s);
        }
    *)
    Definition extend_one (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; s ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let s := M.alloc (| s |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push_str", [] |),
                  [
                    M.read (| self |);
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::deref::Deref",
                        Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                        [],
                        "deref",
                        []
                      |),
                      [ s ]
                    |)
                  ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::Extend"
        Self
        (* Trait polymorphic types *)
        [ (* A *) Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ]
        (* Instance *)
        [ ("extend", InstanceField.Method extend); ("extend_one", InstanceField.Method extend_one)
        ].
  End Impl_core_iter_traits_collect_Extend_alloc_borrow_Cow_str_for_alloc_string_String.
  
  Module Impl_core_str_pattern_Pattern_for_ref__alloc_string_String.
    Definition Self : Ty.t := Ty.apply (Ty.path "&") [] [ Ty.path "alloc::string::String" ].
    
    (*     type Searcher<'a> = <&'b str as Pattern>::Searcher<'a>; *)
    Definition _Searcher : Ty.t := Ty.associated.
    
    (*
        fn into_searcher(self, haystack: &str) -> <&'b str as Pattern>::Searcher<'_> {
            self[..].into_searcher(haystack)
        }
    *)
    Definition into_searcher (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; haystack ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let haystack := M.alloc (| haystack |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::str::pattern::Pattern",
              Ty.apply (Ty.path "&") [] [ Ty.path "str" ],
              [],
              "into_searcher",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.read (| haystack |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn is_contained_in(self, haystack: &str) -> bool {
            self[..].is_contained_in(haystack)
        }
    *)
    Definition is_contained_in (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; haystack ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let haystack := M.alloc (| haystack |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::str::pattern::Pattern",
              Ty.apply (Ty.path "&") [] [ Ty.path "str" ],
              [],
              "is_contained_in",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.read (| haystack |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn is_prefix_of(self, haystack: &str) -> bool {
            self[..].is_prefix_of(haystack)
        }
    *)
    Definition is_prefix_of (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; haystack ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let haystack := M.alloc (| haystack |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::str::pattern::Pattern",
              Ty.apply (Ty.path "&") [] [ Ty.path "str" ],
              [],
              "is_prefix_of",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.read (| haystack |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn strip_prefix_of(self, haystack: &str) -> Option<&str> {
            self[..].strip_prefix_of(haystack)
        }
    *)
    Definition strip_prefix_of (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; haystack ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let haystack := M.alloc (| haystack |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::str::pattern::Pattern",
              Ty.apply (Ty.path "&") [] [ Ty.path "str" ],
              [],
              "strip_prefix_of",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.read (| haystack |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn is_suffix_of<'a>(self, haystack: &'a str) -> bool
        where
            Self::Searcher<'a>: core::str::pattern::ReverseSearcher<'a>,
        {
            self[..].is_suffix_of(haystack)
        }
    *)
    Definition is_suffix_of (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; haystack ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let haystack := M.alloc (| haystack |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::str::pattern::Pattern",
              Ty.apply (Ty.path "&") [] [ Ty.path "str" ],
              [],
              "is_suffix_of",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.read (| haystack |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn strip_suffix_of<'a>(self, haystack: &'a str) -> Option<&'a str>
        where
            Self::Searcher<'a>: core::str::pattern::ReverseSearcher<'a>,
        {
            self[..].strip_suffix_of(haystack)
        }
    *)
    Definition strip_suffix_of (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; haystack ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let haystack := M.alloc (| haystack |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::str::pattern::Pattern",
              Ty.apply (Ty.path "&") [] [ Ty.path "str" ],
              [],
              "strip_suffix_of",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.read (| haystack |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::str::pattern::Pattern"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("Searcher", InstanceField.Ty _Searcher);
          ("into_searcher", InstanceField.Method into_searcher);
          ("is_contained_in", InstanceField.Method is_contained_in);
          ("is_prefix_of", InstanceField.Method is_prefix_of);
          ("strip_prefix_of", InstanceField.Method strip_prefix_of);
          ("is_suffix_of", InstanceField.Method is_suffix_of);
          ("strip_suffix_of", InstanceField.Method strip_suffix_of)
        ].
  End Impl_core_str_pattern_Pattern_for_ref__alloc_string_String.
  
  Module Impl_core_cmp_PartialEq_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
                fn eq(&self, other: &$rhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$rhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.path "str" ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_str_for_alloc_string_String.
  
  Module Impl_core_cmp_PartialEq_alloc_string_String_for_str.
    Definition Self : Ty.t := Ty.path "str".
    
    (*
                fn eq(&self, other: &$lhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$lhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_alloc_string_String_for_str.
  
  Module Impl_core_cmp_PartialEq_ref__str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
                fn eq(&self, other: &$rhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.read (| M.read (| other |) |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$rhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.read (| M.read (| other |) |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_ref__str_for_alloc_string_String.
  
  Module Impl_core_cmp_PartialEq_alloc_string_String_for_ref__str.
    Definition Self : Ty.t := Ty.apply (Ty.path "&") [] [ Ty.path "str" ].
    
    (*
                fn eq(&self, other: &$lhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| M.read (| self |) |); Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$lhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| M.read (| self |) |); Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_alloc_string_String_for_ref__str.
  
  Module Impl_core_cmp_PartialEq_str_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
                fn eq(&self, other: &$rhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| self |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$rhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| self |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.path "str" ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_str_for_alloc_borrow_Cow_str.
  
  Module Impl_core_cmp_PartialEq_alloc_borrow_Cow_str_for_str.
    Definition Self : Ty.t := Ty.path "str".
    
    (*
                fn eq(&self, other: &$lhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| other |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$lhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| other |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *)
        [ (* Rhs *) Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_alloc_borrow_Cow_str_for_str.
  
  Module Impl_core_cmp_PartialEq_ref__str_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
                fn eq(&self, other: &$rhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| self |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.read (| M.read (| other |) |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$rhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| self |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.read (| M.read (| other |) |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_ref__str_for_alloc_borrow_Cow_str.
  
  Module Impl_core_cmp_PartialEq_alloc_borrow_Cow_str_for_ref__str.
    Definition Self : Ty.t := Ty.apply (Ty.path "&") [] [ Ty.path "str" ].
    
    (*
                fn eq(&self, other: &$lhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| M.read (| self |) |); Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| other |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$lhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| M.read (| self |) |); Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| other |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *)
        [ (* Rhs *) Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_alloc_borrow_Cow_str_for_ref__str.
  
  Module Impl_core_cmp_PartialEq_alloc_string_String_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
                fn eq(&self, other: &$rhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| self |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$rhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| self |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| other |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_alloc_string_String_for_alloc_borrow_Cow_str.
  
  Module Impl_core_cmp_PartialEq_alloc_borrow_Cow_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
                fn eq(&self, other: &$lhs) -> bool {
                    PartialEq::eq(&self[..], &other[..])
                }
    *)
    Definition eq (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "eq",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| other |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
                fn ne(&self, other: &$lhs) -> bool {
                    PartialEq::ne(&self[..], &other[..])
                }
    *)
    Definition ne (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::cmp::PartialEq",
              Ty.path "str",
              [ Ty.path "str" ],
              "ne",
              []
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "alloc::string::String",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [ M.read (| self |); Value.StructTuple "core::ops::range::RangeFull" [] ]
              |);
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| other |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::cmp::PartialEq"
        Self
        (* Trait polymorphic types *)
        [ (* Rhs *) Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("eq", InstanceField.Method eq); ("ne", InstanceField.Method ne) ].
  End Impl_core_cmp_PartialEq_alloc_borrow_Cow_str_for_alloc_string_String.
  
  Module Impl_core_default_Default_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn default() -> String {
            String::new()
        }
    *)
    Definition default (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [] =>
        ltac:(M.monadic
          (M.call_closure (|
            M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
            []
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::default::Default"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("default", InstanceField.Method default) ].
  End Impl_core_default_Default_for_alloc_string_String.
  
  Module Impl_core_fmt_Display_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            fmt::Display::fmt(&**self, f)
        }
    *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.call_closure (|
            M.get_trait_method (| "core::fmt::Display", Ty.path "str", [], "fmt", [] |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::deref::Deref",
                  Ty.path "alloc::string::String",
                  [],
                  "deref",
                  []
                |),
                [ M.read (| self |) ]
              |);
              M.read (| f |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Display"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Display_for_alloc_string_String.
  
  Module Impl_core_fmt_Debug_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            fmt::Debug::fmt(&**self, f)
        }
    *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.call_closure (|
            M.get_trait_method (| "core::fmt::Debug", Ty.path "str", [], "fmt", [] |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::deref::Deref",
                  Ty.path "alloc::string::String",
                  [],
                  "deref",
                  []
                |),
                [ M.read (| self |) ]
              |);
              M.read (| f |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_alloc_string_String.
  
  Module Impl_core_hash_Hash_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn hash<H: hash::Hasher>(&self, hasher: &mut H) {
            ( **self).hash(hasher)
        }
    *)
    Definition hash (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ H ], [ self; hasher ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let hasher := M.alloc (| hasher |) in
          M.call_closure (|
            M.get_trait_method (| "core::hash::Hash", Ty.path "str", [], "hash", [ H ] |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::deref::Deref",
                  Ty.path "alloc::string::String",
                  [],
                  "deref",
                  []
                |),
                [ M.read (| self |) ]
              |);
              M.read (| hasher |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::hash::Hash"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("hash", InstanceField.Method hash) ].
  End Impl_core_hash_Hash_for_alloc_string_String.
  
  Module Impl_core_ops_arith_Add_ref__str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*     type Output = String; *)
    Definition _Output : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn add(mut self, other: &str) -> String {
            self.push_str(other);
            self
        }
    *)
    Definition add (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push_str", [] |),
                  [ self; M.read (| other |) ]
                |)
              |) in
            self
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::ops::arith::Add"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("Output", InstanceField.Ty _Output); ("add", InstanceField.Method add) ].
  End Impl_core_ops_arith_Add_ref__str_for_alloc_string_String.
  
  Module Impl_core_ops_arith_AddAssign_ref__str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn add_assign(&mut self, other: &str) {
            self.push_str(other);
        }
    *)
    Definition add_assign (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; other ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let other := M.alloc (| other |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push_str", [] |),
                  [ M.read (| self |); M.read (| other |) ]
                |)
              |) in
            M.alloc (| Value.Tuple [] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::ops::arith::AddAssign"
        Self
        (* Trait polymorphic types *) [ (* Rhs *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("add_assign", InstanceField.Method add_assign) ].
  End Impl_core_ops_arith_AddAssign_ref__str_for_alloc_string_String.
  
  Module Impl_core_ops_index_Index_where_core_slice_index_SliceIndex_I_str_I_for_alloc_string_String.
    Definition Self (I : Ty.t) : Ty.t := Ty.path "alloc::string::String".
    
    (*     type Output = I::Output; *)
    Definition _Output (I : Ty.t) : Ty.t := Ty.associated.
    
    (*
        fn index(&self, index: I) -> &I::Output {
            index.index(self.as_str())
        }
    *)
    Definition index (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self I in
      match ε, τ, α with
      | [], [], [ self; index ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let index := M.alloc (| index |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::slice::index::SliceIndex",
              I,
              [ Ty.path "str" ],
              "index",
              []
            |),
            [
              M.read (| index |);
              M.call_closure (|
                M.get_associated_function (| Ty.path "alloc::string::String", "as_str", [] |),
                [ M.read (| self |) ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      forall (I : Ty.t),
      M.IsTraitInstance
        "core::ops::index::Index"
        (Self I)
        (* Trait polymorphic types *) [ (* Idx *) I ]
        (* Instance *)
        [ ("Output", InstanceField.Ty (_Output I)); ("index", InstanceField.Method (index I)) ].
  End Impl_core_ops_index_Index_where_core_slice_index_SliceIndex_I_str_I_for_alloc_string_String.
  
  Module Impl_core_ops_index_IndexMut_where_core_slice_index_SliceIndex_I_str_I_for_alloc_string_String.
    Definition Self (I : Ty.t) : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn index_mut(&mut self, index: I) -> &mut I::Output {
            index.index_mut(self.as_mut_str())
        }
    *)
    Definition index_mut (I : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self I in
      match ε, τ, α with
      | [], [], [ self; index ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let index := M.alloc (| index |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::slice::index::SliceIndex",
              I,
              [ Ty.path "str" ],
              "index_mut",
              []
            |),
            [
              M.read (| index |);
              M.call_closure (|
                M.get_associated_function (| Ty.path "alloc::string::String", "as_mut_str", [] |),
                [ M.read (| self |) ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      forall (I : Ty.t),
      M.IsTraitInstance
        "core::ops::index::IndexMut"
        (Self I)
        (* Trait polymorphic types *) [ (* Idx *) I ]
        (* Instance *) [ ("index_mut", InstanceField.Method (index_mut I)) ].
  End Impl_core_ops_index_IndexMut_where_core_slice_index_SliceIndex_I_str_I_for_alloc_string_String.
  
  Module Impl_core_ops_deref_Deref_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*     type Target = str; *)
    Definition _Target : Ty.t := Ty.path "str".
    
    (*
        fn deref(&self) -> &str {
            unsafe { str::from_utf8_unchecked(&self.vec) }
        }
    *)
    Definition deref (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_function (| "core::str::converts::from_utf8_unchecked", [] |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::deref::Deref",
                  Ty.apply
                    (Ty.path "alloc::vec::Vec")
                    []
                    [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                  [],
                  "deref",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "alloc::string::String",
                    "vec"
                  |)
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::ops::deref::Deref"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [ ("Target", InstanceField.Ty _Target); ("deref", InstanceField.Method deref) ].
  End Impl_core_ops_deref_Deref_for_alloc_string_String.
  
  Module Impl_core_ops_deref_DerefPure_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::ops::deref::DerefPure"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_ops_deref_DerefPure_for_alloc_string_String.
  
  Module Impl_core_ops_deref_DerefMut_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn deref_mut(&mut self) -> &mut str {
            unsafe { str::from_utf8_unchecked_mut(&mut *self.vec) }
        }
    *)
    Definition deref_mut (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_function (| "core::str::converts::from_utf8_unchecked_mut", [] |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::deref::DerefMut",
                  Ty.apply
                    (Ty.path "alloc::vec::Vec")
                    []
                    [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                  [],
                  "deref_mut",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (| self |),
                    "alloc::string::String",
                    "vec"
                  |)
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::ops::deref::DerefMut"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("deref_mut", InstanceField.Method deref_mut) ].
  End Impl_core_ops_deref_DerefMut_for_alloc_string_String.
  
  Axiom ParseError : (Ty.path "alloc::string::ParseError") = (Ty.path "core::convert::Infallible").
  
  Module Impl_core_str_traits_FromStr_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*     type Err = core::convert::Infallible; *)
    Definition _Err : Ty.t := Ty.path "core::convert::Infallible".
    
    (*
        fn from_str(s: &str) -> Result<String, Self::Err> {
            Ok(String::from(s))
        }
    *)
    Definition from_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          Value.StructTuple
            "core::result::Result::Ok"
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::convert::From",
                  Ty.path "alloc::string::String",
                  [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
                  "from",
                  []
                |),
                [ M.read (| s |) ]
              |)
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::str::traits::FromStr"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [ ("Err", InstanceField.Ty _Err); ("from_str", InstanceField.Method from_str) ].
  End Impl_core_str_traits_FromStr_for_alloc_string_String.
  
  (* Trait *)
  (* Empty module 'ToString' *)
  
  Module Impl_alloc_string_ToString_where_core_fmt_Display_T_where_core_marker_Sized_T_for_T.
    Definition Self (T : Ty.t) : Ty.t := T.
    
    (*
        default fn to_string(&self) -> String {
            let mut buf = String::new();
            let mut formatter = core::fmt::Formatter::new(&mut buf);
            // Bypass format_args!() to avoid write_str with zero-length strs
            fmt::Display::fmt(self, &mut formatter)
                .expect("a Display implementation returned an error unexpectedly");
            buf
        }
    *)
    Definition to_string (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 (|
            let~ buf :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "new", [] |),
                  []
                |)
              |) in
            let~ formatter :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "core::fmt::Formatter", "new", [] |),
                  [ buf ]
                |)
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "core::result::Result")
                      []
                      [ Ty.tuple []; Ty.path "core::fmt::Error" ],
                    "expect",
                    []
                  |),
                  [
                    M.call_closure (|
                      M.get_trait_method (| "core::fmt::Display", T, [], "fmt", [] |),
                      [ M.read (| self |); formatter ]
                    |);
                    M.read (|
                      Value.String "a Display implementation returned an error unexpectedly"
                    |)
                  ]
                |)
              |) in
            buf
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      forall (T : Ty.t),
      M.IsTraitInstance
        "alloc::string::ToString"
        (Self T)
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method (to_string T)) ].
  End Impl_alloc_string_ToString_where_core_fmt_Display_T_where_core_marker_Sized_T_for_T.
  
  Module Impl_alloc_string_ToString_for_core_ascii_ascii_char_AsciiChar.
    Definition Self : Ty.t := Ty.path "core::ascii::ascii_char::AsciiChar".
    
    (*
        fn to_string(&self) -> String {
            self.as_str().to_owned()
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (| "alloc::borrow::ToOwned", Ty.path "str", [], "to_owned", [] |),
            [
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "core::ascii::ascii_char::AsciiChar",
                  "as_str",
                  []
                |),
                [ M.read (| self |) ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_core_ascii_ascii_char_AsciiChar.
  
  Module Impl_alloc_string_ToString_for_char.
    Definition Self : Ty.t := Ty.path "char".
    
    (*
        fn to_string(&self) -> String {
            String::from(self.encode_utf8(&mut [0; 4]))
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&mut") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.call_closure (|
                M.get_associated_function (| Ty.path "char", "encode_utf8", [] |),
                [
                  M.read (| M.read (| self |) |);
                  M.alloc (|
                    repeat (| Value.Integer IntegerKind.U8 0, Value.Integer IntegerKind.Usize 4 |)
                  |)
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_char.
  
  Module Impl_alloc_string_ToString_for_bool.
    Definition Self : Ty.t := Ty.path "bool".
    
    (*
        fn to_string(&self) -> String {
            String::from(if *self { "true" } else { "false" })
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.read (| self |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        Value.String "true"));
                    fun γ => ltac:(M.monadic (M.alloc (| M.read (| Value.String "false" |) |)))
                  ]
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_bool.
  
  Module Impl_alloc_string_ToString_for_u8.
    Definition Self : Ty.t := Ty.path "u8".
    
    (*
        fn to_string(&self) -> String {
            let mut buf = String::with_capacity(3);
            let mut n = *self;
            if n >= 10 {
                if n >= 100 {
                    buf.push((b'0' + n / 100) as char);
                    n %= 100;
                }
                buf.push((b'0' + n / 10) as char);
                n %= 10;
            }
            buf.push((b'0' + n) as char);
            buf
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            let~ buf :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "alloc::string::String",
                    "with_capacity",
                    []
                  |),
                  [ Value.Integer IntegerKind.Usize 3 ]
                |)
              |) in
            let~ n := M.copy (| M.read (| self |) |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            BinOp.ge (| M.read (| n |), Value.Integer IntegerKind.U8 10 |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      let~ _ :=
                        M.match_operator (|
                          M.alloc (| Value.Tuple [] |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ :=
                                  M.use
                                    (M.alloc (|
                                      BinOp.ge (|
                                        M.read (| n |),
                                        Value.Integer IntegerKind.U8 100
                                      |)
                                    |)) in
                                let _ :=
                                  M.is_constant_or_break_match (|
                                    M.read (| γ |),
                                    Value.Bool true
                                  |) in
                                let~ _ :=
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "alloc::string::String",
                                        "push",
                                        []
                                      |),
                                      [
                                        buf;
                                        M.rust_cast
                                          (BinOp.Wrap.add (|
                                            M.read (| UnsupportedLiteral |),
                                            BinOp.Wrap.div (|
                                              M.read (| n |),
                                              Value.Integer IntegerKind.U8 100
                                            |)
                                          |))
                                      ]
                                    |)
                                  |) in
                                let~ _ :=
                                  let β := n in
                                  M.write (|
                                    β,
                                    BinOp.Wrap.rem (|
                                      M.read (| β |),
                                      Value.Integer IntegerKind.U8 100
                                    |)
                                  |) in
                                M.alloc (| Value.Tuple [] |)));
                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                          ]
                        |) in
                      let~ _ :=
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "push",
                              []
                            |),
                            [
                              buf;
                              M.rust_cast
                                (BinOp.Wrap.add (|
                                  M.read (| UnsupportedLiteral |),
                                  BinOp.Wrap.div (|
                                    M.read (| n |),
                                    Value.Integer IntegerKind.U8 10
                                  |)
                                |))
                            ]
                          |)
                        |) in
                      let~ _ :=
                        let β := n in
                        M.write (|
                          β,
                          BinOp.Wrap.rem (| M.read (| β |), Value.Integer IntegerKind.U8 10 |)
                        |) in
                      M.alloc (| Value.Tuple [] |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push", [] |),
                  [
                    buf;
                    M.rust_cast
                      (BinOp.Wrap.add (| M.read (| UnsupportedLiteral |), M.read (| n |) |))
                  ]
                |)
              |) in
            buf
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_u8.
  
  Module Impl_alloc_string_ToString_for_i8.
    Definition Self : Ty.t := Ty.path "i8".
    
    (*
        fn to_string(&self) -> String {
            let mut buf = String::with_capacity(4);
            if self.is_negative() {
                buf.push('-');
            }
            let mut n = self.unsigned_abs();
            if n >= 10 {
                if n >= 100 {
                    buf.push('1');
                    n -= 100;
                }
                buf.push((b'0' + n / 10) as char);
                n %= 10;
            }
            buf.push((b'0' + n) as char);
            buf
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            let~ buf :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "alloc::string::String",
                    "with_capacity",
                    []
                  |),
                  [ Value.Integer IntegerKind.Usize 4 ]
                |)
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "i8", "is_negative", [] |),
                              [ M.read (| M.read (| self |) |) ]
                            |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      let~ _ :=
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "push",
                              []
                            |),
                            [ buf; Value.UnicodeChar 45 ]
                          |)
                        |) in
                      M.alloc (| Value.Tuple [] |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ n :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "i8", "unsigned_abs", [] |),
                  [ M.read (| M.read (| self |) |) ]
                |)
              |) in
            let~ _ :=
              M.match_operator (|
                M.alloc (| Value.Tuple [] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ :=
                        M.use
                          (M.alloc (|
                            BinOp.ge (| M.read (| n |), Value.Integer IntegerKind.U8 10 |)
                          |)) in
                      let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                      let~ _ :=
                        M.match_operator (|
                          M.alloc (| Value.Tuple [] |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ :=
                                  M.use
                                    (M.alloc (|
                                      BinOp.ge (|
                                        M.read (| n |),
                                        Value.Integer IntegerKind.U8 100
                                      |)
                                    |)) in
                                let _ :=
                                  M.is_constant_or_break_match (|
                                    M.read (| γ |),
                                    Value.Bool true
                                  |) in
                                let~ _ :=
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "alloc::string::String",
                                        "push",
                                        []
                                      |),
                                      [ buf; Value.UnicodeChar 49 ]
                                    |)
                                  |) in
                                let~ _ :=
                                  let β := n in
                                  M.write (|
                                    β,
                                    BinOp.Wrap.sub (|
                                      M.read (| β |),
                                      Value.Integer IntegerKind.U8 100
                                    |)
                                  |) in
                                M.alloc (| Value.Tuple [] |)));
                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                          ]
                        |) in
                      let~ _ :=
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "alloc::string::String",
                              "push",
                              []
                            |),
                            [
                              buf;
                              M.rust_cast
                                (BinOp.Wrap.add (|
                                  M.read (| UnsupportedLiteral |),
                                  BinOp.Wrap.div (|
                                    M.read (| n |),
                                    Value.Integer IntegerKind.U8 10
                                  |)
                                |))
                            ]
                          |)
                        |) in
                      let~ _ :=
                        let β := n in
                        M.write (|
                          β,
                          BinOp.Wrap.rem (| M.read (| β |), Value.Integer IntegerKind.U8 10 |)
                        |) in
                      M.alloc (| Value.Tuple [] |)));
                  fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                ]
              |) in
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push", [] |),
                  [
                    buf;
                    M.rust_cast
                      (BinOp.Wrap.add (| M.read (| UnsupportedLiteral |), M.read (| n |) |))
                  ]
                |)
              |) in
            buf
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_i8.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [
                  Ty.apply
                    (Ty.path "&")
                    []
                    [
                      Ty.apply
                        (Ty.path "&")
                        []
                        [
                          Ty.apply
                            (Ty.path "&")
                            []
                            [
                              Ty.apply
                                (Ty.path "&")
                                []
                                [
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "&")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "&")
                                                []
                                                [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
                                            ]
                                        ]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.read (|
                  M.read (|
                    M.read (|
                      M.read (|
                        M.read (|
                          M.read (|
                            M.read (|
                              M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |)
                            |)
                          |)
                        |)
                      |)
                    |)
                  |)
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [
                  Ty.apply
                    (Ty.path "&")
                    []
                    [
                      Ty.apply
                        (Ty.path "&")
                        []
                        [
                          Ty.apply
                            (Ty.path "&")
                            []
                            [
                              Ty.apply
                                (Ty.path "&")
                                []
                                [
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "&")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
                                        ]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.read (|
                  M.read (|
                    M.read (|
                      M.read (|
                        M.read (|
                          M.read (|
                            M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |)
                          |)
                        |)
                      |)
                    |)
                  |)
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [
                  Ty.apply
                    (Ty.path "&")
                    []
                    [
                      Ty.apply
                        (Ty.path "&")
                        []
                        [
                          Ty.apply
                            (Ty.path "&")
                            []
                            [
                              Ty.apply
                                (Ty.path "&")
                                []
                                [
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [
                                      Ty.apply
                                        (Ty.path "&")
                                        []
                                        [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.read (|
                  M.read (|
                    M.read (|
                      M.read (|
                        M.read (|
                          M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |)
                        |)
                      |)
                    |)
                  |)
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [
                  Ty.apply
                    (Ty.path "&")
                    []
                    [
                      Ty.apply
                        (Ty.path "&")
                        []
                        [
                          Ty.apply
                            (Ty.path "&")
                            []
                            [
                              Ty.apply
                                (Ty.path "&")
                                []
                                [
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.read (|
                  M.read (|
                    M.read (|
                      M.read (|
                        M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |)
                      |)
                    |)
                  |)
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [
                  Ty.apply
                    (Ty.path "&")
                    []
                    [
                      Ty.apply
                        (Ty.path "&")
                        []
                        [
                          Ty.apply
                            (Ty.path "&")
                            []
                            [
                              Ty.apply
                                (Ty.path "&")
                                []
                                [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
                            ]
                        ]
                    ]
                ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.read (|
                  M.read (|
                    M.read (|
                      M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |)
                    |)
                  |)
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [
                  Ty.apply
                    (Ty.path "&")
                    []
                    [
                      Ty.apply
                        (Ty.path "&")
                        []
                        [ Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
                        ]
                    ]
                ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.read (|
                  M.read (| M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |) |)
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [
                  Ty.apply
                    (Ty.path "&")
                    []
                    [ Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ] ]
                ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [
              M.read (|
                M.read (| M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |) |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [
              Ty.apply
                (Ty.path "&")
                []
                [ Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ] ]
            ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [ M.read (| M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |) |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [
          Ty.apply
            (Ty.path "&")
            []
            [ Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ] ]
        ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [ M.read (| M.read (| M.read (| M.read (| M.read (| self |) |) |) |) |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply
        (Ty.path "&")
        []
        [ Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ] ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [ M.read (| M.read (| M.read (| M.read (| self |) |) |) |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__ref__str.
    Definition Self : Ty.t :=
      Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [ M.read (| M.read (| M.read (| self |) |) |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__ref__str.
  
  Module Impl_alloc_string_ToString_for_ref__str.
    Definition Self : Ty.t := Ty.apply (Ty.path "&") [] [ Ty.path "str" ].
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [ M.read (| M.read (| self |) |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_ref__str.
  
  Module Impl_alloc_string_ToString_for_str.
    Definition Self : Ty.t := Ty.path "str".
    
    (*
                    fn to_string(&self) -> String {
                        String::from(to_string_expr_wrap_in_deref!(self ; $($x)* ))
                    }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::convert::From",
              Ty.path "alloc::string::String",
              [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
              "from",
              []
            |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_str.
  
  Module Impl_alloc_string_ToString_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
        fn to_string(&self) -> String {
            self[..].to_owned()
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (| "alloc::borrow::ToOwned", Ty.path "str", [], "to_owned", [] |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::index::Index",
                  Ty.path "str",
                  [ Ty.path "core::ops::range::RangeFull" ],
                  "index",
                  []
                |),
                [
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::ops::deref::Deref",
                      Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
                      [],
                      "deref",
                      []
                    |),
                    [ M.read (| self |) ]
                  |);
                  Value.StructTuple "core::ops::range::RangeFull" []
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_alloc_borrow_Cow_str.
  
  Module Impl_alloc_string_ToString_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn to_string(&self) -> String {
            self.to_owned()
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "alloc::borrow::ToOwned",
              Ty.path "alloc::string::String",
              [],
              "to_owned",
              []
            |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_alloc_string_String.
  
  Module Impl_alloc_string_ToString_for_core_fmt_Arguments.
    Definition Self : Ty.t := Ty.path "core::fmt::Arguments".
    
    (*
        fn to_string(&self) -> String {
            crate::fmt::format( *self)
        }
    *)
    Definition to_string (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_function (| "alloc::fmt::format", [] |),
            [ M.read (| M.read (| self |) |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "alloc::string::ToString"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("to_string", InstanceField.Method to_string) ].
  End Impl_alloc_string_ToString_for_core_fmt_Arguments.
  
  Module Impl_core_convert_AsRef_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn as_ref(&self) -> &str {
            self
        }
    *)
    Definition as_ref (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::Deref",
              Ty.path "alloc::string::String",
              [],
              "deref",
              []
            |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::AsRef"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "str" ]
        (* Instance *) [ ("as_ref", InstanceField.Method as_ref) ].
  End Impl_core_convert_AsRef_str_for_alloc_string_String.
  
  Module Impl_core_convert_AsMut_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn as_mut(&mut self) -> &mut str {
            self
        }
    *)
    Definition as_mut (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::ops::deref::DerefMut",
              Ty.path "alloc::string::String",
              [],
              "deref_mut",
              []
            |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::AsMut"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "str" ]
        (* Instance *) [ ("as_mut", InstanceField.Method as_mut) ].
  End Impl_core_convert_AsMut_str_for_alloc_string_String.
  
  Module Impl_core_convert_AsRef_slice_u8_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn as_ref(&self) -> &[u8] {
            self.as_bytes()
        }
    *)
    Definition as_ref (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (| Ty.path "alloc::string::String", "as_bytes", [] |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::AsRef"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ]
        (* Instance *) [ ("as_ref", InstanceField.Method as_ref) ].
  End Impl_core_convert_AsRef_slice_u8_for_alloc_string_String.
  
  Module Impl_core_convert_From_ref__str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from(s: &str) -> String {
            s.to_owned()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          M.call_closure (|
            M.get_trait_method (| "alloc::borrow::ToOwned", Ty.path "str", [], "to_owned", [] |),
            [ M.read (| s |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_ref__str_for_alloc_string_String.
  
  Module Impl_core_convert_From_ref_mut_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from(s: &mut str) -> String {
            s.to_owned()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          M.call_closure (|
            M.get_trait_method (| "alloc::borrow::ToOwned", Ty.path "str", [], "to_owned", [] |),
            [ M.read (| s |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "&mut") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_ref_mut_str_for_alloc_string_String.
  
  Module Impl_core_convert_From_ref__alloc_string_String_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from(s: &String) -> String {
            s.clone()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::clone::Clone",
              Ty.path "alloc::string::String",
              [],
              "clone",
              []
            |),
            [ M.read (| s |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *)
        [ (* T *) Ty.apply (Ty.path "&") [] [ Ty.path "alloc::string::String" ] ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_ref__alloc_string_String_for_alloc_string_String.
  
  Module Impl_core_convert_From_alloc_boxed_Box_str_alloc_alloc_Global_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from(s: Box<str>) -> String {
            s.into_string()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          M.call_closure (|
            M.get_associated_function (| Ty.path "str", "into_string", [] |),
            [ M.read (| s |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *)
        [
          (* T *)
          Ty.apply
            (Ty.path "alloc::boxed::Box")
            []
            [ Ty.path "str"; Ty.path "alloc::alloc::Global" ]
        ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_alloc_boxed_Box_str_alloc_alloc_Global_for_alloc_string_String.
  
  Module Impl_core_convert_From_alloc_string_String_for_alloc_boxed_Box_str_alloc_alloc_Global.
    Definition Self : Ty.t :=
      Ty.apply (Ty.path "alloc::boxed::Box") [] [ Ty.path "str"; Ty.path "alloc::alloc::Global" ].
    
    (*
        fn from(s: String) -> Box<str> {
            s.into_boxed_str()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          M.call_closure (|
            M.get_associated_function (| Ty.path "alloc::string::String", "into_boxed_str", [] |),
            [ M.read (| s |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_alloc_string_String_for_alloc_boxed_Box_str_alloc_alloc_Global.
  
  Module Impl_core_convert_From_alloc_borrow_Cow_str_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from(s: Cow<'a, str>) -> String {
            s.into_owned()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ],
              "into_owned",
              []
            |),
            [ M.read (| s |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *)
        [ (* T *) Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_alloc_borrow_Cow_str_for_alloc_string_String.
  
  Module Impl_core_convert_From_ref__str_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
        fn from(s: &'a str) -> Cow<'a, str> {
            Cow::Borrowed(s)
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          Value.StructTuple "alloc::borrow::Cow::Borrowed" [ M.read (| s |) ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_ref__str_for_alloc_borrow_Cow_str.
  
  Module Impl_core_convert_From_alloc_string_String_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
        fn from(s: String) -> Cow<'a, str> {
            Cow::Owned(s)
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          Value.StructTuple "alloc::borrow::Cow::Owned" [ M.read (| s |) ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_alloc_string_String_for_alloc_borrow_Cow_str.
  
  Module Impl_core_convert_From_ref__alloc_string_String_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
        fn from(s: &'a String) -> Cow<'a, str> {
            Cow::Borrowed(s.as_str())
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ s ] =>
        ltac:(M.monadic
          (let s := M.alloc (| s |) in
          Value.StructTuple
            "alloc::borrow::Cow::Borrowed"
            [
              M.call_closure (|
                M.get_associated_function (| Ty.path "alloc::string::String", "as_str", [] |),
                [ M.read (| s |) ]
              |)
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *)
        [ (* T *) Ty.apply (Ty.path "&") [] [ Ty.path "alloc::string::String" ] ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_ref__alloc_string_String_for_alloc_borrow_Cow_str.
  
  Module Impl_core_iter_traits_collect_FromIterator_char_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
        fn from_iter<I: IntoIterator<Item = char>>(it: I) -> Cow<'a, str> {
            Cow::Owned(FromIterator::from_iter(it))
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ it ] =>
        ltac:(M.monadic
          (let it := M.alloc (| it |) in
          Value.StructTuple
            "alloc::borrow::Cow::Owned"
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::collect::FromIterator",
                  Ty.path "alloc::string::String",
                  [ Ty.path "char" ],
                  "from_iter",
                  [ I ]
                |),
                [ M.read (| it |) ]
              |)
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.path "char" ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_char_for_alloc_borrow_Cow_str.
  
  Module Impl_core_iter_traits_collect_FromIterator_ref__str_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
        fn from_iter<I: IntoIterator<Item = &'b str>>(it: I) -> Cow<'a, str> {
            Cow::Owned(FromIterator::from_iter(it))
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ it ] =>
        ltac:(M.monadic
          (let it := M.alloc (| it |) in
          Value.StructTuple
            "alloc::borrow::Cow::Owned"
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::collect::FromIterator",
                  Ty.path "alloc::string::String",
                  [ Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ],
                  "from_iter",
                  [ I ]
                |),
                [ M.read (| it |) ]
              |)
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.apply (Ty.path "&") [] [ Ty.path "str" ] ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_ref__str_for_alloc_borrow_Cow_str.
  
  Module Impl_core_iter_traits_collect_FromIterator_alloc_string_String_for_alloc_borrow_Cow_str.
    Definition Self : Ty.t := Ty.apply (Ty.path "alloc::borrow::Cow") [] [ Ty.path "str" ].
    
    (*
        fn from_iter<I: IntoIterator<Item = String>>(it: I) -> Cow<'a, str> {
            Cow::Owned(FromIterator::from_iter(it))
        }
    *)
    Definition from_iter (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ _ as I ], [ it ] =>
        ltac:(M.monadic
          (let it := M.alloc (| it |) in
          Value.StructTuple
            "alloc::borrow::Cow::Owned"
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::iter::traits::collect::FromIterator",
                  Ty.path "alloc::string::String",
                  [ Ty.path "alloc::string::String" ],
                  "from_iter",
                  [ I ]
                |),
                [ M.read (| it |) ]
              |)
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::collect::FromIterator"
        Self
        (* Trait polymorphic types *) [ (* A *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("from_iter", InstanceField.Method from_iter) ].
  End Impl_core_iter_traits_collect_FromIterator_alloc_string_String_for_alloc_borrow_Cow_str.
  
  Module Impl_core_convert_From_alloc_string_String_for_alloc_vec_Vec_u8_alloc_alloc_Global.
    Definition Self : Ty.t :=
      Ty.apply (Ty.path "alloc::vec::Vec") [] [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ].
    
    (*
        fn from(string: String) -> Vec<u8> {
            string.into_bytes()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ string ] =>
        ltac:(M.monadic
          (let string := M.alloc (| string |) in
          M.call_closure (|
            M.get_associated_function (| Ty.path "alloc::string::String", "into_bytes", [] |),
            [ M.read (| string |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "alloc::string::String" ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_alloc_string_String_for_alloc_vec_Vec_u8_alloc_alloc_Global.
  
  Module Impl_core_fmt_Write_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn write_str(&mut self, s: &str) -> fmt::Result {
            self.push_str(s);
            Ok(())
        }
    *)
    Definition write_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; s ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let s := M.alloc (| s |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push_str", [] |),
                  [ M.read (| self |); M.read (| s |) ]
                |)
              |) in
            M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn write_char(&mut self, c: char) -> fmt::Result {
            self.push(c);
            Ok(())
        }
    *)
    Definition write_char (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; c ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let c := M.alloc (| c |) in
          M.read (|
            let~ _ :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "push", [] |),
                  [ M.read (| self |); M.read (| c |) ]
                |)
              |) in
            M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Write"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("write_str", InstanceField.Method write_str);
          ("write_char", InstanceField.Method write_char)
        ].
  End Impl_core_fmt_Write_for_alloc_string_String.
  
  (* StructRecord
    {
      name := "Drain";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("string", Ty.apply (Ty.path "*mut") [] [ Ty.path "alloc::string::String" ]);
          ("start", Ty.path "usize");
          ("end_", Ty.path "usize");
          ("iter", Ty.path "core::str::iter::Chars")
        ];
    } *)
  
  Module Impl_core_fmt_Debug_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    (*
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_tuple("Drain").field(&self.as_str()).finish()
        }
    *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      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::DebugTuple", "finish", [] |),
            [
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "core::fmt::builders::DebugTuple",
                  "field",
                  []
                |),
                [
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "core::fmt::Formatter",
                        "debug_tuple",
                        []
                      |),
                      [ M.read (| f |); M.read (| Value.String "Drain" |) ]
                    |)
                  |);
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (| Ty.path "alloc::string::Drain", "as_str", [] |),
                      [ M.read (| self |) ]
                    |)
                  |)
                ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_alloc_string_Drain.
  
  Module Impl_core_marker_Sync_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Sync"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Sync_for_alloc_string_Drain.
  
  Module Impl_core_marker_Send_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::marker::Send"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_marker_Send_for_alloc_string_Drain.
  
  Module Impl_core_ops_drop_Drop_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    (*
        fn drop(&mut self) {
            unsafe {
                // Use Vec::drain. "Reaffirm" the bounds checks to avoid
                // panic code being inserted again.
                let self_vec = ( *self.string).as_mut_vec();
                if self.start <= self.end && self.end <= self_vec.len() {
                    self_vec.drain(self.start..self.end);
                }
            }
        }
    *)
    Definition drop (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            let~ self_vec :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (| Ty.path "alloc::string::String", "as_mut_vec", [] |),
                  [
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "alloc::string::Drain",
                        "string"
                      |)
                    |)
                  ]
                |)
              |) in
            M.match_operator (|
              M.alloc (| Value.Tuple [] |),
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ :=
                      M.use
                        (M.alloc (|
                          LogicalOp.and (|
                            BinOp.le (|
                              M.read (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "alloc::string::Drain",
                                  "start"
                                |)
                              |),
                              M.read (|
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "alloc::string::Drain",
                                  "end"
                                |)
                              |)
                            |),
                            ltac:(M.monadic
                              (BinOp.le (|
                                M.read (|
                                  M.SubPointer.get_struct_record_field (|
                                    M.read (| self |),
                                    "alloc::string::Drain",
                                    "end"
                                  |)
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "alloc::vec::Vec")
                                      []
                                      [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| self_vec |) ]
                                |)
                              |)))
                          |)
                        |)) in
                    let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                    let~ _ :=
                      M.alloc (|
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "alloc::vec::Vec")
                              []
                              [ Ty.path "u8"; Ty.path "alloc::alloc::Global" ],
                            "drain",
                            [ Ty.apply (Ty.path "core::ops::range::Range") [] [ Ty.path "usize" ] ]
                          |),
                          [
                            M.read (| self_vec |);
                            Value.StructRecord
                              "core::ops::range::Range"
                              [
                                ("start",
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "alloc::string::Drain",
                                      "start"
                                    |)
                                  |));
                                ("end_",
                                  M.read (|
                                    M.SubPointer.get_struct_record_field (|
                                      M.read (| self |),
                                      "alloc::string::Drain",
                                      "end"
                                    |)
                                  |))
                              ]
                          ]
                        |)
                      |) in
                    M.alloc (| Value.Tuple [] |)));
                fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::ops::drop::Drop"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("drop", InstanceField.Method drop) ].
  End Impl_core_ops_drop_Drop_for_alloc_string_Drain.
  
  Module Impl_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    (*
        pub fn as_str(&self) -> &str {
            self.iter.as_str()
        }
    *)
    Definition as_str (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (| Ty.path "core::str::iter::Chars", "as_str", [] |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::Drain",
                "iter"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_as_str : M.IsAssociatedFunction Self "as_str" as_str.
  End Impl_alloc_string_Drain.
  
  Module Impl_core_convert_AsRef_str_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    (*
        fn as_ref(&self) -> &str {
            self.as_str()
        }
    *)
    Definition as_ref (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (| Ty.path "alloc::string::Drain", "as_str", [] |),
            [ M.read (| self |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::AsRef"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "str" ]
        (* Instance *) [ ("as_ref", InstanceField.Method as_ref) ].
  End Impl_core_convert_AsRef_str_for_alloc_string_Drain.
  
  Module Impl_core_convert_AsRef_slice_u8_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    (*
        fn as_ref(&self) -> &[u8] {
            self.as_str().as_bytes()
        }
    *)
    Definition as_ref (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (| Ty.path "str", "as_bytes", [] |),
            [
              M.call_closure (|
                M.get_associated_function (| Ty.path "alloc::string::Drain", "as_str", [] |),
                [ M.read (| self |) ]
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::AsRef"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ]
        (* Instance *) [ ("as_ref", InstanceField.Method as_ref) ].
  End Impl_core_convert_AsRef_slice_u8_for_alloc_string_Drain.
  
  Module Impl_core_iter_traits_iterator_Iterator_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    (*     type Item = char; *)
    Definition _Item : Ty.t := Ty.path "char".
    
    (*
        fn next(&mut self) -> Option<char> {
            self.iter.next()
        }
    *)
    Definition next (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::iter::traits::iterator::Iterator",
              Ty.path "core::str::iter::Chars",
              [],
              "next",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::Drain",
                "iter"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn size_hint(&self) -> (usize, Option<usize>) {
            self.iter.size_hint()
        }
    *)
    Definition size_hint (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::iter::traits::iterator::Iterator",
              Ty.path "core::str::iter::Chars",
              [],
              "size_hint",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::Drain",
                "iter"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn last(mut self) -> Option<char> {
            self.next_back()
        }
    *)
    Definition last (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::iter::traits::double_ended::DoubleEndedIterator",
              Ty.path "alloc::string::Drain",
              [],
              "next_back",
              []
            |),
            [ self ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::iterator::Iterator"
        Self
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("Item", InstanceField.Ty _Item);
          ("next", InstanceField.Method next);
          ("size_hint", InstanceField.Method size_hint);
          ("last", InstanceField.Method last)
        ].
  End Impl_core_iter_traits_iterator_Iterator_for_alloc_string_Drain.
  
  Module Impl_core_iter_traits_double_ended_DoubleEndedIterator_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    (*
        fn next_back(&mut self) -> Option<char> {
            self.iter.next_back()
        }
    *)
    Definition next_back (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_trait_method (|
              "core::iter::traits::double_ended::DoubleEndedIterator",
              Ty.path "core::str::iter::Chars",
              [],
              "next_back",
              []
            |),
            [
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "alloc::string::Drain",
                "iter"
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::double_ended::DoubleEndedIterator"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("next_back", InstanceField.Method next_back) ].
  End Impl_core_iter_traits_double_ended_DoubleEndedIterator_for_alloc_string_Drain.
  
  Module Impl_core_iter_traits_marker_FusedIterator_for_alloc_string_Drain.
    Definition Self : Ty.t := Ty.path "alloc::string::Drain".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::iter::traits::marker::FusedIterator"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_iter_traits_marker_FusedIterator_for_alloc_string_Drain.
  
  Module Impl_core_convert_From_char_for_alloc_string_String.
    Definition Self : Ty.t := Ty.path "alloc::string::String".
    
    (*
        fn from(c: char) -> Self {
            c.to_string()
        }
    *)
    Definition from (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ c ] =>
        ltac:(M.monadic
          (let c := M.alloc (| c |) in
          M.call_closure (|
            M.get_trait_method (| "alloc::string::ToString", Ty.path "char", [], "to_string", [] |),
            [ c ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::convert::From"
        Self
        (* Trait polymorphic types *) [ (* T *) Ty.path "char" ]
        (* Instance *) [ ("from", InstanceField.Method from) ].
  End Impl_core_convert_From_char_for_alloc_string_String.
End string.
