(** THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS *)
(** [traits] *)
Require Import Primitives.
Import Primitives.
Require Import Coq.ZArith.ZArith.
Require Import List.
Import ListNotations.
Local Open Scope Primitives_scope.
Module Traits.

(** [core::result::Result]
    Source: '/rustc/library/core/src/result.rs', lines 557:0-557:21
    Name pattern: [core::result::Result]
    Visibility: public *)
Inductive core_result_Result_t (T : Type) (E : Type) :=
| Core_result_Result_Ok : T -> core_result_Result_t T E
| Core_result_Result_Err : E -> core_result_Result_t T E
.

Arguments Core_result_Result_Ok { _ } { _ }.
Arguments Core_result_Result_Err { _ } { _ }.

(** Trait declaration: [traits::BoolTrait]
    Source: 'tests/src/traits.rs', lines 3:0-11:1
    Visibility: public *)
Record BoolTrait_t (Self : Type) := mkBoolTrait_t {
  BoolTrait_t_get_bool : Self -> result bool;
  BoolTrait_t_ret_true : Self -> result bool;
}.

Arguments mkBoolTrait_t { _ }.
Arguments BoolTrait_t_get_bool { _ } _.
Arguments BoolTrait_t_ret_true { _ } _.

(** [traits::BoolTrait::ret_true]:
    Source: 'tests/src/traits.rs', lines 8:4-10:5
    Visibility: public *)
Definition boolTrait_ret_true_default
  {Self : Type} (self : Self) : result bool :=
  Ok true
.

(** [traits::{impl traits::BoolTrait for bool}::get_bool]:
    Source: 'tests/src/traits.rs', lines 14:4-16:5
    Visibility: public *)
Definition Bool_Insts_TraitsBoolTrait_get_bool (self : bool) : result bool :=
  Ok self
.

(** Trait implementation: [traits::{impl traits::BoolTrait for bool}]
    Source: 'tests/src/traits.rs', lines 13:0-17:1 *)
Definition Bool_Insts_TraitsBoolTrait : BoolTrait_t bool := {|
  BoolTrait_t_get_bool := Bool_Insts_TraitsBoolTrait_get_bool;
  BoolTrait_t_ret_true := boolTrait_ret_true_default;
|}.

(** [traits::test_bool_trait_bool]:
    Source: 'tests/src/traits.rs', lines 19:0-21:1
    Visibility: public *)
Definition test_bool_trait_bool (x : bool) : result bool :=
  b <- Bool_Insts_TraitsBoolTrait_get_bool x;
  if b then boolTrait_ret_true_default x else Ok false
.

(** [traits::{impl traits::BoolTrait for core::option::Option<T>}::get_bool]:
    Source: 'tests/src/traits.rs', lines 25:4-30:5
    Visibility: public *)
Definition core_option_Option_Insts_TraitsBoolTrait_get_bool
  {T : Type} (self : option T) : result bool :=
  match self with | None => Ok false | Some _ => Ok true end
.

(** Trait implementation: [traits::{impl traits::BoolTrait for core::option::Option<T>}]
    Source: 'tests/src/traits.rs', lines 24:0-31:1 *)
Definition core_option_Option_Insts_TraitsBoolTrait (T : Type) : BoolTrait_t
  (option T) := {|
  BoolTrait_t_get_bool := core_option_Option_Insts_TraitsBoolTrait_get_bool;
  BoolTrait_t_ret_true := boolTrait_ret_true_default;
|}.

(** [traits::test_bool_trait_option]:
    Source: 'tests/src/traits.rs', lines 33:0-35:1
    Visibility: public *)
Definition test_bool_trait_option {T : Type} (x : option T) : result bool :=
  b <- core_option_Option_Insts_TraitsBoolTrait_get_bool x;
  if b then boolTrait_ret_true_default x else Ok false
.

(** [traits::test_bool_trait]:
    Source: 'tests/src/traits.rs', lines 37:0-39:1
    Visibility: public *)
Definition test_bool_trait
  {T : Type} (boolTraitInst : BoolTrait_t T) (x : T) : result bool :=
  boolTraitInst.(BoolTrait_t_get_bool) x
.

(** Trait declaration: [traits::ToU64]
    Source: 'tests/src/traits.rs', lines 41:0-43:1
    Visibility: public *)
Record ToU64_t (Self : Type) := mkToU64_t {
  ToU64_t_to_u64 : Self -> result u64;
}.

Arguments mkToU64_t { _ }.
Arguments ToU64_t_to_u64 { _ } _.

(** [traits::{impl traits::ToU64 for u64}::to_u64]:
    Source: 'tests/src/traits.rs', lines 46:4-48:5
    Visibility: public *)
Definition U64_Insts_TraitsToU64_to_u64 (self : u64) : result u64 :=
  Ok self.

(** Trait implementation: [traits::{impl traits::ToU64 for u64}]
    Source: 'tests/src/traits.rs', lines 45:0-49:1 *)
Definition U64_Insts_TraitsToU64 : ToU64_t u64 := {|
  ToU64_t_to_u64 := U64_Insts_TraitsToU64_to_u64;
|}.

(** [traits::{impl traits::ToU64 for (A, A)}::to_u64]:
    Source: 'tests/src/traits.rs', lines 52:4-54:5
    Visibility: public *)
Definition Pair_Insts_TraitsToU64_to_u64
  {A : Type} (toU64Inst : ToU64_t A) (self : (A * A)) : result u64 :=
  let (t, t1) := self in
  i <- toU64Inst.(ToU64_t_to_u64) t;
  i1 <- toU64Inst.(ToU64_t_to_u64) t1;
  u64_add i i1
.

(** Trait implementation: [traits::{impl traits::ToU64 for (A, A)}]
    Source: 'tests/src/traits.rs', lines 51:0-55:1 *)
Definition Pair_Insts_TraitsToU64 {A : Type} (toU64Inst : ToU64_t A) : ToU64_t
  (A * A) := {|
  ToU64_t_to_u64 := Pair_Insts_TraitsToU64_to_u64 toU64Inst;
|}.

(** [traits::f]:
    Source: 'tests/src/traits.rs', lines 57:0-59:1
    Visibility: public *)
Definition f {T : Type} (toU64Inst : ToU64_t T) (x : (T * T)) : result u64 :=
  Pair_Insts_TraitsToU64_to_u64 toU64Inst x
.

(** [traits::g]:
    Source: 'tests/src/traits.rs', lines 61:0-66:1
    Visibility: public *)
Definition g
  {T : Type} (toU64PairInst : ToU64_t (T * T)) (x : (T * T)) : result u64 :=
  toU64PairInst.(ToU64_t_to_u64) x
.

(** [traits::h0]:
    Source: 'tests/src/traits.rs', lines 68:0-70:1
    Visibility: public *)
Definition h0 (x : u64) : result u64 :=
  U64_Insts_TraitsToU64_to_u64 x.

(** [traits::Wrapper]
    Source: 'tests/src/traits.rs', lines 72:0-74:1
    Visibility: public *)
Record Wrapper_t (T : Type) := mkWrapper_t { wrapper_x : T; }.

Arguments mkWrapper_t { _ }.
Arguments wrapper_x { _ }.

(** [traits::{impl traits::ToU64 for traits::Wrapper<T>}::to_u64]:
    Source: 'tests/src/traits.rs', lines 77:4-79:5
    Visibility: public *)
Definition Wrapper_Insts_TraitsToU64_to_u64
  {T : Type} (toU64Inst : ToU64_t T) (self : Wrapper_t T) : result u64 :=
  toU64Inst.(ToU64_t_to_u64) self.(wrapper_x)
.

(** Trait implementation: [traits::{impl traits::ToU64 for traits::Wrapper<T>}]
    Source: 'tests/src/traits.rs', lines 76:0-80:1 *)
Definition Wrapper_Insts_TraitsToU64 {T : Type} (toU64Inst : ToU64_t T) :
  ToU64_t (Wrapper_t T) := {|
  ToU64_t_to_u64 := Wrapper_Insts_TraitsToU64_to_u64 toU64Inst;
|}.

(** [traits::h1]:
    Source: 'tests/src/traits.rs', lines 82:0-84:1
    Visibility: public *)
Definition h1 (x : Wrapper_t u64) : result u64 :=
  Wrapper_Insts_TraitsToU64_to_u64 U64_Insts_TraitsToU64 x
.

(** [traits::h2]:
    Source: 'tests/src/traits.rs', lines 86:0-88:1
    Visibility: public *)
Definition h2
  {T : Type} (toU64Inst : ToU64_t T) (x : Wrapper_t T) : result u64 :=
  Wrapper_Insts_TraitsToU64_to_u64 toU64Inst x
.

(** Trait declaration: [traits::ToType]
    Source: 'tests/src/traits.rs', lines 90:0-92:1
    Visibility: public *)
Record ToType_t (Self : Type) (T : Type) := mkToType_t {
  ToType_t_to_type : Self -> result T;
}.

Arguments mkToType_t { _ } { _ }.
Arguments ToType_t_to_type { _ } { _ } _.

(** [traits::{impl traits::ToType<bool> for u64}::to_type]:
    Source: 'tests/src/traits.rs', lines 95:4-97:5
    Visibility: public *)
Definition U64_Insts_TraitsToTypeBool_to_type (self : u64) : result bool :=
  Ok (self s> 0%u64)
.

(** Trait implementation: [traits::{impl traits::ToType<bool> for u64}]
    Source: 'tests/src/traits.rs', lines 94:0-98:1 *)
Definition U64_Insts_TraitsToTypeBool : ToType_t u64 bool := {|
  ToType_t_to_type := U64_Insts_TraitsToTypeBool_to_type;
|}.

(** Trait declaration: [traits::OfType]
    Source: 'tests/src/traits.rs', lines 100:0-104:1
    Visibility: public *)
Record OfType_t (Self : Type) := mkOfType_t {
  OfType_t_of_type : forall {T : Type} (toTypeInst : ToType_t T Self), T ->
    result Self;
}.

Arguments mkOfType_t { _ }.
Arguments OfType_t_of_type { _ } _ { _ }.

(** [traits::h3]:
    Source: 'tests/src/traits.rs', lines 106:0-108:1
    Visibility: public *)
Definition h3
  {T1 : Type} {T2 : Type} (ofTypeInst : OfType_t T1) (toTypeInst : ToType_t T2
  T1) (y : T2) :
  result T1
  :=
  ofTypeInst.(OfType_t_of_type) toTypeInst y
.

(** Trait declaration: [traits::OfTypeBis]
    Source: 'tests/src/traits.rs', lines 111:0-118:1
    Visibility: public *)
Record OfTypeBis_t (Self : Type) (T : Type) := mkOfTypeBis_t {
  OfTypeBis_tOfTypeBis_t_ToTypeInst : ToType_t T Self;
  OfTypeBis_t_of_type : T -> result Self;
}.

Arguments mkOfTypeBis_t { _ } { _ }.
Arguments OfTypeBis_tOfTypeBis_t_ToTypeInst { _ } { _ } _.
Arguments OfTypeBis_t_of_type { _ } { _ } _.

(** [traits::h4]:
    Source: 'tests/src/traits.rs', lines 120:0-122:1
    Visibility: public *)
Definition h4
  {T1 : Type} {T2 : Type} (ofTypeBisInst : OfTypeBis_t T1 T2) (toTypeInst :
  ToType_t T2 T1) (y : T2) :
  result T1
  :=
  ofTypeBisInst.(OfTypeBis_t_of_type) y
.

(** [traits::TestType]
    Source: 'tests/src/traits.rs', lines 124:0-124:26
    Visibility: public *)
Definition TestType_t (T : Type) : Type := T.

(** [traits::{traits::TestType<T>}::test::TestType1]
    Source: 'tests/src/traits.rs', lines 129:8-129:30 *)
Definition TestType_test_TestType1_t : Type := u64.

(** [traits::{traits::TestType<T>}::test::{impl traits::{traits::TestType<T>}::test::TestTrait for traits::{traits::TestType<T>}::test::TestType1}::test]:
    Source: 'tests/src/traits.rs', lines 141:12-143:13 *)
Definition TestType_test_TestType1_Insts_TraitsTestTypeTestTestTrait_test
  (self : TestType_test_TestType1_t) : result bool :=
  Ok (self s> 1%u64)
.

(** [traits::{traits::TestType<T>}::test]:
    Source: 'tests/src/traits.rs', lines 128:4-149:5
    Visibility: public *)
Definition testType_test
  {T : Type} (toU64Inst : ToU64_t T) (self : TestType_t T) (x : T) :
  result bool
  :=
  x1 <- toU64Inst.(ToU64_t_to_u64) x;
  if x1 s> 0%u64
  then TestType_test_TestType1_Insts_TraitsTestTypeTestTestTrait_test 0%u64
  else Ok false
.

(** Trait declaration: [traits::{traits::TestType<T>}::test::TestTrait]
    Source: 'tests/src/traits.rs', lines 130:8-132:9 *)
Record TestType_test_TestTrait_t (Self : Type) := mkTestType_test_TestTrait_t {
  TestType_test_TestTrait_t_test : Self -> result bool;
}.

Arguments mkTestType_test_TestTrait_t { _ }.
Arguments TestType_test_TestTrait_t_test { _ } _.

(** Trait implementation: [traits::{traits::TestType<T>}::test::{impl traits::{traits::TestType<T>}::test::TestTrait for traits::{traits::TestType<T>}::test::TestType1}]
    Source: 'tests/src/traits.rs', lines 140:8-144:9 *)
Definition TestType_test_TestType1_Insts_TraitsTestTypeTestTestTrait :
  TestType_test_TestTrait_t TestType_test_TestType1_t := {|
  TestType_test_TestTrait_t_test :=
    TestType_test_TestType1_Insts_TraitsTestTypeTestTestTrait_test;
|}.

(** [traits::BoolWrapper]
    Source: 'tests/src/traits.rs', lines 152:0-152:33
    Visibility: public *)
Definition BoolWrapper_t : Type := bool.

(** [traits::{impl traits::ToType<T> for traits::BoolWrapper}::to_type]:
    Source: 'tests/src/traits.rs', lines 158:4-160:5
    Visibility: public *)
Definition BoolWrapper_Insts_TraitsToType_to_type
  {T : Type} (toTypeBoolTInst : ToType_t bool T) (self : BoolWrapper_t) :
  result T
  :=
  toTypeBoolTInst.(ToType_t_to_type) self
.

(** Trait implementation: [traits::{impl traits::ToType<T> for traits::BoolWrapper}]
    Source: 'tests/src/traits.rs', lines 154:0-161:1 *)
Definition BoolWrapper_Insts_TraitsToType {T : Type} (toTypeBoolTInst :
  ToType_t bool T) : ToType_t BoolWrapper_t T := {|
  ToType_t_to_type := BoolWrapper_Insts_TraitsToType_to_type toTypeBoolTInst;
|}.

(** Trait declaration: [traits::WithConstTy]
    Source: 'tests/src/traits.rs', lines 163:0-174:1
    Visibility: public *)
Record WithConstTy_t (Self : Type) (Self_V : Type) (Self_W : Type) (LEN :
  usize) := mkWithConstTy_t {
  WithConstTy_tWithConstTy_t_LEN1 : result usize;
  WithConstTy_tWithConstTy_t_LEN2 : result usize;
  WithConstTy_tWithConstTy_t_ToU64Inst : ToU64_t Self_W;
  WithConstTy_t_f : Self_W -> array u8 LEN -> result Self_W;
}.

Arguments mkWithConstTy_t { _ } { _ } { _ } { _ }.
Arguments WithConstTy_tWithConstTy_t_LEN1 { _ } { _ } { _ } { _ } _.
Arguments WithConstTy_tWithConstTy_t_LEN2 { _ } { _ } { _ } { _ } _.
Arguments WithConstTy_tWithConstTy_t_ToU64Inst { _ } { _ } { _ } { _ } _.
Arguments WithConstTy_t_f { _ } { _ } { _ } { _ } _.

(** [traits::WithConstTy::LEN2]
    Source: 'tests/src/traits.rs', lines 166:4-166:27
    Visibility: public *)
Definition withConstTy_LEN2_default (Self : Type) (Clause0_V : Type) (Clause0_W
  : Type) (LEN : usize) : usize :=
  32%usize
.

(** [traits::{impl traits::WithConstTy<u8, u64, 32usize> for bool}::f]:
    Source: 'tests/src/traits.rs', lines 182:4-182:42
    Visibility: public *)
Definition Bool_Insts_TraitsWithConstTyU8U6432_f
  (i : u64) (a : array u8 32%usize) : result u64 :=
  Ok i
.

(** [traits::{impl traits::WithConstTy<u8, u64, 32usize> for bool}::LEN1]
    Source: 'tests/src/traits.rs', lines 177:4-177:27
    Visibility: public *)
Definition Bool_Insts_TraitsWithConstTyU8U6432_LEN1 : usize := 12%usize.

(** Trait implementation: [traits::{impl traits::WithConstTy<u8, u64, 32usize> for bool}]
    Source: 'tests/src/traits.rs', lines 176:0-183:1 *)
Definition Bool_Insts_TraitsWithConstTyU8U6432 : WithConstTy_t bool u8 u64
  32%usize := {|
  WithConstTy_tWithConstTy_t_LEN1 := Ok
    Bool_Insts_TraitsWithConstTyU8U6432_LEN1;
  WithConstTy_tWithConstTy_t_LEN2 := Ok (withConstTy_LEN2_default bool u8 u64
    32%usize);
  WithConstTy_tWithConstTy_t_ToU64Inst := U64_Insts_TraitsToU64;
  WithConstTy_t_f := Bool_Insts_TraitsWithConstTyU8U6432_f;
|}.

(** [traits::use_with_const_ty1]:
    Source: 'tests/src/traits.rs', lines 185:0-187:1
    Visibility: public *)
Definition use_with_const_ty1
  {H : Type} {Clause0_V : Type} {Clause0_W : Type} {LEN : usize}
  (withConstTyInst : WithConstTy_t H Clause0_V Clause0_W LEN) :
  result usize
  :=
  withConstTyInst.(WithConstTy_tWithConstTy_t_LEN1)
.

(** [traits::use_with_const_ty2]:
    Source: 'tests/src/traits.rs', lines 189:0-189:76
    Visibility: public *)
Definition use_with_const_ty2
  {H : Type} {Clause0_V : Type} {Clause0_W : Type} {LEN : usize}
  (withConstTyInst : WithConstTy_t H Clause0_V Clause0_W LEN) (t : Clause0_W) :
  result unit
  :=
  Ok tt
.

(** [traits::use_with_const_ty3]:
    Source: 'tests/src/traits.rs', lines 191:0-193:1
    Visibility: public *)
Definition use_with_const_ty3
  {H : Type} {Clause0_V : Type} {Clause0_W : Type} {LEN : usize}
  (withConstTyInst : WithConstTy_t H Clause0_V Clause0_W LEN) (x : Clause0_W) :
  result u64
  :=
  withConstTyInst.(WithConstTy_tWithConstTy_t_ToU64Inst).(ToU64_t_to_u64) x
.

(** [traits::test_where1]:
    Source: 'tests/src/traits.rs', lines 195:0-195:43
    Visibility: public *)
Definition test_where1 {T : Type} (_x : T) : result unit :=
  Ok tt.

(** [traits::test_where2]:
    Source: 'tests/src/traits.rs', lines 196:0-196:60
    Visibility: public *)
Definition test_where2
  {T : Type} {Clause0_W : Type} (withConstTyTU32Clause0_W32Inst : WithConstTy_t
  T u32 Clause0_W 32%usize) (_x : u32) :
  result unit
  :=
  Ok tt
.

(** Trait declaration: [traits::ParentTrait0]
    Source: 'tests/src/traits.rs', lines 202:0-206:1
    Visibility: public *)
Record ParentTrait0_t (Self : Type) (Self_W : Type) := mkParentTrait0_t {
  ParentTrait0_t_get_name : Self -> result string;
  ParentTrait0_t_get_w : Self -> result Self_W;
}.

Arguments mkParentTrait0_t { _ } { _ }.
Arguments ParentTrait0_t_get_name { _ } { _ } _.
Arguments ParentTrait0_t_get_w { _ } { _ } _.

(** Trait declaration: [traits::ParentTrait1]
    Source: 'tests/src/traits.rs', lines 207:0-207:25
    Visibility: public *)
Record ParentTrait1_t (Self : Type) := mkParentTrait1_t{}.

Arguments mkParentTrait1_t { _ }.

(** Trait declaration: [traits::ChildTrait]
    Source: 'tests/src/traits.rs', lines 208:0-208:52
    Visibility: public *)
Record ChildTrait_t (Self : Type) (Self_Clause0_W : Type) := mkChildTrait_t {
  ChildTrait_tChildTrait_t_ParentTrait0Inst : ParentTrait0_t Self
    Self_Clause0_W;
  ChildTrait_tChildTrait_t_ParentTrait1Inst : ParentTrait1_t Self;
}.

Arguments mkChildTrait_t { _ } { _ }.
Arguments ChildTrait_tChildTrait_t_ParentTrait0Inst { _ } { _ } _.
Arguments ChildTrait_tChildTrait_t_ParentTrait1Inst { _ } { _ } _.

(** [traits::test_child_trait1]:
    Source: 'tests/src/traits.rs', lines 211:0-213:1
    Visibility: public *)
Definition test_child_trait1
  {T : Type} {Clause0_Clause0_W : Type} (childTraitInst : ChildTrait_t T
  Clause0_Clause0_W) (x : T) :
  result string
  :=
  childTraitInst.(ChildTrait_tChildTrait_t_ParentTrait0Inst).(ParentTrait0_t_get_name)
    x
.

(** [traits::test_child_trait2]:
    Source: 'tests/src/traits.rs', lines 215:0-217:1
    Visibility: public *)
Definition test_child_trait2
  {T : Type} {Clause0_Clause0_W : Type} (childTraitInst : ChildTrait_t T
  Clause0_Clause0_W) (x : T) :
  result Clause0_Clause0_W
  :=
  childTraitInst.(ChildTrait_tChildTrait_t_ParentTrait0Inst).(ParentTrait0_t_get_w)
    x
.

(** [traits::order1]:
    Source: 'tests/src/traits.rs', lines 221:0-221:62
    Visibility: public *)
Definition order1
  {T : Type} {U : Type} {Clause1_W : Type} (parentTrait0Inst : ParentTrait0_t T
  Clause1_W) (parentTrait0Inst1 : ParentTrait0_t U Clause1_W) :
  result unit
  :=
  Ok tt
.

(** Trait declaration: [traits::ChildTrait1]
    Source: 'tests/src/traits.rs', lines 224:0-224:38
    Visibility: public *)
Record ChildTrait1_t (Self : Type) := mkChildTrait1_t {
  ChildTrait1_tChildTrait1_t_ParentTrait1Inst : ParentTrait1_t Self;
}.

Arguments mkChildTrait1_t { _ }.
Arguments ChildTrait1_tChildTrait1_t_ParentTrait1Inst { _ } _.

(** Trait implementation: [traits::{impl traits::ParentTrait1 for usize}]
    Source: 'tests/src/traits.rs', lines 226:0-226:30 *)
Definition Usize_Insts_TraitsParentTrait1 : ParentTrait1_t usize
  := mkParentTrait1_t.

(** Trait implementation: [traits::{impl traits::ChildTrait1 for usize}]
    Source: 'tests/src/traits.rs', lines 227:0-227:29 *)
Definition Usize_Insts_TraitsChildTrait1 : ChildTrait1_t usize := {|
  ChildTrait1_tChildTrait1_t_ParentTrait1Inst :=
    Usize_Insts_TraitsParentTrait1;
|}.

(** Trait declaration: [traits::Iterator]
    Source: 'tests/src/traits.rs', lines 231:0-233:1
    Visibility: public *)
Record Iterator_t (Self : Type) (Self_Item : Type) := mkIterator_t{}.

Arguments mkIterator_t { _ } { _ }.

(** Trait declaration: [traits::IntoIterator]
    Source: 'tests/src/traits.rs', lines 235:0-241:1
    Visibility: public *)
Record IntoIterator_t (Self : Type) (Self_Item : Type) (Self_IntoIter : Type)
  := mkIntoIterator_t {
  IntoIterator_tIntoIterator_t_IteratorInst : Iterator_t Self_IntoIter
    Self_Item;
  IntoIterator_t_into_iter : Self -> result Self_IntoIter;
}.

Arguments mkIntoIterator_t { _ } { _ } { _ }.
Arguments IntoIterator_tIntoIterator_t_IteratorInst { _ } { _ } { _ } _.
Arguments IntoIterator_t_into_iter { _ } { _ } { _ } _.

(** Trait declaration: [traits::FromResidual]
    Source: 'tests/src/traits.rs', lines 252:0-252:24 *)
Record FromResidual_t (Self : Type) (T : Type) := mkFromResidual_t{}.

Arguments mkFromResidual_t { _ } { _ }.

(** Trait declaration: [traits::Try]
    Source: 'tests/src/traits.rs', lines 248:0-250:1 *)
Record Try_t (Self : Type) (Self_Residual : Type) := mkTry_t {
  Try_tTry_t_FromResidualInst : FromResidual_t Self Self_Residual;
}.

Arguments mkTry_t { _ } { _ }.
Arguments Try_tTry_t_FromResidualInst { _ } { _ } _.

(** Trait declaration: [traits::WithTarget]
    Source: 'tests/src/traits.rs', lines 254:0-256:1
    Visibility: public *)
Record WithTarget_t (Self : Type) (Self_Target : Type) := mkWithTarget_t{}.

Arguments mkWithTarget_t { _ } { _ }.

(** Trait declaration: [traits::ParentTrait2]
    Source: 'tests/src/traits.rs', lines 258:0-260:1
    Visibility: public *)
Record ParentTrait2_t (Self : Type) (Self_U : Type) (Self_Clause0_Target :
  Type) := mkParentTrait2_t {
  ParentTrait2_tParentTrait2_t_WithTargetInst : WithTarget_t Self_U
    Self_Clause0_Target;
}.

Arguments mkParentTrait2_t { _ } { _ } { _ }.
Arguments ParentTrait2_tParentTrait2_t_WithTargetInst { _ } { _ } { _ } _.

(** Trait declaration: [traits::ChildTrait2]
    Source: 'tests/src/traits.rs', lines 262:0-264:1
    Visibility: public *)
Record ChildTrait2_t (Self : Type) (Self_Clause0_U : Type)
  (Self_Clause0_Clause0_Target : Type) := mkChildTrait2_t {
  ChildTrait2_tChildTrait2_t_ParentTrait2Inst : ParentTrait2_t Self
    Self_Clause0_U Self_Clause0_Clause0_Target;
  ChildTrait2_t_convert : Self_Clause0_U -> result Self_Clause0_Clause0_Target;
}.

Arguments mkChildTrait2_t { _ } { _ } { _ }.
Arguments ChildTrait2_tChildTrait2_t_ParentTrait2Inst { _ } { _ } { _ } _.
Arguments ChildTrait2_t_convert { _ } { _ } { _ } _.

(** Trait implementation: [traits::{impl traits::WithTarget<u32> for u32}]
    Source: 'tests/src/traits.rs', lines 266:0-268:1 *)
Definition U32_Insts_TraitsWithTargetU32 : WithTarget_t u32 u32
  := mkWithTarget_t.

(** Trait implementation: [traits::{impl traits::ParentTrait2<u32, u32> for u32}]
    Source: 'tests/src/traits.rs', lines 270:0-272:1 *)
Definition U32_Insts_TraitsParentTrait2U32U32 : ParentTrait2_t u32 u32 u32
  := {|
  ParentTrait2_tParentTrait2_t_WithTargetInst := U32_Insts_TraitsWithTargetU32;
|}.

(** [traits::{impl traits::ChildTrait2<u32, u32> for u32}::convert]:
    Source: 'tests/src/traits.rs', lines 275:4-277:5
    Visibility: public *)
Definition U32_Insts_TraitsChildTrait2U32U32_convert (x : u32) : result u32 :=
  Ok x
.

(** Trait implementation: [traits::{impl traits::ChildTrait2<u32, u32> for u32}]
    Source: 'tests/src/traits.rs', lines 274:0-278:1 *)
Definition U32_Insts_TraitsChildTrait2U32U32 : ChildTrait2_t u32 u32 u32 := {|
  ChildTrait2_tChildTrait2_t_ParentTrait2Inst :=
    U32_Insts_TraitsParentTrait2U32U32;
  ChildTrait2_t_convert := U32_Insts_TraitsChildTrait2U32U32_convert;
|}.

(** Trait declaration: [traits::CFnOnce]
    Source: 'tests/src/traits.rs', lines 288:0-292:1
    Visibility: public *)
Record CFnOnce_t (Self : Type) (Args : Type) (Self_Output : Type)
  := mkCFnOnce_t {
  CFnOnce_t_call_once : Self -> Args -> result Self_Output;
}.

Arguments mkCFnOnce_t { _ } { _ } { _ }.
Arguments CFnOnce_t_call_once { _ } { _ } { _ } _.

(** Trait declaration: [traits::CFnMut]
    Source: 'tests/src/traits.rs', lines 294:0-296:1
    Visibility: public *)
Record CFnMut_t (Self : Type) (Args : Type) (Self_Clause0_Output : Type)
  := mkCFnMut_t {
  CFnMut_tCFnMut_t_CFnOnceInst : CFnOnce_t Self Args Self_Clause0_Output;
  CFnMut_t_call_mut : Self -> Args -> result (Self_Clause0_Output * Self);
}.

Arguments mkCFnMut_t { _ } { _ } { _ }.
Arguments CFnMut_tCFnMut_t_CFnOnceInst { _ } { _ } { _ } _.
Arguments CFnMut_t_call_mut { _ } { _ } { _ } _.

(** Trait declaration: [traits::CFn]
    Source: 'tests/src/traits.rs', lines 298:0-300:1
    Visibility: public *)
Record CFn_t (Self : Type) (Args : Type) (Self_Clause0_Clause0_Output : Type)
  := mkCFn_t {
  CFn_tCFn_t_CFnMutInst : CFnMut_t Self Args Self_Clause0_Clause0_Output;
  CFn_t_call : Self -> Args -> result Self_Clause0_Clause0_Output;
}.

Arguments mkCFn_t { _ } { _ } { _ }.
Arguments CFn_tCFn_t_CFnMutInst { _ } { _ } { _ } _.
Arguments CFn_t_call { _ } { _ } { _ } _.

(** Trait declaration: [traits::GetTrait]
    Source: 'tests/src/traits.rs', lines 302:0-305:1
    Visibility: public *)
Record GetTrait_t (Self : Type) (Self_W : Type) := mkGetTrait_t {
  GetTrait_t_get_w : Self -> result Self_W;
}.

Arguments mkGetTrait_t { _ } { _ }.
Arguments GetTrait_t_get_w { _ } { _ } _.

(** [traits::test_get_trait]:
    Source: 'tests/src/traits.rs', lines 307:0-309:1
    Visibility: public *)
Definition test_get_trait
  {T : Type} {Clause0_W : Type} (getTraitInst : GetTrait_t T Clause0_W) 
  (x : T) :
  result Clause0_W
  :=
  getTraitInst.(GetTrait_t_get_w) x
.

(** Trait declaration: [traits::Trait]
    Source: 'tests/src/traits.rs', lines 312:0-314:1
    Visibility: public *)
Record Trait_t (Self : Type) := mkTrait_t { Trait_tTrait_t_LEN : result usize;
}.

Arguments mkTrait_t { _ }.
Arguments Trait_tTrait_t_LEN { _ } _.

(** [traits::{impl traits::Trait for [T; N]}::LEN]
    Source: 'tests/src/traits.rs', lines 317:4-317:25
    Visibility: public *)
Definition Array_Insts_TraitsTrait_LEN (T : Type) (N : usize) : usize := N.

(** Trait implementation: [traits::{impl traits::Trait for [T; N]}]
    Source: 'tests/src/traits.rs', lines 316:0-318:1 *)
Definition Array_Insts_TraitsTrait (T : Type) (N : usize) : Trait_t (array T N)
  := {|
  Trait_tTrait_t_LEN := Ok (Array_Insts_TraitsTrait_LEN T N);
|}.

(** [traits::{impl traits::Trait for traits::Wrapper<T>}::LEN]
    Source: 'tests/src/traits.rs', lines 321:4-321:25
    Visibility: public *)
Definition Wrapper_Insts_TraitsTrait_LEN {T : Type} (traitInst : Trait_t T)
  : usize :=
  0%usize
.

(** Trait implementation: [traits::{impl traits::Trait for traits::Wrapper<T>}]
    Source: 'tests/src/traits.rs', lines 320:0-322:1 *)
Definition Wrapper_Insts_TraitsTrait {T : Type} (traitInst : Trait_t T) :
  Trait_t (Wrapper_t T) := {|
  Trait_tTrait_t_LEN := Ok (Wrapper_Insts_TraitsTrait_LEN traitInst);
|}.

(** [traits::use_wrapper_len]:
    Source: 'tests/src/traits.rs', lines 324:0-326:1
    Visibility: public *)
Definition use_wrapper_len {T : Type} (traitInst : Trait_t T) : result usize :=
  Ok (Wrapper_Insts_TraitsTrait_LEN traitInst)
.

(** [traits::Foo]
    Source: 'tests/src/traits.rs', lines 328:0-331:1
    Visibility: public *)
Record Foo_t (T : Type) (U : Type) := mkFoo_t { foo_x : T; foo_y : U; }.

Arguments mkFoo_t { _ } { _ }.
Arguments foo_x { _ } { _ }.
Arguments foo_y { _ } { _ }.

(** [traits::{traits::Foo<T, U>}::FOO]
    Source: 'tests/src/traits.rs', lines 334:4-334:43
    Visibility: public *)
Definition foo_FOO {T : Type} (U : Type) (traitInst : Trait_t T)
  : core_result_Result_t T i32 :=
  Core_result_Result_Err 0%i32
.

(** [traits::use_foo1]:
    Source: 'tests/src/traits.rs', lines 337:0-339:1
    Visibility: public *)
Definition use_foo1
  {T : Type} (U : Type) (traitInst : Trait_t T) :
  result (core_result_Result_t T i32)
  :=
  Ok (foo_FOO U traitInst)
.

(** [traits::use_foo2]:
    Source: 'tests/src/traits.rs', lines 341:0-343:1
    Visibility: public *)
Definition use_foo2
  (T : Type) {U : Type} (traitInst : Trait_t U) :
  result (core_result_Result_t U i32)
  :=
  Ok (foo_FOO T traitInst)
.

End Traits.
