Module L5.
#[local] Canonical Structure cs_lambda_func5 :=
{| cs_lambda_key := Nat.add 1 |}. Check (refl_equal _ : cs_lambda_key _ = fun x => 1 + x). End L5. End LambdaKeys.
Module DepProd.
Structure hello := { hello_key : Type }. Module FixedTypes. Local Canonical Structure hello_dep1 := {| hello_key := forall x : nat, x = x |}.
Example ex_hello2 := let h := _ in fun f : hello_key h => (f : forall x : nat, x = x) 1. End FixedTypes.
Module VariableTypes. Local Canonical Structure hello_dep2 v1 v2 := {| hello_key := forall x : list v1, x = v2 |}.
Example ex_hello1 : _ -> _ = nil := let h := _ in fun f : hello_key h => (f : forall x : list _, _ = _) (@nil nat). End VariableTypes. End DepProd.
(* Testing that canonical projections equipped with function type instances ([forall _, _]) or default instances ([_]) can be used in places where functions/function types are expected. This feature triggers CS search in two typing cases: 1. [f x : _] when [f : proj _] 2. [(fun x => _) : proj _].
*) Module NoCasts. Module Basic.
Structure r1 (useless_param: bool) :=
{ #[canonical=no] r1_pre : unit
; #[canonical=yes] r1_key : Type
; #[canonical=no] r1_post: nat
}.
Canonical Structure r1_func b : r1 b := {| r1_pre:= tt; r1_key := nat -> nat; r1_post:= 0|}.
Example ex_r1_1 p := let b := _ in fun f : @r1_key p b => f 1.
Example ex_r1_2 p := let b := _ in (fun x => x) : @r1_key p b. End Basic.
Module Primitive. LocalSet Primitive Projections.
Structure r2 (useless_param: bool) :=
{ #[canonical=no] r2_pre : unit
; #[canonical=yes] r2_key : Type
; #[canonical=no] r2_post: nat; }.
Canonical Structure r2_func b : r2 b := {| r2_pre:= tt; r2_key := nat -> nat; r2_post:= 0|}.
Example ex_r2_1 p := let b := _ in fun f : @r2_key p b => f 1.
Example ex_r2_2 p := let b := _ in (fun x => x) : @r2_key p b. End Primitive.
Module UsedParameters.
Structure r3 (useless_param: bool) (T : Type) :=
{ #[canonical=no] r3_pre : unit
; #[canonical=yes] r3_key : Type
; #[canonical=no] r3_post: T
}.
Canonical Structure r3_func b : r3 b nat := {| r3_pre:= tt; r3_key := nat -> nat; r3_post:= 0|}.
Example ex_r3_1 p := let b := _ in fun f : @r3_key p _ b => f 1.
Example ex_r3_2 p := let b := _ in (fun x => x) : @r3_key p _ b. End UsedParameters.
Module LetBoundFieldBefore.
Structure r4 (useless_param: bool) :=
{ #[canonical=no] r4_pre : unit
; #[canonical=no] r4_let := true
; #[canonical=yes] r4_key : Type
; #[canonical=no] r4_post: nat;
}.
Canonical Structure r4_func b : r4 b := {| r4_pre:= tt; r4_key := nat -> nat; r4_post:= 0|}.
Example ex_r4_1 p := let b := _ in fun f : @r4_key p b => f 1.
Example ex_r4_2 p := let b := _ in (fun x => x) : @r4_key p b. End LetBoundFieldBefore.
Module LetBoundFieldAfter.
Structure r4 (useless_param: bool) :=
{ #[canonical=no] r4_pre : unit
; #[canonical=yes] r4_key : Type
; #[canonical=no] r4_let := true
; #[canonical=no] r4_post: nat;
}.
Canonical Structure r4_func b : r4 b := {| r4_pre:= tt; r4_key := nat -> nat; r4_post:= 0|}.
Example ex_r4_1 p := let b := _ in fun f : @r4_key p b => f 1.
Example ex_r4_2 p := let b := _ in (fun x => x) : @r4_key p b. End LetBoundFieldAfter.
Module Tele. Inductive tele : Type :=
| TeleO : tele
| TeleS {X} : (X -> tele) -> tele.
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.