diff options
author | Son HO | 2024-03-11 11:10:01 +0100 |
---|---|---|
committer | GitHub | 2024-03-11 11:10:01 +0100 |
commit | c33a9807cf6aa21b2364449ee756ebf93de19eca (patch) | |
tree | 3a58f5a619502521d0a6ff7fe2edd139e275f8f1 /tests/lean | |
parent | 14171474f9a4a45874d181cdb6567c7af7dc32cd (diff) | |
parent | 157a2364c02293d14b765ebdaec0d2eeae75a1aa (diff) |
Merge pull request #88 from AeneasVerif/son/clashes
Improve the name generation for code extraction
Diffstat (limited to 'tests/lean')
-rw-r--r-- | tests/lean/Arrays.lean | 4 | ||||
-rw-r--r-- | tests/lean/BetreeMain/Funs.lean | 14 | ||||
-rw-r--r-- | tests/lean/Constants.lean | 80 | ||||
-rw-r--r-- | tests/lean/Demo/Demo.lean | 14 | ||||
-rw-r--r-- | tests/lean/NoNestedBorrows.lean | 8 | ||||
-rw-r--r-- | tests/lean/Traits.lean | 257 |
6 files changed, 186 insertions, 191 deletions
diff --git a/tests/lean/Arrays.lean b/tests/lean/Arrays.lean index 59458393..d637ee13 100644 --- a/tests/lean/Arrays.lean +++ b/tests/lean/Arrays.lean @@ -451,8 +451,8 @@ def f3 : Result U32 := /- [arrays::SZ] Source: 'src/arrays.rs', lines 286:0-286:19 -/ -def sz_body : Result Usize := Result.ret 32#usize -def sz_c : Usize := eval_global sz_body +def SZ_body : Result Usize := Result.ret 32#usize +def SZ : Usize := eval_global SZ_body /- [arrays::f5]: Source: 'src/arrays.rs', lines 289:0-289:31 -/ diff --git a/tests/lean/BetreeMain/Funs.lean b/tests/lean/BetreeMain/Funs.lean index 96daa197..d6449b37 100644 --- a/tests/lean/BetreeMain/Funs.lean +++ b/tests/lean/BetreeMain/Funs.lean @@ -135,7 +135,7 @@ def betree.List.hd (T : Type) (self : betree.List T) : Result T := /- [betree_main::betree::{betree_main::betree::List<(u64, T)>#2}::head_has_key]: Source: 'src/betree.rs', lines 327:4-327:44 -/ -def betree.ListTupleU64T.head_has_key +def betree.ListPairU64T.head_has_key (T : Type) (self : betree.List (U64 × T)) (key : U64) : Result Bool := match self with | betree.List.Cons hd _ => let (i, _) := hd @@ -144,7 +144,7 @@ def betree.ListTupleU64T.head_has_key /- [betree_main::betree::{betree_main::betree::List<(u64, T)>#2}::partition_at_pivot]: Source: 'src/betree.rs', lines 339:4-339:73 -/ -divergent def betree.ListTupleU64T.partition_at_pivot +divergent def betree.ListPairU64T.partition_at_pivot (T : Type) (self : betree.List (U64 × T)) (pivot : U64) : Result ((betree.List (U64 × T)) × (betree.List (U64 × T))) := @@ -155,7 +155,7 @@ divergent def betree.ListTupleU64T.partition_at_pivot then Result.ret (betree.List.Nil, betree.List.Cons (i, t) tl) else do - let p ← betree.ListTupleU64T.partition_at_pivot T tl pivot + let p ← betree.ListPairU64T.partition_at_pivot T tl pivot let (ls0, ls1) := p Result.ret (betree.List.Cons (i, t) ls0, ls1) | betree.List.Nil => Result.ret (betree.List.Nil, betree.List.Nil) @@ -227,7 +227,7 @@ divergent def betree.Node.apply_upserts Result (State × (U64 × (betree.List (U64 × betree.Message)))) := do - let b ← betree.ListTupleU64T.head_has_key betree.Message msgs key + let b ← betree.ListPairU64T.head_has_key betree.Message msgs key if b then do @@ -387,7 +387,7 @@ def betree.Node.apply_to_internal do let (msgs1, lookup_first_message_for_key_back) ← betree.Node.lookup_first_message_for_key key msgs - let b ← betree.ListTupleU64T.head_has_key betree.Message msgs1 key + let b ← betree.ListPairU64T.head_has_key betree.Message msgs1 key if b then match new_msg with @@ -490,7 +490,7 @@ def betree.Node.apply_to_leaf do let (bindings1, lookup_mut_in_bindings_back) ← betree.Node.lookup_mut_in_bindings key bindings - let b ← betree.ListTupleU64T.head_has_key U64 bindings1 key + let b ← betree.ListPairU64T.head_has_key U64 bindings1 key if b then do @@ -546,7 +546,7 @@ mutual divergent def betree.Internal.flush := do let ⟨ i, i1, n, n1 ⟩ := self - let p ← betree.ListTupleU64T.partition_at_pivot betree.Message content i1 + let p ← betree.ListPairU64T.partition_at_pivot betree.Message content i1 let (msgs_left, msgs_right) := p let len_left ← betree.List.len (U64 × betree.Message) msgs_left if len_left >= params.min_flush_size diff --git a/tests/lean/Constants.lean b/tests/lean/Constants.lean index 32e0317b..7949a25c 100644 --- a/tests/lean/Constants.lean +++ b/tests/lean/Constants.lean @@ -7,18 +7,18 @@ namespace constants /- [constants::X0] Source: 'src/constants.rs', lines 5:0-5:17 -/ -def x0_body : Result U32 := Result.ret 0#u32 -def x0_c : U32 := eval_global x0_body +def X0_body : Result U32 := Result.ret 0#u32 +def X0 : U32 := eval_global X0_body /- [constants::X1] Source: 'src/constants.rs', lines 7:0-7:17 -/ -def x1_body : Result U32 := Result.ret core_u32_max -def x1_c : U32 := eval_global x1_body +def X1_body : Result U32 := Result.ret core_u32_max +def X1 : U32 := eval_global X1_body /- [constants::X2] Source: 'src/constants.rs', lines 10:0-10:17 -/ -def x2_body : Result U32 := Result.ret 3#u32 -def x2_c : U32 := eval_global x2_body +def X2_body : Result U32 := Result.ret 3#u32 +def X2 : U32 := eval_global X2_body /- [constants::incr]: Source: 'src/constants.rs', lines 17:0-17:32 -/ @@ -27,8 +27,8 @@ def incr (n : U32) : Result U32 := /- [constants::X3] Source: 'src/constants.rs', lines 15:0-15:17 -/ -def x3_body : Result U32 := incr 32#u32 -def x3_c : U32 := eval_global x3_body +def X3_body : Result U32 := incr 32#u32 +def X3 : U32 := eval_global X3_body /- [constants::mk_pair0]: Source: 'src/constants.rs', lines 23:0-23:51 -/ @@ -48,23 +48,23 @@ def mk_pair1 (x : U32) (y : U32) : Result (Pair U32 U32) := /- [constants::P0] Source: 'src/constants.rs', lines 31:0-31:24 -/ -def p0_body : Result (U32 × U32) := mk_pair0 0#u32 1#u32 -def p0_c : (U32 × U32) := eval_global p0_body +def P0_body : Result (U32 × U32) := mk_pair0 0#u32 1#u32 +def P0 : (U32 × U32) := eval_global P0_body /- [constants::P1] Source: 'src/constants.rs', lines 32:0-32:28 -/ -def p1_body : Result (Pair U32 U32) := mk_pair1 0#u32 1#u32 -def p1_c : Pair U32 U32 := eval_global p1_body +def P1_body : Result (Pair U32 U32) := mk_pair1 0#u32 1#u32 +def P1 : Pair U32 U32 := eval_global P1_body /- [constants::P2] Source: 'src/constants.rs', lines 33:0-33:24 -/ -def p2_body : Result (U32 × U32) := Result.ret (0#u32, 1#u32) -def p2_c : (U32 × U32) := eval_global p2_body +def P2_body : Result (U32 × U32) := Result.ret (0#u32, 1#u32) +def P2 : (U32 × U32) := eval_global P2_body /- [constants::P3] Source: 'src/constants.rs', lines 34:0-34:28 -/ -def p3_body : Result (Pair U32 U32) := Result.ret { x := 0#u32, y := 1#u32 } -def p3_c : Pair U32 U32 := eval_global p3_body +def P3_body : Result (Pair U32 U32) := Result.ret { x := 0#u32, y := 1#u32 } +def P3 : Pair U32 U32 := eval_global P3_body /- [constants::Wrap] Source: 'src/constants.rs', lines 49:0-49:18 -/ @@ -78,28 +78,28 @@ def Wrap.new (T : Type) (value : T) : Result (Wrap T) := /- [constants::Y] Source: 'src/constants.rs', lines 41:0-41:22 -/ -def y_body : Result (Wrap I32) := Wrap.new I32 2#i32 -def y_c : Wrap I32 := eval_global y_body +def Y_body : Result (Wrap I32) := Wrap.new I32 2#i32 +def Y : Wrap I32 := eval_global Y_body /- [constants::unwrap_y]: Source: 'src/constants.rs', lines 43:0-43:30 -/ def unwrap_y : Result I32 := - Result.ret y_c.value + Result.ret Y.value /- [constants::YVAL] Source: 'src/constants.rs', lines 47:0-47:19 -/ -def yval_body : Result I32 := unwrap_y -def yval_c : I32 := eval_global yval_body +def YVAL_body : Result I32 := unwrap_y +def YVAL : I32 := eval_global YVAL_body /- [constants::get_z1::Z1] Source: 'src/constants.rs', lines 62:4-62:17 -/ -def get_z1_z1_body : Result I32 := Result.ret 3#i32 -def get_z1_z1_c : I32 := eval_global get_z1_z1_body +def get_z1.Z1_body : Result I32 := Result.ret 3#i32 +def get_z1.Z1 : I32 := eval_global get_z1.Z1_body /- [constants::get_z1]: Source: 'src/constants.rs', lines 61:0-61:28 -/ def get_z1 : Result I32 := - Result.ret get_z1_z1_c + Result.ret get_z1.Z1 /- [constants::add]: Source: 'src/constants.rs', lines 66:0-66:39 -/ @@ -108,45 +108,45 @@ def add (a : I32) (b : I32) : Result I32 := /- [constants::Q1] Source: 'src/constants.rs', lines 74:0-74:17 -/ -def q1_body : Result I32 := Result.ret 5#i32 -def q1_c : I32 := eval_global q1_body +def Q1_body : Result I32 := Result.ret 5#i32 +def Q1 : I32 := eval_global Q1_body /- [constants::Q2] Source: 'src/constants.rs', lines 75:0-75:17 -/ -def q2_body : Result I32 := Result.ret q1_c -def q2_c : I32 := eval_global q2_body +def Q2_body : Result I32 := Result.ret Q1 +def Q2 : I32 := eval_global Q2_body /- [constants::Q3] Source: 'src/constants.rs', lines 76:0-76:17 -/ -def q3_body : Result I32 := add q2_c 3#i32 -def q3_c : I32 := eval_global q3_body +def Q3_body : Result I32 := add Q2 3#i32 +def Q3 : I32 := eval_global Q3_body /- [constants::get_z2]: Source: 'src/constants.rs', lines 70:0-70:28 -/ def get_z2 : Result I32 := do let i ← get_z1 - let i1 ← add i q3_c - add q1_c i1 + let i1 ← add i Q3 + add Q1 i1 /- [constants::S1] Source: 'src/constants.rs', lines 80:0-80:18 -/ -def s1_body : Result U32 := Result.ret 6#u32 -def s1_c : U32 := eval_global s1_body +def S1_body : Result U32 := Result.ret 6#u32 +def S1 : U32 := eval_global S1_body /- [constants::S2] Source: 'src/constants.rs', lines 81:0-81:18 -/ -def s2_body : Result U32 := incr s1_c -def s2_c : U32 := eval_global s2_body +def S2_body : Result U32 := incr S1 +def S2 : U32 := eval_global S2_body /- [constants::S3] Source: 'src/constants.rs', lines 82:0-82:29 -/ -def s3_body : Result (Pair U32 U32) := Result.ret p3_c -def s3_c : Pair U32 U32 := eval_global s3_body +def S3_body : Result (Pair U32 U32) := Result.ret P3 +def S3 : Pair U32 U32 := eval_global S3_body /- [constants::S4] Source: 'src/constants.rs', lines 83:0-83:29 -/ -def s4_body : Result (Pair U32 U32) := mk_pair1 7#u32 8#u32 -def s4_c : Pair U32 U32 := eval_global s4_body +def S4_body : Result (Pair U32 U32) := mk_pair1 7#u32 8#u32 +def S4 : Pair U32 U32 := eval_global S4_body end constants diff --git a/tests/lean/Demo/Demo.lean b/tests/lean/Demo/Demo.lean index 01818585..854b4853 100644 --- a/tests/lean/Demo/Demo.lean +++ b/tests/lean/Demo/Demo.lean @@ -126,23 +126,23 @@ divergent def i32_id (i : I32) : Result I32 := structure Counter (Self : Type) where incr : Self → Result (Usize × Self) -/- [demo::{usize}::incr]: +/- [demo::{(demo::Counter for usize)}::incr]: Source: 'src/demo.rs', lines 88:4-88:31 -/ -def Usize.incr (self : Usize) : Result (Usize × Usize) := +def CounterUsize.incr (self : Usize) : Result (Usize × Usize) := do let self1 ← self + 1#usize Result.ret (self, self1) -/- Trait implementation: [demo::{usize}] +/- Trait implementation: [demo::{(demo::Counter for usize)}] Source: 'src/demo.rs', lines 87:0-87:22 -/ -def demo.CounterUsizeInst : Counter Usize := { - incr := Usize.incr +def CounterUsize : Counter Usize := { + incr := CounterUsize.incr } /- [demo::use_counter]: Source: 'src/demo.rs', lines 95:0-95:59 -/ def use_counter - (T : Type) (CounterTInst : Counter T) (cnt : T) : Result (Usize × T) := - CounterTInst.incr cnt + (T : Type) (CounterInst : Counter T) (cnt : T) : Result (Usize × T) := + CounterInst.incr cnt end demo diff --git a/tests/lean/NoNestedBorrows.lean b/tests/lean/NoNestedBorrows.lean index a85209ea..2112e282 100644 --- a/tests/lean/NoNestedBorrows.lean +++ b/tests/lean/NoNestedBorrows.lean @@ -138,13 +138,13 @@ def mix_arith_i32 (x : I32) (y : I32) (z : I32) : Result I32 := /- [no_nested_borrows::CONST0] Source: 'src/no_nested_borrows.rs', lines 125:0-125:23 -/ -def const0_body : Result Usize := 1#usize + 1#usize -def const0_c : Usize := eval_global const0_body +def CONST0_body : Result Usize := 1#usize + 1#usize +def CONST0 : Usize := eval_global CONST0_body /- [no_nested_borrows::CONST1] Source: 'src/no_nested_borrows.rs', lines 126:0-126:23 -/ -def const1_body : Result Usize := 2#usize * 2#usize -def const1_c : Usize := eval_global const1_body +def CONST1_body : Result Usize := 2#usize * 2#usize +def CONST1 : Usize := eval_global CONST1_body /- [no_nested_borrows::cast_u32_to_i32]: Source: 'src/no_nested_borrows.rs', lines 128:0-128:37 -/ diff --git a/tests/lean/Traits.lean b/tests/lean/Traits.lean index f83fbc2f..26dac252 100644 --- a/tests/lean/Traits.lean +++ b/tests/lean/Traits.lean @@ -10,15 +10,15 @@ namespace traits structure BoolTrait (Self : Type) where get_bool : Self → Result Bool -/- [traits::{bool}::get_bool]: +/- [traits::{(traits::BoolTrait for bool)}::get_bool]: Source: 'src/traits.rs', lines 12:4-12:30 -/ -def Bool.get_bool (self : Bool) : Result Bool := +def BoolTraitBool.get_bool (self : Bool) : Result Bool := Result.ret self -/- Trait implementation: [traits::{bool}] +/- Trait implementation: [traits::{(traits::BoolTrait for bool)}] Source: 'src/traits.rs', lines 11:0-11:23 -/ -def traits.BoolTraitBoolInst : BoolTrait Bool := { - get_bool := Bool.get_bool +def BoolTraitBool : BoolTrait Bool := { + get_bool := BoolTraitBool.get_bool } /- [traits::BoolTrait::ret_true]: @@ -31,162 +31,159 @@ def BoolTrait.ret_true Source: 'src/traits.rs', lines 17:0-17:44 -/ def test_bool_trait_bool (x : Bool) : Result Bool := do - let b ← Bool.get_bool x + let b ← BoolTraitBool.get_bool x if b - then BoolTrait.ret_true traits.BoolTraitBoolInst x + then BoolTrait.ret_true BoolTraitBool x else Result.ret false -/- [traits::{core::option::Option<T>#1}::get_bool]: +/- [traits::{(traits::BoolTrait for core::option::Option<T>)#1}::get_bool]: Source: 'src/traits.rs', lines 23:4-23:30 -/ -def Option.get_bool (T : Type) (self : Option T) : Result Bool := +def BoolTraitOption.get_bool (T : Type) (self : Option T) : Result Bool := match self with | none => Result.ret false | some _ => Result.ret true -/- Trait implementation: [traits::{core::option::Option<T>#1}] +/- Trait implementation: [traits::{(traits::BoolTrait for core::option::Option<T>)#1}] Source: 'src/traits.rs', lines 22:0-22:31 -/ -def traits.BoolTraitcoreoptionOptionTInst (T : Type) : BoolTrait (Option T) - := { - get_bool := Option.get_bool T +def BoolTraitOption (T : Type) : BoolTrait (Option T) := { + get_bool := BoolTraitOption.get_bool T } /- [traits::test_bool_trait_option]: Source: 'src/traits.rs', lines 31:0-31:54 -/ def test_bool_trait_option (T : Type) (x : Option T) : Result Bool := do - let b ← Option.get_bool T x + let b ← BoolTraitOption.get_bool T x if b - then BoolTrait.ret_true (traits.BoolTraitcoreoptionOptionTInst T) x + then BoolTrait.ret_true (BoolTraitOption T) x else Result.ret false /- [traits::test_bool_trait]: Source: 'src/traits.rs', lines 35:0-35:50 -/ def test_bool_trait - (T : Type) (BoolTraitTInst : BoolTrait T) (x : T) : Result Bool := - BoolTraitTInst.get_bool x + (T : Type) (BoolTraitInst : BoolTrait T) (x : T) : Result Bool := + BoolTraitInst.get_bool x /- Trait declaration: [traits::ToU64] Source: 'src/traits.rs', lines 39:0-39:15 -/ structure ToU64 (Self : Type) where to_u64 : Self → Result U64 -/- [traits::{u64#2}::to_u64]: +/- [traits::{(traits::ToU64 for u64)#2}::to_u64]: Source: 'src/traits.rs', lines 44:4-44:26 -/ -def U64.to_u64 (self : U64) : Result U64 := +def ToU64U64.to_u64 (self : U64) : Result U64 := Result.ret self -/- Trait implementation: [traits::{u64#2}] +/- Trait implementation: [traits::{(traits::ToU64 for u64)#2}] Source: 'src/traits.rs', lines 43:0-43:18 -/ -def traits.ToU64U64Inst : ToU64 U64 := { - to_u64 := U64.to_u64 +def ToU64U64 : ToU64 U64 := { + to_u64 := ToU64U64.to_u64 } -/- [traits::{(A, A)#3}::to_u64]: +/- [traits::{(traits::ToU64 for (A, A))#3}::to_u64]: Source: 'src/traits.rs', lines 50:4-50:26 -/ -def Pair.to_u64 - (A : Type) (ToU64AInst : ToU64 A) (self : (A × A)) : Result U64 := +def ToU64Pair.to_u64 + (A : Type) (ToU64Inst : ToU64 A) (self : (A × A)) : Result U64 := do let (t, t1) := self - let i ← ToU64AInst.to_u64 t - let i1 ← ToU64AInst.to_u64 t1 + let i ← ToU64Inst.to_u64 t + let i1 ← ToU64Inst.to_u64 t1 i + i1 -/- Trait implementation: [traits::{(A, A)#3}] +/- Trait implementation: [traits::{(traits::ToU64 for (A, A))#3}] Source: 'src/traits.rs', lines 49:0-49:31 -/ -def traits.ToU64TupleAAInst (A : Type) (ToU64AInst : ToU64 A) : ToU64 (A × A) - := { - to_u64 := Pair.to_u64 A ToU64AInst +def ToU64Pair (A : Type) (ToU64Inst : ToU64 A) : ToU64 (A × A) := { + to_u64 := ToU64Pair.to_u64 A ToU64Inst } /- [traits::f]: Source: 'src/traits.rs', lines 55:0-55:36 -/ -def f (T : Type) (ToU64TInst : ToU64 T) (x : (T × T)) : Result U64 := - Pair.to_u64 T ToU64TInst x +def f (T : Type) (ToU64Inst : ToU64 T) (x : (T × T)) : Result U64 := + ToU64Pair.to_u64 T ToU64Inst x /- [traits::g]: Source: 'src/traits.rs', lines 59:0-61:18 -/ def g - (T : Type) (ToU64TupleTTInst : ToU64 (T × T)) (x : (T × T)) : Result U64 := - ToU64TupleTTInst.to_u64 x + (T : Type) (ToU64PairInst : ToU64 (T × T)) (x : (T × T)) : Result U64 := + ToU64PairInst.to_u64 x /- [traits::h0]: Source: 'src/traits.rs', lines 66:0-66:24 -/ def h0 (x : U64) : Result U64 := - U64.to_u64 x + ToU64U64.to_u64 x /- [traits::Wrapper] Source: 'src/traits.rs', lines 70:0-70:21 -/ structure Wrapper (T : Type) where x : T -/- [traits::{traits::Wrapper<T>#4}::to_u64]: +/- [traits::{(traits::ToU64 for traits::Wrapper<T>)#4}::to_u64]: Source: 'src/traits.rs', lines 75:4-75:26 -/ -def Wrapper.to_u64 - (T : Type) (ToU64TInst : ToU64 T) (self : Wrapper T) : Result U64 := - ToU64TInst.to_u64 self.x +def ToU64traitsWrapper.to_u64 + (T : Type) (ToU64Inst : ToU64 T) (self : Wrapper T) : Result U64 := + ToU64Inst.to_u64 self.x -/- Trait implementation: [traits::{traits::Wrapper<T>#4}] +/- Trait implementation: [traits::{(traits::ToU64 for traits::Wrapper<T>)#4}] Source: 'src/traits.rs', lines 74:0-74:35 -/ -def traits.ToU64traitsWrapperTInst (T : Type) (ToU64TInst : ToU64 T) : ToU64 - (Wrapper T) := { - to_u64 := Wrapper.to_u64 T ToU64TInst +def ToU64traitsWrapper (T : Type) (ToU64Inst : ToU64 T) : ToU64 (Wrapper T) + := { + to_u64 := ToU64traitsWrapper.to_u64 T ToU64Inst } /- [traits::h1]: Source: 'src/traits.rs', lines 80:0-80:33 -/ def h1 (x : Wrapper U64) : Result U64 := - Wrapper.to_u64 U64 traits.ToU64U64Inst x + ToU64traitsWrapper.to_u64 U64 ToU64U64 x /- [traits::h2]: Source: 'src/traits.rs', lines 84:0-84:41 -/ -def h2 (T : Type) (ToU64TInst : ToU64 T) (x : Wrapper T) : Result U64 := - Wrapper.to_u64 T ToU64TInst x +def h2 (T : Type) (ToU64Inst : ToU64 T) (x : Wrapper T) : Result U64 := + ToU64traitsWrapper.to_u64 T ToU64Inst x /- Trait declaration: [traits::ToType] Source: 'src/traits.rs', lines 88:0-88:19 -/ structure ToType (Self T : Type) where to_type : Self → Result T -/- [traits::{u64#5}::to_type]: +/- [traits::{(traits::ToType<bool> for u64)#5}::to_type]: Source: 'src/traits.rs', lines 93:4-93:28 -/ -def U64.to_type (self : U64) : Result Bool := +def ToTypeU64Bool.to_type (self : U64) : Result Bool := Result.ret (self > 0#u64) -/- Trait implementation: [traits::{u64#5}] +/- Trait implementation: [traits::{(traits::ToType<bool> for u64)#5}] Source: 'src/traits.rs', lines 92:0-92:25 -/ -def traits.ToTypeU64BoolInst : ToType U64 Bool := { - to_type := U64.to_type +def ToTypeU64Bool : ToType U64 Bool := { + to_type := ToTypeU64Bool.to_type } /- Trait declaration: [traits::OfType] Source: 'src/traits.rs', lines 98:0-98:16 -/ structure OfType (Self : Type) where - of_type : forall (T : Type) (ToTypeTSelfInst : ToType T Self), T → Result - Self + of_type : forall (T : Type) (ToTypeInst : ToType T Self), T → Result Self /- [traits::h3]: Source: 'src/traits.rs', lines 104:0-104:50 -/ def h3 - (T1 T2 : Type) (OfTypeT1Inst : OfType T1) (ToTypeT2T1Inst : ToType T2 T1) + (T1 T2 : Type) (OfTypeInst : OfType T1) (ToTypeInst : ToType T2 T1) (y : T2) : Result T1 := - OfTypeT1Inst.of_type T2 ToTypeT2T1Inst y + OfTypeInst.of_type T2 ToTypeInst y /- Trait declaration: [traits::OfTypeBis] Source: 'src/traits.rs', lines 109:0-109:36 -/ structure OfTypeBis (Self T : Type) where - ToTypeTSelfInst : ToType T Self + ToTypeInst : ToType T Self of_type : T → Result Self /- [traits::h4]: Source: 'src/traits.rs', lines 118:0-118:57 -/ def h4 - (T1 T2 : Type) (OfTypeBisT1T2Inst : OfTypeBis T1 T2) (ToTypeT2T1Inst : ToType - T2 T1) (y : T2) : + (T1 T2 : Type) (OfTypeBisInst : OfTypeBis T1 T2) (ToTypeInst : ToType T2 T1) + (y : T2) : Result T1 := - OfTypeBisT1T2Inst.of_type y + OfTypeBisInst.of_type y /- [traits::TestType] Source: 'src/traits.rs', lines 122:0-122:22 -/ @@ -201,54 +198,53 @@ def h4 structure TestType.test.TestTrait (Self : Type) where test : Self → Result Bool -/- [traits::{traits::TestType<T>#6}::test::{traits::{traits::TestType<T>#6}::test::TestType1}::test]: +/- [traits::{traits::TestType<T>#6}::test::{(traits::{traits::TestType<T>#6}::test::TestTrait for traits::{traits::TestType<T>#6}::test::TestType1)}::test]: Source: 'src/traits.rs', lines 139:12-139:34 -/ -def TestType.test.TestType1.test +def TestType.test.TestTraittraitsTestTypetestTestType1.test (self : TestType.test.TestType1) : Result Bool := Result.ret (self > 1#u64) -/- Trait implementation: [traits::{traits::TestType<T>#6}::test::{traits::{traits::TestType<T>#6}::test::TestType1}] +/- Trait implementation: [traits::{traits::TestType<T>#6}::test::{(traits::{traits::TestType<T>#6}::test::TestTrait for traits::{traits::TestType<T>#6}::test::TestType1)}] Source: 'src/traits.rs', lines 138:8-138:36 -/ -def traits.TestType.test.TestTraittraitstraitsTestTypeTtestTestType1Inst : +def TestType.test.TestTraittraitsTestTypetestTestType1 : TestType.test.TestTrait TestType.test.TestType1 := { - test := TestType.test.TestType1.test + test := TestType.test.TestTraittraitsTestTypetestTestType1.test } /- [traits::{traits::TestType<T>#6}::test]: Source: 'src/traits.rs', lines 126:4-126:36 -/ def TestType.test - (T : Type) (ToU64TInst : ToU64 T) (self : TestType T) (x : T) : - Result Bool - := + (T : Type) (ToU64Inst : ToU64 T) (self : TestType T) (x : T) : Result Bool := do - let x1 ← ToU64TInst.to_u64 x + let x1 ← ToU64Inst.to_u64 x if x1 > 0#u64 - then TestType.test.TestType1.test 0#u64 + then TestType.test.TestTraittraitsTestTypetestTestType1.test 0#u64 else Result.ret false /- [traits::BoolWrapper] Source: 'src/traits.rs', lines 150:0-150:22 -/ @[reducible] def BoolWrapper := Bool -/- [traits::{traits::BoolWrapper#7}::to_type]: +/- [traits::{(traits::ToType<T> for traits::BoolWrapper)#7}::to_type]: Source: 'src/traits.rs', lines 156:4-156:25 -/ -def BoolWrapper.to_type +def ToTypetraitsBoolWrapperT.to_type (T : Type) (ToTypeBoolTInst : ToType Bool T) (self : BoolWrapper) : Result T := ToTypeBoolTInst.to_type self -/- Trait implementation: [traits::{traits::BoolWrapper#7}] +/- Trait implementation: [traits::{(traits::ToType<T> for traits::BoolWrapper)#7}] Source: 'src/traits.rs', lines 152:0-152:33 -/ -def traits.ToTypetraitsBoolWrapperTInst (T : Type) (ToTypeBoolTInst : ToType - Bool T) : ToType BoolWrapper T := { - to_type := BoolWrapper.to_type T ToTypeBoolTInst +def ToTypetraitsBoolWrapperT (T : Type) (ToTypeBoolTInst : ToType Bool T) : + ToType BoolWrapper T := { + to_type := ToTypetraitsBoolWrapperT.to_type T ToTypeBoolTInst } /- [traits::WithConstTy::LEN2] Source: 'src/traits.rs', lines 164:4-164:21 -/ -def with_const_ty_len2_body : Result Usize := Result.ret 32#usize -def with_const_ty_len2_c : Usize := eval_global with_const_ty_len2_body +def WithConstTy.LEN2_default_body : Result Usize := Result.ret 32#usize +def WithConstTy.LEN2_default : Usize := + eval_global WithConstTy.LEN2_default_body /- Trait declaration: [traits::WithConstTy] Source: 'src/traits.rs', lines 161:0-161:39 -/ @@ -260,40 +256,40 @@ structure WithConstTy (Self : Type) (LEN : Usize) where W_clause_0 : ToU64 W f : W → Array U8 LEN → Result W -/- [traits::{bool#8}::LEN1] +/- [traits::{(traits::WithConstTy<32: usize> for bool)#8}::LEN1] Source: 'src/traits.rs', lines 175:4-175:21 -/ -def bool_len1_body : Result Usize := Result.ret 12#usize -def bool_len1_c : Usize := eval_global bool_len1_body +def WithConstTyBool32.LEN1_body : Result Usize := Result.ret 12#usize +def WithConstTyBool32.LEN1 : Usize := eval_global WithConstTyBool32.LEN1_body -/- [traits::{bool#8}::f]: +/- [traits::{(traits::WithConstTy<32: usize> for bool)#8}::f]: Source: 'src/traits.rs', lines 180:4-180:39 -/ -def Bool.f (i : U64) (a : Array U8 32#usize) : Result U64 := +def WithConstTyBool32.f (i : U64) (a : Array U8 32#usize) : Result U64 := Result.ret i -/- Trait implementation: [traits::{bool#8}] +/- Trait implementation: [traits::{(traits::WithConstTy<32: usize> for bool)#8}] Source: 'src/traits.rs', lines 174:0-174:29 -/ -def traits.WithConstTyBool32Inst : WithConstTy Bool 32#usize := { - LEN1 := bool_len1_c - LEN2 := with_const_ty_len2_c +def WithConstTyBool32 : WithConstTy Bool 32#usize := { + LEN1 := WithConstTyBool32.LEN1 + LEN2 := WithConstTy.LEN2_default V := U8 W := U64 - W_clause_0 := traits.ToU64U64Inst - f := Bool.f + W_clause_0 := ToU64U64 + f := WithConstTyBool32.f } /- [traits::use_with_const_ty1]: Source: 'src/traits.rs', lines 183:0-183:75 -/ def use_with_const_ty1 - (H : Type) (LEN : Usize) (WithConstTyHLENInst : WithConstTy H LEN) : + (H : Type) (LEN : Usize) (WithConstTyInst : WithConstTy H LEN) : Result Usize := - Result.ret WithConstTyHLENInst.LEN1 + Result.ret WithConstTyInst.LEN1 /- [traits::use_with_const_ty2]: Source: 'src/traits.rs', lines 187:0-187:73 -/ def use_with_const_ty2 - (H : Type) (LEN : Usize) (WithConstTyHLENInst : WithConstTy H LEN) - (w : WithConstTyHLENInst.W) : + (H : Type) (LEN : Usize) (WithConstTyInst : WithConstTy H LEN) + (w : WithConstTyInst.W) : Result Unit := Result.ret () @@ -301,11 +297,11 @@ def use_with_const_ty2 /- [traits::use_with_const_ty3]: Source: 'src/traits.rs', lines 189:0-189:80 -/ def use_with_const_ty3 - (H : Type) (LEN : Usize) (WithConstTyHLENInst : WithConstTy H LEN) - (x : WithConstTyHLENInst.W) : + (H : Type) (LEN : Usize) (WithConstTyInst : WithConstTy H LEN) + (x : WithConstTyInst.W) : Result U64 := - WithConstTyHLENInst.W_clause_0.to_u64 x + WithConstTyInst.W_clause_0.to_u64 x /- [traits::test_where1]: Source: 'src/traits.rs', lines 193:0-193:40 -/ @@ -334,27 +330,27 @@ structure ParentTrait1 (Self : Type) where /- Trait declaration: [traits::ChildTrait] Source: 'src/traits.rs', lines 206:0-206:49 -/ structure ChildTrait (Self : Type) where - ParentTrait0SelfInst : ParentTrait0 Self - ParentTrait1SelfInst : ParentTrait1 Self + ParentTrait0Inst : ParentTrait0 Self + ParentTrait1Inst : ParentTrait1 Self /- [traits::test_child_trait1]: Source: 'src/traits.rs', lines 209:0-209:56 -/ def test_child_trait1 - (T : Type) (ChildTraitTInst : ChildTrait T) (x : T) : Result String := - ChildTraitTInst.ParentTrait0SelfInst.get_name x + (T : Type) (ChildTraitInst : ChildTrait T) (x : T) : Result String := + ChildTraitInst.ParentTrait0Inst.get_name x /- [traits::test_child_trait2]: Source: 'src/traits.rs', lines 213:0-213:54 -/ def test_child_trait2 - (T : Type) (ChildTraitTInst : ChildTrait T) (x : T) : - Result ChildTraitTInst.ParentTrait0SelfInst.W + (T : Type) (ChildTraitInst : ChildTrait T) (x : T) : + Result ChildTraitInst.ParentTrait0Inst.W := - ChildTraitTInst.ParentTrait0SelfInst.get_w x + ChildTraitInst.ParentTrait0Inst.get_w x /- [traits::order1]: Source: 'src/traits.rs', lines 219:0-219:59 -/ def order1 - (T U : Type) (ParentTrait0TInst : ParentTrait0 T) (ParentTrait0UInst : + (T U : Type) (ParentTrait0Inst : ParentTrait0 T) (ParentTrait0Inst1 : ParentTrait0 U) : Result Unit := @@ -363,17 +359,17 @@ def order1 /- Trait declaration: [traits::ChildTrait1] Source: 'src/traits.rs', lines 222:0-222:35 -/ structure ChildTrait1 (Self : Type) where - ParentTrait1SelfInst : ParentTrait1 Self + ParentTrait1Inst : ParentTrait1 Self -/- Trait implementation: [traits::{usize#9}] +/- Trait implementation: [traits::{(traits::ParentTrait1 for usize)#9}] Source: 'src/traits.rs', lines 224:0-224:27 -/ -def traits.ParentTrait1UsizeInst : ParentTrait1 Usize := { +def ParentTrait1Usize : ParentTrait1 Usize := { } -/- Trait implementation: [traits::{usize#10}] +/- Trait implementation: [traits::{(traits::ChildTrait1 for usize)#10}] Source: 'src/traits.rs', lines 225:0-225:26 -/ -def traits.ChildTrait1UsizeInst : ChildTrait1 Usize := { - ParentTrait1SelfInst := traits.ParentTrait1UsizeInst +def ChildTrait1Usize : ChildTrait1 Usize := { + ParentTrait1Inst := ParentTrait1Usize } /- Trait declaration: [traits::Iterator] @@ -397,7 +393,7 @@ structure FromResidual (Self T : Type) where Source: 'src/traits.rs', lines 246:0-246:48 -/ structure Try (Self : Type) where Residual : Type - FromResidualSelftraitsTrySelfResidualInst : FromResidual Self Residual + FromResidualSelftraitsTryResidualInst : FromResidual Self Residual /- Trait declaration: [traits::WithTarget] Source: 'src/traits.rs', lines 252:0-252:20 -/ @@ -413,33 +409,32 @@ structure ParentTrait2 (Self : Type) where /- Trait declaration: [traits::ChildTrait2] Source: 'src/traits.rs', lines 260:0-260:35 -/ structure ChildTrait2 (Self : Type) where - ParentTrait2SelfInst : ParentTrait2 Self - convert : ParentTrait2SelfInst.U → Result - ParentTrait2SelfInst.U_clause_0.Target + ParentTrait2Inst : ParentTrait2 Self + convert : ParentTrait2Inst.U → Result ParentTrait2Inst.U_clause_0.Target -/- Trait implementation: [traits::{u32#11}] +/- Trait implementation: [traits::{(traits::WithTarget for u32)#11}] Source: 'src/traits.rs', lines 264:0-264:23 -/ -def traits.WithTargetU32Inst : WithTarget U32 := { +def WithTargetU32 : WithTarget U32 := { Target := U32 } -/- Trait implementation: [traits::{u32#12}] +/- Trait implementation: [traits::{(traits::ParentTrait2 for u32)#12}] Source: 'src/traits.rs', lines 268:0-268:25 -/ -def traits.ParentTrait2U32Inst : ParentTrait2 U32 := { +def ParentTrait2U32 : ParentTrait2 U32 := { U := U32 - U_clause_0 := traits.WithTargetU32Inst + U_clause_0 := WithTargetU32 } -/- [traits::{u32#13}::convert]: +/- [traits::{(traits::ChildTrait2 for u32)#13}::convert]: Source: 'src/traits.rs', lines 273:4-273:29 -/ -def U32.convert (x : U32) : Result U32 := +def ChildTrait2U32.convert (x : U32) : Result U32 := Result.ret x -/- Trait implementation: [traits::{u32#13}] +/- Trait implementation: [traits::{(traits::ChildTrait2 for u32)#13}] Source: 'src/traits.rs', lines 272:0-272:24 -/ -def traits.ChildTrait2U32Inst : ChildTrait2 U32 := { - ParentTrait2SelfInst := traits.ParentTrait2U32Inst - convert := U32.convert +def ChildTrait2U32 : ChildTrait2 U32 := { + ParentTrait2Inst := ParentTrait2U32 + convert := ChildTrait2U32.convert } /- Trait declaration: [traits::CFnOnce] @@ -451,14 +446,14 @@ structure CFnOnce (Self Args : Type) where /- Trait declaration: [traits::CFnMut] Source: 'src/traits.rs', lines 292:0-292:37 -/ structure CFnMut (Self Args : Type) where - CFnOnceSelfArgsInst : CFnOnce Self Args - call_mut : Self → Args → Result (CFnOnceSelfArgsInst.Output × Self) + CFnOnceInst : CFnOnce Self Args + call_mut : Self → Args → Result (CFnOnceInst.Output × Self) /- Trait declaration: [traits::CFn] Source: 'src/traits.rs', lines 296:0-296:33 -/ structure CFn (Self Args : Type) where - CFnMutSelfArgsInst : CFnMut Self Args - call : Self → Args → Result CFnMutSelfArgsInst.CFnOnceSelfArgsInst.Output + CFnMutInst : CFnMut Self Args + call : Self → Args → Result CFnMutInst.CFnOnceInst.Output /- Trait declaration: [traits::GetTrait] Source: 'src/traits.rs', lines 300:0-300:18 -/ @@ -469,7 +464,7 @@ structure GetTrait (Self : Type) where /- [traits::test_get_trait]: Source: 'src/traits.rs', lines 305:0-305:49 -/ def test_get_trait - (T : Type) (GetTraitTInst : GetTrait T) (x : T) : Result GetTraitTInst.W := - GetTraitTInst.get_w x + (T : Type) (GetTraitInst : GetTrait T) (x : T) : Result GetTraitInst.W := + GetTraitInst.get_w x end traits |