@@ -462,46 +462,40 @@ Module Stack.
462462 Definition t : Type :=
463463 list Set .
464464
465- Fixpoint to_Set (stack : t) : Set :=
466- match stack with
465+ Fixpoint to_Set_aux (A : Set ) (Stack : t) : Set :=
466+ match Stack with
467+ | [] => A
468+ | B :: Stack => A * to_Set_aux B Stack
469+ end .
470+
471+ Definition to_Set (Stack : t) : Set :=
472+ match Stack with
467473 | [] => unit
468- | A :: stack => A * to_Set stack
474+ | A :: Stack => to_Set_aux A Stack
469475 end .
470476
471477 Definition read_Set (Stack : t) (index : nat) : Set :=
472478 List.nth index Stack unit.
473479
474- Fixpoint read {Stack : t} (stack : to_Set Stack) (index : nat) : read_Set Stack index.
480+ Fixpoint read_aux {A : Set } {Stack : t}
481+ (stack : to_Set_aux A Stack)
482+ (index : nat)
483+ {struct Stack} :
484+ read_Set (A :: Stack) index.
475485 Proof .
476- destruct Stack as [|A Stack], index as [|index]; cbn in *.
477- { exact tt . }
478- { exact tt. }
486+ destruct Stack as [|B Stack], index as [|index]; cbn in *.
487+ { exact stack . }
488+ { destruct index; exact tt. }
479489 { exact (fst stack). }
480- { exact (read _ (snd stack) index). }
490+ { exact (read_aux _ _ (snd stack) index). }
481491 Defined .
482492
483- (* Module Read.
484- Inductive t {A : Set} `{Link A} {Stack : Stack.t} (stack : to_Set Stack) :
485- Ref.Core.t A ->
486- option A ->
487- Set :=
488- | Immediate
489- (value : option A) :
490- t stack
491- (Ref.Core.Immediate value)
492- value
493- | Mutable
494- (index : nat)
495- (path : Pointer.Path.t)
496- (big_to_value : read_Set Stack index -> Value.t)
497- (projection : read_Set Stack index -> option A)
498- (injection : read_Set Stack index -> A -> option (read_Set Stack index)) :
499- t stack
500- (Ref.Core.Mutable (Address := nat) (Big_A := read_Set Stack index)
501- index path big_to_value projection injection
502- )
503- (projection (read stack index)).
504- End Read. *)
493+ Definition read {Stack : t} (stack : to_Set Stack) (index : nat) : read_Set Stack index.
494+ Proof .
495+ destruct Stack; cbn in *.
496+ { destruct index; exact tt. }
497+ { apply (read_aux stack). }
498+ Defined .
505499
506500 Module CanRead.
507501 Inductive t {A : Set} `{Link A} (Stack : Stack.t) : Ref.Core.t A -> Set :=
0 commit comments