@@ -2,6 +2,7 @@ Require Import CoqOfRust.CoqOfRust.
2
2
Require Import links.M.
3
3
Require Import core.cmp.
4
4
Require Import core.intrinsics.
5
+ Require Import core.links.option.
5
6
Require core.ops.links.function.
6
7
Require Import core.links.intrinsics.
7
8
Require Export core.links.cmpOrdering.
@@ -182,4 +183,63 @@ Module Impl_Ord_for_u64.
182
183
exact run_clamp.
183
184
}
184
185
Defined .
185
- End Impl_Ord_for_u64.
186
+ End Impl_Ord_for_u64.
187
+
188
+ Module PartialOrd.
189
+ (*
190
+ pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
191
+ fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>;
192
+ fn lt(&self, other: &Rhs) -> bool;
193
+ fn le(&self, other: &Rhs) -> bool;
194
+ fn gt(&self, other: &Rhs) -> bool;
195
+ fn ge(&self, other: &Rhs) -> bool;
196
+ }
197
+ *)
198
+ Definition Run_partial_cmp (Self Rhs : Set ) `{Link Self} `{Link Rhs} : Set :=
199
+ {partial_cmp @
200
+ IsTraitMethod.t "core::cmp::PartialOrd" [] [] (Φ Self) "partial_cmp" partial_cmp *
201
+ forall (self : Ref.t Pointer.Kind.Ref Self) (other: Ref.t Pointer.Kind.Ref Rhs),
202
+ {{ partial_cmp [] [] [φ self; φ other] 🔽 option Ordering.t }}
203
+ }.
204
+
205
+ Definition Run_lt (Self Rhs : Set ) `{Link Self} `{Link Rhs} : Set :=
206
+ {lt @
207
+ IsTraitMethod.t "core::cmp::PartialOrd" [] [] (Φ Self) "lt" lt *
208
+ forall (self : Ref.t Pointer.Kind.Ref Self) (other: Ref.t Pointer.Kind.Ref Rhs),
209
+ {{ lt [] [] [φ self; φ other] 🔽 bool }}
210
+ }.
211
+
212
+ Definition Run_le (Self Rhs : Set ) `{Link Self} `{Link Rhs} : Set :=
213
+ {le @
214
+ IsTraitMethod.t "core::cmp::PartialOrd" [] [] (Φ Self) "le" le *
215
+ forall (self : Ref.t Pointer.Kind.Ref Self) (other: Ref.t Pointer.Kind.Ref Rhs),
216
+ {{ le [] [] [φ self; φ other] 🔽 bool }}
217
+ }.
218
+
219
+ Definition Run_gt (Self Rhs : Set ) `{Link Self} `{Link Rhs} : Set :=
220
+ {gt @
221
+ IsTraitMethod.t "core::cmp::PartialOrd" [] [] (Φ Self) "gt" gt *
222
+ forall (self : Ref.t Pointer.Kind.Ref Self) (other: Ref.t Pointer.Kind.Ref Rhs),
223
+ {{ gt [] [] [φ self; φ other] 🔽 bool }}
224
+ }.
225
+
226
+ Definition Run_ge (Self Rhs : Set ) `{Link Self} `{Link Rhs} : Set :=
227
+ {ge @
228
+ IsTraitMethod.t "core::cmp::PartialOrd" [] [] (Φ Self) "ge" ge *
229
+ forall (self : Ref.t Pointer.Kind.Ref Self) (other: Ref.t Pointer.Kind.Ref Rhs),
230
+ {{ ge [] [] [φ self; φ other] 🔽 bool }}
231
+ }.
232
+
233
+ Record Run (Self Rhs : Set ) `{Link Self} `{Link Rhs} : Set := {
234
+ partial_cmp : Run_partial_cmp Self Rhs;
235
+ lt : Run_lt Self Rhs;
236
+ le : Run_le Self Rhs;
237
+ gt : Run_gt Self Rhs;
238
+ ge : Run_ge Self Rhs;
239
+ }.
240
+
241
+ (* Instance run_partial_cmp {Self Rhs : Set} `{Link Self} `{Link Rhs}
242
+ (self : Ref.t Pointer.Kind.Ref Self) (other : Ref.t Pointer.Kind.Ref Rhs) :
243
+ Run.Trait cmp.Impl_core_cmp_PartialOrd_for_core_cmp_Ordering.partial_cmp [] [] [φ self; φ other] (option Ordering.t).
244
+ Admitted. *)
245
+ End PartialOrd.
0 commit comments