Skip to content

Commit ab53681

Browse files
committed
wip: add impl as axiom instead of notation
1 parent 4dac454 commit ab53681

File tree

313 files changed

+4234
-7142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

313 files changed

+4234
-7142
lines changed

CoqOfRust/_std/ops.v

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,16 @@ pub trait Generator<R = ()> {
239239
}
240240
*)
241241
Module Generator.
242-
Class Trait (Self : Set) (R : option Set) (Yield Return : Set) : Set := {
243-
R := defaultType R unit;
242+
Class Trait (Self : Set) {R Yield Return : Set} : Set := {
243+
R := R;
244244
Yield := Yield;
245245
Return := Return;
246246
resume : Pin (mut_ref Self) -> R -> GeneratorState Yield Return;
247247
}.
248+
249+
Module Default.
250+
Definition R : Set := unit.
251+
End Default.
248252
End Generator.
249253

250254
(*

CoqOfRust/alloc/collections/btree/map.v

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ where
3333
Module Cursor.
3434
Parameter t : Set -> Set -> Set.
3535
End Cursor.
36-
Definition Cursor := Cursor.t.
3736

3837
(*
3938
pub struct CursorMut<'a, K, V, A = Global>
@@ -45,8 +44,6 @@ where
4544
Module CursorMut.
4645
Parameter t : Set -> Set -> Set -> Set.
4746
End CursorMut.
48-
Definition CursorMut (K V : Set) (A : option Set) :=
49-
CursorMut.t K V (defaultType A alloc.Global.t).
5047

5148
(*
5249
pub struct DrainFilter<'a, K, V, F, A = Global>
@@ -61,11 +58,6 @@ Module DrainFilter.
6158
`{core.clone.Clone.Trait A},
6259
Set.
6360
End DrainFilter.
64-
Definition DrainFilter (K V : Set) (A : option Set)
65-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
66-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
67-
: Set :=
68-
DrainFilter.t K V (defaultType A alloc.Global.t).
6961

7062
(*
7163
pub struct OccupiedEntry<'a, K, V, A = Global>
@@ -79,11 +71,6 @@ Module OccupiedEntry.
7971
`{core.clone.Clone.Trait A},
8072
Set.
8173
End OccupiedEntry.
82-
Definition OccupiedEntry (K V : Set) (A : option Set)
83-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
84-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
85-
: Set :=
86-
OccupiedEntry.t K V (defaultType A alloc.Global.t).
8774

8875
(*
8976
pub struct OccupiedError<'a, K, V, A = Global>
@@ -101,15 +88,10 @@ Module OccupiedError.
10188
`{alloc.Allocator.Trait A}
10289
`{core.clone.Clone.Trait A}
10390
: Set := {
104-
entry : OccupiedEntry K V (Some A);
91+
entry : OccupiedEntry.t K V A;
10592
value : V;
10693
}.
10794
End OccupiedError.
108-
Definition OccupiedError (K V : Set) (A : option Set)
109-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
110-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
111-
: Set :=
112-
OccupiedError.t K V (defaultType A alloc.Global.t).
11395

11496
(*
11597
pub struct BTreeMap<K, V, A = Global>
@@ -127,11 +109,6 @@ Module BTreeMap.
127109
Definition A : Set := alloc.Global.t.
128110
End Default.
129111
End BTreeMap.
130-
Definition BTreeMap (K V A : Set)
131-
{H0 : alloc.Allocator.Trait A}
132-
{H1 : core.clone.Clone.Trait A} :
133-
Set :=
134-
M.Val (BTreeMap.t K V A).
135112

136113
(*
137114
pub struct IntoIter<K, V, A = Global>
@@ -145,11 +122,6 @@ Module IntoIter.
145122
`{core.clone.Clone.Trait A},
146123
Set.
147124
End IntoIter.
148-
Definition IntoIter (K V : Set) (A : option Set)
149-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
150-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
151-
: Set :=
152-
IntoIter.t K V (defaultType A alloc.Global.t).
153125

154126
(*
155127
pub struct IntoKeys<K, V, A = Global>
@@ -163,11 +135,6 @@ Module IntoKeys.
163135
`{core.clone.Clone.Trait A},
164136
Set.
165137
End IntoKeys.
166-
Definition IntoKeys (K V : Set) (A : option Set)
167-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
168-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
169-
: Set :=
170-
IntoKeys.t K V (defaultType A alloc.Global.t).
171138

172139
(*
173140
pub struct IntoValues<K, V, A = Global>
@@ -181,11 +148,6 @@ Module IntoValues.
181148
`{core.clone.Clone.Trait A},
182149
Set.
183150
End IntoValues.
184-
Definition IntoValues (K V : Set) (A : option Set)
185-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
186-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
187-
: Set :=
188-
IntoValues.t K V (defaultType A alloc.Global.t).
189151

190152
(*
191153
pub struct Iter<'a, K, V>
@@ -197,7 +159,6 @@ where
197159
Module Iter.
198160
Parameter t : Set -> Set -> Set.
199161
End Iter.
200-
Definition Iter := Iter.t.
201162

202163
(*
203164
pub struct IterMut<'a, K, V>
@@ -209,13 +170,11 @@ where
209170
Module IterMut.
210171
Parameter t : Set -> Set -> Set.
211172
End IterMut.
212-
Definition IterMut := IterMut.t.
213173

214174
(* pub struct Keys<'a, K, V> { /* private fields */ } *)
215175
Module Keys.
216176
Parameter t : Set -> Set -> Set.
217177
End Keys.
218-
Definition Keys := Keys.t.
219178

220179
(*
221180
pub struct Range<'a, K, V>
@@ -227,7 +186,6 @@ where
227186
Module Range.
228187
Parameter t : Set -> Set -> Set.
229188
End Range.
230-
Definition Range := Range.t.
231189

232190
(*
233191
pub struct RangeMut<'a, K, V>
@@ -239,7 +197,6 @@ where
239197
Module RangeMut.
240198
Parameter t : Set -> Set -> Set.
241199
End RangeMut.
242-
Definition RangeMut := RangeMut.t.
243200

244201
(*
245202
pub struct VacantEntry<'a, K, V, A = Global>
@@ -253,23 +210,16 @@ Module VacantEntry.
253210
`{core.clone.Clone.Trait A},
254211
Set.
255212
End VacantEntry.
256-
Definition VacantEntry (K V : Set) (A : option Set)
257-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
258-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
259-
: Set :=
260-
VacantEntry.t K V (defaultType A alloc.Global.t).
261213

262214
(* pub struct Values<'a, K, V> { /* private fields */ } *)
263215
Module Values.
264216
Parameter t : Set -> Set -> Set.
265217
End Values.
266-
Definition Values := Values.t.
267218

268219
(* pub struct ValuesMut<'a, K, V> { /* private fields */ } *)
269220
Module ValuesMut.
270221
Parameter t : Set -> Set -> Set.
271222
End ValuesMut.
272-
Definition ValuesMut := ValuesMut.t.
273223

274224
(* ********ENUMS******** *)
275225
(*
@@ -297,8 +247,3 @@ Module Entry.
297247
| Occupied
298248
.
299249
End Entry.
300-
Definition Entry (K V : Set) (A : option Set)
301-
`{alloc.Allocator.Trait (defaultType A alloc.Global.t)}
302-
`{core.clone.Clone.Trait (defaultType A alloc.Global.t)}
303-
: Set :=
304-
Entry.t K V (defaultType A alloc.Global.t).

CoqOfRust/alloc/vec.v

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ where
2727
Module DrainFilter.
2828
Parameter t : forall (T F A : Set), Set.
2929
End DrainFilter.
30-
Definition DrainFilter (T F : Set) (A : option Set)
31-
`{Allocator.Trait (defaultType A alloc.Global.t)}
32-
`{FnMut.Trait F (mut_ref T -> bool)}
33-
: Set :=
34-
DrainFilter.t T F (defaultType A alloc.Global.t).
3530
(*
3631
let A_type := (defaultType A Global) in
3732
let traits
@@ -50,8 +45,6 @@ where
5045
Module Drain.
5146
Parameter t : forall (T A : Set), Set.
5247
End Drain.
53-
Definition Drain (T : Set) (A : option Set) : Set :=
54-
Drain.t T (defaultType A alloc.Global.t).
5548
(*
5649
let A_type := (defaultType A Global) in
5750
let traits
@@ -71,8 +64,6 @@ Module into_iter.
7164
Module IntoIter.
7265
Parameter t : forall (T A : Set), Set.
7366
End IntoIter.
74-
Definition IntoIter (T : Set) (A : option Set) :=
75-
IntoIter.t T (defaultType A alloc.Global.t).
7667
(*
7768
let A_type := (defaultType A Global) in
7869
let traits
@@ -94,8 +85,6 @@ where
9485
Module Splice.
9586
Parameter t : forall (I A : Set), Set.
9687
End Splice.
97-
Definition Splice (I : Set) (A : option Set) :=
98-
Splice.t I (defaultType A alloc.Global.t).
9988

10089
(* BUGGED: same as above *)
10190
(*

CoqOfRust/blacklist.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,11 @@ examples/axiomatized/examples/traits/returning_traits_with_dyn.v
4444
examples/axiomatized/examples/traits/supertraits.v
4545
examples/axiomatized/examples/traits/traits_parms.v
4646
examples/axiomatized/examples/traits/traits.v
47-
examples/default/examples/conversion/parsing_a_string.v
4847
examples/default/examples/conversion/try_from_and_try_into.v
4948
examples/default/examples/custom_types/enums_c_like.v
5049
examples/default/examples/custom_types/enums_testcase_linked_list.v
5150
examples/default/examples/custom_types/structures.v
52-
examples/default/examples/error_handling/aliases_for_result.v
5351
examples/default/examples/error_handling/boxing_errors.v
54-
examples/default/examples/error_handling/defining_an_error_type.v
55-
examples/default/examples/error_handling/early_returns.v
56-
examples/default/examples/error_handling/introducing_question_mark_is_an_replacement_for_deprecated_try.v
57-
examples/default/examples/error_handling/introducing_question_mark.v
5852
examples/default/examples/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition_unwrapped.v
5953
examples/default/examples/error_handling/iterating_over_results_collect_valid_values_and_failures_via_partition.v
6054
examples/default/examples/error_handling/iterating_over_results_collect_via_map_err_and_filter_map.v
@@ -63,14 +57,10 @@ examples/default/examples/error_handling/iterating_over_results_failed.v
6357
examples/default/examples/error_handling/iterating_over_results_handle_via_filter_map.v
6458
examples/default/examples/error_handling/map_in_result_via_combinators.v
6559
examples/default/examples/error_handling/map_in_result_via_match.v
66-
examples/default/examples/error_handling/multiple_error_types.v
6760
examples/default/examples/error_handling/other_uses_of_question_mark.v
6861
examples/default/examples/error_handling/pulling_results_out_of_options_with_stop_error_processing.v
69-
examples/default/examples/error_handling/pulling_results_out_of_options.v
70-
examples/default/examples/error_handling/result_use_in_main.v
7162
examples/default/examples/error_handling/unpacking_options_and_defaults_via_get_or_insert_with.v
7263
examples/default/examples/error_handling/unpacking_options_and_defaults_via_or_else.v
73-
examples/default/examples/error_handling/unpacking_options_and_defaults_via_or.v
7464
examples/default/examples/error_handling/unpacking_options_via_question_mark.v
7565
examples/default/examples/error_handling/wrapping_errors.v
7666
examples/default/examples/flow_of_control/for_and_iterators_iter_mut.v
@@ -102,47 +92,38 @@ examples/default/examples/generics/generics_phantom_type_test_case_unit_clarific
10292
examples/default/examples/generics/generics_phantom_type.v
10393
examples/default/examples/generics/generics.v
10494
examples/default/examples/guessing_game/guessing_game.v
105-
examples/default/examples/hello_world/formatted_print.v
10695
examples/default/examples/macro_rules/macro_rules_designators.v
10796
examples/default/examples/macro_rules/macro_rules_repeat.v
10897
examples/default/examples/modules/struct_visibility.v
10998
examples/default/examples/modules/super_and_self.v
11099
examples/default/examples/modules/the_use_as_declaration.v
111100
examples/default/examples/modules/visibility.v
112101
examples/default/examples/primitives/arrays_and_slices.v
113-
examples/default/examples/primitives/literals_operators.v
114102
examples/default/examples/primitives/tuples.v
115103
examples/default/examples/scoping_rules/scoping_rules_borrowing.v
116104
examples/default/examples/scoping_rules/scoping_rules_lifetimes_bounds.v
117105
examples/default/examples/scoping_rules/scoping_rules_lifetimes_structs.v
118-
examples/default/examples/scoping_rules/scoping_rules_lifetimes_traits.v
119106
examples/default/examples/scoping_rules/scoping_rules_ownership_and_rules_mutablity.v
120107
examples/default/examples/scoping_rules/scoping_rules_ownership_and_rules_partial_moves.v
121108
examples/default/examples/std_library_types/arc.v
122109
examples/default/examples/std_library_types/box_stack_heap.v
123110
examples/default/examples/std_library_types/hash_map_alternate_or_custom_key_types.v
124111
examples/default/examples/std_library_types/hash_map_hash_set.v
125112
examples/default/examples/std_library_types/hash_map.v
126-
examples/default/examples/std_library_types/option.v
127113
examples/default/examples/std_library_types/rc.v
128114
examples/default/examples/std_library_types/result_chaining_with_question_mark.v
129115
examples/default/examples/std_library_types/result.v
130-
examples/default/examples/std_library_types/strings_byte_strings_as_non_utf8.v
131116
examples/default/examples/std_library_types/strings_literals_and_escapes.v
132117
examples/default/examples/std_library_types/strings_raw_string_literals.v
133118
examples/default/examples/std_library_types/strings.v
134119
examples/default/examples/std_library_types/vectors.v
135120
examples/default/examples/std_misc/channels.v
136121
examples/default/examples/std_misc/child_processes_pipes.v
137-
examples/default/examples/std_misc/child_processes_wait.v
138122
examples/default/examples/std_misc/child_processes.v
139-
examples/default/examples/std_misc/file_io_create.v
140-
examples/default/examples/std_misc/file_io_open.v
141123
examples/default/examples/std_misc/file_io_read_lines_efficient_method.v
142124
examples/default/examples/std_misc/file_io_read_lines.v
143125
examples/default/examples/std_misc/filesystem_operations.v
144126
examples/default/examples/std_misc/foreign_function_interface.v
145-
examples/default/examples/std_misc/path.v
146127
examples/default/examples/std_misc/program_arguments_parsing.v
147128
examples/default/examples/std_misc/program_arguments.v
148129
examples/default/examples/std_misc/threads_test_case_map_reduce.v

CoqOfRust/examples/axiomatized/examples/conversion/converting_to_string.v

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ Section Impl_core_fmt_Display_for_converting_to_string_Circle_t.
2424
Parameter fmt :
2525
(ref Self) -> (mut_ref core.fmt.Formatter.t) -> M ltac:(core.fmt.Result).
2626

27-
Global Instance AssociatedFunction_fmt : Notations.DoubleColon Self "fmt" := {
28-
Notations.double_colon := fmt;
29-
}.
27+
Axiom fmt_is_impl : impl Self "fmt" = fmt.
3028

3129
Global Instance ℐ : core.fmt.Display.Trait Self := {
3230
core.fmt.Display.fmt := fmt;

CoqOfRust/examples/axiomatized/examples/conversion/from.v

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ Section Impl_core_convert_From_i32_t_for_from_Number_t.
2323
*)
2424
Parameter from : i32.t -> M Self.
2525

26-
Global Instance AssociatedFunction_from :
27-
Notations.DoubleColon Self "from" := {
28-
Notations.double_colon := from;
29-
}.
26+
Axiom from_is_impl : impl Self "from" = from.
3027

3128
Global Instance ℐ : core.convert.From.Trait Self (T := i32.t) := {
3229
core.convert.From.from := from;

CoqOfRust/examples/axiomatized/examples/conversion/into.v

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ Section Impl_core_convert_From_i32_t_for_into_Number_t.
2323
*)
2424
Parameter from : i32.t -> M Self.
2525

26-
Global Instance AssociatedFunction_from :
27-
Notations.DoubleColon Self "from" := {
28-
Notations.double_colon := from;
29-
}.
26+
Axiom from_is_impl : impl Self "from" = from.
3027

3128
Global Instance ℐ : core.convert.From.Trait Self (T := i32.t) := {
3229
core.convert.From.from := from;

CoqOfRust/examples/axiomatized/examples/conversion/try_from_and_try_into.v

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ Section Impl_core_fmt_Debug_for_try_from_and_try_into_EvenNumber_t.
2222
Parameter fmt :
2323
(ref Self) -> (mut_ref core.fmt.Formatter.t) -> M ltac:(core.fmt.Result).
2424

25-
Global Instance AssociatedFunction_fmt : Notations.DoubleColon Self "fmt" := {
26-
Notations.double_colon := fmt;
27-
}.
25+
Axiom fmt_is_impl : impl Self "fmt" = fmt.
2826

2927
Global Instance ℐ : core.fmt.Debug.Trait Self := {
3028
core.fmt.Debug.fmt := fmt;
@@ -51,9 +49,7 @@ Section Impl_core_cmp_PartialEq_for_try_from_and_try_into_EvenNumber_t.
5149
Parameter eq :
5250
(ref Self) -> (ref try_from_and_try_into.EvenNumber.t) -> M bool.t.
5351

54-
Global Instance AssociatedFunction_eq : Notations.DoubleColon Self "eq" := {
55-
Notations.double_colon := eq;
56-
}.
52+
Axiom eq_is_impl : impl Self "eq" = eq.
5753

5854
Global Instance ℐ :
5955
core.cmp.PartialEq.Required.Trait Self
@@ -84,10 +80,7 @@ Section Impl_core_convert_TryFrom_i32_t_for_try_from_and_try_into_EvenNumber_t.
8480
*)
8581
Parameter try_from : i32.t -> M (core.result.Result.t Self Error.t).
8682

87-
Global Instance AssociatedFunction_try_from :
88-
Notations.DoubleColon Self "try_from" := {
89-
Notations.double_colon := try_from;
90-
}.
83+
Axiom try_from_is_impl : impl Self "try_from" = try_from.
9184

9285
Global Instance ℐ : core.convert.TryFrom.Trait Self (T := i32.t) := {
9386
core.convert.TryFrom.Error := Error;

0 commit comments

Comments
 (0)