Primitive make : forall A, int -> A -> array A := #array_make. Arguments make {_} _ _.
Primitive get : forall A, array A -> int -> A := #array_get. Arguments get {_} _ _.
Notation"t .[ i ]" := (get t i)
(at level 2, left associativity, format "t .[ i ]").
Primitive set : forall A, array A -> int -> A -> array A := #array_set. Argumentsset {_} _ _ _.
Notation"t .[ i <- a ]" := (set t i a)
(at level 2, left associativity, format "t .[ i <- a ]").
Module Inconsistent. Definition P a := 0 = get (get a 1) 0. Definition H : P [|[|0|0|]; [|0|0|] |[| |0|]|] := eq_refl.
Fail Definition bad : P (let m := [| [|0|0|]; [|0|0|] |[| |0|]|] in set (set m 0 (get m 0)) 1 [| 1 |0|]) := H. (* Goal False. *) (* enough (eqb 1 0 = eqb 0 0) by (cbv in *; congruence). *) (* rewrite bad; reflexivity. *) (* Qed. *)
Inductive CMP (x:array (unit -> nat)) := C.
Definition F (x:nat) := fun _:unit => x.
Definition TARGET := let m := [| F 0; F 0 | F 0 |] in let m := set m 0 (fun _ => get (set m 1 (F 1)) 0 tt) in
CMP m.
Definition EVALED := Eval cbv in TARGET.
Check C [| F 0; F 0 | F 0 |] : EVALED. Check C [| F 0; F 0 | F 0 |] <: EVALED. Check C [| F 0; F 0 | F 0 |] <<: EVALED.
Fail Check C [| F 0; F 1 | F 0 |] : TARGET.
Fail Check C [| F 0; F 1 | F 0 |] <: TARGET.
Fail Check C [| F 0; F 1 | F 0 |] <<: TARGET. End Inconsistent.
Module ShouldWork.
Definition mem := array (array int). Definition SCM := (mem -> mem) -> mem. Definition run : SCM -> mem := fun s => s (fun x => x). Definition ret : mem -> SCM := fun x k => k x. Definition bind : SCM -> (mem -> SCM) -> SCM := fun s f k => s (fun m => f m k).
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.