text
stringlengths 0
3.34M
|
---|
! { dg-do compile }
!
! PR 54594: [OOP] Type-bound ASSIGNMENTs (elemental + array version) rejected as ambiguous
!
! Contributed by James van Buskirk
module a_mod
type :: a
contains
procedure, NOPASS :: a_ass, a_ass_sv
generic :: ass => a_ass, a_ass_sv
end type
contains
impure elemental subroutine a_ass (out)
class(a), intent(out) :: out
end subroutine
subroutine a_ass_sv (out)
class(a), intent(out) :: out(:)
end subroutine
end module
! { dg-final { cleanup-modules "a_mod" } }
|
Formal statement is: lemma Lim_emeasure_incseq: "range A \<subseteq> sets M \<Longrightarrow> incseq A \<Longrightarrow> (\<lambda>i. (emeasure M (A i))) \<longlonglongrightarrow> emeasure M (\<Union>i. A i)" Informal statement is: If $A_1 \subseteq A_2 \subseteq \cdots$ is an increasing sequence of sets, then $\mu(A_1) \leq \mu(A_2) \leq \cdots$ and $\lim_{n \to \infty} \mu(A_n) = \mu(\bigcup_{n=1}^\infty A_n)$. |
module Compiler.LLVM.Rapid.Builtin
import Data.Vect
import System.Info
import Core.Name
import Compiler.LLVM.IR
import Compiler.LLVM.Instruction
import Compiler.LLVM.Rapid.Foreign
import Compiler.LLVM.Rapid.Object
import Control.Codegen
import Data.Utils
import Rapid.Common
-- we provide our own in Data.Utils
%hide Core.Name.Namespace.showSep
mk_prim__bufferNew : Vect 2 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferNew [sizeObj, _] = do
size <- unboxInt' sizeObj
-- TODO: safety check: size < 2^32
hdrValue <- mkHeader OBJECT_TYPE_ID_BUFFER !(mkTrunc size)
newObj <- dynamicAllocate size
putObjectHeader newObj hdrValue
pure newObj
mk_prim__bufferSize : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferSize [arg0] = do
hdr <- getObjectHeader arg0
size <- mkAnd hdr (ConstI64 0xffffffff)
sizeInt <- cgMkInt size
pure sizeInt
mk_prim__bufferGetByte : Vect 3 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferGetByte [buf, offsetObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
byte <- load bytePtr
val <- mkZext {to=I64} byte
cgMkInt val
mk_prim__bufferSetByte : Vect 4 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferSetByte [buf, offsetObj, valObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
val <- mkTrunc {to=I8} !(unboxInt' valObj)
store val bytePtr
mkUnit
mk_prim__bufferGetDouble : Vect 3 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferGetDouble [buf, offsetObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
doublePtr <- bitcastA {n=1} bytePtr
val <- load doublePtr
cgMkDouble val
mk_prim__bufferSetDouble : Vect 4 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferSetDouble [buf, offsetObj, valObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
doublePtr <- bitcastA {n=1} bytePtr
val <- unboxFloat64' valObj
store val doublePtr
mkUnit
mk_prim__bufferGetInt : Vect 3 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferGetInt [buf, offsetObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
intPtr <- bitcastA {to=I64} {n=1} bytePtr
val <- load intPtr
cgMkInt val
mk_prim__bufferGetInt32 : Vect 3 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferGetInt32 [buf, offsetObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
intPtr <- bitcastA {to=I32} {n=1} bytePtr
val32 <- load intPtr
val <- mkZext val32
cgMkInt val
mk_prim__bufferSetInt : Vect 4 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferSetInt [buf, offsetObj, valObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
intPtr <- bitcastA {to=I64} {n=1} bytePtr
val <- unboxInt' valObj
store val intPtr
mkUnit
mk_prim__bufferSetInt32 : Vect 4 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferSetInt32 [buf, offsetObj, valObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
intPtr <- bitcastA {to=I32} {n=1} bytePtr
val <- mkTrunc {to=I32} !(unboxInt' valObj)
store val intPtr
mkUnit
mk_prim__bufferGetBits16 : Vect 3 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferGetBits16 [buf, offsetObj, _] = do
-- TODO: this assumes little-endian target architecture
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
bitsPtr <- bitcastA {to=I16} {n=1} bytePtr
valRaw <- load bitsPtr
val <- mkZext valRaw
cgMkInt val
mk_prim__bufferSetBits16 : Vect 4 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferSetBits16 [buf, offsetObj, valObj, _] = do
-- TODO: this assumes little-endian target architecture
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
bitsPtr <- bitcastA {to=I16} {n=1} bytePtr
val <- mkTrunc {to=I16} !(unboxInt' valObj)
store val bitsPtr
mkUnit
mk_prim__bufferGetString : Vect 4 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferGetString [buf, offsetObj, lengthObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
length <- unboxInt' lengthObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
newStr <- dynamicAllocate length
newHeader <- mkHeader OBJECT_TYPE_ID_STR !(mkTrunc length)
putObjectHeader newStr newHeader
strPayload <- getObjectPayloadAddr {t=I8} newStr
appendCode $ " call void @llvm.memcpy.p1i8.p1i8.i64(" ++ toIR strPayload ++ ", " ++ toIR bytePtr ++ ", " ++ toIR length ++ ", i1 false)"
pure newStr
mk_prim__bufferSetString : Vect 4 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferSetString [buf, offsetObj, valObj, _] = do
-- TODO: size check in safe mode
--hdr <- getObjectHeader buf
--size <- mkAnd hdr (ConstI64 0xffffffff)
offset <- unboxInt' offsetObj
payloadStart <- getObjectPayloadAddr {t=I8} buf
bytePtr <- getElementPtr payloadStart offset
strLength <- mkZext {to=I64} !(getStringByteLength valObj)
strPayload <- getObjectPayloadAddr {t=I8} valObj
appendCode $ " call void @llvm.memcpy.p1i8.p1i8.i64(" ++ toIR bytePtr ++ ", " ++ toIR strPayload ++ ", " ++ toIR strLength ++ ", i1 false)"
mkUnit
mk_prim__bufferCopyData : Vect 6 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__bufferCopyData [src, startObj, lenObj, dest, locObj, _] = do
start <- unboxInt' startObj
len <- unboxInt' lenObj
srcPayloadStart <- getObjectPayloadAddr {t=I8} src
srcPtr <- getElementPtr srcPayloadStart start
loc <- unboxInt' locObj
dstPayloadStart <- getObjectPayloadAddr {t=I8} dest
dstPtr <- getElementPtr dstPayloadStart loc
appendCode $ " call void @llvm.memmove.p1i8.p1i8.i64(" ++ toIR dstPtr ++ ", " ++ toIR srcPtr ++ ", " ++ toIR len ++ ", i1 false)"
mkUnit
mk_prim__nullAnyPtr : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__nullAnyPtr [p] = do
lblStart <- genLabel "nullAnyPtr_start"
lblInside <- genLabel "nullAnyPtr_inside"
lblEnd <- genLabel "nullAnyPtr_end"
jump lblStart
beginLabel lblStart
ptrObjIsZero <- SSA I1 <$> assignSSA ("call fastcc i1 @rapid.ptrisnull(" ++ toIR p ++ ")")
branch ptrObjIsZero lblEnd lblInside
beginLabel lblInside
payload <- getObjectSlot {t=I64} p 0
payloadIsZero <- icmp "eq" (ConstI64 0) payload
jump lblEnd
beginLabel lblEnd
isNullPtr <- phi [(ptrObjIsZero, lblStart), (payloadIsZero, lblInside)]
result <- cgMkInt !(mkZext isNullPtr)
pure result
mk_prim__getString : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__getString [p] = do
assertObjectType' p OBJECT_TYPE_ID_POINTER
payload <- getObjectSlot {t=IRObjPtr} p 0
assertObjectType' payload OBJECT_TYPE_ID_STR
pure payload
mk_prim__noop2 : Vect 2 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__noop2 [_, _] = do
mkUnit
mk_prim__currentDir : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__currentDir [_] = do
dummy <- mkStr "/tmp"
newPtr <- dynamicAllocate (Const I64 8)
putObjectHeader newPtr (constHeader OBJECT_TYPE_ID_POINTER 0)
putObjectSlot newPtr (Const I64 0) dummy
pure newPtr
mk_prelude_fastPack : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prelude_fastPack [charListObj] = do
newObj <- foreignCall {t=IRObjPtr} "@rapid_fast_pack" [toIR charListObj]
pure newObj
mk_prelude_fastAppend : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prelude_fastAppend [stringListObj] = do
newObj <- foreignCall {t=IRObjPtr} "@rapid_fast_append" [toIR stringListObj]
pure newObj
TAG_LIST_NIL : IRValue I32
TAG_LIST_NIL = Const I32 0
TAG_LIST_CONS : IRValue I32
TAG_LIST_CONS = Const I32 1
mk_prelude_fastUnpack : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prelude_fastUnpack [strObj] = do
nilHdr <- mkHeader OBJECT_TYPE_ID_CON_NO_ARGS TAG_LIST_NIL
nilObj <- dynamicAllocate (Const I64 0)
putObjectHeader nilObj nilHdr
startLbl <- genLabel "start"
returnLbl <- genLabel "ret"
loopInitLbl <- genLabel "li"
loopStartLbl <- genLabel "ls"
loopBodyLbl <- genLabel "ls"
loopEndLbl <- genLabel "le"
jump startLbl
beginLabel startLbl
stringByteLength <- getStringByteLength strObj
isEmpty <- icmp "eq" stringByteLength (Const I32 0)
branch isEmpty returnLbl loopInitLbl
beginLabel loopInitLbl
resultObj <- dynamicAllocate (Const I64 16)
putObjectHeader resultObj !(mkHeader (OBJECT_TYPE_ID_CON_NO_ARGS + 0x200) TAG_LIST_CONS)
payload0 <- getObjectPayloadAddr {t=I8} strObj
jump loopStartLbl
beginLabel loopStartLbl
nextBytePos <- SSA I32 <$> mkVarName "%nI."
nextTail <- SSA IRObjPtr <$> mkVarName "%nT."
bytePos <- phi [((Const I32 0), loopInitLbl), (nextBytePos, loopBodyLbl)]
currentTail <- phi [(resultObj, loopInitLbl), (nextTail, loopBodyLbl)]
payload <- getElementPtr payload0 bytePos
decodedRaw <- call {t=I64} "ccc" "@utf8_decode1_length" [toIR payload]
charVal <- mkTrunc {to=I32} decodedRaw
decodedLength <- mkTrunc {to=I32} !(mkShiftR decodedRaw (Const I64 32))
ch <- cgMkChar charVal
putObjectSlot currentTail (Const I64 0) ch
appendCode $ (showWithoutType nextBytePos) ++ " = add " ++ toIR bytePos ++ ", " ++ showWithoutType decodedLength
finished <- icmp "uge" nextBytePos stringByteLength
branch finished loopEndLbl loopBodyLbl
beginLabel loopBodyLbl
gc <- gcFlavour <$> getOpts
dynamicAllocateInto gc (showWithoutType nextTail) (Const I64 16)
putObjectHeader nextTail !(mkHeader (OBJECT_TYPE_ID_CON_NO_ARGS + 0x200) TAG_LIST_CONS)
putObjectSlot currentTail (Const I64 1) nextTail
jump loopStartLbl
beginLabel loopEndLbl
putObjectSlot currentTail (Const I64 1) nilObj
jump returnLbl
beginLabel returnLbl
phi [(nilObj, startLbl), (resultObj, loopEndLbl)]
TAG_UNCONS_RESULT_EOF : IRValue I32
TAG_UNCONS_RESULT_EOF = Const I32 0
TAG_UNCONS_RESULT_CHARACTER : IRValue I32
TAG_UNCONS_RESULT_CHARACTER = Const I32 1
mk_prim__stringIteratorNew : Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__stringIteratorNew [strObj] = do
iterObj <- cgMkInt (Const I64 0)
pure iterObj
mk_prim__stringIteratorNext : Vect 2 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__stringIteratorNext [strObj, iteratorObj] = do
offset <- unboxInt' iteratorObj
strLength <- mkZext !(getStringByteLength strObj)
mkIf (icmp "uge" offset strLength) (do
eofObj <- dynamicAllocate (Const I64 0)
hdr <- mkHeader OBJECT_TYPE_ID_CON_NO_ARGS TAG_UNCONS_RESULT_EOF
putObjectHeader eofObj hdr
pure eofObj
) (do
resultObj <- dynamicAllocate (Const I64 16)
hdrWithoutSize <- mkHeader OBJECT_TYPE_ID_CON_NO_ARGS TAG_UNCONS_RESULT_CHARACTER
hdr <- mkOr hdrWithoutSize (Const I64 (2 `prim__shl_Integer` 40))
putObjectHeader resultObj hdr
payload0 <- getObjectPayloadAddr {t=I8} strObj
payload <- getElementPtr payload0 offset
decodedRaw <- call {t=I64} "ccc" "@utf8_decode1_length" [toIR payload]
charVal <- mkTrunc {to=I32} decodedRaw
decodedLength <- mkTrunc {to=I32} !(mkShiftR decodedRaw (Const I64 32))
charObj <- cgMkChar charVal
putObjectSlot resultObj (Const I64 0) charObj
newOffset <- mkAdd !(mkZext decodedLength) offset
newIter <- cgMkInt newOffset
putObjectSlot resultObj (Const I64 1) newIter
pure resultObj
)
-- Needs to be kept in sync with time.c:
CLOCK_TYPE_UTC : Int
CLOCK_TYPE_UTC = 1
CLOCK_TYPE_MONOTONIC : Int
CLOCK_TYPE_MONOTONIC = 2
CLOCK_TYPE_DURATION : Int
CLOCK_TYPE_DURATION = 3
CLOCK_TYPE_PROCESS : Int
CLOCK_TYPE_PROCESS = 4
CLOCK_TYPE_THREAD : Int
CLOCK_TYPE_THREAD = 5
CLOCK_TYPE_GCCPU : Int
CLOCK_TYPE_GCCPU = 6
CLOCK_TYPE_GCREAL : Int
CLOCK_TYPE_GCREAL = 7
mk_prim__readTime : Int -> Vect 1 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__readTime clockType [_] = do
clock <- dynamicAllocate (Const I64 16)
hdr <- mkHeader OBJECT_TYPE_ID_CLOCK (Const I32 0)
putObjectHeader clock hdr
r <- foreignCall {t=I32} "@rapid_clock_read" [toIR clock, "i32 " ++ show clockType]
pure clock
mk_prim__clockSecond : Vect 2 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__clockSecond [clockObj, _] = do
secondsAddr <- getObjectSlotAddrVar {t=I64} clockObj (Const I64 0)
seconds <- cgMkBits64 !(load secondsAddr)
pure seconds
mk_prim__clockNanoSecond : Vect 2 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__clockNanoSecond [clockObj, _] = do
nanoSecondsAddr <- getObjectSlotAddrVar {t=I64} clockObj (Const I64 1)
nanoSeconds <- cgMkBits64 !(load nanoSecondsAddr)
pure nanoSeconds
mk_prim__clockIsValid : Vect 2 (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
mk_prim__clockIsValid [clockObj, _] = do
-- clock objects store either "1" or "0" in the size field as validity flag
valid <- cgMkInt !(mkZext !(getObjectSize clockObj))
pure valid
export
builtinPrimitives : List (String, (n : Nat ** (Vect n (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr))))
builtinPrimitives = [
("prim/blodwen-new-buffer", (2 ** mk_prim__bufferNew))
, ("prim/blodwen-buffer-size", (1 ** mk_prim__bufferSize))
, ("prim/blodwen-buffer-setbyte", (4 ** mk_prim__bufferSetByte))
, ("prim/blodwen-buffer-getbyte", (3 ** mk_prim__bufferGetByte))
, ("prim/blodwen-buffer-setbits16", (4 ** mk_prim__bufferSetBits16))
, ("prim/blodwen-buffer-getbits16", (3 ** mk_prim__bufferGetBits16))
, ("prim/blodwen-buffer-setint32", (4 ** mk_prim__bufferSetInt32))
, ("prim/blodwen-buffer-getint32", (3 ** mk_prim__bufferGetInt32))
, ("prim/blodwen-buffer-setint", (4 ** mk_prim__bufferSetInt))
, ("prim/blodwen-buffer-getint", (3 ** mk_prim__bufferGetInt))
, ("prim/blodwen-buffer-setdouble", (4 ** mk_prim__bufferSetDouble))
, ("prim/blodwen-buffer-getdouble", (3 ** mk_prim__bufferGetDouble))
, ("prim/blodwen-buffer-setstring", (4 ** mk_prim__bufferSetString))
, ("prim/blodwen-buffer-getstring", (4 ** mk_prim__bufferGetString))
, ("prim/blodwen-buffer-copydata", (6 ** mk_prim__bufferCopyData))
, ("prim/string-concat", (1 ** mk_prelude_fastAppend))
, ("prim/string-pack", (1 ** mk_prelude_fastPack))
, ("prim/string-unpack", (1 ** mk_prelude_fastUnpack))
, ("prim/blodwen-string-iterator-new", (1 ** mk_prim__stringIteratorNew))
, ("prim/blodwen-string-iterator-next", (2 ** mk_prim__stringIteratorNext))
--, ("prim/blodwen-string-iterator-to-string", (4 ** mk_prim__stringIteratorToString))
, ("prim/blodwen-clock-time-utc", (1 ** mk_prim__readTime CLOCK_TYPE_UTC))
, ("prim/blodwen-clock-time-monotonic", (1 ** mk_prim__readTime CLOCK_TYPE_MONOTONIC))
, ("prim/blodwen-clock-time-duration", (1 ** mk_prim__readTime CLOCK_TYPE_DURATION))
, ("prim/blodwen-clock-time-process", (1 ** mk_prim__readTime CLOCK_TYPE_PROCESS))
, ("prim/blodwen-clock-time-thread", (1 ** mk_prim__readTime CLOCK_TYPE_THREAD))
, ("prim/blodwen-clock-time-gccpu", (1 ** mk_prim__readTime CLOCK_TYPE_GCCPU))
, ("prim/blodwen-clock-time-gcreal", (1 ** mk_prim__readTime CLOCK_TYPE_GCREAL))
, ("prim/blodwen-clock-second", (2 ** mk_prim__clockSecond))
, ("prim/blodwen-clock-nanosecond", (2 ** mk_prim__clockNanoSecond))
, ("prim/blodwen-is-time", (2 ** mk_prim__clockIsValid))
, ("prim/isNull", (1 ** mk_prim__nullAnyPtr))
, ("prim/getString", (1 ** mk_prim__getString))
, ("prim/noop2", (2 ** mk_prim__noop2))
]
compileExtPrimFallback : Name -> List (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
compileExtPrimFallback n args =
do hp <- ((++) "%RuntimePtr ") <$> assignSSA "load %RuntimePtr, %RuntimePtr* %HpVar"
hpLim <- ((++) "%RuntimePtr ") <$> assignSSA "load %RuntimePtr, %RuntimePtr* %HpLimVar"
let base = "%TSOPtr %BaseArg"
result <- assignSSA $ "call fastcc %Return1 @_extprim_" ++ (safeName n) ++ "(" ++ showSep ", " (hp::base::hpLim::(map toIR args)) ++ ")"
newHp <- assignSSA $ "extractvalue %Return1 " ++ result ++ ", 0"
appendCode $ "store %RuntimePtr " ++ newHp ++ ", %RuntimePtr* %HpVar"
newHpLim <- assignSSA $ "extractvalue %Return1 " ++ result ++ ", 1"
appendCode $ "store %RuntimePtr " ++ newHpLim ++ ", %RuntimePtr* %HpLimVar"
returnValue <- SSA IRObjPtr <$> assignSSA ("extractvalue %Return1 " ++ result ++ ", 2")
pure returnValue
export
compileExtPrim : Name -> List (IRValue IRObjPtr) -> Codegen (IRValue IRObjPtr)
compileExtPrim (NS ns n) args with (unsafeUnfoldNamespace ns)
compileExtPrim (NS ns (UN $ Basic "prim__newArray")) [_, countArg, elemArg, _] | ["Prims", "IOArray", "Data"] = do
lblStart <- genLabel "new_array_init_start"
lblLoop <- genLabel "new_array_init_loop"
lblEnd <- genLabel "new_array_init_end"
count <- unboxInt' countArg
size <- mkMul (Const I64 8) count
newObj <- dynamicAllocate size
hdr <- mkHeader OBJECT_TYPE_ID_IOARRAY !(mkTrunc count)
putObjectHeader newObj hdr
jump lblStart
beginLabel lblStart
jump lblLoop
beginLabel lblLoop
iPlus1name <- mkVarName "%iplus1."
let iPlus1 = SSA I64 iPlus1name
i <- phi [(Const I64 0, lblStart), (iPlus1, lblLoop)]
addr <- getObjectSlotAddrVar newObj i
store elemArg addr
appendCode $ iPlus1name ++ " = add " ++ toIR i ++ ", 1"
continue <- icmp "ult" iPlus1 count
branch continue lblLoop lblEnd
beginLabel lblEnd
pure newObj
compileExtPrim (NS ns (UN $ Basic "prim__arrayGet")) [_, array, indexArg, _] | ["Prims", "IOArray", "Data"] = do
index <- unboxInt' indexArg
addr <- getObjectSlotAddrVar array index
load addr
compileExtPrim (NS ns (UN $ Basic "prim__arraySet")) [_, array, indexArg, val, _] | ["Prims", "IOArray", "Data"] = do
index <- unboxInt' indexArg
addr <- getObjectSlotAddrVar array index
store val addr
mkUnit
compileExtPrim (NS ns (UN $ Basic "prim__codegen")) [] | ["Info", "System"] = do
mkStr "rapid"
compileExtPrim (NS ns (UN $ Basic "prim__os")) [] | ["Info", "System"] = do
-- no cross compiling for now:
mkStr System.Info.os
compileExtPrim (NS ns (UN $ Basic "void")) _ | ["Uninhabited", "Prelude"] = do
appendCode $ " call ccc void @rapid_crash(i8* bitcast ([23 x i8]* @error_msg_void to i8*)) noreturn"
appendCode $ "unreachable"
pure nullPtr
compileExtPrim (NS ns (UN $ Basic "prim__void")) _ | ["Uninhabited", "Prelude"] = do
appendCode $ " call ccc void @rapid_crash(i8* bitcast ([23 x i8]* @error_msg_void to i8*)) noreturn"
appendCode $ "unreachable"
pure nullPtr
compileExtPrim (NS ns (UN $ Basic "prim__newIORef")) [_, val, _] | ["IORef", "Data"] = do
ioRefObj <- dynamicAllocate (Const I64 8)
putObjectHeader ioRefObj !(mkHeader OBJECT_TYPE_ID_IOREF (Const I32 0))
putObjectSlot ioRefObj (Const I64 0) val
pure ioRefObj
compileExtPrim (NS ns (UN $ Basic "prim__readIORef")) [_, ioRefObj, _] | ["IORef", "Data"] = do
getObjectSlot ioRefObj 0
compileExtPrim (NS ns (UN $ Basic "prim__writeIORef")) [_, ioRefObj, payload, _] | ["IORef", "Data"] = do
putObjectSlot ioRefObj (Const I64 0) payload
mkUnit
compileExtPrim (NS ns n) args | _ = compileExtPrimFallback (NS ns n) args
compileExtPrim n args = compileExtPrimFallback n args
|
= = = Clash with Reagan = = =
|
If $l$ is a limit point of $X$ and $f$ is eventually equal to $l$ on $F$, then $l$ is a limit point of $f$ on $F$. |
(*
Copyright (C) 2017 M.A.L. Marques
Copyright (C) 2018 Susi Lehtola
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)
(* type: mgga_exc *)
(* prefix:
mgga_x_msb_params *params;
assert(p->params != NULL);
params = (mgga_x_msb_params * ) (p->params);
*)
$include "mgga_x_ms.mpl"
(* eq (5) in the paper *)
msb_beta := (t, x) -> ms_alpha(t, x)*K_FACTOR_C/(t + K_FACTOR_C):
(* eq (14) in the supplement *)
msb_fa := b -> (1 - (2*b)^2)^3 / (1 + (2*b)^3 + params_a_b*(2*b)^6):
msb_f := (x, u, t) -> ms_f0(X2S^2*x^2, 0) + \
msb_fa(msb_beta(t,x))*(ms_f0(X2S^2*x^2, params_a_c) - ms_f0(X2S^2*x^2, 0)):
f := (rs, z, xt, xs0, xs1, u0, u1, t0, t1) ->
mgga_exchange(msb_f, rs, z, xs0, xs1, u0, u1, t0, t1):
|
section "Stack Machine and Compilation"
theory ASM imports AExp begin
subsection "Stack Machine"
text_raw\<open>\snip{ASMinstrdef}{0}{1}{%\<close>
datatype instr = LOADI val | LOAD vname | ADD
text_raw\<open>}%endsnip\<close>
text_raw\<open>\snip{ASMstackdef}{1}{2}{%\<close>
type_synonym stack = "val list"
text_raw\<open>}%endsnip\<close>
text\<open>\noindent Abbreviations are transparent: they are unfolded after
parsing and folded back again before printing. Internally, they do not
exist.\<close>
text_raw\<open>\snip{ASMexeconedef}{0}{1}{%\<close>
fun exec1 :: "instr \<Rightarrow> state \<Rightarrow> stack \<Rightarrow> stack" where
"exec1 (LOADI n) _ stk = n # stk" |
"exec1 (LOAD x) s stk = s(x) # stk" |
"exec1 ADD _ (j # i # stk) = (i + j) # stk"
text_raw\<open>}%endsnip\<close>
text_raw\<open>\snip{ASMexecdef}{1}{2}{%\<close>
fun exec :: "instr list \<Rightarrow> state \<Rightarrow> stack \<Rightarrow> stack" where
"exec [] _ stk = stk" |
"exec (i#is) s stk = exec is s (exec1 i s stk)"
text_raw\<open>}%endsnip\<close>
value "exec [LOADI 5, LOAD ''y'', ADD] <''x'' := 42, ''y'' := 43> [50]"
lemma exec_append[simp]:
"exec (is1@is2) s stk = exec is2 s (exec is1 s stk)"
apply(induction is1 arbitrary: stk)
apply (auto)
done
subsection "Compilation"
text_raw\<open>\snip{ASMcompdef}{0}{2}{%\<close>
fun comp :: "aexp \<Rightarrow> instr list" where
"comp (N n) = [LOADI n]" |
"comp (V x) = [LOAD x]" |
"comp (Plus e\<^sub>1 e\<^sub>2) = comp e\<^sub>1 @ comp e\<^sub>2 @ [ADD]"
text_raw\<open>}%endsnip\<close>
value "comp (Plus (Plus (V ''x'') (N 1)) (V ''z''))"
theorem exec_comp: "exec (comp a) s stk = aval a s # stk"
apply(induction a arbitrary: stk)
apply (auto)
done
end
|
subroutine blue(value,hexrep,bfrac)
c-----------------------------------------------------------------------
c
c Provided with a real value ``value'' this subroutine returns the blue
c portion of the color specification.
c
c Note common block "color" and call to "hexa"
c
c-----------------------------------------------------------------------
real*8 value
character hexrep*2,hexa*2
common /color/ cmin,cmax,cint(4),cscl
hexrep = '00'
if(value.lt.cint(2))then
c
c Scale it between (255,255):
c
integ = 255
else if((value.ge.cint(2)).and.(value.lt.cint(3)))then
c
c Scale it between (255,0):
c
integ = int((cint(3)-value)/(cint(3)-cint(2))*255.)
if(integ.gt.255) integ = 255
if(integ.lt.0) integ = 0
else if(value.ge.cint(3))then
c
c Scale it between (0,0):
c
integ = 0
end if
c
c Establish coding and return:
c
bfrac = real(integ) / 255.
hexrep = hexa(integ)
return
end
|
Formal statement is: lemma snd_pseudo_divmod_main: "snd (pseudo_divmod_main lc q r d dr n) = snd (pseudo_divmod_main lc q' r d dr n)" Informal statement is: The second component of the result of pseudo_divmod_main is the same for two different inputs. |
!-------------------------------------------------------------------------------
!> module ATMOSPHERE / Physics Cloud Microphysics / SDM
!!
!! @par Description
!! Memory management of the SDM variables
!!
!! - Reference
!! - Shima et al., 2009:
!! The super-droplet method for the numerical simulation of clouds and precipitation:
!! A particle-based and probabilistic microphysics model coupled with a non-hydrostatic model.
!! Quart. J. Roy. Meteorol. Soc., 135: 1307-1320
!!
!! @author Team SCALE
!!
!! @par History
!! @li 2014-06-23 (S.Shima) [new] Separated from scale_atmos_phy_mp_sdm.F90
!! @li 2014-07-14 (S.Shima) [rev] Removed unused variables
!! @li 2014-07-18 (Y.Sato) [add] add QTRC_sdm
!! @li 2014-07-22 (Y.Sato) [mod] modify the bug at the allocation of QTRC_sdm
!!
!<
!-------------------------------------------------------------------------------
module m_sdm_memmgr
implicit none
private
public :: sdm_allocinit
contains
!-----------------------------------------------------------------------------
subroutine sdm_allocinit
use scale_gridtrans, only: &
I_XYZ, I_XYW, &
GTRANS_GSQRT, &
GTRANS_J13G, &
GTRANS_J23G, &
GTRANS_J33G
use scale_tracer_sdm, only: &
QA
use scale_grid_index, only: &
IE,IS,KE,KS,JE,JS,IA,KA,JA ! S:start, E: end of active grids. A: num of grids including HALO.
use m_sdm_common
integer :: i, j, k, n, s
integer :: bndsdmdim, bufsiz ! For send/receive buffer. bndsdmdim is the number of variables for each sd. bufsiz is the num of sds that the buffer can store.
! There exists a bug on the multiplicity transfer, and should be fixed in the near future.
!------------------------------------------------------
! Get numbers of kind of chemical material contained as
! water-soluble aerosol in super droplets.
if( abs(mod(sdm_aslset,10))==1 ) then
!### init+rest : (NH4)2SO4 ###!
sdnumasl_s2c = 1
else if( abs(mod(sdm_aslset,10))==2 ) then
if( abs(sdm_aslset)==2 ) then
!### init : NaCl ###!
sdnumasl_s2c = 1
else if( abs(sdm_aslset)==12 ) then
!### init : NaCl, rest : (NH4)2SO4 ###!
sdnumasl_s2c = 2
end if
else if( abs(mod(sdm_aslset,10))==3 ) then
!### init+rest : (NH4)2SO4, NaCl, ... ###!
sdnumasl_s2c = 2 !! default
do n=1,20
if( sdm_aslmw(n)>0.0_RP ) then
sdnumasl_s2c = n + 2
end if
end do
end if
bndsdmdim = 8 + sdnumasl_s2c !! n,x,y,rk,u,v,w,r + asl(1:sdnumasl)
!--- Allocate arrays for SDM
allocate(sdn_s2c(1:sdnum_s2c))
allocate(sdri_s2c(1:sdnum_s2c))
allocate(sdrj_s2c(1:sdnum_s2c))
allocate(sdrk_s2c(1:sdnum_s2c))
allocate(sdx_s2c(1:sdnum_s2c))
allocate(sdy_s2c(1:sdnum_s2c))
allocate(sdz_s2c(1:sdnum_s2c))
allocate(sdr_s2c(1:sdnum_s2c))
allocate(sdu_s2c(1:sdnum_s2c))
allocate(sdv_s2c(1:sdnum_s2c))
allocate(sdvz_s2c(1:sdnum_s2c))
allocate(sdasl_s2c(1:sdnum_s2c,1:sdnumasl_s2c))
allocate(sdn_fm(1:sdfmnum_s2c))
allocate(sdri_fm(1:sdfmnum_s2c))
allocate(sdrj_fm(1:sdfmnum_s2c))
allocate(sdrk_fm(1:sdfmnum_s2c))
allocate(sdx_fm(1:sdfmnum_s2c))
allocate(sdy_fm(1:sdfmnum_s2c))
allocate(sdz_fm(1:sdfmnum_s2c))
allocate(sdr_fm(1:sdfmnum_s2c))
allocate(sdvz_fm(1:sdfmnum_s2c))
allocate(sdasl_fm(1:sdnum_s2c,1:sdnumasl_s2c))
allocate(sdrkl_s2c(IA,JA))
allocate(sdrku_s2c(IA,JA))
! These variables are not needed for SCALE. They are for leap-frog scheme of CReSS.
allocate(sdn_tmp(1:1))
allocate(sdrk_tmp(1:1))
allocate(sdx_tmp(1:1))
allocate(sdy_tmp(1:1))
allocate(sdz_tmp(1:1))
allocate(sdr_tmp(1:1))
allocate(sdu_tmp(1:1))
allocate(sdv_tmp(1:1))
allocate(sdvz_tmp(1:1))
allocate(sdasl_tmp(1:1,1:1))
allocate(rand_s2c(1:sdnum_s2c))
allocate(sortid_s2c(1:sdnum_s2c))
allocate(sortkey_s2c(1:sdnum_s2c))
allocate(sortfreq_s2c(1:ni_s2c*nj_s2c*nk_s2c+1))
allocate(sorttag_s2c(1:ni_s2c*nj_s2c*nk_s2c+2))
! These CReSS related variables should not be used for SCALE. Remove these in the near future.
!!$ allocate(rhod_crs(KA,IA,JA))
!!$ allocate(rhoc_sdm(KA,IA,JA))
!!$ allocate(rhor_sdm(KA,IA,JA))
!!$ allocate(rhoa_sdm(KA,IA,JA))
bufsiz = nint( sdininum_s2c )
bufsiz = nint( real(bufsiz) * ( real(sdm_extbuf)*1.E-2_RP) )
allocate(rbuf(1:bufsiz,bndsdmdim,1:2))
allocate(sbuf(1:bufsiz,bndsdmdim,1:2))
allocate(sdm_itmp1(1:ni_s2c*nj_s2c*nk_s2c+2))
allocate(sdm_itmp2(1:ni_s2c*nj_s2c*nk_s2c+2))
allocate(sdm_itmp3(1:ni_s2c*nj_s2c*nk_s2c+2))
! OpenMP not supported for SCLAE-LES-SDM. Rmove nomp in the near future.
allocate(sd_itmp1(1:sdnum_s2c,1:nomp))
allocate(sd_itmp2(1:sdnum_s2c,1:nomp))
allocate(sd_itmp3(1:sdnum_s2c,1:nomp))
allocate(sd_dtmp1(1:sdnum_s2c))
allocate( prr_crs(IA,JA,1:2) )
! allocate( j31(KA,IA,JA) )
! allocate( j32(KA,IA,JA) )
! allocate( jcb(KA,IA,JA) )
! allocate( jcb8w(KA,IA,JA) )
! allocate( mf(IA,JA) )
allocate( dxiv_sdm(IA) )
allocate( dyiv_sdm(JA) )
! allocate( dziv_sdm(KA) )
allocate( dx_sdm(IA) )
allocate( dy_sdm(JA) )
! allocate( dz_sdm(KA) )
allocate(QTRC_sdm(KA,IA,JA,QA))
! Initialize allocated array
QTRC_sdm(:,:,:,:) = 0.0_RP
!!$ rhod_crs(:,:,:) = 0.0_RP
!!$ rhoc_sdm(:,:,:) = 0.0_RP
!!$ rhor_sdm(:,:,:) = 0.0_RP
!!$ rhoa_sdm(:,:,:) = 0.0_RP
do n = 1, sdnum_s2c
sortid_s2c(n) = 0
sortkey_s2c(n) = 0
rand_s2c(n) = 0.0_RP
sdn_s2c(n) = int(0,kind=DP)
sdx_s2c(n) = 0.0_RP
sdy_s2c(n) = 0.0_RP
sdz_s2c(n) = 0.0_RP
sdr_s2c(n) = 0.0_RP
sdu_s2c(n) = 0.0_RP
sdv_s2c(n) = 0.0_RP
sdvz_s2c(n) = 0.0_RP
sd_itmp1(n,1:nomp) = 0
sd_itmp2(n,1:nomp) = 0
sd_itmp3(n,1:nomp) = 0
sd_dtmp1(n) = 0.0_RP
enddo
do s = 1, sdnumasl_s2c
do n = 1, sdnum_s2c
sdasl_s2c(n,s) = 0.0_RP
enddo
enddo
if( abs(sdm_aslset) > 10 ) then
do n = 1, sdfmnum_s2c
sdn_fm(n) = int(0,kind=DP)
sdx_fm(n) = 0.0_RP
sdy_fm(n) = 0.0_RP
sdz_fm(n) = 0.0_RP
sdr_fm(n) = 0.0_RP
sdvz_fm(n) = 0.0_RP
enddo
do s = 1, sdnumasl_s2c
do n = 1, sdnum_s2c
sdasl_fm(n,s) = 0.0_RP
enddo
enddo
endif
do n = 1, ni_s2c*nj_s2c*nk_s2c+1
sortfreq_s2c(n) = 0
enddo
do n = 1, ni_s2c*nj_s2c*nk_s2c+2
sorttag_s2c(n) = 0
sdm_itmp1(n) = 0
sdm_itmp2(n) = 0
sdm_itmp3(n) = 0
enddo
do k = 1,2
do j = 1, bndsdmdim
do i = 1, bufsiz
rbuf(i,j,k) = 0.0_RP
sbuf(i,j,k) = 0.0_RP
enddo
enddo
enddo
!!$ ! Check the evaluation of Jacobian later.
!!$ do k = 1, KA
!!$ do i = 1, IA
!!$ do j = 1, JA
!!$ j31(k,i,j) = GTRANS_J13G(k,i,j,I_XYZ) / GTRANS_GSQRT(k,i,j,I_XYZ)
!!$ j32(k,i,j) = GTRANS_J23G(k,i,j,I_XYZ) / GTRANS_GSQRT(k,i,j,I_XYZ)
!!$! jcb(k,i,j) = GTRANS_GSQRT(k,i,j,I_XYZ)
!!$! jcb8w(k,i,j) = GTRANS_GSQRT(k,i,j,I_XYW)
!!$ enddo
!!$ enddo
!!$ enddo
return
end subroutine sdm_allocinit
end module m_sdm_memmgr
|
function [week, sow] = time2weektow(time)
% SYNTAX:
% [week, sow] = time2weektow(time);
%
% INPUT:
% time = GPS time (continuous since 6-1-1980)
%
% OUTPUT:
% week = GPS week
% sow = GPS seconds-of-week
%
% DESCRIPTION:
% Conversion from GPS time in continuous format (similar to datenum) to
% GPS time in week, seconds-of-week.
%--- * --. --- --. .--. ... * ---------------------------------------------
% ___ ___ ___
% __ _ ___ / __| _ | __|
% / _` / _ \ (_ | _|__ \
% \__, \___/\___|_| |___/
% |___/ v 1.0RC1
%
%--------------------------------------------------------------------------
% Copyright (C) 2021 Geomatics Research & Development srl (GReD)
% Written by:
% Contributors: ...
% A list of all the historical goGPS contributors is in CREDITS.nfo
%--------------------------------------------------------------------------
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
%--------------------------------------------------------------------------
% 01100111 01101111 01000111 01010000 01010011
%--------------------------------------------------------------------------
sec_in_week = 7*86400;
sow = rem(time, sec_in_week);
week = (time - sow) / sec_in_week;
|
--
-- PoolLayer : pooling layer
--
module CNN.PoolLayer (
poolMax
, depoolMax
, reversePooling
) where
import Numeric.LinearAlgebra
import CNN.Algebra
import CNN.Image
import CNN.LayerType
type Pix = (Double, Double)
{- |
poolMax
In : pooling size (x = y)
image
OUT: updated image
position of max values
>>> let im = [fromLists [[1.0,2.0,3.0,4.0],[8.0,7.0,6.0,5.0],[1.0,3.0,5.0,7.0],[2.0,4.0,6.0,8.0]], fromLists [[1.0,2.0,3.0,4.0],[2.0,2.0,3.0,4.0],[3.0,3.0,3.0,4.0],[4.0,4.0,4.0,4.0]]]
>>> poolMax 2 im
[[(2><2)
[ 8.0, 6.0
, 4.0, 8.0 ],(2><2)
[ 2.0, 4.0
, 4.0, 4.0 ]],[(2><2)
[ 2.0, 2.0
, 3.0, 3.0 ],(2><2)
[ 1.0, 1.0
, 2.0, 1.0 ]]]
-}
poolMax :: Int -> Image -> [Image]
poolMax s im = [os, is]
where
pl = head im
x = cols pl `div` s
y = rows pl `div` s
ps = [(i*s, j*s) | i <- [0..(x-1)], j <- [0..(y-1)]]
(os, is) = unzip $ map (toPlain x y . maxPix s ps) im
toPlain :: Int -> Int -> [Pix] -> (Plain, Plain)
toPlain x y pls = ((x><y) op, (x><y) ip)
where
(op, ip) = unzip pls
maxPix :: Int -> [(Int, Int)] -> Plain -> [Pix]
maxPix s ps is = map (max' . toPix) ps
where
toPix :: (Int, Int) -> [Pix]
toPix p = zip (concat $ toLists $ subMatrix p (s, s) is) [0.0..]
max' :: [Pix] -> Pix
max' [] = error "empty list!"
max' [x] = x
max' (x:xs) = maximum' x (max' xs)
maximum' :: Pix -> Pix -> Pix
maximum' a@(v1, _) b@(v2, _) = if v1 < v2 then b else a
-- back prop
{- |
depoolMax
>>> let im = [fromLists [[0.0,2.0],[3.0,1.0]]]
>>> let dl = [fromLists [[0.1,0.2],[0.3,0.4]]]
>>> depoolMax 2 im dl
([(4><4)
[ 0.1, 0.0, 0.0, 0.0
, 0.0, 0.0, 0.2, 0.0
, 0.0, 0.0, 0.0, 0.4
, 0.0, 0.3, 0.0, 0.0 ]],Nothing)
-}
depoolMax :: Int -> Image -> Delta -> (Delta, Maybe Layer)
depoolMax s im d = (zipWith (concatWith (expand s 0.0)) im d, Nothing)
where
concatWith :: (Double -> Double -> Matrix R) -> Matrix R -> Matrix R
-> Matrix R
concatWith f i d = fromBlocks $ zipWith (zipWith f) is ds
where
is = toLists i
ds = toLists d
{- |
expand
IN : size of pooling
filling value
positions
delta values
>>> expand 2 0.0 0 3
(2><2)
[ 3.0, 0.0
, 0.0, 0.0 ]
>>> expand 2 0.0 2 4
(2><2)
[ 0.0, 0.0
, 4.0, 0.0 ]
>>> expand 3 0.0 5 3
(3><3)
[ 0.0, 0.0, 0.0
, 0.0, 0.0, 3.0
, 0.0, 0.0, 0.0 ]
>>> expand 3 0.0 8 3
(3><3)
[ 0.0, 0.0, 0.0
, 0.0, 0.0, 0.0
, 0.0, 0.0, 3.0 ]
-}
expand :: Int -> Double -> Double -> Double -> Matrix R
expand s r p d = (s><s) $ (replicate p1 r ++ [d] ++ replicate p2 r)
where
p1 = truncate p
p2 = max 0 (s * s - p1 - 1)
-- reverse
reversePooling :: Int -> Layer
reversePooling = MaxPoolLayer
|
Notice: This is an old thread. The last post was 2737 days ago. If your post is not directly related to this discussion please consider making a new thread.
Every researcher or diagnostician working with reptiles has faced the challenge of identifying reptile hemoparasites and then determining whether they are of importance or merely incidental. Another challenge is how to easily find the information required to make the proper identification. A distillation of knowledge from world-renowned expert Sam R. Telford, Jr, Hemoparasites of the Reptilia: Color Atlas and Text provides a comprehensive compilation of information on how to differentiate between the myriad species of reptile hemoparasites.
The atlas provides diagnoses for 262 species of plasmodiids, hemogregarines, hemococcidians, trypansosomes, and leishmanias, including descriptions of eight new species or new taxonomic designations. It also discusses lesser known groups, such as piroplasms, rickettsiae, chlamydia, and erythrocytic viruses. Each genus and many species are represented among the 166 taxa illustrated in color. The species accounts contain host and geographic distribution, with precise localities when possible, prevalence, life cycles and vectors when known, effects upon the host, and ecology of the host-parasite relationship, morphological variation, and an exhaustive bibliography. The book also includes an illustrated key showing diagnostic characters.
Telford draws on his 45 years of experience and his personal collection, considered the world’s most complete, to provide information on the morphology of the unicellular parasites of reptilian blood. He includes information from hard-to-find original papers and articles from sources throughout the world. The illustrated key and photomicrographs from Telford’s collection make identifying species quicker and easier.
Last edited by Motoko; 6th September 2012 at 07:09 PM. Reason: UPDATE!
Last edited by Motoko; 12th October 2018 at 08:19 PM. Reason: UPDATE. |
\section{Making a Dummy THICC Atmospheric Model*}
* The naming of this section is decided by the stream name, I did not come up with this \cite{twitch}. During this stream, a lot of plotting improvements have been made, which is not the scope of
this manual and hence has been left out. The plan was to add vertical momentum and advection, though things did not go according to plan\dots
\subsection{Discovering That Things Are Broken}
While trying to add vertical momentum, it appears that some parts of the model are broken in their current state. The horizontal advection is one of the things that is broken. If you recall,
we needed to use the Laplacian operator in the advection equations (as shown in \autoref{eq:diffusion}, diffusion is considered a part of advection since diffusion transports energy and matter
which is what advection does as well). The Laplacian operator (as shown in \autoref{alg:laplacian layer}) did not work. This is because there was a misplaced bracket causing weird numerical errors.
This has been fixed in the code (but was never present in the manual, yay for me) and can be safely enabled, though for this stream we disabled the Laplacian operator as it has a small effect on
the total advection (and because it was at this time broken). %The Laplacian has been re-enabled in Stream 8 (\autoref{sec:stream8}).
Another thing that we found out was broken is the vertical momentum. We tried to add it, ran into problems and just set it to 0 to fix the other problems that occured. One of those problems was
a wrong initialisation of the density. We basically told the model that the density is the same on every layer of the atmosphere, which is obviously not true. Hence we need to adjust that. The
new initialisation is described in \autoref{alg:density}. Note that the $\rho[:,: i]$ notation means that for every index in the first and second dimension, only change the value for the index $i$
in the third dimension. As soon as the vertical momentum has been fixed it will be fixed in the correct spot. If a lot of the code changes then it will probably be in another section and I will
insert a reference to that section.
\begin{algorithm}
$\rho[:, :, 0] \leftarrow 1.3$ \;
\For{$i \in [1, nlevels-1]$}{
$\rho[:, :, i] \leftarrow 0.1\rho[:, :, i - 1]$
}
\caption{Initialisation of the air density $\rho$}
\label{alg:density}
\end{algorithm} |
% 20YangMillsFields.tex
\subsection{20.1. Noether's Theorem for Internal Symmetries }
\begin{quote}
\emph{How do symmetries yield conservation laws?}
\end{quote}
$\phi$ $N$-tuple $\phi^a(t,\mathbf{x}) = \phi^a(x)$, local representation of a section of some vector bundle $E$,
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=2em, column sep=3em, minimum width=1em]
{
E & \\
M & \\ };
\path[->] (m-1-1) edge node [auto] {$\pi$} (m-2-1);
\end{tikzpicture}
%\begin{tikzpicture}
% \matrix (m) [matrix of math nodes, row sep=2em, column sep=3em, minimum width=1em]
% {
% U_i \subset \mathbb{R}^{n+1} - 0 & \\
% V_i \subset \mathbb{R}P^n & \mathbb{R}^n \\ };
% \path[-stealth]
% (m-1-1) edge node [right] {$\varphi_i \pi$} (m-2-2)
% edge node [left] { $\pi$} (m-2-1)
% (m-2-1) edge node [below] {$\varphi$} (m-2-2);
%\end{tikzpicture}
In the case of a Dirac electorn, we have seen that $E$ is the bundle of complex 4-component Dirac spinors over a perhaps curved spacetime. If $E$ is not a trivial bundle (or if we insist on using curvilinear coordinates) we shall have to deal with the fact that $\partial_j \phi^a$ do not form a tensor.
\subsubsection{ 20.1a. The Tensorial Nature of Lagrange's Equations }
Let $M^{n+1}$ (pseudo-) Riemannian manifold, let $E$ vector bundle over $M$; for definiteness, let fiber be $\mathbb{R}^N$. \\
section of this bundle over $U \subset M$ is described by $N$ real-valued functions $\lbrace \phi^a_U \rbrace$, \\
\quad where $\phi_V = c_{VU}\phi_U$ and \\
\quad \quad $c_{VU}(x)$ is $N\times N$ transition matrix function, $c^a_{VUb}$. \\
notation $\begin{gathered} \quad \\
\lbrace \Phi^a \rbrace \\
\lbrace \Phi^a_{\alpha} \rbrace \\
\Phi^a_{\alpha} = \tau_{\alpha \beta} \Phi_{\beta} \end{gathered}$ \\
Lagrangian $L_0(x, \phi, \phi_x) \equiv L_0(x,\Phi, \partial_j \Phi^a)$
\subsection{20.2. Weyl's Gauge Invariance Revisited}
\subsubsection{ 20.2a. The Dirac Lagrangian }
\subsubsection{ 20.2b. Weyl's Gauge Invariance Revisited}
\subsubsection{ 20.2c. The Electromagnetic Lagrangian }
Instead of considering a change of (spacetime) coordinates $x$, we shall look at a change of the \emph{field} (fiber) coordinate $\psi$, i.e. \emph{a gauge transformation}.
Since the phase of $\psi$ is not measurable, we \emph{should} be able to have invariance under a \emph{local} gauge transformation, where $\alpha = \alpha(x)$ varies with the spacetime point $x$! \\
\quad Clearly the Dirac equation and Lagrangian are \emph{not} invariant under such a substitution because of the appearance of terms involving $d\alpha$. \\
\quad It must be that \emph{there is some background field that is interacting with the electron}. This background field will manifest itself through the appearance of the connection.
\subsection{ The Yang-Mills Nucleon }
\begin{quote}
How did the groups $SU(2)$ and $SU(3)$ appear in particle physics?
\end{quote}
\subsubsection{ 20.3a. The Heisenberg Nucleon }
\subsubsection{ 20.3b. The Yang-Mills Nucleon }
\subsubsection{ 20.3c. A Remark on Terminology }
We have related the connection matrices $\omega$ to the gauge potentials $A$ by
\[
\omega = -i q A
\]
$q$ is called a generalized \textbf{charge}.
|
[STATEMENT]
lemma onl_invariant_sterms_TT:
assumes wf: "wellformed \<Gamma>"
and il: "A \<TTurnstile> onl \<Gamma> P"
and rp: "(\<xi>, p) \<in> reachable A I"
and "p'\<in>sterms \<Gamma> p"
and "l\<in>labels \<Gamma> p'"
shows "P (\<xi>, l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. P (\<xi>, l)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wellformed \<Gamma>
A \<TTurnstile> onl \<Gamma> P
(\<xi>, p) \<in> reachable A I
p' \<in> sterms \<Gamma> p
l \<in> labels \<Gamma> p'
goal (1 subgoal):
1. P (\<xi>, l)
[PROOF STEP]
by (rule onl_invariant_sterms_weaken) simp |
-- It is recommended to use Cubical.Algebra.CommRing.Instances.Int
-- instead of this file.
{-# OPTIONS --safe #-}
module Cubical.Algebra.AbGroup.Instances.DiffInt where
open import Cubical.Foundations.Prelude
open import Cubical.HITs.SetQuotients
open import Cubical.Algebra.AbGroup.Base
open import Cubical.Data.Int.MoreInts.DiffInt
renaming (
_+_ to _+ℤ_
)
DiffℤasAbGroup : AbGroup ℓ-zero
DiffℤasAbGroup = makeAbGroup {G = ℤ}
[ (0 , 0) ]
_+ℤ_
-ℤ_
ℤ-isSet
+ℤ-assoc
(λ x → zero-identityʳ 0 x)
(λ x → -ℤ-invʳ x)
+ℤ-comm
|
#include "OptionParsers.h"
#include "Convenience.h"
#include <boost/date_time/posix_time/ptime.hpp>
#include <macgyver/Exception.h>
#include <macgyver/StringConversion.h>
#include <stdexcept>
const int default_timestep = 60;
namespace SmartMet
{
namespace Spine
{
namespace OptionParsers
{
namespace
{
int get_parameter_index(const ParameterList& parameters, const std::string& paramname)
{
for (unsigned int i = 0; i < parameters.size(); i++)
if (parameters.at(i).name() == paramname)
return i;
return -1;
}
} // anonymous namespace
void ParameterOptions::expandParameter(const std::string& paramname)
{
// Expand parameter in index
int expand_index = get_parameter_index(itsParameters, paramname);
if (expand_index > -1)
{
const ParameterFunctions& expand_func = itsParameterFunctions.at(expand_index).functions;
std::vector<Parameter> dataSourceParams;
std::vector<ParameterAndFunctions> dataSourceParameterFunctions;
for (const auto& p : itsParameters)
{
if (p.type() == SmartMet::Spine::Parameter::Type::Data ||
p.type() == SmartMet::Spine::Parameter::Type::Landscaped)
{
if (!p.getSensorParameter().empty())
{
// data_source field is not added to qc-field
continue;
}
std::string name = p.name() + "_data_source";
Fmi::ascii_tolower(name);
Parameter param(name, p.type(), p.number());
if (p.getSensorNumber())
param.setSensorNumber(*(p.getSensorNumber()));
ParameterAndFunctions paramfunc(param, expand_func);
dataSourceParams.push_back(param);
dataSourceParameterFunctions.push_back(paramfunc);
}
}
if (!dataSourceParams.empty())
{
// Replace the original parameter with expanded list of parameters
itsParameters.erase(itsParameters.begin() + expand_index);
itsParameters.insert(
itsParameters.begin() + expand_index, dataSourceParams.begin(), dataSourceParams.end());
itsParameterFunctions.erase(itsParameterFunctions.begin() + expand_index);
itsParameterFunctions.insert(itsParameterFunctions.begin() + expand_index,
dataSourceParameterFunctions.begin(),
dataSourceParameterFunctions.end());
}
}
}
void ParameterOptions::add(const Parameter& theParam)
{
itsParameters.push_back(theParam);
itsParameterFunctions.push_back(ParameterAndFunctions(theParam, ParameterFunctions()));
}
void ParameterOptions::add(const Parameter& theParam, const ParameterFunctions& theParamFunctions)
{
itsParameters.push_back(theParam);
itsParameterFunctions.push_back(ParameterAndFunctions(theParam, theParamFunctions));
}
ParameterOptions parseParameters(const HTTP::Request& theReq)
{
try
{
ParameterOptions options;
// Get the option string
std::string opt = required_string(theReq.getParameter("param"), "Option param is required");
// Protect against empty selection
if (opt.empty())
throw Fmi::Exception(BCP, "param option is empty");
// Split
std::vector<std::string> names;
boost::algorithm::split(names, opt, boost::algorithm::is_any_of(","));
// Validate and convert
for (const std::string& name : names)
{
options.add(ParameterFactory::instance().parse(name));
}
return options;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
// ----------------------------------------------------------------------
/*!
* \brief Parse time series generation options.
*
* Note: If you add a new parameter, please do not forget to change
* the timeseries-plugin hash_value method accordinly.
*/
// ----------------------------------------------------------------------
TimeSeriesGeneratorOptions parseTimes(const HTTP::Request& theReq)
{
try
{
boost::posix_time::ptime now = optional_time(theReq.getParameter("now"),
boost::posix_time::second_clock::universal_time());
TimeSeriesGeneratorOptions options(now);
// We first parse the options which imply the TimeMode
// because the behaviour of some other options depend on it
// Parse hour option
if (theReq.getParameter("hour"))
{
options.mode = TimeSeriesGeneratorOptions::FixedTimes;
const std::string hours = required_string(theReq.getParameter("hour"), "");
std::vector<std::string> parts;
boost::algorithm::split(parts, hours, boost::algorithm::is_any_of(","));
for (const std::string& part : parts)
{
int hour = Fmi::stoi(part);
if (hour < 0 || hour > 23)
throw Fmi::Exception(BCP, "Invalid hour selection '" + part + "'!");
options.timeList.insert(hour * 100);
}
}
// Parse time option
if (theReq.getParameter("time"))
{
options.mode = TimeSeriesGeneratorOptions::FixedTimes;
const std::string times = required_string(theReq.getParameter("time"), "");
std::vector<std::string> parts;
boost::algorithm::split(parts, times, boost::algorithm::is_any_of(","));
for (const std::string& part : parts)
{
int th = Fmi::stoi(part);
if (th < 0 || th > 2359)
throw Fmi::Exception(BCP, "Invalid time selection '" + part + "'!");
options.timeList.insert(th);
}
}
// Timestep should be parsed last so we can check if the
// defaults have been changed
if (theReq.getParameter("timestep"))
{
if (options.mode != TimeSeriesGeneratorOptions::TimeSteps)
throw Fmi::Exception(
BCP, "Cannot use timestep option when another time mode is implied by another option");
const std::string step = optional_string(theReq.getParameter("timestep"), "");
if (step == "data" || step == "all")
{
options.mode = TimeSeriesGeneratorOptions::DataTimes;
options.timeStep = 0;
}
else if (step == "graph")
{
options.mode = TimeSeriesGeneratorOptions::GraphTimes;
options.timeStep = 0;
}
else if (step != "current")
{
options.mode = TimeSeriesGeneratorOptions::TimeSteps;
int num = duration_string_to_minutes(step);
if (num < 0)
throw Fmi::Exception(BCP, "The 'timestep' option cannot be negative!");
if (num > 0 && 1440 % num != 0)
throw Fmi::Exception(BCP,
"Timestep must be a divisor of 24*60 or zero for all timesteps!");
options.timeStep = num;
}
}
// TIMEMODE HAS NOW BEEN DETERMINED
// The number of timesteps is a spine option for various modes,
// including DataTimes and GraphTimes
if (theReq.getParameter("timesteps"))
{
const std::string steps = optional_string(theReq.getParameter("timesteps"), "");
int num = Fmi::stoi(steps);
if (num < 0)
throw Fmi::Exception(BCP, "The 'timesteps' option cannot be negative!");
options.timeSteps = num;
}
// starttime option may modify "now" which is the default
// value set by the constructor
if (theReq.getParameter("starttime"))
{
std::string stamp = required_string(theReq.getParameter("starttime"), "");
if (stamp == "data")
options.startTimeData = true;
else
{
options.startTime = Fmi::TimeParser::parse(stamp);
options.startTimeUTC = Fmi::TimeParser::looks_utc(stamp);
}
}
else
{
options.startTimeUTC = true; // generate from "now" in all locations
}
// startstep must be handled after starttime and timestep options
if (theReq.getParameter("startstep"))
{
int startstep = optional_int(theReq.getParameter("startstep"), 0);
if (startstep < 0)
throw Fmi::Exception(BCP, "The 'startstep' option cannot be negative!");
if (startstep > 10000)
throw Fmi::Exception(BCP, "Too large 'startstep' value!");
int timestep = (options.timeStep ? *options.timeStep : default_timestep);
options.startTime +=
boost::posix_time::minutes(boost::numeric_cast<unsigned int>(startstep) * timestep);
}
// endtime must be handled last since it may depend on starttime,
// timestep and timesteps options. The default is to set the end
// time to the start time plus 24 hours.
if (theReq.getParameter("endtime"))
{
std::string stamp = required_string(theReq.getParameter("endtime"), "");
if (stamp != "now")
{
if (!!options.timeSteps)
throw Fmi::Exception(BCP, "Cannot specify 'timesteps' and 'endtime' simultaneously!");
if (stamp == "data")
options.endTimeData = true;
else
{
// iso, sql, xml, timestamp obey tz, epoch is always UTC
options.endTime = Fmi::TimeParser::parse(stamp);
options.endTimeUTC = Fmi::TimeParser::looks_utc(stamp);
}
}
}
else if (!!options.timeSteps)
{
options.endTimeUTC = options.startTimeUTC;
// If you give the number of timesteps, we must assume a default timestep unless you give
// one
if (!options.timeStep)
options.timeStep = default_timestep;
options.endTime =
options.startTime + boost::posix_time::minutes(*options.timeStep * *options.timeSteps);
}
else
{
options.endTimeUTC = options.startTimeUTC;
options.endTime = options.startTime + boost::posix_time::hours(24);
}
return options;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
} // namespace OptionParsers
} // namespace Spine
} // namespace SmartMet
|
SUBROUTINE JACROB (ESQ ,HGT ,TIME ,USAT ,USUN ,RHO)
IMPLICIT REAL*8 (A-H,O-Z)
DIMENSION USAT(3) ,USUN(3)
C
C.......................................................................
C
C VERSION OF 20 JULY 1976
C
C PURPOSE
C JACROB FURNISHES ATMOSPHERIC DENSITY USING JACCHIA'S
C 1971 ATMOSPHERIC MODEL AS MODIFIED BY ROBERTS IN 1971.
C COMPUTATIONS PERFORMED ARE TIME DEFINITION, EXOSPHERIC
C TEMPERATURE, CORRECTIONS TO THE ATMOSPHERIC DENSITY, AND
C ASSESSMENT AS TO WHICH HEIGHT RANGE TO USE IN COMPUTING THE
C ATMOSPHERIC DENSITY.
C
C REFERENCES
C JACCHIA, L. J., REVISED STATIC MODELS OF THE THERMOSPHERE AND
C EXOSPHERE WITH EMPIRICAL TEMPERATURE PROFILES, S.A.O., SPECIAL
C REPORT NO. 332, MAY 5,1971.
C ROBERTS, C. E., JR., AN ANALYTICAL MODEL FOR UPPER ATMOSPHERE
C DENSITIES BASED UPON JACCHIA'S 1970 MODELS, CELESTIAL MECHANICS
C 4,(1971).
C
C COMMON BLOCKS NEEDED
C NONE
C
C CALLING SEQUENCE EXPLANATION
C
C VARIABLE I/O DESCRIPTION
C -------- --- -----------------------------------------
C ESQ I ECCENTRICITY OF THE CENTRAL BODY SQUARED
C HGT I SPACECRAFT HEIGHT (KM)
C IERR I ERROR RETURN CODE FROM JACCWF
C TIME I CURRENT TIME (FULL A.1 JULIAN DATE)
C USAT(3) I UNIT POSITION VECTOR OF THE SPACECRAFT
C USUN(3) I UNIT POSITION VECTOR OF THE SUN
C RHO O ATMOSPHERIC DENSITY
C
C JACROB IS CALLED FROM SUBROUTINE DRAG
C
C SUBROUTINES AND FUNCTIONS REQUIRED
C HIALT - COMPUTES RHO AT ALTITUDES ABOVE 125 KM.
C JACCWF - RETURNS GEOMAGNETIC INDEX AND EXOSPHERIC TEMPERATURE
C LOWALT - COMPUTES RHO AT ALTITUDES BETWEEN 90 KM AND 125 KM
C
C.......................................................................
C
C INITIALIZE NECESSARY PARAMETERS
C
DATA DTR /1.745329251994330D-2/
DATA TWOPI /6.283185307179586D0/
DATA PI /3.141592653589793D0/
C
C MINIMUM HEIGHT IN KILOMETERS
DATA ZJ0 /90.D0/
C DENSITY AT MINIMUM HEIGHT IN GM/CM**3
DATA RHOZ /3.46D-9/
C TEMPERATURE AT MINIMUM HEIGHT IN DEGREES KELVIN
DATA T0 /183.D0/
C
IF (HGT .GE. ZJ0) GO TO 10
C
C SPACECRAFT IS AT OR BELOW MINIMUM HEIGHT
RHO = RHOZ
GO TO 90
C
10 IF (HGT .LT. 3000.D0) GO TO 20
C
C THERE IS NO ATMOSPHERE ABOVE 3000 KM
C
RHO = 0.D0
GO TO 999
C
C CALCULATE SATELLITE GEODETIC LATITUDE
C
20 D1 = DSQRT (USAT(1)**2 + USAT(2)**2)
PHJ = DATAN (USAT(3)/(D1*(1.D0 - ESQ)))
C
C CALCULATE SUN HOUR ANGLE
C
D2 = DSQRT (USUN(1)**2 + USUN(2)**2)
CX = USUN(1) * USAT(1) + USUN(2) * USAT(2)
TH = DARCOS (CX/(D1*D2))
HC = USUN(1)*USAT(2) - USUN(2)*USAT(1)
HCJ = TH / DTR * HC / DABS(HC)
C
C OBTAIN TEMPERATURE AND MAGNETIC VALUE AT CURRENT TIME
C ...........
CALL JACCWF (TIME ,TEMP ,MAG)
C ...........
C
C COMPUTE THE DIURNAL EXOSPHERIC TEMPERATURE -- DL
C
DEL0 = DATAN2 (USUN(3),D2)
Q = (HCJ + 43.D0) * DTR
TAU = (HCJ - 37.D0 + 6.D0 *DSIN(Q)) * DTR
IF (TAU .LT. -PI) TAU = TAU + TWOPI
IF (TAU .GT. PI) TAU = TAU - TWOPI
TAU = .5D0 * TAU
TH22 = ( DSIN (.5D0 * DABS (PHJ+DEL0) ) ) ** 2.2
UN22 = ( DCOS (.5D0 * DABS (PHJ-DEL0) ) ) ** 2.2
CSTAU3 = DCOS(TAU)**3
DL = TEMP * (1.D0 + .3D0 * (TH22 + (UN22 - TH22) * CSTAU3))
C
C GEOMAGNETIC ACTIVITY
C
C GEOMAGNETIC DISTURBANCES INFLUENCE THE ATMOSPHERIC DENSITY WITH A
C TIME LAG OF 6.7 HOURS. THE STORED VALUES ARE 10 TIMES THE ACTUAL
C VALUES.
C
TP1 = (MAG * 3 + 5) / 10
TP1 = TP1 / 3.D0
C
C THE GEOMAGNETIC TEMPERATURE CONTRIBUTION (DTG) AND
C THE BASE 10 LOGARITHM OF THE CONTRIBUTION TO RHO FROM GEOMAGNETIC
C INFLUENCES ARE HANDLED DIFFERENTLY ABOVE AND BELOW 200KM.
C
IF (HGT .LT. 200.D0) GO TO 30
C
DTG = 28.D0 * TP1 + .03D0 * DEXP(TP1)
DL10RG = 0.D0
GO TO 40
C
30 DTG = 14.D0 * TP1 + .02D0 * DEXP(TP1)
DL10RG = .012D0 * TP1 + 1.2D-5 * DEXP(TP1)
C
C EXOSPHERIC TEMPERATURE IS THE TOTAL TEMPERATURE DUE TO DIURNAL AND
C GEOMAGNETIC EFFECTS
C
40 TINF = DL + DTG
C
C SEMI-ANNUAL DENSITY VARIATION IS ADDED ON TO THE GEOMAGNETIC -- BOTH
C IN BASE 10 LOGARITHMS
C
PHI = (TIME - 2436204.5D0) / 365.2422D0
TSA = TWOPI * PHI + 6.035D0
TSA = PHI + .09544D0*((.5D0 + .5D0*DSIN(TSA))**1.65D0 - .5D0)
B1 = TWOPI * TSA + 4.137D0
B2 = TWOPI * TSA * 2.D0 + 4.259D0
GT = .02835D0 + (.3817D0 + .17829D0*DSIN(B1)) * DSIN(B2)
FZ = (.5876D-6*HGT**2.331D0+.06328D0)*DEXP(-.002868D0*HGT)
DL10RG = DL10RG + FZ * GT
C
C SEASONAL LATITUDE VARIATION OF THE LOWER THERMOSPHERE IS ALSO ADDED
C IN TO THE LOGARITHM OF DENSITY
C
ZM90 = HGT - ZJ0
C
C HGT .GT. 440 GIVES UNDERFLOWS.
C
IF (HGT .LT. 440.D0) GO TO 50
C
DL10RL = 0.D0
GO TO 60
C
50 EXPR = .014D0 * DEXP (-1.3D-3*ZM90**2) * DSIN (TWOPI*PHI+1.72D0)
DL10RL = DSIN(PHJ)
DL10RL = DL10RL * DABS(DL10RL) * EXPR * ZM90
C
60 DL10RG = 10.D0 ** (DL10RG + DL10RL)
C
C INFLECTION POINT TEMPERATURE
C
TX =371.6673D0+.0518806D0*TINF-294.3505D0*DEXP(TINF*(-.0021622D0))
C
C THE OTHER CONTRIBUTIONS ARE CALCULATED BY SUBROUTINES HIALT OR
C LOWALT, AS APPROPRIATE, AND ADDED INTO THE LOGARITHM OF RHO.
C
IF (HGT .GT. 125.D0) GO TO 70
C
C ......
CALL LOWALT (HGT ,RHOZ ,TINF ,TX ,T0 ,ZJ0 ,RHO )
C ......
C
GO TO 80
C
C .....
70 CALL HIALT (DEL0 ,HGT ,PHJ ,TINF ,TX ,T0 ,ZJ0 ,RHO)
C .....
C
80 RHO = RHO * DL10RG
C
C CONVERT RHO FROM CGS TO MKS UNITS.
C
90 RHO = RHO*1.D12
C
C
999 RETURN
END
|
function hdrv = hdrvclose(hdrv)
%
% hdrv = hdrvclose(hdrv)
%
%
% Input:
% -hdrv: a HDR video structure
%
% Output:
% -hdrv: a HDR video structure
%
% This function closes a video stream (hdrv) for reading frames
%
% Copyright (C) 2013-17 Francesco Banterle
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
if(hdrv.streamOpen == 1)
switch hdrv.type
case 'TYPE_HDR_VIDEO'
if(hdrv.permission == 'w')
if(~isempty(hdrv.streamTMO))
close(hdrv.streamTMO)
end
if(~isempty(hdrv.streamR))
close(hdrv.streamR)
end
end
end
hdrv.streamOpen = 0;
end
end |
(* *********************************************************************)
(* *)
(* The Compcert verified compiler *)
(* *)
(* Xavier Leroy, INRIA Paris-Rocquencourt *)
(* *)
(* Copyright Institut National de Recherche en Informatique et en *)
(* Automatique. All rights reserved. This file is distributed *)
(* under the terms of the GNU General Public License as published by *)
(* the Free Software Foundation, either version 2 of the License, or *)
(* (at your option) any later version. This file is also distributed *)
(* under the terms of the INRIA Non-Commercial License Agreement. *)
(* *)
(* *********************************************************************)
(** Dynamic semantics for the Compcert C language *)
Require Import Coqlib.
Require Import Errors.
Require Import Maps.
Require Import Integers.
Require Import Floats.
Require Import Values.
Require Import AST.
Require Import Memory.
Require Import Events.
Require Import Globalenvs.
Require Import Ctypes.
Require Import Cop.
Require Import Csyntax.
Require Import Smallstep.
(** * Operational semantics *)
(** The semantics uses two environments. The global environment
maps names of functions and global variables to memory block references,
and function pointers to their definitions. (See module [Globalenvs].)
It also contains a composite environment, used by type-dependent operations. *)
Record genv := { genv_genv :> Genv.t fundef type; genv_cenv :> composite_env }.
Definition globalenv (p: program) :=
{| genv_genv := Genv.globalenv p; genv_cenv := p.(prog_comp_env) |}.
(** The local environment maps local variables to block references and types.
The current value of the variable is stored in the associated memory
block. *)
Definition env := PTree.t (block * type). (* map variable -> location & type *)
Definition empty_env: env := (PTree.empty (block * type)).
Section SEMANTICS.
Variable ge: genv.
(** [deref_loc ty m b ofs t v] computes the value of a datum
of type [ty] residing in memory [m] at block [b], offset [ofs].
If the type [ty] indicates an access by value, the corresponding
memory load is performed. If the type [ty] indicates an access by
reference, the pointer [Vptr b ofs] is returned. [v] is the value
returned, and [t] the trace of observables (nonempty if this is
a volatile access). *)
Inductive deref_loc (ty: type) (m: mem) (b: block) (ofs: ptrofs) : trace -> val -> Prop :=
| deref_loc_value: forall chunk v,
access_mode ty = By_value chunk ->
type_is_volatile ty = false ->
Mem.loadv chunk m (Vptr b ofs) = Some v ->
deref_loc ty m b ofs E0 v
| deref_loc_volatile: forall chunk t v,
access_mode ty = By_value chunk -> type_is_volatile ty = true ->
volatile_load ge chunk m b ofs t v ->
deref_loc ty m b ofs t v
| deref_loc_reference:
access_mode ty = By_reference ->
deref_loc ty m b ofs E0 (Vptr b ofs)
| deref_loc_copy:
access_mode ty = By_copy ->
deref_loc ty m b ofs E0 (Vptr b ofs).
(** Symmetrically, [assign_loc ty m b ofs v t m'] returns the
memory state after storing the value [v] in the datum
of type [ty] residing in memory [m] at block [b], offset [ofs].
This is allowed only if [ty] indicates an access by value or by copy.
[m'] is the updated memory state and [t] the trace of observables
(nonempty if this is a volatile store). *)
Inductive assign_loc (ty: type) (m: mem) (b: block) (ofs: ptrofs):
val -> trace -> mem -> Prop :=
| assign_loc_value: forall v chunk m',
access_mode ty = By_value chunk ->
type_is_volatile ty = false ->
Mem.storev chunk m (Vptr b ofs) v = Some m' ->
assign_loc ty m b ofs v E0 m'
| assign_loc_volatile: forall v chunk t m',
access_mode ty = By_value chunk -> type_is_volatile ty = true ->
volatile_store ge chunk m b ofs v t m' ->
assign_loc ty m b ofs v t m'
| assign_loc_copy: forall b' ofs' bytes m',
access_mode ty = By_copy ->
(alignof_blockcopy ge ty | Ptrofs.unsigned ofs') ->
(alignof_blockcopy ge ty | Ptrofs.unsigned ofs) ->
b' <> b \/ Ptrofs.unsigned ofs' = Ptrofs.unsigned ofs
\/ Ptrofs.unsigned ofs' + sizeof ge ty <= Ptrofs.unsigned ofs
\/ Ptrofs.unsigned ofs + sizeof ge ty <= Ptrofs.unsigned ofs' ->
Mem.loadbytes m b' (Ptrofs.unsigned ofs') (sizeof ge ty) = Some bytes ->
Mem.storebytes m b (Ptrofs.unsigned ofs) bytes = Some m' ->
assign_loc ty m b ofs (Vptr b' ofs') E0 m'.
(** Allocation of function-local variables.
[alloc_variables e1 m1 vars e2 m2] allocates one memory block
for each variable declared in [vars], and associates the variable
name with this block. [e1] and [m1] are the initial local environment
and memory state. [e2] and [m2] are the final local environment
and memory state. *)
Inductive alloc_variables: env -> mem ->
list (ident * type) ->
env -> mem -> Prop :=
| alloc_variables_nil:
forall e m,
alloc_variables e m nil e m
| alloc_variables_cons:
forall e m id ty vars m1 b1 m2 e2,
Mem.alloc m 0 (sizeof ge ty) = (m1, b1) ->
alloc_variables (PTree.set id (b1, ty) e) m1 vars e2 m2 ->
alloc_variables e m ((id, ty) :: vars) e2 m2.
(** Initialization of local variables that are parameters to a function.
[bind_parameters e m1 params args m2] stores the values [args]
in the memory blocks corresponding to the variables [params].
[m1] is the initial memory state and [m2] the final memory state. *)
Inductive bind_parameters (e: env):
mem -> list (ident * type) -> list val ->
mem -> Prop :=
| bind_parameters_nil:
forall m,
bind_parameters e m nil nil m
| bind_parameters_cons:
forall m id ty params v1 vl b m1 m2,
PTree.get id e = Some(b, ty) ->
assign_loc ty m b Ptrofs.zero v1 E0 m1 ->
bind_parameters e m1 params vl m2 ->
bind_parameters e m ((id, ty) :: params) (v1 :: vl) m2.
(** Return the list of blocks in the codomain of [e], with low and high bounds. *)
Definition block_of_binding (id_b_ty: ident * (block * type)) :=
match id_b_ty with (id, (b, ty)) => (b, 0, sizeof ge ty) end.
Definition blocks_of_env (e: env) : list (block * Z * Z) :=
List.map block_of_binding (PTree.elements e).
(** Selection of the appropriate case of a [switch], given the value [n]
of the selector expression. *)
Fixpoint select_switch_default (sl: labeled_statements): labeled_statements :=
match sl with
| LSnil => sl
| LScons None s sl' => sl
| LScons (Some i) s sl' => select_switch_default sl'
end.
Fixpoint select_switch_case (n: Z) (sl: labeled_statements): option labeled_statements :=
match sl with
| LSnil => None
| LScons None s sl' => select_switch_case n sl'
| LScons (Some c) s sl' => if zeq c n then Some sl else select_switch_case n sl'
end.
Definition select_switch (n: Z) (sl: labeled_statements): labeled_statements :=
match select_switch_case n sl with
| Some sl' => sl'
| None => select_switch_default sl
end.
(** Turn a labeled statement into a sequence *)
Fixpoint seq_of_labeled_statement (sl: labeled_statements) : statement :=
match sl with
| LSnil => Sskip
| LScons _ s sl' => Ssequence s (seq_of_labeled_statement sl')
end.
(** Extract the values from a list of function arguments *)
Inductive cast_arguments (m: mem): exprlist -> typelist -> list val -> Prop :=
| cast_args_nil:
cast_arguments m Enil Tnil nil
| cast_args_cons: forall v ty el targ1 targs v1 vl,
sem_cast v ty targ1 m = Some v1 -> cast_arguments m el targs vl ->
cast_arguments m (Econs (Eval v ty) el) (Tcons targ1 targs) (v1 :: vl).
(** ** Reduction semantics for expressions *)
Section EXPR.
Variable e: env.
(** The semantics of expressions follows the popular Wright-Felleisen style.
It is a small-step semantics that reduces one redex at a time.
We first define head reductions (at the top of an expression, then
use reduction contexts to define reduction within an expression. *)
(** Head reduction for l-values. *)
Inductive lred: expr -> mem -> expr -> mem -> Prop :=
| red_var_local: forall x ty m b,
e!x = Some(b, ty) ->
lred (Evar x ty) m
(Eloc b Ptrofs.zero ty) m
| red_var_global: forall x ty m b,
e!x = None ->
Genv.find_symbol ge x = Some b ->
lred (Evar x ty) m
(Eloc b Ptrofs.zero ty) m
| red_deref: forall b ofs ty1 ty m,
lred (Ederef (Eval (Vptr b ofs) ty1) ty) m
(Eloc b ofs ty) m
| red_field_struct: forall b ofs id co a f ty m delta,
ge.(genv_cenv)!id = Some co ->
field_offset ge f (co_members co) = OK delta ->
lred (Efield (Eval (Vptr b ofs) (Tstruct id a)) f ty) m
(Eloc b (Ptrofs.add ofs (Ptrofs.repr delta)) ty) m
| red_field_union: forall b ofs id co a f ty m,
ge.(genv_cenv)!id = Some co ->
lred (Efield (Eval (Vptr b ofs) (Tunion id a)) f ty) m
(Eloc b ofs ty) m.
(** Head reductions for r-values *)
Inductive rred: expr -> mem -> trace -> expr -> mem -> Prop :=
| red_rvalof: forall b ofs ty m t v,
deref_loc ty m b ofs t v ->
rred (Evalof (Eloc b ofs ty) ty) m
t (Eval v ty) m
| red_addrof: forall b ofs ty1 ty m,
rred (Eaddrof (Eloc b ofs ty1) ty) m
E0 (Eval (Vptr b ofs) ty) m
| red_unop: forall op v1 ty1 ty m v,
sem_unary_operation op v1 ty1 m = Some v ->
rred (Eunop op (Eval v1 ty1) ty) m
E0 (Eval v ty) m
| red_binop: forall op v1 ty1 v2 ty2 ty m v,
sem_binary_operation ge op v1 ty1 v2 ty2 m = Some v ->
rred (Ebinop op (Eval v1 ty1) (Eval v2 ty2) ty) m
E0 (Eval v ty) m
| red_cast: forall ty v1 ty1 m v,
sem_cast v1 ty1 ty m = Some v ->
rred (Ecast (Eval v1 ty1) ty) m
E0 (Eval v ty) m
| red_seqand_true: forall v1 ty1 r2 ty m,
bool_val v1 ty1 m = Some true ->
rred (Eseqand (Eval v1 ty1) r2 ty) m
E0 (Eparen r2 type_bool ty) m
| red_seqand_false: forall v1 ty1 r2 ty m,
bool_val v1 ty1 m = Some false ->
rred (Eseqand (Eval v1 ty1) r2 ty) m
E0 (Eval (Vint Int.zero) ty) m
| red_seqor_true: forall v1 ty1 r2 ty m,
bool_val v1 ty1 m = Some true ->
rred (Eseqor (Eval v1 ty1) r2 ty) m
E0 (Eval (Vint Int.one) ty) m
| red_seqor_false: forall v1 ty1 r2 ty m,
bool_val v1 ty1 m = Some false ->
rred (Eseqor (Eval v1 ty1) r2 ty) m
E0 (Eparen r2 type_bool ty) m
| red_condition: forall v1 ty1 r1 r2 ty b m,
bool_val v1 ty1 m = Some b ->
rred (Econdition (Eval v1 ty1) r1 r2 ty) m
E0 (Eparen (if b then r1 else r2) ty ty) m
| red_sizeof: forall ty1 ty m,
rred (Esizeof ty1 ty) m
E0 (Eval (Vptrofs (Ptrofs.repr (sizeof ge ty1))) ty) m
| red_alignof: forall ty1 ty m,
rred (Ealignof ty1 ty) m
E0 (Eval (Vptrofs (Ptrofs.repr (alignof ge ty1))) ty) m
| red_assign: forall b ofs ty1 v2 ty2 m v t m',
sem_cast v2 ty2 ty1 m = Some v ->
assign_loc ty1 m b ofs v t m' ->
rred (Eassign (Eloc b ofs ty1) (Eval v2 ty2) ty1) m
t (Eval v ty1) m'
| red_assignop: forall op b ofs ty1 v2 ty2 tyres m t v1,
deref_loc ty1 m b ofs t v1 ->
rred (Eassignop op (Eloc b ofs ty1) (Eval v2 ty2) tyres ty1) m
t (Eassign (Eloc b ofs ty1)
(Ebinop op (Eval v1 ty1) (Eval v2 ty2) tyres) ty1) m
| red_postincr: forall id b ofs ty m t v1 op,
deref_loc ty m b ofs t v1 ->
op = match id with Incr => Oadd | Decr => Osub end ->
rred (Epostincr id (Eloc b ofs ty) ty) m
t (Ecomma (Eassign (Eloc b ofs ty)
(Ebinop op (Eval v1 ty)
(Eval (Vint Int.one) type_int32s)
(incrdecr_type ty))
ty)
(Eval v1 ty) ty) m
| red_comma: forall v ty1 r2 ty m,
typeof r2 = ty ->
rred (Ecomma (Eval v ty1) r2 ty) m
E0 r2 m
| red_paren: forall v1 ty1 ty2 ty m v,
sem_cast v1 ty1 ty2 m = Some v ->
rred (Eparen (Eval v1 ty1) ty2 ty) m
E0 (Eval v ty) m
| red_builtin: forall ef tyargs el ty m vargs t vres m',
cast_arguments m el tyargs vargs ->
external_call ef ge vargs m t vres m' ->
rred (Ebuiltin ef tyargs el ty) m
t (Eval vres ty) m'.
(** Head reduction for function calls.
(More exactly, identification of function calls that can reduce.) *)
Inductive callred: expr -> mem -> fundef -> list val -> type -> Prop :=
| red_call: forall vf tyf m tyargs tyres cconv el ty fd vargs,
Genv.find_funct ge vf = Some fd ->
cast_arguments m el tyargs vargs ->
type_of_fundef fd = Tfunction tyargs tyres cconv ->
classify_fun tyf = fun_case_f tyargs tyres cconv ->
callred (Ecall (Eval vf tyf) el ty) m
fd vargs ty.
(** Reduction contexts. In accordance with C's nondeterministic semantics,
we allow reduction both to the left and to the right of a binary operator.
To enforce C's notion of sequence point, reductions within a conditional
[a ? b : c] can only take place in [a], not in [b] nor [c];
reductions within a sequential "or" / "and" [a && b] or [a || b] can
only take place in [a], not in [b];
and reductions within a sequence [a, b] can only take place in [a],
not in [b].
Reduction contexts are represented by functions [C] from expressions
to expressions, suitably constrained by the [context from to C]
predicate below. Contexts are "kinded" with respect to l-values and
r-values: [from] is the kind of the hole in the context and [to] is
the kind of the term resulting from filling the hole.
*)
Inductive kind : Type := LV | RV.
Inductive context: kind -> kind -> (expr -> expr) -> Prop :=
| ctx_top: forall k,
context k k (fun x => x)
| ctx_deref: forall k C ty,
context k RV C -> context k LV (fun x => Ederef (C x) ty)
| ctx_field: forall k C f ty,
context k RV C -> context k LV (fun x => Efield (C x) f ty)
| ctx_rvalof: forall k C ty,
context k LV C -> context k RV (fun x => Evalof (C x) ty)
| ctx_addrof: forall k C ty,
context k LV C -> context k RV (fun x => Eaddrof (C x) ty)
| ctx_unop: forall k C op ty,
context k RV C -> context k RV (fun x => Eunop op (C x) ty)
| ctx_binop_left: forall k C op e2 ty,
context k RV C -> context k RV (fun x => Ebinop op (C x) e2 ty)
| ctx_binop_right: forall k C op e1 ty,
context k RV C -> context k RV (fun x => Ebinop op e1 (C x) ty)
| ctx_cast: forall k C ty,
context k RV C -> context k RV (fun x => Ecast (C x) ty)
| ctx_seqand: forall k C r2 ty,
context k RV C -> context k RV (fun x => Eseqand (C x) r2 ty)
| ctx_seqor: forall k C r2 ty,
context k RV C -> context k RV (fun x => Eseqor (C x) r2 ty)
| ctx_condition: forall k C r2 r3 ty,
context k RV C -> context k RV (fun x => Econdition (C x) r2 r3 ty)
| ctx_assign_left: forall k C e2 ty,
context k LV C -> context k RV (fun x => Eassign (C x) e2 ty)
| ctx_assign_right: forall k C e1 ty,
context k RV C -> context k RV (fun x => Eassign e1 (C x) ty)
| ctx_assignop_left: forall k C op e2 tyres ty,
context k LV C -> context k RV (fun x => Eassignop op (C x) e2 tyres ty)
| ctx_assignop_right: forall k C op e1 tyres ty,
context k RV C -> context k RV (fun x => Eassignop op e1 (C x) tyres ty)
| ctx_postincr: forall k C id ty,
context k LV C -> context k RV (fun x => Epostincr id (C x) ty)
| ctx_call_left: forall k C el ty,
context k RV C -> context k RV (fun x => Ecall (C x) el ty)
| ctx_call_right: forall k C e1 ty,
contextlist k C -> context k RV (fun x => Ecall e1 (C x) ty)
| ctx_builtin: forall k C ef tyargs ty,
contextlist k C -> context k RV (fun x => Ebuiltin ef tyargs (C x) ty)
| ctx_comma: forall k C e2 ty,
context k RV C -> context k RV (fun x => Ecomma (C x) e2 ty)
| ctx_paren: forall k C tycast ty,
context k RV C -> context k RV (fun x => Eparen (C x) tycast ty)
with contextlist: kind -> (expr -> exprlist) -> Prop :=
| ctx_list_head: forall k C el,
context k RV C -> contextlist k (fun x => Econs (C x) el)
| ctx_list_tail: forall k C e1,
contextlist k C -> contextlist k (fun x => Econs e1 (C x)).
(** In a nondeterministic semantics, expressions can go wrong according
to one reduction order while being defined according to another.
Consider for instance [(x = 1) + (10 / x)] where [x] is initially [0].
This expression goes wrong if evaluated right-to-left, but is defined
if evaluated left-to-right. Since our compiler is going to pick one
particular evaluation order, we must make sure that all orders are safe,
i.e. never evaluate a subexpression that goes wrong.
Being safe is a stronger requirement than just not getting stuck during
reductions. Consider [f() + (10 / x)], where [f()] does not terminate.
This expression is never stuck because the evaluation of [f()] can make
infinitely many transitions. Yet it contains a subexpression [10 / x]
that can go wrong if [x = 0], and the compiler may choose to evaluate
[10 / x] first, before calling [f()].
Therefore, we must make sure that not only an expression cannot get stuck,
but none of its subexpressions can either. We say that a subexpression
is not immediately stuck if it is a value (of the appropriate kind)
or it can reduce (at head or within). *)
Inductive imm_safe: kind -> expr -> mem -> Prop :=
| imm_safe_val: forall v ty m,
imm_safe RV (Eval v ty) m
| imm_safe_loc: forall b ofs ty m,
imm_safe LV (Eloc b ofs ty) m
| imm_safe_lred: forall to C e m e' m',
lred e m e' m' ->
context LV to C ->
imm_safe to (C e) m
| imm_safe_rred: forall to C e m t e' m',
rred e m t e' m' ->
context RV to C ->
imm_safe to (C e) m
| imm_safe_callred: forall to C e m fd args ty,
callred e m fd args ty ->
context RV to C ->
imm_safe to (C e) m.
Definition not_stuck (e: expr) (m: mem) : Prop :=
forall k C e' ,
context k RV C -> e = C e' -> imm_safe k e' m.
End EXPR.
(** ** Transition semantics. *)
(** Continuations describe the computations that remain to be performed
after the statement or expression under consideration has
evaluated completely. *)
Inductive cont: Type :=
| Kstop: cont
| Kdo: cont -> cont (**r [Kdo k] = after [x] in [x;] *)
| Kseq: statement -> cont -> cont (**r [Kseq s2 k] = after [s1] in [s1;s2] *)
| Kifthenelse: statement -> statement -> cont -> cont (**r [Kifthenelse s1 s2 k] = after [x] in [if (x) { s1 } else { s2 }] *)
| Kwhile1: expr -> statement -> cont -> cont (**r [Kwhile1 x s k] = after [x] in [while(x) s] *)
| Kwhile2: expr -> statement -> cont -> cont (**r [Kwhile x s k] = after [s] in [while (x) s] *)
| Kdowhile1: expr -> statement -> cont -> cont (**r [Kdowhile1 x s k] = after [s] in [do s while (x)] *)
| Kdowhile2: expr -> statement -> cont -> cont (**r [Kdowhile2 x s k] = after [x] in [do s while (x)] *)
| Kfor2: expr -> statement -> statement -> cont -> cont (**r [Kfor2 e2 e3 s k] = after [e2] in [for(e1;e2;e3) s] *)
| Kfor3: expr -> statement -> statement -> cont -> cont (**r [Kfor3 e2 e3 s k] = after [s] in [for(e1;e2;e3) s] *)
| Kfor4: expr -> statement -> statement -> cont -> cont (**r [Kfor4 e2 e3 s k] = after [e3] in [for(e1;e2;e3) s] *)
| Kswitch1: labeled_statements -> cont -> cont (**r [Kswitch1 ls k] = after [e] in [switch(e) { ls }] *)
| Kswitch2: cont -> cont (**r catches [break] statements arising out of [switch] *)
| Kreturn: cont -> cont (**r [Kreturn k] = after [e] in [return e;] *)
| Kcall: function -> (**r calling function *)
env -> (**r local env of calling function *)
(expr -> expr) -> (**r context of the call *)
type -> (**r type of call expression *)
cont -> cont.
(** Pop continuation until a call or stop *)
Fixpoint call_cont (k: cont) : cont :=
match k with
| Kstop => k
| Kdo k => k
| Kseq s k => call_cont k
| Kifthenelse s1 s2 k => call_cont k
| Kwhile1 e s k => call_cont k
| Kwhile2 e s k => call_cont k
| Kdowhile1 e s k => call_cont k
| Kdowhile2 e s k => call_cont k
| Kfor2 e2 e3 s k => call_cont k
| Kfor3 e2 e3 s k => call_cont k
| Kfor4 e2 e3 s k => call_cont k
| Kswitch1 ls k => call_cont k
| Kswitch2 k => call_cont k
| Kreturn k => call_cont k
| Kcall _ _ _ _ _ => k
end.
Definition is_call_cont (k: cont) : Prop :=
match k with
| Kstop => True
| Kcall _ _ _ _ _ => True
| _ => False
end.
(** Execution states of the program are grouped in 4 classes corresponding
to the part of the program we are currently executing. It can be
a statement ([State]), an expression ([ExprState]), a transition
from a calling function to a called function ([Callstate]), or
the symmetrical transition from a function back to its caller
([Returnstate]). *)
Inductive state: Type :=
| State (**r execution of a statement *)
(f: function)
(s: statement)
(k: cont)
(e: env)
(m: mem) : state
| ExprState (**r reduction of an expression *)
(f: function)
(r: expr)
(k: cont)
(e: env)
(m: mem) : state
| Callstate (**r calling a function *)
(fd: fundef)
(args: list val)
(k: cont)
(m: mem) : state
| Returnstate (**r returning from a function *)
(res: val)
(k: cont)
(m: mem) : state
| Stuckstate. (**r undefined behavior occurred *)
(**NEW *)
Definition get_mem (s:state):=
match s with
| State _ _ _ _ m => m
| ExprState _ _ _ _ m => m
| Callstate _ _ _ m => m
| Returnstate _ _ m => m
| Stuckstate => Mem.empty
end.
(**NEW *)
Definition set_mem (s:state)(m:mem):=
match s with
| State f s k e _ => State f s k e m
| ExprState f r k e _ => ExprState f r k e m
| Callstate fd args k _ => Callstate fd args k m
| Returnstate res k _ => Returnstate res k m
| Stuckstate => Stuckstate
end.
(**NEW *)
Definition at_external (c: state) : option (external_function * list val) :=
match c with
| State _ _ _ _ _ => None
| ExprState _ _ _ _ m => None
| Callstate fd args k _ =>
match fd with
Internal f => None
| External ef targs tres cc =>
Some (ef, args)
end
| Returnstate _ _ _ => None
| Stuckstate => None
end.
(**NEW *)
Definition after_external (rv: option val) (c: state) (m:mem): option state :=
match c with
Callstate fd vargs k m =>
match fd with
Internal _ => None
| External ef tps tp cc =>
match rv with
Some v => Some(Returnstate v k m)
| None => Some(Returnstate Vundef k m)
end
end
| _ => None
end.
(** Find the statement and manufacture the continuation
corresponding to a label. *)
Fixpoint find_label (lbl: label) (s: statement) (k: cont)
{struct s}: option (statement * cont) :=
match s with
| Ssequence s1 s2 =>
match find_label lbl s1 (Kseq s2 k) with
| Some sk => Some sk
| None => find_label lbl s2 k
end
| Sifthenelse a s1 s2 =>
match find_label lbl s1 k with
| Some sk => Some sk
| None => find_label lbl s2 k
end
| Swhile a s1 =>
find_label lbl s1 (Kwhile2 a s1 k)
| Sdowhile a s1 =>
find_label lbl s1 (Kdowhile1 a s1 k)
| Sfor a1 a2 a3 s1 =>
match find_label lbl a1 (Kseq (Sfor Sskip a2 a3 s1) k) with
| Some sk => Some sk
| None =>
match find_label lbl s1 (Kfor3 a2 a3 s1 k) with
| Some sk => Some sk
| None => find_label lbl a3 (Kfor4 a2 a3 s1 k)
end
end
| Sswitch e sl =>
find_label_ls lbl sl (Kswitch2 k)
| Slabel lbl' s' =>
if ident_eq lbl lbl' then Some(s', k) else find_label lbl s' k
| _ => None
end
with find_label_ls (lbl: label) (sl: labeled_statements) (k: cont)
{struct sl}: option (statement * cont) :=
match sl with
| LSnil => None
| LScons _ s sl' =>
match find_label lbl s (Kseq (seq_of_labeled_statement sl') k) with
| Some sk => Some sk
| None => find_label_ls lbl sl' k
end
end.
(** We separate the transition rules in two groups:
- one group that deals with reductions over expressions;
- the other group that deals with everything else: statements, function calls, etc.
This makes it easy to express different reduction strategies for expressions:
the second group of rules can be reused as is. *)
Inductive estep: state -> trace -> state -> Prop :=
| step_lred: forall C f a k e m a' m',
lred e a m a' m' ->
context LV RV C ->
estep (ExprState f (C a) k e m)
E0 (ExprState f (C a') k e m')
| step_rred: forall C f a k e m t a' m',
rred a m t a' m' ->
context RV RV C ->
estep (ExprState f (C a) k e m)
t (ExprState f (C a') k e m')
| step_call: forall C f a k e m fd vargs ty,
callred a m fd vargs ty ->
context RV RV C ->
estep (ExprState f (C a) k e m)
E0 (Callstate fd vargs (Kcall f e C ty k) m)
| step_stuck: forall C f a k e m K,
context K RV C -> ~(imm_safe e K a m) ->
estep (ExprState f (C a) k e m)
E0 Stuckstate.
Inductive sstep: state -> trace -> state -> Prop :=
| step_do_1: forall f x k e m,
sstep (State f (Sdo x) k e m)
E0 (ExprState f x (Kdo k) e m)
| step_do_2: forall f v ty k e m,
sstep (ExprState f (Eval v ty) (Kdo k) e m)
E0 (State f Sskip k e m)
| step_seq: forall f s1 s2 k e m,
sstep (State f (Ssequence s1 s2) k e m)
E0 (State f s1 (Kseq s2 k) e m)
| step_skip_seq: forall f s k e m,
sstep (State f Sskip (Kseq s k) e m)
E0 (State f s k e m)
| step_continue_seq: forall f s k e m,
sstep (State f Scontinue (Kseq s k) e m)
E0 (State f Scontinue k e m)
| step_break_seq: forall f s k e m,
sstep (State f Sbreak (Kseq s k) e m)
E0 (State f Sbreak k e m)
| step_ifthenelse_1: forall f a s1 s2 k e m,
sstep (State f (Sifthenelse a s1 s2) k e m)
E0 (ExprState f a (Kifthenelse s1 s2 k) e m)
| step_ifthenelse_2: forall f v ty s1 s2 k e m b,
bool_val v ty m = Some b ->
sstep (ExprState f (Eval v ty) (Kifthenelse s1 s2 k) e m)
E0 (State f (if b then s1 else s2) k e m)
| step_while: forall f x s k e m,
sstep (State f (Swhile x s) k e m)
E0 (ExprState f x (Kwhile1 x s k) e m)
| step_while_false: forall f v ty x s k e m,
bool_val v ty m = Some false ->
sstep (ExprState f (Eval v ty) (Kwhile1 x s k) e m)
E0 (State f Sskip k e m)
| step_while_true: forall f v ty x s k e m ,
bool_val v ty m = Some true ->
sstep (ExprState f (Eval v ty) (Kwhile1 x s k) e m)
E0 (State f s (Kwhile2 x s k) e m)
| step_skip_or_continue_while: forall f s0 x s k e m,
s0 = Sskip \/ s0 = Scontinue ->
sstep (State f s0 (Kwhile2 x s k) e m)
E0 (State f (Swhile x s) k e m)
| step_break_while: forall f x s k e m,
sstep (State f Sbreak (Kwhile2 x s k) e m)
E0 (State f Sskip k e m)
| step_dowhile: forall f a s k e m,
sstep (State f (Sdowhile a s) k e m)
E0 (State f s (Kdowhile1 a s k) e m)
| step_skip_or_continue_dowhile: forall f s0 x s k e m,
s0 = Sskip \/ s0 = Scontinue ->
sstep (State f s0 (Kdowhile1 x s k) e m)
E0 (ExprState f x (Kdowhile2 x s k) e m)
| step_dowhile_false: forall f v ty x s k e m,
bool_val v ty m = Some false ->
sstep (ExprState f (Eval v ty) (Kdowhile2 x s k) e m)
E0 (State f Sskip k e m)
| step_dowhile_true: forall f v ty x s k e m,
bool_val v ty m = Some true ->
sstep (ExprState f (Eval v ty) (Kdowhile2 x s k) e m)
E0 (State f (Sdowhile x s) k e m)
| step_break_dowhile: forall f a s k e m,
sstep (State f Sbreak (Kdowhile1 a s k) e m)
E0 (State f Sskip k e m)
| step_for_start: forall f a1 a2 a3 s k e m,
a1 <> Sskip ->
sstep (State f (Sfor a1 a2 a3 s) k e m)
E0 (State f a1 (Kseq (Sfor Sskip a2 a3 s) k) e m)
| step_for: forall f a2 a3 s k e m,
sstep (State f (Sfor Sskip a2 a3 s) k e m)
E0 (ExprState f a2 (Kfor2 a2 a3 s k) e m)
| step_for_false: forall f v ty a2 a3 s k e m,
bool_val v ty m = Some false ->
sstep (ExprState f (Eval v ty) (Kfor2 a2 a3 s k) e m)
E0 (State f Sskip k e m)
| step_for_true: forall f v ty a2 a3 s k e m,
bool_val v ty m = Some true ->
sstep (ExprState f (Eval v ty) (Kfor2 a2 a3 s k) e m)
E0 (State f s (Kfor3 a2 a3 s k) e m)
| step_skip_or_continue_for3: forall f x a2 a3 s k e m,
x = Sskip \/ x = Scontinue ->
sstep (State f x (Kfor3 a2 a3 s k) e m)
E0 (State f a3 (Kfor4 a2 a3 s k) e m)
| step_break_for3: forall f a2 a3 s k e m,
sstep (State f Sbreak (Kfor3 a2 a3 s k) e m)
E0 (State f Sskip k e m)
| step_skip_for4: forall f a2 a3 s k e m,
sstep (State f Sskip (Kfor4 a2 a3 s k) e m)
E0 (State f (Sfor Sskip a2 a3 s) k e m)
| step_return_0: forall f k e m m',
Mem.free_list m (blocks_of_env e) = Some m' ->
sstep (State f (Sreturn None) k e m)
E0 (Returnstate Vundef (call_cont k) m')
| step_return_1: forall f x k e m,
sstep (State f (Sreturn (Some x)) k e m)
E0 (ExprState f x (Kreturn k) e m)
| step_return_2: forall f v1 ty k e m v2 m',
sem_cast v1 ty f.(fn_return) m = Some v2 ->
Mem.free_list m (blocks_of_env e) = Some m' ->
sstep (ExprState f (Eval v1 ty) (Kreturn k) e m)
E0 (Returnstate v2 (call_cont k) m')
| step_skip_call: forall f k e m m',
is_call_cont k ->
Mem.free_list m (blocks_of_env e) = Some m' ->
sstep (State f Sskip k e m)
E0 (Returnstate Vundef k m')
| step_switch: forall f x sl k e m,
sstep (State f (Sswitch x sl) k e m)
E0 (ExprState f x (Kswitch1 sl k) e m)
| step_expr_switch: forall f ty sl k e m v n,
sem_switch_arg v ty = Some n ->
sstep (ExprState f (Eval v ty) (Kswitch1 sl k) e m)
E0 (State f (seq_of_labeled_statement (select_switch n sl)) (Kswitch2 k) e m)
| step_skip_break_switch: forall f x k e m,
x = Sskip \/ x = Sbreak ->
sstep (State f x (Kswitch2 k) e m)
E0 (State f Sskip k e m)
| step_continue_switch: forall f k e m,
sstep (State f Scontinue (Kswitch2 k) e m)
E0 (State f Scontinue k e m)
| step_label: forall f lbl s k e m,
sstep (State f (Slabel lbl s) k e m)
E0 (State f s k e m)
| step_goto: forall f lbl k e m s' k',
find_label lbl f.(fn_body) (call_cont k) = Some (s', k') ->
sstep (State f (Sgoto lbl) k e m)
E0 (State f s' k' e m)
| step_internal_function: forall f vargs k m e m1 m2,
list_norepet (var_names (fn_params f) ++ var_names (fn_vars f)) ->
alloc_variables empty_env m (f.(fn_params) ++ f.(fn_vars)) e m1 ->
bind_parameters e m1 f.(fn_params) vargs m2 ->
sstep (Callstate (Internal f) vargs k m)
E0 (State f f.(fn_body) k e m2)
| step_external_function: forall ef targs tres cc vargs k m vres t m',
external_call ef ge vargs m t vres m' ->
sstep (Callstate (External ef targs tres cc) vargs k m)
t (Returnstate vres k m')
| step_returnstate: forall v f e C ty k m,
sstep (Returnstate v (Kcall f e C ty k) m)
E0 (ExprState f (C (Eval v ty)) k e m).
Definition step (S: state) (t: trace) (S': state) : Prop :=
estep S t S' \/ sstep S t S'.
End SEMANTICS.
(** * Whole-program semantics *)
(** Execution of whole programs are described as sequences of transitions
from an initial state to a final state. An initial state is a [Callstate]
corresponding to the invocation of the ``main'' function of the program
without arguments and with an empty continuation. *)
Inductive initial_state (p: program): state -> Prop :=
| initial_state_intro: forall b f m0,
let ge := globalenv p in
Genv.init_mem p = Some m0 ->
Genv.find_symbol ge p.(prog_main) = Some b ->
Genv.find_funct_ptr ge b = Some f ->
type_of_fundef f = Tfunction Tnil type_int32s cc_default ->
initial_state p (Callstate f nil Kstop m0).
(** A final state is a [Returnstate] with an empty continuation. *)
Inductive final_state: state -> int -> Prop :=
| final_state_intro: forall r m,
final_state (Returnstate (Vint r) Kstop m) r.
(** Wrapping up these definitions in a small-step semantics. *)
(*
Definition semantics (p: program) :=
let ge:= (globalenv p) in
Semantics_gen
get_mem set_mem
(step ge)
(entry_point p)
(at_external )
(after_external )
final_state ge
(Genv.find_symbol ge p.(prog_main))
(Genv.init_mem p ).
Semantics_gen step (initial_state p) final_state (globalenv p) (globalenv p).
(** This semantics has the single-event property. *)
Lemma semantics_single_events:
forall p, single_events (semantics p).
Proof.
unfold semantics; intros; red; simpl; intros.
set (ge := globalenv p) in *.
assert (DEREF: forall chunk m b ofs t v, deref_loc ge chunk m b ofs t v -> (length t <= 1)%nat).
intros. inv H0; simpl; try omega. inv H3; simpl; try omega.
assert (ASSIGN: forall chunk m b ofs t v m', assign_loc ge chunk m b ofs v t m' -> (length t <= 1)%nat).
intros. inv H0; simpl; try omega. inv H3; simpl; try omega.
destruct H.
inv H; simpl; try omega. inv H0; eauto; simpl; try omega.
eapply external_call_trace_length; eauto.
inv H; simpl; try omega. eapply external_call_trace_length; eauto.
Qed.
*) |
Require Import Platform.Cito.CompileStmtSpec.
Require Import Bedrock.StringSet.
Import StringSet.
Require Import Platform.Cito.FreeVars.
Require Import Platform.Cito.SynReqFactsUtil.
Local Infix ";;" := Syntax.Seq (right associativity, at level 95).
Local Hint Resolve Subset_singleton.
Local Hint Resolve In_to_set.
Local Hint Resolve to_set_In.
Local Hint Resolve Subset_union_right Max.max_lub.
Require Platform.Cito.CompileExpr Platform.Cito.CompileExprs Platform.Cito.SaveRet.
Ltac t := unfold syn_req, CompileExpr.syn_req, CompileExprs.syn_req, SaveRet.syn_req,
in_scope, WellFormed.wellformed;
simpl; intuition;
repeat (match goal with
| [ H : Subset _ _ |- _ ] => apply Subset_union_left in H
| [ H : (max _ _ <= _)%nat |- _ ] =>
generalize (Max.max_lub_l _ _ _ H);
generalize (Max.max_lub_r _ _ _ H);
clear H
| [ H : WellFormed.args_not_too_long _ |- _ ] => inversion_clear H; []
| [ |- match ?E with Some _ => _ | None => _ end ] => destruct E
end; intuition).
Local Hint Constructors WellFormed.args_not_too_long.
Lemma Subset_syn_req_In : forall x vars temp_size s, syn_req vars temp_size s -> Subset (singleton x) (free_vars s) -> List.In x vars.
t.
Qed.
Lemma syn_req_Seq_Seq : forall vars temp_size a b c, syn_req vars temp_size ((a ;; b) ;; c) -> syn_req vars temp_size (a ;; b ;; c).
t.
Qed.
Lemma syn_req_Seq : forall vars temp_size a b c, syn_req vars temp_size ((a ;; b) ;; c) -> syn_req vars temp_size (b ;; c).
t.
Qed.
Lemma syn_req_If_true : forall vars temp_size e t f k, syn_req vars temp_size (Syntax.If e t f ;; k) -> syn_req vars temp_size (t ;; k).
t.
Qed.
Lemma syn_req_If_false : forall vars temp_size e t f k, syn_req vars temp_size (Syntax.If e t f ;; k) -> syn_req vars temp_size (f ;; k).
t.
Qed.
Lemma syn_req_If_e : forall vars temp_size e t f k, syn_req vars temp_size (Syntax.If e t f ;; k) -> CompileExpr.syn_req vars temp_size e 0.
t.
Qed.
Lemma syn_req_While_e : forall vars temp_size e s k, syn_req vars temp_size (Syntax.While e s ;; k) -> CompileExpr.syn_req vars temp_size e 0.
t.
Qed.
Lemma syn_req_While : forall vars temp_size e s k, syn_req vars temp_size (Syntax.While e s ;; k) -> syn_req vars temp_size (s ;; Syntax.While e s ;; k).
t.
Qed.
Lemma syn_req_Call_f : forall vars temp_size x f args k, syn_req vars temp_size (Syntax.Call x f args ;; k) -> CompileExpr.syn_req vars temp_size f 0.
t.
Qed.
Local Hint Resolve Max.le_max_l Max.le_max_r.
Lemma max_more : forall n m k,
(n <= m)%nat
-> (n <= max m k)%nat.
intros; transitivity m; eauto.
Qed.
Local Hint Resolve max_more.
Require Import Coq.Lists.List.
Lemma args_bound' : forall x args,
In x args
-> (DepthExpr.depth x <= fold_right max 0 (map DepthExpr.depth args))%nat.
induction args; simpl; intuition (subst; auto).
eapply Le.le_trans; [ | eapply Max.le_max_r]; eauto.
Qed.
Lemma args_bound : forall args,
List.Forall (fun e => (DepthExpr.depth e <= CompileExprs.depth args)%nat) args.
intros; apply Forall_forall; intros.
apply args_bound'; auto.
Qed.
Local Hint Resolve args_bound.
Lemma syn_req_Call_args : forall vars temp_size x f args k, syn_req vars temp_size (Syntax.Call x f args ;; k) -> CompileExprs.syn_req vars temp_size args args 0.
t.
Qed.
Lemma syn_req_Call_ret : forall vars temp_size x f args k, syn_req vars temp_size (Syntax.Call x f args ;; k) -> SaveRet.syn_req vars x.
t.
Qed.
Require Import Platform.AutoSep.
Lemma syn_req_goodSize : forall vars temp_size x f args k, syn_req vars temp_size (Syntax.Call x f args ;; k) -> goodSize (2 + List.length args).
t.
Qed.
Lemma syn_req_Seq_Skip : forall vars temp_size s, syn_req vars temp_size s -> syn_req vars temp_size (s ;; Syntax.Skip).
t.
Qed.
|
module TTImp.Elab.Term
import Libraries.Data.UserNameMap
import Core.Context
import Core.Core
import Core.Env
import Core.Metadata
import Core.Normalise
import Core.Options
import Core.Reflect
import Core.Unify
import Core.TT
import Core.Value
import TTImp.Elab.Ambiguity
import TTImp.Elab.App
import TTImp.Elab.As
import TTImp.Elab.Binders
import TTImp.Elab.Case
import TTImp.Elab.Check
import TTImp.Elab.Dot
import TTImp.Elab.Hole
import TTImp.Elab.ImplicitBind
import TTImp.Elab.Lazy
import TTImp.Elab.Local
import TTImp.Elab.Prim
import TTImp.Elab.Quote
import TTImp.Elab.Record
import TTImp.Elab.Rewrite
import TTImp.Elab.RunElab
import TTImp.Reflect
import TTImp.TTImp
%default covering
-- If the expected type has an implicit pi, elaborate with leading
-- implicit lambdas if they aren't there already.
insertImpLam : {auto c : Ref Ctxt Defs} ->
{auto u : Ref UST UState} ->
Env Term vars ->
(term : RawImp) -> (expected : Maybe (Glued vars)) ->
Core RawImp
insertImpLam {vars} env tm (Just ty) = bindLam tm ty
where
-- If we can decide whether we need implicit lambdas without looking
-- at the normal form, do so
bindLamTm : RawImp -> Term vs -> Core (Maybe RawImp)
bindLamTm tm@(ILam _ _ Implicit _ _ _) (Bind fc n (Pi _ _ Implicit _) sc)
= pure (Just tm)
bindLamTm tm@(ILam _ _ AutoImplicit _ _ _) (Bind fc n (Pi _ _ AutoImplicit _) sc)
= pure (Just tm)
bindLamTm tm@(ILam _ _ (DefImplicit _) _ _ _) (Bind fc n (Pi _ _ (DefImplicit _) _) sc)
= pure (Just tm)
bindLamTm tm (Bind fc n (Pi _ c Implicit ty) sc)
= do n' <- genVarName (nameRoot n)
Just sc' <- bindLamTm tm sc
| Nothing => pure Nothing
pure $ Just (ILam fc c Implicit (Just n') (Implicit fc False) sc')
bindLamTm tm (Bind fc n (Pi _ c AutoImplicit ty) sc)
= do n' <- genVarName (nameRoot n)
Just sc' <- bindLamTm tm sc
| Nothing => pure Nothing
pure $ Just (ILam fc c AutoImplicit (Just n') (Implicit fc False) sc')
bindLamTm tm (Bind fc n (Pi _ c (DefImplicit _) ty) sc)
= do n' <- genVarName (nameRoot n)
Just sc' <- bindLamTm tm sc
| Nothing => pure Nothing
pure $ Just (ILam fc c (DefImplicit (Implicit fc False))
(Just n') (Implicit fc False) sc')
bindLamTm tm exp
= case getFn exp of
Ref _ Func _ => pure Nothing -- might still be implicit
TForce _ _ _ => pure Nothing
Bind _ _ (Lam _ _ _ _) _ => pure Nothing
_ => pure $ Just tm
bindLamNF : RawImp -> NF vars -> Core RawImp
bindLamNF tm@(ILam _ _ Implicit _ _ _) (NBind fc n (Pi _ _ Implicit _) sc)
= pure tm
bindLamNF tm@(ILam _ _ AutoImplicit _ _ _) (NBind fc n (Pi _ _ AutoImplicit _) sc)
= pure tm
bindLamNF tm (NBind fc n (Pi fc' c Implicit ty) sc)
= do defs <- get Ctxt
n' <- genVarName (nameRoot n)
sctm <- sc defs (toClosure defaultOpts env (Ref fc Bound n'))
sc' <- bindLamNF tm sctm
pure $ ILam fc c Implicit (Just n') (Implicit fc False) sc'
bindLamNF tm (NBind fc n (Pi fc' c AutoImplicit ty) sc)
= do defs <- get Ctxt
n' <- genVarName (nameRoot n)
sctm <- sc defs (toClosure defaultOpts env (Ref fc Bound n'))
sc' <- bindLamNF tm sctm
pure $ ILam fc c AutoImplicit (Just n') (Implicit fc False) sc'
bindLamNF tm (NBind fc n (Pi _ c (DefImplicit _) ty) sc)
= do defs <- get Ctxt
n' <- genVarName (nameRoot n)
sctm <- sc defs (toClosure defaultOpts env (Ref fc Bound n'))
sc' <- bindLamNF tm sctm
pure $ ILam fc c (DefImplicit (Implicit fc False))
(Just n') (Implicit fc False) sc'
bindLamNF tm sc = pure tm
bindLam : RawImp -> Glued vars -> Core RawImp
bindLam tm gty
= do ty <- getTerm gty
Just tm' <- bindLamTm tm ty
| Nothing =>
do nf <- getNF gty
bindLamNF tm nf
pure tm'
insertImpLam env tm _ = pure tm
-- Main driver for checking terms, after implicits have been added.
-- Implements 'checkImp' in TTImp.Elab.Check
checkTerm : {vars : _} ->
{auto c : Ref Ctxt Defs} ->
{auto m : Ref MD Metadata} ->
{auto u : Ref UST UState} ->
{auto e : Ref EST (EState vars)} ->
RigCount -> ElabInfo ->
NestedNames vars -> Env Term vars -> RawImp -> Maybe (Glued vars) ->
Core (Term vars, Glued vars)
checkTerm rig elabinfo nest env (IVar fc n) exp
= -- It may actually turn out to be an application, if the expected
-- type is expecting an implicit argument, so check it as an
-- application with no arguments
checkApp rig elabinfo nest env fc (IVar fc n) [] [] [] exp
checkTerm rig elabinfo nest env (IPi fc r p Nothing argTy retTy) exp
= do n <- case p of
Explicit => genVarName "arg"
Implicit => genVarName "impArg"
AutoImplicit => genVarName "conArg"
(DefImplicit _) => genVarName "defArg"
checkPi rig elabinfo nest env fc r p n argTy retTy exp
checkTerm rig elabinfo nest env (IPi fc r p (Just (UN Underscore)) argTy retTy) exp
= checkTerm rig elabinfo nest env (IPi fc r p Nothing argTy retTy) exp
checkTerm rig elabinfo nest env (IPi fc r p (Just n) argTy retTy) exp
= checkPi rig elabinfo nest env fc r p n argTy retTy exp
checkTerm rig elabinfo nest env (ILam fc r p (Just n) argTy scope) exp
= checkLambda rig elabinfo nest env fc r p n argTy scope exp
checkTerm rig elabinfo nest env (ILam fc r p Nothing argTy scope) exp
= do n <- genVarName "_"
checkLambda rig elabinfo nest env fc r p n argTy scope exp
checkTerm rig elabinfo nest env (ILet fc lhsFC r n nTy nVal scope) exp
= checkLet rig elabinfo nest env fc lhsFC r n nTy nVal scope exp
checkTerm rig elabinfo nest env (ICase fc scr scrty alts) exp
= checkCase rig elabinfo nest env fc scr scrty alts exp
checkTerm rig elabinfo nest env (ILocal fc nested scope) exp
= checkLocal rig elabinfo nest env fc nested scope exp
checkTerm rig elabinfo nest env (ICaseLocal fc uname iname args scope) exp
= checkCaseLocal rig elabinfo nest env fc uname iname args scope exp
checkTerm rig elabinfo nest env (IUpdate fc upds rec) exp
= checkUpdate rig elabinfo nest env fc upds rec exp
checkTerm rig elabinfo nest env (IApp fc fn arg) exp
= checkApp rig elabinfo nest env fc fn [arg] [] [] exp
checkTerm rig elabinfo nest env (IAutoApp fc fn arg) exp
= checkApp rig elabinfo nest env fc fn [] [arg] [] exp
checkTerm rig elabinfo nest env (IWithApp fc fn arg) exp
= throw (GenericMsg fc "with application not implemented yet")
checkTerm rig elabinfo nest env (INamedApp fc fn nm arg) exp
= checkApp rig elabinfo nest env fc fn [] [] [(nm, arg)] exp
checkTerm rig elabinfo nest env (ISearch fc depth) (Just gexpty)
= do est <- get EST
nm <- genName "search"
expty <- getTerm gexpty
sval <- searchVar fc rig depth (Resolved (defining est)) env nest nm expty
pure (sval, gexpty)
checkTerm rig elabinfo nest env (ISearch fc depth) Nothing
= do est <- get EST
nmty <- genName "searchTy"
ty <- metaVar fc erased env nmty (TType fc)
nm <- genName "search"
sval <- searchVar fc rig depth (Resolved (defining est)) env nest nm ty
pure (sval, gnf env ty)
checkTerm rig elabinfo nest env (IAlternative fc uniq alts) exp
= checkAlternative rig elabinfo nest env fc uniq alts exp
checkTerm rig elabinfo nest env (IRewrite fc rule tm) exp
= checkRewrite rig elabinfo nest env fc rule tm exp
checkTerm rig elabinfo nest env (ICoerced fc tm) exp
= checkTerm rig elabinfo nest env tm exp
checkTerm rig elabinfo nest env (IBindHere fc binder sc) exp
= checkBindHere rig elabinfo nest env fc binder sc exp
checkTerm rig elabinfo nest env (IBindVar fc n) exp
= checkBindVar rig elabinfo nest env fc (Basic n) exp
checkTerm rig elabinfo nest env (IAs fc nameFC side n_in tm) exp
= checkAs rig elabinfo nest env fc nameFC side n_in tm exp
checkTerm rig elabinfo nest env (IMustUnify fc reason tm) exp
= checkDot rig elabinfo nest env fc reason tm exp
checkTerm rig elabinfo nest env (IDelayed fc r tm) exp
= checkDelayed rig elabinfo nest env fc r tm exp
checkTerm rig elabinfo nest env (IDelay fc tm) exp
= checkDelay rig elabinfo nest env fc tm exp
checkTerm rig elabinfo nest env (IForce fc tm) exp
= checkForce rig elabinfo nest env fc tm exp
checkTerm rig elabinfo nest env (IQuote fc tm) exp
= checkQuote rig elabinfo nest env fc tm exp
checkTerm rig elabinfo nest env (IQuoteName fc n) exp
= checkQuoteName rig elabinfo nest env fc n exp
checkTerm rig elabinfo nest env (IQuoteDecl fc ds) exp
= checkQuoteDecl rig elabinfo nest env fc ds exp
checkTerm rig elabinfo nest env (IUnquote fc tm) exp
= throw (GenericMsg fc "Can't escape outside a quoted term")
checkTerm rig elabinfo nest env (IRunElab fc tm) exp
= checkRunElab rig elabinfo nest env fc tm exp
checkTerm {vars} rig elabinfo nest env (IPrimVal fc c) exp
= do let (cval, cty) = checkPrim {vars} fc c
checkExp rig elabinfo env fc cval (gnf env cty) exp
checkTerm rig elabinfo nest env (IType fc) exp
= checkExp rig elabinfo env fc (TType fc) (gType fc) exp
checkTerm rig elabinfo nest env (IHole fc str) exp
= checkHole rig elabinfo nest env fc (Basic str) exp
checkTerm rig elabinfo nest env (IUnifyLog fc lvl tm) exp
= withLogLevel lvl $ check rig elabinfo nest env tm exp
checkTerm rig elabinfo nest env (Implicit fc b) (Just gexpty)
= do nm <- genName "_"
expty <- getTerm gexpty
metaval <- metaVar fc rig env nm expty
-- Add to 'bindIfUnsolved' if 'b' set
when (b && bindingVars elabinfo) $
do est <- get EST
expty <- getTerm gexpty
-- Explicit because it's an explicitly given thing!
put EST (addBindIfUnsolved nm rig Explicit env metaval expty est)
pure (metaval, gexpty)
checkTerm rig elabinfo nest env (Implicit fc b) Nothing
= do nmty <- genName "implicit_type"
ty <- metaVar fc erased env nmty (TType fc)
nm <- genName "_"
metaval <- metaVar fc rig env nm ty
-- Add to 'bindIfUnsolved' if 'b' set
when (b && bindingVars elabinfo) $
do est <- get EST
put EST (addBindIfUnsolved nm rig Explicit env metaval ty est)
pure (metaval, gnf env ty)
checkTerm rig elabinfo nest env (IWithUnambigNames fc ns rhs) exp
= do -- enter the scope -> add unambiguous names
est <- get EST
rns <- resolveNames fc ns
put EST $ record { unambiguousNames = mergeLeft rns (unambiguousNames est) } est
-- inside the scope -> check the RHS
result <- check rig elabinfo nest env rhs exp
-- exit the scope -> restore unambiguous names
newEST <- get EST
put EST $ record { unambiguousNames = unambiguousNames est } newEST
pure result
where
resolveNames : FC -> List Name -> Core (UserNameMap (Name, Int, GlobalDef))
resolveNames fc [] = pure empty
resolveNames fc (n :: ns) =
case userNameRoot n of
-- should never happen
Nothing => throw $ InternalError $ "non-UN in \"with\" LHS: " ++ show n
Just nRoot => do
-- this will always be a global name
-- so we lookup only among the globals
ctxt <- get Ctxt
rns <- lookupCtxtName n (gamma ctxt)
case rns of
[] => undefinedName fc n
[rn] => insert nRoot rn <$> resolveNames fc ns
_ => throw $ AmbiguousName fc (map fst rns)
-- Declared in TTImp.Elab.Check
-- check : {vars : _} ->
-- {auto c : Ref Ctxt Defs} ->
-- {auto m : Ref MD Metadata} ->
-- {auto u : Ref UST UState} ->
-- {auto e : Ref EST (EState vars)} ->
-- RigCount -> ElabInfo -> Env Term vars -> RawImp ->
-- Maybe (Glued vars) ->
-- Core (Term vars, Glued vars)
-- If we've just inserted an implicit coercion (in practice, that's either
-- a force or delay) then check the term with any further insertions
TTImp.Elab.Check.check rigc elabinfo nest env (ICoerced fc tm) exp
= checkImp rigc elabinfo nest env tm exp
-- Don't add implicits/coercions on local blocks or record updates
TTImp.Elab.Check.check rigc elabinfo nest env tm@(ILet _ _ _ _ _ _ _) exp
= checkImp rigc elabinfo nest env tm exp
TTImp.Elab.Check.check rigc elabinfo nest env tm@(ILocal _ _ _) exp
= checkImp rigc elabinfo nest env tm exp
TTImp.Elab.Check.check rigc elabinfo nest env tm@(IUpdate _ _ _) exp
= checkImp rigc elabinfo nest env tm exp
TTImp.Elab.Check.check rigc elabinfo nest env tm_in exp
= do defs <- get Ctxt
est <- get EST
tm <- expandAmbigName (elabMode elabinfo) nest env tm_in [] tm_in exp
case elabMode elabinfo of
InLHS _ => -- Don't expand implicit lambda on lhs
checkImp rigc elabinfo nest env tm exp
_ => do tm' <- insertImpLam env tm exp
checkImp rigc elabinfo nest env tm' exp
onLHS : ElabMode -> Bool
onLHS (InLHS _) = True
onLHS _ = False
-- As above, but doesn't add any implicit lambdas, forces, delays, etc
-- checkImp : {vars : _} ->
-- {auto c : Ref Ctxt Defs} ->
-- {auto m : Ref MD Metadata} ->
-- {auto u : Ref UST UState} ->
-- {auto e : Ref EST (EState vars)} ->
-- RigCount -> ElabInfo -> Env Term vars -> RawImp -> Maybe (Glued vars) ->
-- Core (Term vars, Glued vars)
TTImp.Elab.Check.checkImp rigc elabinfo nest env tm exp
= do res <- checkTerm rigc elabinfo nest env tm exp
-- LHS arguments can't infer their own type - they need to be inferred
-- from some other argument. This is to prevent arguments being not
-- polymorphic enough. So, here, add the constraint to be checked later.
when (onLHS (elabMode elabinfo) && not (topLevel elabinfo)) $
do let (argv, argt) = res
let Just expty = exp
| Nothing => pure ()
addPolyConstraint (getFC tm) env argv !(getNF expty) !(getNF argt)
pure res
|
6/12/2018 · From this article you will learn how to perform export to excel and PDF in kendo grid for Angular 2 Export DataGridView To Excel In C# 8/4/2017 7:16:09 AM. This code example demonstrates how to export data from a DataGridView control to an Excel document using C#.... exported to PDF, youll need to use the multiple page method described.Export Kendo UI grid as PDF file. Sans font family, which Sans font family, which is declared in kendo.common.css, but it also declares the paths to the font files using kendo.pdf.
Incorporate page breaks into the Gantt PDF Export and include option to repeat column headers on each page. Your Comment Attach files (Total attached files size should be smaller than 20mb .... Incorporate page breaks into the Gantt PDF Export and include option to repeat column headers on each page. Your Comment Attach files (Total attached files size should be smaller than 20mb .
6/12/2018 · From this article you will learn how to perform export to excel and PDF in kendo grid for Angular 2 Export DataGridView To Excel In C# 8/4/2017 7:16:09 AM. This code example demonstrates how to export data from a DataGridView control to an Excel document using C#.
I am trying to export multiple kendo charts to pdf doc. I see there is a pdf demo on kendo website but if my charts are inside div with fixed height, then when i click on export pdf, only chart that is visible at that time is exported and not all.
To enable it, include the corresponding command to the grid toolbar and configure the PDF Export settings. For instance, you can specify - export all pages, margins, paper size, font, etc. For instance, you can specify - export all pages, margins, paper size, font, etc. |
Formal statement is: lemma continuous_on_divide[continuous_intros]: fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_field" assumes "continuous_on s f" "continuous_on s g" and "\<forall>x\<in>s. g x \<noteq> 0" shows "continuous_on s (\<lambda>x. (f x) / (g x))" Informal statement is: If $f$ and $g$ are continuous functions on a set $S$ and $g(x) \neq 0$ for all $x \in S$, then the function $f/g$ is continuous on $S$. |
In September 2011 , Fey was ranked at the top of Forbes magazine 's list of the highest @-@ paid TV actresses .
|
The CompactFlash Association released version 5.0 of the CF specification. The new standard uses a 48-bit addressing system that raises the maximum storage capacity from 137GB to a humongous 144PB (1PB = 1,000 terabytes). Other improvements include more efficiency data transfer, more efficient cleanup of unused space, ATA standard update, optional "Video Performance Guarantee", and new electrical specification to enable easier and better card design.
To help manufacturers and consumers differentiate the new CF5 cards, the CompactFlash Association has created an evolutionary CF5 compatibility mark. Additionally, since the Video Performance Guarantee feature is optional, the CompactFlash Association has created a Video Performance Guarantee compatibility mark that host and card manufactures can use to help end users choose the right card. |
theory Example_Oil
imports
"../Numerics/Euler_Affine"
"../Numerics/Optimize_Float"
begin
subsection {* Oil reservoir in Affine arithmetic *}
text {*\label{sec:exampleoil}*}
approximate_affine oil "\<lambda>(y::real, z::real). (z, z*z + -3 * inverse (inverse 1000 + y*y))"
lemma oil_deriv_ok: fixes y::real
shows "1 / 1000 + y*y = 0 \<longleftrightarrow> False"
proof -
have "1 / 1000 + y*y > 0"
by (auto intro!: add_pos_nonneg)
thus ?thesis by auto
qed
lemma oil_fderiv: "((\<lambda>(y::real, z::real). (z, z * z + -3 * inverse (inverse 1000 + y * y))) has_derivative
(case x of (y, z) \<Rightarrow> \<lambda>(dy, dz). (dz, 2 * dz * z + 6 * (inverse (inverse 1000 + y * y) * (dy * (y * inverse (inverse 1000 + y * y)))))))
(at x within X)"
by (auto intro!: derivative_eq_intros simp: oil_deriv_ok split_beta inverse_eq_divide)
approximate_affine oil_d "\<lambda>(y::real, z) (dy, dz). (dz, 2 * dz * z + 6 * (inverse (inverse 1000 + y*y) * (dy * (y * inverse (inverse 1000 + y*y)))))"
interpretation oil!: aform_approximate_ivp
"uncurry_options oil"
"uncurry_options oil_d"
"\<lambda>(y::real, z::real). (z, z*z + -3 * inverse (inverse 1000 + y*y))"
"\<lambda>(y::real, z) (dy, dz).
(dz, 2 * dz * z + 6 * (inverse (inverse 1000 + y*y) * (dy * (y * inverse (inverse 1000 + y*y)))))"
apply default
apply (rule oil[THEN Joints2_JointsI]) apply assumption apply assumption
apply (rule oil_fderiv)
apply (rule oil_d[THEN Joints2_JointsI]) apply assumption apply assumption
apply (auto intro!: continuous_intros simp: split_beta oil_deriv_ok)
done
definition "rough_optns = default_optns
\<lparr> precision := 50,
tolerance := FloatR 1 (- 3),
stepsize := FloatR 1 (- 9),
result_fun := ivls_result 20 110,
iterations := 20,
widening_mod := 20,
printing_fun := (\<lambda>_ _ _. ())\<rparr>"
definition "oiltest_rough =
(\<lambda>_::unit. euler_series_result (uncurry_options oil) (uncurry_options oil_d) rough_optns 0
(aform_of_point (10, 0)) 22000)"
lemma "oiltest_rough () =
Some (FloatR 175831 (- 12),
[(FloatR 174951 (- 12), (FloatR (- 899741) (- 17), FloatR (- 666307) (- 21)),
(FloatR (- 793547) (- 17), FloatR (- 591743) (- 21)), FloatR 175831 (- 12),
(FloatR (- 899741) (- 17), FloatR (- 658317) (- 21)), FloatR (- 801547) (- 17),
FloatR (- 591821) (- 21)),
(FloatR 174071 (- 12), (FloatR (- 890848) (- 17), FloatR (- 674567) (- 21)),
(FloatR (- 785451) (- 17), FloatR (- 599104) (- 21)), FloatR 174951 (- 12),
(FloatR (- 890848) (- 17), FloatR (- 666230) (- 21)), FloatR (- 793551) (- 17),
FloatR (- 599183) (- 21)),
(FloatR 173191 (- 12), (FloatR (- 881846) (- 17), FloatR (- 683203) (- 21)),
(FloatR (- 777248) (- 17), FloatR (- 606801) (- 21)), FloatR 174071 (- 12),
(FloatR (- 881846) (- 17), FloatR (- 674489) (- 21)), FloatR (- 785455) (- 17),
FloatR (- 606882) (- 21)),
(FloatR 172311 (- 12), (FloatR (- 872731) (- 17), FloatR (- 692248) (- 21)),
(FloatR (- 768935) (- 17), FloatR (- 614865) (- 21)), FloatR 173191 (- 12),
(FloatR (- 872731) (- 17), FloatR (- 683123) (- 21)), FloatR (- 777252) (- 17),
FloatR (- 614947) (- 21)),
(FloatR 171431 (- 12), (FloatR (- 863498) (- 17), FloatR (- 701740) (- 21)),
(FloatR (- 760505) (- 17), FloatR (- 623329) (- 21)), FloatR 172311 (- 12),
(FloatR (- 863498) (- 17), FloatR (- 692166) (- 21)), FloatR (- 768939) (- 17),
FloatR (- 623413) (- 21)),
(FloatR 170551 (- 12), (FloatR (- 854140) (- 17), FloatR (- 711722) (- 21)),
(FloatR (- 751953) (- 17), FloatR (- 632231) (- 21)), FloatR 171431 (- 12),
(FloatR (- 854140) (- 17), FloatR (- 701656) (- 21)), FloatR (- 760510) (- 17),
FloatR (- 632318) (- 21)),
(FloatR 169671 (- 12), (FloatR (- 844651) (- 17), FloatR (- 722245) (- 21)),
(FloatR (- 743271) (- 17), FloatR (- 641616) (- 21)), FloatR 170551 (- 12),
(FloatR (- 844651) (- 17), FloatR (- 711637) (- 21)), FloatR (- 751957) (- 17),
FloatR (- 641705) (- 21)),
(FloatR 168791 (- 12), (FloatR (- 835025) (- 17), FloatR (- 733366) (- 21)),
(FloatR (- 734452) (- 17), FloatR (- 651534) (- 21)), FloatR 169671 (- 12),
(FloatR (- 835025) (- 17), FloatR (- 722158) (- 21)), FloatR (- 743275) (- 17),
FloatR (- 651624) (- 21)),
(FloatR 167911 (- 12), (FloatR (- 825253) (- 17), FloatR (- 745150) (- 21)),
(FloatR (- 725487) (- 17), FloatR (- 662041) (- 21)), FloatR 168791 (- 12),
(FloatR (- 825253) (- 17), FloatR (- 733276) (- 21)), FloatR (- 734456) (- 17),
FloatR (- 662134) (- 21)),
(FloatR 167031 (- 12), (FloatR (- 815328) (- 17), FloatR (- 757674) (- 21)),
(FloatR (- 716368) (- 17), FloatR (- 673205) (- 21)), FloatR 167911 (- 12),
(FloatR (- 815328) (- 17), FloatR (- 745058) (- 21)), FloatR (- 725491) (- 17),
FloatR (- 673299) (- 21)),
(FloatR 166151 (- 12), (FloatR (- 805240) (- 17), FloatR (- 771028) (- 21)),
(FloatR (- 707083) (- 17), FloatR (- 685101) (- 21)), FloatR 167031 (- 12),
(FloatR (- 805240) (- 17), FloatR (- 757580) (- 21)), FloatR (- 716372) (- 17),
FloatR (- 685198) (- 21)),
(FloatR 165271 (- 12), (FloatR (- 794978) (- 17), FloatR (- 785316) (- 21)),
(FloatR (- 697622) (- 17), FloatR (- 697820) (- 21)), FloatR 166151 (- 12),
(FloatR (- 794978) (- 17), FloatR (- 770931) (- 21)), FloatR (- 707088) (- 17),
FloatR (- 697920) (- 21)),
(FloatR 164391 (- 12), (FloatR (- 784531) (- 17), FloatR (- 800661) (- 21)),
(FloatR (- 687970) (- 17), FloatR (- 711467) (- 21)), FloatR 165271 (- 12),
(FloatR (- 784531) (- 17), FloatR (- 785216) (- 21)), FloatR (- 697626) (- 17),
FloatR (- 711570) (- 21)),
(FloatR 163511 (- 12), (FloatR (- 773884) (- 17), FloatR (- 817211) (- 21)),
(FloatR (- 678114) (- 17), FloatR (- 726165) (- 21)), FloatR 164391 (- 12),
(FloatR (- 773884) (- 17), FloatR (- 800559) (- 21)), FloatR (- 687975) (- 17),
FloatR (- 726271) (- 21)),
(FloatR 162631 (- 12), (FloatR (- 763024) (- 17), FloatR (- 835141) (- 21)),
(FloatR (- 668034) (- 17), FloatR (- 742062) (- 21)), FloatR 163511 (- 12),
(FloatR (- 763024) (- 17), FloatR (- 817105) (- 21)), FloatR (- 678118) (- 17),
FloatR (- 742171) (- 21)),
(FloatR 161751 (- 12), (FloatR (- 751933) (- 17), FloatR (- 854663) (- 21)),
(FloatR (- 657713) (- 17), FloatR (- 759332) (- 21)), FloatR 162631 (- 12),
(FloatR (- 751933) (- 17), FloatR (- 835032) (- 21)), FloatR (- 668039) (- 17),
FloatR (- 759444) (- 21)),
(FloatR 160871 (- 12), (FloatR (- 740591) (- 17), FloatR (- 876032) (- 21)),
(FloatR (- 647126) (- 17), FloatR (- 778186) (- 21)), FloatR 161751 (- 12),
(FloatR (- 740591) (- 17), FloatR (- 854550) (- 21)), FloatR (- 657717) (- 17),
FloatR (- 778302) (- 21)),
(FloatR 159991 (- 12), (FloatR (- 728974) (- 17), FloatR (- 899562) (- 21)),
(FloatR (- 636247) (- 17), FloatR (- 798881) (- 21)), FloatR 160871 (- 12),
(FloatR (- 728974) (- 17), FloatR (- 875915) (- 21)), FloatR (- 647131) (- 17),
FloatR (- 799001) (- 21)),
(FloatR 159111 (- 12), (FloatR (- 717056) (- 17), FloatR (- 925642) (- 21)),
(FloatR (- 625045) (- 17), FloatR (- 821726) (- 21)), FloatR 159991 (- 12),
(FloatR (- 717056) (- 17), FloatR (- 899441) (- 21)), FloatR (- 636252) (- 17),
FloatR (- 821851) (- 21)),
(FloatR 158231 (- 12), (FloatR (- 704806) (- 17), FloatR (- 954755) (- 21)),
(FloatR (- 613482) (- 17), FloatR (- 847108) (- 21)), FloatR 159111 (- 12),
(FloatR (- 704806) (- 17), FloatR (- 925515) (- 21)), FloatR (- 625050) (- 17),
FloatR (- 847237) (- 21)),
(FloatR 157351 (- 12), (FloatR (- 692186) (- 17), FloatR (- 987512) (- 21)),
(FloatR (- 601515) (- 17), FloatR (- 875505) (- 21)), FloatR 158231 (- 12),
(FloatR (- 692186) (- 17), FloatR (- 954623) (- 21)), FloatR (- 613487) (- 17),
FloatR (- 875640) (- 21)),
(FloatR 156471 (- 12), (FloatR (- 679151) (- 17), FloatR (- 1024697) (- 21)),
(FloatR (- 589089) (- 17), FloatR (- 907522) (- 21)), FloatR 157351 (- 12),
(FloatR (- 679151) (- 17), FloatR (- 987375) (- 21)), FloatR (- 601520) (- 17),
FloatR (- 907663) (- 21)),
(FloatR 155591 (- 12), (FloatR (- 665648) (- 17), FloatR (- 533662) (- 20)),
(FloatR (- 576139) (- 17), FloatR (- 943929) (- 21)), FloatR 156471 (- 12),
(FloatR (- 665648) (- 17), FloatR (- 1024553) (- 21)), FloatR (- 589094) (- 17),
FloatR (- 944077) (- 21)),
(FloatR 154711 (- 12), (FloatR (- 651610) (- 17), FloatR (- 558366) (- 20)),
(FloatR (- 562584) (- 17), FloatR (- 985725) (- 21)), FloatR 155591 (- 12),
(FloatR (- 651610) (- 17), FloatR (- 533586) (- 20)), FloatR (- 576144) (- 17),
FloatR (- 985881) (- 21)),
(FloatR 153831 (- 12), (FloatR (- 636956) (- 17), FloatR (- 587361) (- 20)),
(FloatR (- 548324) (- 17), FloatR (- 1034224) (- 21)), FloatR 154711 (- 12),
(FloatR (- 636956) (- 17), FloatR (- 558286) (- 20)), FloatR (- 562589) (- 17),
FloatR (- 1034389) (- 21)),
(FloatR 152951 (- 12), (FloatR (- 621583) (- 17), FloatR (- 621886) (- 20)),
(FloatR (- 533229) (- 17), FloatR (- 545594) (- 20)), FloatR 153831 (- 12),
(FloatR (- 621583) (- 17), FloatR (- 587276) (- 20)), FloatR (- 548329) (- 17),
FloatR (- 545681) (- 20)),
(FloatR 152071 (- 12), (FloatR (- 605361) (- 17), FloatR (- 663687) (- 20)),
(FloatR (- 1034263) (- 18), FloatR (- 579517) (- 20)), FloatR 152951 (- 12),
(FloatR (- 605361) (- 17), FloatR (- 621794) (- 20)), FloatR (- 533234) (- 17),
FloatR (- 579611) (- 20)),
(FloatR 151191 (- 12), (FloatR (- 588119) (- 17), FloatR (- 715306) (- 20)),
(FloatR (- 999617) (- 18), FloatR (- 620582) (- 20)), FloatR 152071 (- 12),
(FloatR (- 588119) (- 17), FloatR (- 663587) (- 20)), FloatR (- 1034274) (- 18),
FloatR (- 620685) (- 20)),
(FloatR 150311 (- 12), (FloatR (- 569629) (- 17), FloatR (- 780586) (- 20)),
(FloatR (- 961911) (- 18), FloatR (- 671256) (- 20)), FloatR 151191 (- 12),
(FloatR (- 569629) (- 17), FloatR (- 715197) (- 20)), FloatR (- 999628) (- 18),
FloatR (- 671370) (- 20)),
(FloatR 149431 (- 12), (FloatR (- 549580) (- 17), FloatR (- 865610) (- 20)),
(FloatR (- 920285) (- 18), FloatR (- 735257) (- 20)), FloatR 150311 (- 12),
(FloatR (- 549580) (- 17), FloatR (- 780464) (- 20)), FloatR (- 961922) (- 18),
FloatR (- 735385) (- 20)),
(FloatR 148551 (- 12), (FloatR (- 527531) (- 17), FloatR (- 980602) (- 20)),
(FloatR (- 873468) (- 18), FloatR (- 818447) (- 20)), FloatR 149431 (- 12),
(FloatR (- 527530) (- 17), FloatR (- 865471) (- 20)), FloatR (- 920297) (- 18),
FloatR (- 818595) (- 20)),
(FloatR 147671 (- 12), (FloatR (- 1005650) (- 18), FloatR (- 572069) (- 19)),
(FloatR (- 819476) (- 18), FloatR (- 930637) (- 20)), FloatR 148551 (- 12),
(FloatR (- 1005649) (- 18), FloatR (- 980439) (- 20)), FloatR (- 873480) (- 18),
FloatR (- 930815) (- 20)),
(FloatR 146791 (- 12), (FloatR (- 948872) (- 18), FloatR (- 696902) (- 19)),
(FloatR (- 754961) (- 18), FloatR (- 544773) (- 19)), FloatR 147671 (- 12),
(FloatR (- 948871) (- 18), FloatR (- 571968) (- 19)), FloatR (- 819489) (- 18),
FloatR (- 544887) (- 19)),
(FloatR 145911 (- 12), (FloatR (- 881238) (- 18), FloatR (- 909366) (- 19)),
(FloatR (- 673607) (- 18), FloatR (- 665379) (- 19)), FloatR 146791 (- 12),
(FloatR (- 881238) (- 18), FloatR (- 696766) (- 19)), FloatR (- 754977) (- 18),
FloatR (- 665541) (- 19)),
(FloatR 145031 (- 12), (FloatR (- 796106) (- 18), FloatR (- 676194) (- 18)),
(FloatR (- 561314) (- 18), FloatR (- 868852) (- 19)), FloatR 145911 (- 12),
(FloatR (- 796105) (- 18), FloatR (- 909153) (- 19)), FloatR (- 673628) (- 18),
FloatR (- 869126) (- 19)),
(FloatR 144151 (- 12), (FloatR (- 678028) (- 18), FloatR (- 697052) (- 17)),
(FloatR (- 747200) (- 19), FloatR (- 637694) (- 18)), FloatR 145031 (- 12),
(FloatR (- 678025) (- 18), FloatR (- 675934) (- 18)), FloatR (- 561354) (- 18),
FloatR (- 638108) (- 18)),
(FloatR 35859 (- 10), (FloatR (- 949024) (- 19), FloatR (- 782952) (- 15)),
(FloatR 809103 (- 23), FloatR (- 621866) (- 17)), FloatR 144151 (- 12),
(FloatR (- 949003) (- 19), FloatR (- 696167) (- 17)), FloatR (- 747511) (- 19),
FloatR (- 623437) (- 17)),
(FloatR 17820 (- 9), (FloatR 794796 (- 23), FloatR (- 863739) (- 17)),
(FloatR 704638 (- 20), FloatR (- 923149) (- 19)), FloatR 35859 (- 10),
(FloatR 794796 (- 23), FloatR (- 863739) (- 17)), FloatR 808606 (- 23),
FloatR (- 847811) (- 17)),
(FloatR 17710 (- 9), (FloatR 704583 (- 20), FloatR (- 923233) (- 19)),
(FloatR 1040854 (- 20), FloatR (- 680113) (- 19)), FloatR 17820 (- 9),
(FloatR 704583 (- 20), FloatR (- 923232) (- 19)), FloatR 704638 (- 20),
FloatR (- 923150) (- 19)),
(FloatR 17600 (- 9), (FloatR 1040826 (- 20), FloatR (- 680135) (- 19)),
(FloatR 653079 (- 19), FloatR (- 565606) (- 19)), FloatR 17710 (- 9),
(FloatR 1040826 (- 20), FloatR (- 680135) (- 19)), FloatR 1040854 (- 20),
FloatR (- 680113) (- 19)),
(FloatR 17490 (- 9), (FloatR 653069 (- 19), FloatR (- 565616) (- 19)),
(FloatR 766522 (- 19), FloatR (- 990470) (- 20)), FloatR 17600 (- 9),
(FloatR 653069 (- 19), FloatR (- 565616) (- 19)), FloatR 653079 (- 19),
FloatR (- 565606) (- 19)),
(FloatR 17380 (- 9), (FloatR 766515 (- 19), FloatR (- 990482) (- 20)),
(FloatR 867382 (- 19), FloatR (- 892557) (- 20)), FloatR 17490 (- 9),
(FloatR 766515 (- 19), FloatR (- 990482) (- 20)), FloatR 766522 (- 19),
FloatR (- 990470) (- 20)),
(FloatR 17270 (- 9), (FloatR 867376 (- 19), FloatR (- 892565) (- 20)),
(FloatR 959155 (- 19), FloatR (- 819290) (- 20)), FloatR 17380 (- 9),
(FloatR 867376 (- 19), FloatR (- 892565) (- 20)), FloatR 867382 (- 19),
FloatR (- 892557) (- 20)),
(FloatR 17160 (- 9), (FloatR 959150 (- 19), FloatR (- 819295) (- 20)),
(FloatR 1043960 (- 19), FloatR (- 761757) (- 20)), FloatR 17270 (- 9),
(FloatR 959150 (- 19), FloatR (- 819295) (- 20)), FloatR 959155 (- 19),
FloatR (- 819290) (- 20)),
(FloatR 17050 (- 9), (FloatR 1043956 (- 19), FloatR (- 761761) (- 20)),
(FloatR 561599 (- 18), FloatR (- 715002) (- 20)), FloatR 17160 (- 9),
(FloatR 1043956 (- 19), FloatR (- 761761) (- 20)), FloatR 1043960 (- 19),
FloatR (- 761757) (- 20)),
(FloatR 16940 (- 9), (FloatR 561596 (- 18), FloatR (- 715005) (- 20)),
(FloatR 598926 (- 18), FloatR (- 676015) (- 20)), FloatR 17050 (- 9),
(FloatR 561596 (- 18), FloatR (- 715005) (- 20)), FloatR 561599 (- 18),
FloatR (- 715002) (- 20)),
(FloatR 16830 (- 9), (FloatR 598923 (- 18), FloatR (- 676018) (- 20)),
(FloatR 634322 (- 18), FloatR (- 642850) (- 20)), FloatR 16940 (- 9),
(FloatR 598923 (- 18), FloatR (- 676018) (- 20)), FloatR 598926 (- 18),
FloatR (- 676015) (- 20)),
(FloatR 16720 (- 9), (FloatR 634319 (- 18), FloatR (- 642853) (- 20)),
(FloatR 668062 (- 18), FloatR (- 614182) (- 20)), FloatR 16830 (- 9),
(FloatR 634319 (- 18), FloatR (- 642853) (- 20)), FloatR 634322 (- 18),
FloatR (- 642850) (- 20)),
(FloatR 16610 (- 9), (FloatR 668060 (- 18), FloatR (- 614184) (- 20)),
(FloatR 700362 (- 18), FloatR (- 589074) (- 20)), FloatR 16720 (- 9),
(FloatR 668060 (- 18), FloatR (- 614184) (- 20)), FloatR 668062 (- 18),
FloatR (- 614182) (- 20)),
(FloatR 16500 (- 9), (FloatR 700360 (- 18), FloatR (- 589076) (- 20)),
(FloatR 731393 (- 18), FloatR (- 566842) (- 20)), FloatR 16610 (- 9),
(FloatR 700360 (- 18), FloatR (- 589076) (- 20)), FloatR 700362 (- 18),
FloatR (- 589074) (- 20)),
(FloatR 16390 (- 9), (FloatR 731391 (- 18), FloatR (- 566844) (- 20)),
(FloatR 761295 (- 18), FloatR (- 546974) (- 20)), FloatR 16500 (- 9),
(FloatR 731391 (- 18), FloatR (- 566844) (- 20)), FloatR 731393 (- 18),
FloatR (- 566842) (- 20)),
(FloatR 16280 (- 9), (FloatR 761293 (- 18), FloatR (- 546976) (- 20)),
(FloatR 790185 (- 18), FloatR (- 529077) (- 20)), FloatR 16390 (- 9),
(FloatR 761293 (- 18), FloatR (- 546976) (- 20)), FloatR 761295 (- 18),
FloatR (- 546974) (- 20)),
(FloatR 16170 (- 9), (FloatR 790183 (- 18), FloatR (- 529078) (- 20)),
(FloatR 818160 (- 18), FloatR (- 1025688) (- 21)), FloatR 16280 (- 9),
(FloatR 790183 (- 18), FloatR (- 529078) (- 20)), FloatR 790185 (- 18),
FloatR (- 529077) (- 20)),
(FloatR 16060 (- 9), (FloatR 818158 (- 18), FloatR (- 1025690) (- 21)),
(FloatR 845301 (- 18), FloatR (- 996061) (- 21)), FloatR 16170 (- 9),
(FloatR 818158 (- 18), FloatR (- 1025690) (- 21)), FloatR 818160 (- 18),
FloatR (- 1025688) (- 21)),
(FloatR 15950 (- 9), (FloatR 845299 (- 18), FloatR (- 996064) (- 21)),
(FloatR 871681 (- 18), FloatR (- 968883) (- 21)), FloatR 16060 (- 9),
(FloatR 845299 (- 18), FloatR (- 996064) (- 21)), FloatR 845301 (- 18),
FloatR (- 996061) (- 21)),
(FloatR 15840 (- 9), (FloatR 871679 (- 18), FloatR (- 968885) (- 21)),
(FloatR 897360 (- 18), FloatR (- 943831) (- 21)), FloatR 15950 (- 9),
(FloatR 871679 (- 18), FloatR (- 968885) (- 21)), FloatR 871681 (- 18),
FloatR (- 968883) (- 21)),
(FloatR 15730 (- 9), (FloatR 897358 (- 18), FloatR (- 943833) (- 21)),
(FloatR 922392 (- 18), FloatR (- 920641) (- 21)), FloatR 15840 (- 9),
(FloatR 897358 (- 18), FloatR (- 943833) (- 21)), FloatR 897360 (- 18),
FloatR (- 943831) (- 21)),
(FloatR 15620 (- 9), (FloatR 922390 (- 18), FloatR (- 920643) (- 21)),
(FloatR 946823 (- 18), FloatR (- 899093) (- 21)), FloatR 15730 (- 9),
(FloatR 922390 (- 18), FloatR (- 920643) (- 21)), FloatR 922392 (- 18),
FloatR (- 920641) (- 21)),
(FloatR 15510 (- 9), (FloatR 946821 (- 18), FloatR (- 899094) (- 21)),
(FloatR 970696 (- 18), FloatR (- 879000) (- 21)), FloatR 15620 (- 9),
(FloatR 946821 (- 18), FloatR (- 899094) (- 21)), FloatR 946823 (- 18),
FloatR (- 899093) (- 21)),
(FloatR 15400 (- 9), (FloatR 970694 (- 18), FloatR (- 879002) (- 21)),
(FloatR 994047 (- 18), FloatR (- 860207) (- 21)), FloatR 15510 (- 9),
(FloatR 970694 (- 18), FloatR (- 879002) (- 21)), FloatR 970696 (- 18),
FloatR (- 879000) (- 21)),
(FloatR 15290 (- 9), (FloatR 994045 (- 18), FloatR (- 860208) (- 21)),
(FloatR 1016909 (- 18), FloatR (- 842577) (- 21)), FloatR 15400 (- 9),
(FloatR 994045 (- 18), FloatR (- 860208) (- 21)), FloatR 994047 (- 18),
FloatR (- 860207) (- 21)),
(FloatR 15180 (- 9), (FloatR 1016907 (- 18), FloatR (- 842578) (- 21)),
(FloatR 1039312 (- 18), FloatR (- 825995) (- 21)), FloatR 15290 (- 9),
(FloatR 1016907 (- 18), FloatR (- 842578) (- 21)), FloatR 1016909 (- 18),
FloatR (- 842577) (- 21)),
(FloatR 15070 (- 9), (FloatR 1039310 (- 18), FloatR (- 825997) (- 21)),
(FloatR 530641 (- 17), FloatR (- 810362) (- 21)), FloatR 15180 (- 9),
(FloatR 1039310 (- 18), FloatR (- 825997) (- 21)), FloatR 1039312 (- 18),
FloatR (- 825995) (- 21)),
(FloatR 14960 (- 9), (FloatR 530640 (- 17), FloatR (- 810363) (- 21)),
(FloatR 541423 (- 17), FloatR (- 795589) (- 21)), FloatR 15070 (- 9),
(FloatR 530640 (- 17), FloatR (- 810363) (- 21)), FloatR 530641 (- 17),
FloatR (- 810362) (- 21)),
(FloatR 14850 (- 9), (FloatR 541421 (- 17), FloatR (- 795590) (- 21)),
(FloatR 552011 (- 17), FloatR (- 781600) (- 21)), FloatR 14960 (- 9),
(FloatR 541421 (- 17), FloatR (- 795590) (- 21)), FloatR 541423 (- 17),
FloatR (- 795589) (- 21)),
(FloatR 14740 (- 9), (FloatR 552010 (- 17), FloatR (- 781602) (- 21)),
(FloatR 562416 (- 17), FloatR (- 768329) (- 21)), FloatR 14850 (- 9),
(FloatR 552010 (- 17), FloatR (- 781602) (- 21)), FloatR 552011 (- 17),
FloatR (- 781600) (- 21)),
(FloatR 14630 (- 9), (FloatR 562415 (- 17), FloatR (- 768330) (- 21)),
(FloatR 572648 (- 17), FloatR (- 755715) (- 21)), FloatR 14740 (- 9),
(FloatR 562415 (- 17), FloatR (- 768330) (- 21)), FloatR 562416 (- 17),
FloatR (- 768329) (- 21)),
(FloatR 14520 (- 9), (FloatR 572646 (- 17), FloatR (- 755716) (- 21)),
(FloatR 582714 (- 17), FloatR (- 743706) (- 21)), FloatR 14630 (- 9),
(FloatR 572646 (- 17), FloatR (- 755716) (- 21)), FloatR 572648 (- 17),
FloatR (- 755715) (- 21)),
(FloatR 14410 (- 9), (FloatR 582713 (- 17), FloatR (- 743707) (- 21)),
(FloatR 592623 (- 17), FloatR (- 732255) (- 21)), FloatR 14520 (- 9),
(FloatR 582713 (- 17), FloatR (- 743707) (- 21)), FloatR 582714 (- 17),
FloatR (- 743706) (- 21)),
(FloatR 14300 (- 9), (FloatR 592621 (- 17), FloatR (- 732256) (- 21)),
(FloatR 602381 (- 17), FloatR (- 721319) (- 21)), FloatR 14410 (- 9),
(FloatR 592621 (- 17), FloatR (- 732256) (- 21)), FloatR 592623 (- 17),
FloatR (- 732255) (- 21)),
(FloatR 14190 (- 9), (FloatR 602380 (- 17), FloatR (- 721321) (- 21)),
(FloatR 611996 (- 17), FloatR (- 710862) (- 21)), FloatR 14300 (- 9),
(FloatR 602380 (- 17), FloatR (- 721321) (- 21)), FloatR 602381 (- 17),
FloatR (- 721319) (- 21)),
(FloatR 14080 (- 9), (FloatR 611995 (- 17), FloatR (- 710864) (- 21)),
(FloatR 621474 (- 17), FloatR (- 700849) (- 21)), FloatR 14190 (- 9),
(FloatR 611995 (- 17), FloatR (- 710864) (- 21)), FloatR 611996 (- 17),
FloatR (- 710862) (- 21)),
(FloatR 13970 (- 9), (FloatR 621473 (- 17), FloatR (- 700851) (- 21)),
(FloatR 630820 (- 17), FloatR (- 691250) (- 21)), FloatR 14080 (- 9),
(FloatR 621473 (- 17), FloatR (- 700851) (- 21)), FloatR 621474 (- 17),
FloatR (- 700849) (- 21)),
(FloatR 13860 (- 9), (FloatR 630818 (- 17), FloatR (- 691251) (- 21)),
(FloatR 640039 (- 17), FloatR (- 682037) (- 21)), FloatR 13970 (- 9),
(FloatR 630818 (- 17), FloatR (- 691251) (- 21)), FloatR 630820 (- 17),
FloatR (- 691250) (- 21)),
(FloatR 13750 (- 9), (FloatR 640038 (- 17), FloatR (- 682038) (- 21)),
(FloatR 649138 (- 17), FloatR (- 673184) (- 21)), FloatR 13860 (- 9),
(FloatR 640038 (- 17), FloatR (- 682038) (- 21)), FloatR 640039 (- 17),
FloatR (- 682037) (- 21)),
(FloatR 13640 (- 9), (FloatR 649137 (- 17), FloatR (- 673185) (- 21)),
(FloatR 658119 (- 17), FloatR (- 664668) (- 21)), FloatR 13750 (- 9),
(FloatR 649137 (- 17), FloatR (- 673185) (- 21)), FloatR 649138 (- 17),
FloatR (- 673184) (- 21)),
(FloatR 13530 (- 9), (FloatR 658118 (- 17), FloatR (- 664669) (- 21)),
(FloatR 666989 (- 17), FloatR (- 656469) (- 21)), FloatR 13640 (- 9),
(FloatR 658118 (- 17), FloatR (- 664669) (- 21)), FloatR 658119 (- 17),
FloatR (- 664668) (- 21)),
(FloatR 13420 (- 9), (FloatR 666988 (- 17), FloatR (- 656470) (- 21)),
(FloatR 675751 (- 17), FloatR (- 648567) (- 21)), FloatR 13530 (- 9),
(FloatR 666988 (- 17), FloatR (- 656470) (- 21)), FloatR 666989 (- 17),
FloatR (- 656469) (- 21)),
(FloatR 13310 (- 9), (FloatR 675749 (- 17), FloatR (- 648569) (- 21)),
(FloatR 684408 (- 17), FloatR (- 640946) (- 21)), FloatR 13420 (- 9),
(FloatR 675749 (- 17), FloatR (- 648569) (- 21)), FloatR 675751 (- 17),
FloatR (- 648567) (- 21)),
(FloatR 13200 (- 9), (FloatR 684407 (- 17), FloatR (- 640947) (- 21)),
(FloatR 692965 (- 17), FloatR (- 633587) (- 21)), FloatR 13310 (- 9),
(FloatR 684407 (- 17), FloatR (- 640947) (- 21)), FloatR 684408 (- 17),
FloatR (- 640946) (- 21)),
(FloatR 13090 (- 9), (FloatR 692964 (- 17), FloatR (- 633588) (- 21)),
(FloatR 701424 (- 17), FloatR (- 626477) (- 21)), FloatR 13200 (- 9),
(FloatR 692964 (- 17), FloatR (- 633588) (- 21)), FloatR 692965 (- 17),
FloatR (- 633587) (- 21)),
(FloatR 12980 (- 9), (FloatR 701423 (- 17), FloatR (- 626479) (- 21)),
(FloatR 709790 (- 17), FloatR (- 619603) (- 21)), FloatR 13090 (- 9),
(FloatR 701423 (- 17), FloatR (- 626479) (- 21)), FloatR 701424 (- 17),
FloatR (- 626477) (- 21)),
(FloatR 12870 (- 9), (FloatR 709789 (- 17), FloatR (- 619604) (- 21)),
(FloatR 718065 (- 17), FloatR (- 612950) (- 21)), FloatR 12980 (- 9),
(FloatR 709789 (- 17), FloatR (- 619604) (- 21)), FloatR 709790 (- 17),
FloatR (- 619603) (- 21)),
(FloatR 12760 (- 9), (FloatR 718064 (- 17), FloatR (- 612951) (- 21)),
(FloatR 726252 (- 17), FloatR (- 606508) (- 21)), FloatR 12870 (- 9),
(FloatR 718064 (- 17), FloatR (- 612951) (- 21)), FloatR 718065 (- 17),
FloatR (- 612950) (- 21)),
(FloatR 12650 (- 9), (FloatR 726251 (- 17), FloatR (- 606509) (- 21)),
(FloatR 734354 (- 17), FloatR (- 600265) (- 21)), FloatR 12760 (- 9),
(FloatR 726251 (- 17), FloatR (- 606509) (- 21)), FloatR 726252 (- 17),
FloatR (- 606508) (- 21)),
(FloatR 12540 (- 9), (FloatR 734353 (- 17), FloatR (- 600266) (- 21)),
(FloatR 742373 (- 17), FloatR (- 594211) (- 21)), FloatR 12650 (- 9),
(FloatR 734353 (- 17), FloatR (- 600266) (- 21)), FloatR 734354 (- 17),
FloatR (- 600265) (- 21)),
(FloatR 12430 (- 9), (FloatR 742372 (- 17), FloatR (- 594212) (- 21)),
(FloatR 750313 (- 17), FloatR (- 588337) (- 21)), FloatR 12540 (- 9),
(FloatR 742372 (- 17), FloatR (- 594212) (- 21)), FloatR 742373 (- 17),
FloatR (- 594211) (- 21)),
(FloatR 12320 (- 9), (FloatR 750312 (- 17), FloatR (- 588339) (- 21)),
(FloatR 758174 (- 17), FloatR (- 582635) (- 21)), FloatR 12430 (- 9),
(FloatR 750312 (- 17), FloatR (- 588339) (- 21)), FloatR 750313 (- 17),
FloatR (- 588337) (- 21)),
(FloatR 12210 (- 9), (FloatR 758173 (- 17), FloatR (- 582636) (- 21)),
(FloatR 765960 (- 17), FloatR (- 577095) (- 21)), FloatR 12320 (- 9),
(FloatR 758173 (- 17), FloatR (- 582636) (- 21)), FloatR 758174 (- 17),
FloatR (- 582635) (- 21)),
(FloatR 12100 (- 9), (FloatR 765959 (- 17), FloatR (- 577096) (- 21)),
(FloatR 773673 (- 17), FloatR (- 571710) (- 21)), FloatR 12210 (- 9),
(FloatR 765959 (- 17), FloatR (- 577096) (- 21)), FloatR 765960 (- 17),
FloatR (- 577095) (- 21)),
(FloatR 11990 (- 9), (FloatR 773672 (- 17), FloatR (- 571711) (- 21)),
(FloatR 781314 (- 17), FloatR (- 566473) (- 21)), FloatR 12100 (- 9),
(FloatR 773672 (- 17), FloatR (- 571711) (- 21)), FloatR 773673 (- 17),
FloatR (- 571710) (- 21)),
(FloatR 11880 (- 9), (FloatR 781313 (- 17), FloatR (- 566474) (- 21)),
(FloatR 788887 (- 17), FloatR (- 561378) (- 21)), FloatR 11990 (- 9),
(FloatR 781313 (- 17), FloatR (- 566474) (- 21)), FloatR 781314 (- 17),
FloatR (- 566473) (- 21)),
(FloatR 11770 (- 9), (FloatR 788886 (- 17), FloatR (- 561379) (- 21)),
(FloatR 796391 (- 17), FloatR (- 556417) (- 21)), FloatR 11880 (- 9),
(FloatR 788886 (- 17), FloatR (- 561379) (- 21)), FloatR 788887 (- 17),
FloatR (- 561378) (- 21)),
(FloatR 11660 (- 9), (FloatR 796390 (- 17), FloatR (- 556418) (- 21)),
(FloatR 803830 (- 17), FloatR (- 551585) (- 21)), FloatR 11770 (- 9),
(FloatR 796390 (- 17), FloatR (- 556418) (- 21)), FloatR 796391 (- 17),
FloatR (- 556417) (- 21)),
(FloatR 11550 (- 9), (FloatR 803829 (- 17), FloatR (- 551586) (- 21)),
(FloatR 811205 (- 17), FloatR (- 546877) (- 21)), FloatR 11660 (- 9),
(FloatR 803829 (- 17), FloatR (- 551586) (- 21)), FloatR 803830 (- 17),
FloatR (- 551585) (- 21)),
(FloatR 11440 (- 9), (FloatR 811204 (- 17), FloatR (- 546878) (- 21)),
(FloatR 818517 (- 17), FloatR (- 542286) (- 21)), FloatR 11550 (- 9),
(FloatR 811204 (- 17), FloatR (- 546878) (- 21)), FloatR 811205 (- 17),
FloatR (- 546877) (- 21)),
(FloatR 11330 (- 9), (FloatR 818516 (- 17), FloatR (- 542287) (- 21)),
(FloatR 825769 (- 17), FloatR (- 537808) (- 21)), FloatR 11440 (- 9),
(FloatR 818516 (- 17), FloatR (- 542287) (- 21)), FloatR 818517 (- 17),
FloatR (- 542286) (- 21)),
(FloatR 11220 (- 9), (FloatR 825768 (- 17), FloatR (- 537809) (- 21)),
(FloatR 832961 (- 17), FloatR (- 533439) (- 21)), FloatR 11330 (- 9),
(FloatR 825768 (- 17), FloatR (- 537809) (- 21)), FloatR 825769 (- 17),
FloatR (- 537808) (- 21)),
(FloatR 11110 (- 9), (FloatR 832960 (- 17), FloatR (- 533440) (- 21)),
(FloatR 840095 (- 17), FloatR (- 529174) (- 21)), FloatR 11220 (- 9),
(FloatR 832960 (- 17), FloatR (- 533440) (- 21)), FloatR 832961 (- 17),
FloatR (- 533439) (- 21)),
(FloatR 11000 (- 9), (FloatR 840094 (- 17), FloatR (- 529175) (- 21)),
(FloatR 847172 (- 17), FloatR (- 525008) (- 21)), FloatR 11110 (- 9),
(FloatR 840094 (- 17), FloatR (- 529175) (- 21)), FloatR 840095 (- 17),
FloatR (- 529174) (- 21)),
(FloatR 10890 (- 9), (FloatR 847171 (- 17), FloatR (- 525009) (- 21)),
(FloatR 854195 (- 17), FloatR (- 1041875) (- 22)), FloatR 11000 (- 9),
(FloatR 847171 (- 17), FloatR (- 525009) (- 21)), FloatR 847172 (- 17),
FloatR (- 525008) (- 21)),
(FloatR 10780 (- 9), (FloatR 854194 (- 17), FloatR (- 1041876) (- 22)),
(FloatR 861163 (- 17), FloatR (- 1033918) (- 22)), FloatR 10890 (- 9),
(FloatR 854194 (- 17), FloatR (- 1041876) (- 22)), FloatR 854195 (- 17),
FloatR (- 1041875) (- 22)),
(FloatR 10670 (- 9), (FloatR 861162 (- 17), FloatR (- 1033919) (- 22)),
(FloatR 868078 (- 17), FloatR (- 1026137) (- 22)), FloatR 10780 (- 9),
(FloatR 861162 (- 17), FloatR (- 1033919) (- 22)), FloatR 861163 (- 17),
FloatR (- 1033918) (- 22)),
(FloatR 10560 (- 9), (FloatR 868077 (- 17), FloatR (- 1026138) (- 22)),
(FloatR 874942 (- 17), FloatR (- 1018525) (- 22)), FloatR 10670 (- 9),
(FloatR 868077 (- 17), FloatR (- 1026138) (- 22)), FloatR 868078 (- 17),
FloatR (- 1026137) (- 22)),
(FloatR 10450 (- 9), (FloatR 874941 (- 17), FloatR (- 1018526) (- 22)),
(FloatR 881755 (- 17), FloatR (- 1011076) (- 22)), FloatR 10560 (- 9),
(FloatR 874941 (- 17), FloatR (- 1018526) (- 22)), FloatR 874942 (- 17),
FloatR (- 1018525) (- 22)),
(FloatR 10340 (- 9), (FloatR 881754 (- 17), FloatR (- 1011077) (- 22)),
(FloatR 888519 (- 17), FloatR (- 1003783) (- 22)), FloatR 10450 (- 9),
(FloatR 881754 (- 17), FloatR (- 1011077) (- 22)), FloatR 881755 (- 17),
FloatR (- 1011076) (- 22)),
(FloatR 10230 (- 9), (FloatR 888518 (- 17), FloatR (- 1003784) (- 22)),
(FloatR 895234 (- 17), FloatR (- 996641) (- 22)), FloatR 10340 (- 9),
(FloatR 888518 (- 17), FloatR (- 1003784) (- 22)), FloatR 888519 (- 17),
FloatR (- 1003783) (- 22)),
(FloatR 10120 (- 9), (FloatR 895233 (- 17), FloatR (- 996642) (- 22)),
(FloatR 901902 (- 17), FloatR (- 989643) (- 22)), FloatR 10230 (- 9),
(FloatR 895233 (- 17), FloatR (- 996642) (- 22)), FloatR 895234 (- 17),
FloatR (- 996641) (- 22)),
(FloatR 10010 (- 9), (FloatR 901901 (- 17), FloatR (- 989644) (- 22)),
(FloatR 908523 (- 17), FloatR (- 982784) (- 22)), FloatR 10120 (- 9),
(FloatR 901901 (- 17), FloatR (- 989644) (- 22)), FloatR 901902 (- 17),
FloatR (- 989643) (- 22)),
(FloatR 9900 (- 9), (FloatR 908522 (- 17), FloatR (- 982785) (- 22)),
(FloatR 915099 (- 17), FloatR (- 976058) (- 22)), FloatR 10010 (- 9),
(FloatR 908522 (- 17), FloatR (- 982785) (- 22)), FloatR 908523 (- 17),
FloatR (- 982784) (- 22)),
(FloatR 9790 (- 9), (FloatR 915098 (- 17), FloatR (- 976059) (- 22)),
(FloatR 921629 (- 17), FloatR (- 969461) (- 22)), FloatR 9900 (- 9),
(FloatR 915098 (- 17), FloatR (- 976059) (- 22)), FloatR 915099 (- 17),
FloatR (- 976058) (- 22)),
(FloatR 9680 (- 9), (FloatR 921628 (- 17), FloatR (- 969462) (- 22)),
(FloatR 928117 (- 17), FloatR (- 962987) (- 22)), FloatR 9790 (- 9),
(FloatR 921628 (- 17), FloatR (- 969462) (- 22)), FloatR 921629 (- 17),
FloatR (- 969461) (- 22)),
(FloatR 9570 (- 9), (FloatR 928115 (- 17), FloatR (- 962988) (- 22)),
(FloatR 934560 (- 17), FloatR (- 956631) (- 22)), FloatR 9680 (- 9),
(FloatR 928115 (- 17), FloatR (- 962988) (- 22)), FloatR 928117 (- 17),
FloatR (- 962987) (- 22)),
(FloatR 9460 (- 9), (FloatR 934559 (- 17), FloatR (- 956632) (- 22)),
(FloatR 940962 (- 17), FloatR (- 950389) (- 22)), FloatR 9570 (- 9),
(FloatR 934559 (- 17), FloatR (- 956632) (- 22)), FloatR 934560 (- 17),
FloatR (- 956631) (- 22)),
(FloatR 9350 (- 9), (FloatR 940961 (- 17), FloatR (- 950391) (- 22)),
(FloatR 947322 (- 17), FloatR (- 944257) (- 22)), FloatR 9460 (- 9),
(FloatR 940961 (- 17), FloatR (- 950391) (- 22)), FloatR 940962 (- 17),
FloatR (- 950389) (- 22)),
(FloatR 9240 (- 9), (FloatR 947321 (- 17), FloatR (- 944258) (- 22)),
(FloatR 953642 (- 17), FloatR (- 938228) (- 22)), FloatR 9350 (- 9),
(FloatR 947321 (- 17), FloatR (- 944258) (- 22)), FloatR 947322 (- 17),
FloatR (- 944257) (- 22)),
(FloatR 9130 (- 9), (FloatR 953641 (- 17), FloatR (- 938229) (- 22)),
(FloatR 959921 (- 17), FloatR (- 932300) (- 22)), FloatR 9240 (- 9),
(FloatR 953641 (- 17), FloatR (- 938229) (- 22)), FloatR 953642 (- 17),
FloatR (- 938228) (- 22)),
(FloatR 9020 (- 9), (FloatR 959920 (- 17), FloatR (- 932301) (- 22)),
(FloatR 966161 (- 17), FloatR (- 926467) (- 22)), FloatR 9130 (- 9),
(FloatR 959920 (- 17), FloatR (- 932301) (- 22)), FloatR 959921 (- 17),
FloatR (- 932300) (- 22)),
(FloatR 8910 (- 9), (FloatR 966159 (- 17), FloatR (- 926468) (- 22)),
(FloatR 972361 (- 17), FloatR (- 920726) (- 22)), FloatR 9020 (- 9),
(FloatR 966159 (- 17), FloatR (- 926468) (- 22)), FloatR 966161 (- 17),
FloatR (- 926467) (- 22)),
(FloatR 8800 (- 9), (FloatR 972360 (- 17), FloatR (- 920727) (- 22)),
(FloatR 978524 (- 17), FloatR (- 915072) (- 22)), FloatR 8910 (- 9),
(FloatR 972360 (- 17), FloatR (- 920727) (- 22)), FloatR 972361 (- 17),
FloatR (- 920726) (- 22)),
(FloatR 8690 (- 9), (FloatR 978523 (- 17), FloatR (- 915073) (- 22)),
(FloatR 984649 (- 17), FloatR (- 909501) (- 22)), FloatR 8800 (- 9),
(FloatR 978523 (- 17), FloatR (- 915073) (- 22)), FloatR 978524 (- 17),
FloatR (- 915072) (- 22)),
(FloatR 8580 (- 9), (FloatR 984648 (- 17), FloatR (- 909502) (- 22)),
(FloatR 990737 (- 17), FloatR (- 904009) (- 22)), FloatR 8690 (- 9),
(FloatR 984648 (- 17), FloatR (- 909502) (- 22)), FloatR 984649 (- 17),
FloatR (- 909501) (- 22)),
(FloatR 8470 (- 9), (FloatR 990736 (- 17), FloatR (- 904010) (- 22)),
(FloatR 996788 (- 17), FloatR (- 898591) (- 22)), FloatR 8580 (- 9),
(FloatR 990736 (- 17), FloatR (- 904010) (- 22)), FloatR 990737 (- 17),
FloatR (- 904009) (- 22)),
(FloatR 8360 (- 9), (FloatR 996787 (- 17), FloatR (- 898593) (- 22)),
(FloatR 1002803 (- 17), FloatR (- 893244) (- 22)), FloatR 8470 (- 9),
(FloatR 996787 (- 17), FloatR (- 898593) (- 22)), FloatR 996788 (- 17),
FloatR (- 898591) (- 22)),
(FloatR 8250 (- 9), (FloatR 1002802 (- 17), FloatR (- 893245) (- 22)),
(FloatR 1008782 (- 17), FloatR (- 887963) (- 22)), FloatR 8360 (- 9),
(FloatR 1002802 (- 17), FloatR (- 893245) (- 22)), FloatR 1002803 (- 17),
FloatR (- 893244) (- 22)),
(FloatR 8140 (- 9), (FloatR 1008781 (- 17), FloatR (- 887964) (- 22)),
(FloatR 1014726 (- 17), FloatR (- 882744) (- 22)), FloatR 8250 (- 9),
(FloatR 1008781 (- 17), FloatR (- 887964) (- 22)), FloatR 1008782 (- 17),
FloatR (- 887963) (- 22)),
(FloatR 8030 (- 9), (FloatR 1014725 (- 17), FloatR (- 882745) (- 22)),
(FloatR 1020636 (- 17), FloatR (- 877582) (- 22)), FloatR 8140 (- 9),
(FloatR 1014725 (- 17), FloatR (- 882745) (- 22)), FloatR 1014726 (- 17),
FloatR (- 882744) (- 22)),
(FloatR 7920 (- 9), (FloatR 1020635 (- 17), FloatR (- 877583) (- 22)),
(FloatR 1026510 (- 17), FloatR (- 872474) (- 22)), FloatR 8030 (- 9),
(FloatR 1020635 (- 17), FloatR (- 877583) (- 22)), FloatR 1020636 (- 17),
FloatR (- 877582) (- 22)),
(FloatR 7810 (- 9), (FloatR 1026509 (- 17), FloatR (- 872475) (- 22)),
(FloatR 1032351 (- 17), FloatR (- 867414) (- 22)), FloatR 7920 (- 9),
(FloatR 1026509 (- 17), FloatR (- 872475) (- 22)), FloatR 1026510 (- 17),
FloatR (- 872474) (- 22)),
(FloatR 7700 (- 9), (FloatR 1032350 (- 17), FloatR (- 867415) (- 22)),
(FloatR 1038158 (- 17), FloatR (- 862398) (- 22)), FloatR 7810 (- 9),
(FloatR 1032350 (- 17), FloatR (- 867415) (- 22)), FloatR 1032351 (- 17),
FloatR (- 867414) (- 22)),
(FloatR 7590 (- 9), (FloatR 1038157 (- 17), FloatR (- 862399) (- 22)),
(FloatR 1043931 (- 17), FloatR (- 857421) (- 22)), FloatR 7700 (- 9),
(FloatR 1038157 (- 17), FloatR (- 862399) (- 22)), FloatR 1038158 (- 17),
FloatR (- 862398) (- 22)),
(FloatR 7480 (- 9), (FloatR 1043930 (- 17), FloatR (- 857422) (- 22)),
(FloatR 524836 (- 16), FloatR (- 852479) (- 22)), FloatR 7590 (- 9),
(FloatR 1043930 (- 17), FloatR (- 857422) (- 22)), FloatR 1043931 (- 17),
FloatR (- 857421) (- 22)),
(FloatR 7370 (- 9), (FloatR 524835 (- 16), FloatR (- 852480) (- 22)),
(FloatR 527689 (- 16), FloatR (- 847567) (- 22)), FloatR 7480 (- 9),
(FloatR 524835 (- 16), FloatR (- 852480) (- 22)), FloatR 524836 (- 16),
FloatR (- 852479) (- 22)),
(FloatR 7260 (- 9), (FloatR 527688 (- 16), FloatR (- 847568) (- 22)),
(FloatR 530526 (- 16), FloatR (- 842678) (- 22)), FloatR 7370 (- 9),
(FloatR 527688 (- 16), FloatR (- 847568) (- 22)), FloatR 527689 (- 16),
FloatR (- 847567) (- 22)),
(FloatR 7150 (- 9), (FloatR 530525 (- 16), FloatR (- 842679) (- 22)),
(FloatR 533347 (- 16), FloatR (- 837808) (- 22)), FloatR 7260 (- 9),
(FloatR 530525 (- 16), FloatR (- 842679) (- 22)), FloatR 530526 (- 16),
FloatR (- 842678) (- 22)),
(FloatR 7040 (- 9), (FloatR 533346 (- 16), FloatR (- 837809) (- 22)),
(FloatR 536151 (- 16), FloatR (- 832951) (- 22)), FloatR 7150 (- 9),
(FloatR 533346 (- 16), FloatR (- 837809) (- 22)), FloatR 533347 (- 16),
FloatR (- 837808) (- 22)),
(FloatR 6930 (- 9), (FloatR 536150 (- 16), FloatR (- 832952) (- 22)),
(FloatR 538939 (- 16), FloatR (- 828102) (- 22)), FloatR 7040 (- 9),
(FloatR 536150 (- 16), FloatR (- 832952) (- 22)), FloatR 536151 (- 16),
FloatR (- 832951) (- 22)),
(FloatR 6820 (- 9), (FloatR 538938 (- 16), FloatR (- 828103) (- 22)),
(FloatR 541711 (- 16), FloatR (- 823254) (- 22)), FloatR 6930 (- 9),
(FloatR 538938 (- 16), FloatR (- 828103) (- 22)), FloatR 538939 (- 16),
FloatR (- 828102) (- 22)),
(FloatR 6710 (- 9), (FloatR 541710 (- 16), FloatR (- 823255) (- 22)),
(FloatR 544467 (- 16), FloatR (- 818400) (- 22)), FloatR 6820 (- 9),
(FloatR 541710 (- 16), FloatR (- 823255) (- 22)), FloatR 541711 (- 16),
FloatR (- 823254) (- 22)),
(FloatR 6600 (- 9), (FloatR 544466 (- 16), FloatR (- 818401) (- 22)),
(FloatR 547206 (- 16), FloatR (- 813534) (- 22)), FloatR 6710 (- 9),
(FloatR 544466 (- 16), FloatR (- 818401) (- 22)), FloatR 544467 (- 16),
FloatR (- 818400) (- 22)),
(FloatR 6490 (- 9), (FloatR 547205 (- 16), FloatR (- 813535) (- 22)),
(FloatR 549929 (- 16), FloatR (- 808649) (- 22)), FloatR 6600 (- 9),
(FloatR 547205 (- 16), FloatR (- 813535) (- 22)), FloatR 547206 (- 16),
FloatR (- 813534) (- 22)),
(FloatR 6380 (- 9), (FloatR 549927 (- 16), FloatR (- 808650) (- 22)),
(FloatR 552635 (- 16), FloatR (- 803737) (- 22)), FloatR 6490 (- 9),
(FloatR 549927 (- 16), FloatR (- 808650) (- 22)), FloatR 549929 (- 16),
FloatR (- 808649) (- 22)),
(FloatR 6270 (- 9), (FloatR 552634 (- 16), FloatR (- 803738) (- 22)),
(FloatR 555325 (- 16), FloatR (- 798791) (- 22)), FloatR 6380 (- 9),
(FloatR 552634 (- 16), FloatR (- 803738) (- 22)), FloatR 552635 (- 16),
FloatR (- 803737) (- 22)),
(FloatR 6160 (- 9), (FloatR 555324 (- 16), FloatR (- 798792) (- 22)),
(FloatR 557998 (- 16), FloatR (- 793801) (- 22)), FloatR 6270 (- 9),
(FloatR 555324 (- 16), FloatR (- 798792) (- 22)), FloatR 555325 (- 16),
FloatR (- 798791) (- 22)),
(FloatR 6050 (- 9), (FloatR 557997 (- 16), FloatR (- 793802) (- 22)),
(FloatR 560654 (- 16), FloatR (- 788760) (- 22)), FloatR 6160 (- 9),
(FloatR 557997 (- 16), FloatR (- 793802) (- 22)), FloatR 557998 (- 16),
FloatR (- 793801) (- 22)),
(FloatR 5940 (- 9), (FloatR 560653 (- 16), FloatR (- 788761) (- 22)),
(FloatR 563293 (- 16), FloatR (- 783659) (- 22)), FloatR 6050 (- 9),
(FloatR 560653 (- 16), FloatR (- 788761) (- 22)), FloatR 560654 (- 16),
FloatR (- 788760) (- 22)),
(FloatR 5830 (- 9), (FloatR 563292 (- 16), FloatR (- 783660) (- 22)),
(FloatR 565915 (- 16), FloatR (- 778487) (- 22)), FloatR 5940 (- 9),
(FloatR 563292 (- 16), FloatR (- 783660) (- 22)), FloatR 563293 (- 16),
FloatR (- 783659) (- 22)),
(FloatR 5720 (- 9), (FloatR 565914 (- 16), FloatR (- 778488) (- 22)),
(FloatR 568520 (- 16), FloatR (- 773234) (- 22)), FloatR 5830 (- 9),
(FloatR 565914 (- 16), FloatR (- 778488) (- 22)), FloatR 565915 (- 16),
FloatR (- 778487) (- 22)),
(FloatR 5610 (- 9), (FloatR 568519 (- 16), FloatR (- 773235) (- 22)),
(FloatR 571107 (- 16), FloatR (- 767889) (- 22)), FloatR 5720 (- 9),
(FloatR 568519 (- 16), FloatR (- 773235) (- 22)), FloatR 568520 (- 16),
FloatR (- 773234) (- 22)),
(FloatR 5500 (- 9), (FloatR 571106 (- 16), FloatR (- 767890) (- 22)),
(FloatR 573675 (- 16), FloatR (- 762441) (- 22)), FloatR 5610 (- 9),
(FloatR 571106 (- 16), FloatR (- 767890) (- 22)), FloatR 571107 (- 16),
FloatR (- 767889) (- 22)),
(FloatR 5390 (- 9), (FloatR 573674 (- 16), FloatR (- 762442) (- 22)),
(FloatR 576225 (- 16), FloatR (- 756878) (- 22)), FloatR 5500 (- 9),
(FloatR 573674 (- 16), FloatR (- 762442) (- 22)), FloatR 573675 (- 16),
FloatR (- 762441) (- 22)),
(FloatR 5280 (- 9), (FloatR 576224 (- 16), FloatR (- 756880) (- 22)),
(FloatR 578757 (- 16), FloatR (- 751188) (- 22)), FloatR 5390 (- 9),
(FloatR 576224 (- 16), FloatR (- 756880) (- 22)), FloatR 576225 (- 16),
FloatR (- 756878) (- 22)),
(FloatR 5170 (- 9), (FloatR 578756 (- 16), FloatR (- 751189) (- 22)),
(FloatR 581269 (- 16), FloatR (- 745356) (- 22)), FloatR 5280 (- 9),
(FloatR 578756 (- 16), FloatR (- 751189) (- 22)), FloatR 578757 (- 16),
FloatR (- 751188) (- 22)),
(FloatR 5060 (- 9), (FloatR 581268 (- 16), FloatR (- 745357) (- 22)),
(FloatR 583761 (- 16), FloatR (- 739369) (- 22)), FloatR 5170 (- 9),
(FloatR 581268 (- 16), FloatR (- 745357) (- 22)), FloatR 581269 (- 16),
FloatR (- 745356) (- 22)),
(FloatR 4950 (- 9), (FloatR 583760 (- 16), FloatR (- 739370) (- 22)),
(FloatR 586233 (- 16), FloatR (- 733212) (- 22)), FloatR 5060 (- 9),
(FloatR 583760 (- 16), FloatR (- 739370) (- 22)), FloatR 583761 (- 16),
FloatR (- 739369) (- 22)),
(FloatR 4840 (- 9), (FloatR 586232 (- 16), FloatR (- 733213) (- 22)),
(FloatR 588683 (- 16), FloatR (- 726869) (- 22)), FloatR 4950 (- 9),
(FloatR 586232 (- 16), FloatR (- 733213) (- 22)), FloatR 586233 (- 16),
FloatR (- 733212) (- 22)),
(FloatR 4730 (- 9), (FloatR 588682 (- 16), FloatR (- 726870) (- 22)),
(FloatR 591112 (- 16), FloatR (- 720325) (- 22)), FloatR 4840 (- 9),
(FloatR 588682 (- 16), FloatR (- 726870) (- 22)), FloatR 588683 (- 16),
FloatR (- 726869) (- 22)),
(FloatR 4620 (- 9), (FloatR 591111 (- 16), FloatR (- 720326) (- 22)),
(FloatR 593519 (- 16), FloatR (- 713561) (- 22)), FloatR 4730 (- 9),
(FloatR 591111 (- 16), FloatR (- 720326) (- 22)), FloatR 591112 (- 16),
FloatR (- 720325) (- 22)),
(FloatR 4510 (- 9), (FloatR 593518 (- 16), FloatR (- 713562) (- 22)),
(FloatR 595903 (- 16), FloatR (- 706560) (- 22)), FloatR 4620 (- 9),
(FloatR 593518 (- 16), FloatR (- 713562) (- 22)), FloatR 593519 (- 16),
FloatR (- 713561) (- 22)),
(FloatR 4400 (- 9), (FloatR 595902 (- 16), FloatR (- 706561) (- 22)),
(FloatR 598263 (- 16), FloatR (- 699304) (- 22)), FloatR 4510 (- 9),
(FloatR 595902 (- 16), FloatR (- 706561) (- 22)), FloatR 595903 (- 16),
FloatR (- 706560) (- 22)),
(FloatR 4290 (- 9), (FloatR 598262 (- 16), FloatR (- 699305) (- 22)),
(FloatR 600598 (- 16), FloatR (- 691773) (- 22)), FloatR 4400 (- 9),
(FloatR 598262 (- 16), FloatR (- 699305) (- 22)), FloatR 598263 (- 16),
FloatR (- 699304) (- 22)),
(FloatR 4180 (- 9), (FloatR 600597 (- 16), FloatR (- 691774) (- 22)),
(FloatR 602907 (- 16), FloatR (- 683947) (- 22)), FloatR 4290 (- 9),
(FloatR 600597 (- 16), FloatR (- 691774) (- 22)), FloatR 600598 (- 16),
FloatR (- 691773) (- 22)),
(FloatR 4070 (- 9), (FloatR 602906 (- 16), FloatR (- 683948) (- 22)),
(FloatR 605189 (- 16), FloatR (- 675805) (- 22)), FloatR 4180 (- 9),
(FloatR 602906 (- 16), FloatR (- 683948) (- 22)), FloatR 602907 (- 16),
FloatR (- 683947) (- 22)),
(FloatR 3960 (- 9), (FloatR 605188 (- 16), FloatR (- 675806) (- 22)),
(FloatR 607444 (- 16), FloatR (- 667325) (- 22)), FloatR 4070 (- 9),
(FloatR 605188 (- 16), FloatR (- 675806) (- 22)), FloatR 605189 (- 16),
FloatR (- 675805) (- 22)),
(FloatR 3850 (- 9), (FloatR 607443 (- 16), FloatR (- 667326) (- 22)),
(FloatR 609669 (- 16), FloatR (- 658486) (- 22)), FloatR 3960 (- 9),
(FloatR 607443 (- 16), FloatR (- 667326) (- 22)), FloatR 607444 (- 16),
FloatR (- 667325) (- 22)),
(FloatR 3740 (- 9), (FloatR 609668 (- 16), FloatR (- 658487) (- 22)),
(FloatR 611864 (- 16), FloatR (- 649264) (- 22)), FloatR 3850 (- 9),
(FloatR 609668 (- 16), FloatR (- 658487) (- 22)), FloatR 609669 (- 16),
FloatR (- 658486) (- 22)),
(FloatR 3630 (- 9), (FloatR 611863 (- 16), FloatR (- 649265) (- 22)),
(FloatR 614028 (- 16), FloatR (- 639637) (- 22)), FloatR 3740 (- 9),
(FloatR 611863 (- 16), FloatR (- 649265) (- 22)), FloatR 611864 (- 16),
FloatR (- 649264) (- 22)),
(FloatR 3520 (- 9), (FloatR 614027 (- 16), FloatR (- 639638) (- 22)),
(FloatR 616158 (- 16), FloatR (- 629580) (- 22)), FloatR 3630 (- 9),
(FloatR 614027 (- 16), FloatR (- 639638) (- 22)), FloatR 614028 (- 16),
FloatR (- 639637) (- 22)),
(FloatR 3410 (- 9), (FloatR 616157 (- 16), FloatR (- 629581) (- 22)),
(FloatR 618254 (- 16), FloatR (- 619070) (- 22)), FloatR 3520 (- 9),
(FloatR 616157 (- 16), FloatR (- 629581) (- 22)), FloatR 616158 (- 16),
FloatR (- 629580) (- 22)),
(FloatR 3300 (- 9), (FloatR 618253 (- 16), FloatR (- 619071) (- 22)),
(FloatR 620314 (- 16), FloatR (- 608083) (- 22)), FloatR 3410 (- 9),
(FloatR 618253 (- 16), FloatR (- 619071) (- 22)), FloatR 618254 (- 16),
FloatR (- 619070) (- 22)),
(FloatR 3190 (- 9), (FloatR 620313 (- 16), FloatR (- 608084) (- 22)),
(FloatR 622336 (- 16), FloatR (- 596594) (- 22)), FloatR 3300 (- 9),
(FloatR 620313 (- 16), FloatR (- 608084) (- 22)), FloatR 620314 (- 16),
FloatR (- 608083) (- 22)),
(FloatR 3080 (- 9), (FloatR 622335 (- 16), FloatR (- 596595) (- 22)),
(FloatR 624319 (- 16), FloatR (- 584581) (- 22)), FloatR 3190 (- 9),
(FloatR 622335 (- 16), FloatR (- 596595) (- 22)), FloatR 622336 (- 16),
FloatR (- 596594) (- 22)),
(FloatR 2970 (- 9), (FloatR 624318 (- 16), FloatR (- 584582) (- 22)),
(FloatR 626260 (- 16), FloatR (- 572019) (- 22)), FloatR 3080 (- 9),
(FloatR 624318 (- 16), FloatR (- 584582) (- 22)), FloatR 624319 (- 16),
FloatR (- 584581) (- 22)),
(FloatR 2860 (- 9), (FloatR 626259 (- 16), FloatR (- 572020) (- 22)),
(FloatR 628159 (- 16), FloatR (- 558886) (- 22)), FloatR 2970 (- 9),
(FloatR 626259 (- 16), FloatR (- 572020) (- 22)), FloatR 626260 (- 16),
FloatR (- 572019) (- 22)),
(FloatR 2750 (- 9), (FloatR 628158 (- 16), FloatR (- 558888) (- 22)),
(FloatR 630012 (- 16), FloatR (- 545161) (- 22)), FloatR 2860 (- 9),
(FloatR 628158 (- 16), FloatR (- 558888) (- 22)), FloatR 628159 (- 16),
FloatR (- 558886) (- 22)),
(FloatR 2640 (- 9), (FloatR 630011 (- 16), FloatR (- 545162) (- 22)),
(FloatR 631818 (- 16), FloatR (- 530822) (- 22)), FloatR 2750 (- 9),
(FloatR 630011 (- 16), FloatR (- 545162) (- 22)), FloatR 630012 (- 16),
FloatR (- 545161) (- 22)),
(FloatR 2530 (- 9), (FloatR 631817 (- 16), FloatR (- 530823) (- 22)),
(FloatR 633575 (- 16), FloatR (- 1031701) (- 23)), FloatR 2640 (- 9),
(FloatR 631817 (- 16), FloatR (- 530823) (- 22)), FloatR 631818 (- 16),
FloatR (- 530822) (- 22)),
(FloatR 2420 (- 9), (FloatR 633574 (- 16), FloatR (- 1031702) (- 23)),
(FloatR 635281 (- 16), FloatR (- 1000458) (- 23)), FloatR 2530 (- 9),
(FloatR 633574 (- 16), FloatR (- 1031702) (- 23)), FloatR 633575 (- 16),
FloatR (- 1031701) (- 23)),
(FloatR 2310 (- 9), (FloatR 635280 (- 16), FloatR (- 1000459) (- 23)),
(FloatR 636933 (- 16), FloatR (- 967884) (- 23)), FloatR 2420 (- 9),
(FloatR 635280 (- 16), FloatR (- 1000459) (- 23)), FloatR 635281 (- 16),
FloatR (- 1000458) (- 23)),
(FloatR 2200 (- 9), (FloatR 636932 (- 16), FloatR (- 967885) (- 23)),
(FloatR 638529 (- 16), FloatR (- 933955) (- 23)), FloatR 2310 (- 9),
(FloatR 636932 (- 16), FloatR (- 967885) (- 23)), FloatR 636933 (- 16),
FloatR (- 967884) (- 23)),
(FloatR 2090 (- 9), (FloatR 638528 (- 16), FloatR (- 933956) (- 23)),
(FloatR 640067 (- 16), FloatR (- 898650) (- 23)), FloatR 2200 (- 9),
(FloatR 638528 (- 16), FloatR (- 933956) (- 23)), FloatR 638529 (- 16),
FloatR (- 933955) (- 23)),
(FloatR 1980 (- 9), (FloatR 640066 (- 16), FloatR (- 898651) (- 23)),
(FloatR 641545 (- 16), FloatR (- 861955) (- 23)), FloatR 2090 (- 9),
(FloatR 640066 (- 16), FloatR (- 898651) (- 23)), FloatR 640067 (- 16),
FloatR (- 898650) (- 23)),
(FloatR 1870 (- 9), (FloatR 641544 (- 16), FloatR (- 861957) (- 23)),
(FloatR 642960 (- 16), FloatR (- 823865) (- 23)), FloatR 1980 (- 9),
(FloatR 641544 (- 16), FloatR (- 861957) (- 23)), FloatR 641545 (- 16),
FloatR (- 861955) (- 23)),
(FloatR 1760 (- 9), (FloatR 642959 (- 16), FloatR (- 823866) (- 23)),
(FloatR 644310 (- 16), FloatR (- 784380) (- 23)), FloatR 1870 (- 9),
(FloatR 642959 (- 16), FloatR (- 823866) (- 23)), FloatR 642960 (- 16),
FloatR (- 823865) (- 23)),
(FloatR 1650 (- 9), (FloatR 644309 (- 16), FloatR (- 784382) (- 23)),
(FloatR 645592 (- 16), FloatR (- 743511) (- 23)), FloatR 1760 (- 9),
(FloatR 644309 (- 16), FloatR (- 784381) (- 23)), FloatR 644310 (- 16),
FloatR (- 784380) (- 23)),
(FloatR 1540 (- 9), (FloatR 645591 (- 16), FloatR (- 743512) (- 23)),
(FloatR 646805 (- 16), FloatR (- 701274) (- 23)), FloatR 1650 (- 9),
(FloatR 645591 (- 16), FloatR (- 743512) (- 23)), FloatR 645592 (- 16),
FloatR (- 743511) (- 23)),
(FloatR 1430 (- 9), (FloatR 646804 (- 16), FloatR (- 701275) (- 23)),
(FloatR 647946 (- 16), FloatR (- 657699) (- 23)), FloatR 1540 (- 9),
(FloatR 646804 (- 16), FloatR (- 701275) (- 23)), FloatR 646805 (- 16),
FloatR (- 701274) (- 23)),
(FloatR 1320 (- 9), (FloatR 647945 (- 16), FloatR (- 657700) (- 23)),
(FloatR 649012 (- 16), FloatR (- 612824) (- 23)), FloatR 1430 (- 9),
(FloatR 647945 (- 16), FloatR (- 657700) (- 23)), FloatR 647946 (- 16),
FloatR (- 657699) (- 23)),
(FloatR 1210 (- 9), (FloatR 649011 (- 16), FloatR (- 612825) (- 23)),
(FloatR 650002 (- 16), FloatR (- 566695) (- 23)), FloatR 1320 (- 9),
(FloatR 649011 (- 16), FloatR (- 612825) (- 23)), FloatR 649012 (- 16),
FloatR (- 612824) (- 23)),
(FloatR 1100 (- 9), (FloatR 650001 (- 16), FloatR (- 566696) (- 23)),
(FloatR 650914 (- 16), FloatR (- 1038743) (- 24)), FloatR 1210 (- 9),
(FloatR 650001 (- 16), FloatR (- 566696) (- 23)), FloatR 650002 (- 16),
FloatR (- 566695) (- 23)),
(FloatR 990 (- 9), (FloatR 650913 (- 16), FloatR (- 1038744) (- 24)),
(FloatR 651745 (- 16), FloatR (- 941842) (- 24)), FloatR 1100 (- 9),
(FloatR 650913 (- 16), FloatR (- 1038744) (- 24)), FloatR 650914 (- 16),
FloatR (- 1038743) (- 24)),
(FloatR 880 (- 9), (FloatR 651744 (- 16), FloatR (- 941843) (- 24)),
(FloatR 652494 (- 16), FloatR (- 842845) (- 24)), FloatR 990 (- 9),
(FloatR 651744 (- 16), FloatR (- 941843) (- 24)), FloatR 651745 (- 16),
FloatR (- 941842) (- 24)),
(FloatR 770 (- 9), (FloatR 652493 (- 16), FloatR (- 842846) (- 24)),
(FloatR 653159 (- 16), FloatR (- 741927) (- 24)), FloatR 880 (- 9),
(FloatR 652493 (- 16), FloatR (- 842846) (- 24)), FloatR 652494 (- 16),
FloatR (- 842845) (- 24)),
(FloatR 660 (- 9), (FloatR 653158 (- 16), FloatR (- 741928) (- 24)),
(FloatR 653739 (- 16), FloatR (- 639284) (- 24)), FloatR 770 (- 9),
(FloatR 653158 (- 16), FloatR (- 741928) (- 24)), FloatR 653159 (- 16),
FloatR (- 741927) (- 24)),
(FloatR 550 (- 9), (FloatR 653738 (- 16), FloatR (- 639285) (- 24)),
(FloatR 654232 (- 16), FloatR (- 535127) (- 24)), FloatR 660 (- 9),
(FloatR 653738 (- 16), FloatR (- 639285) (- 24)), FloatR 653739 (- 16),
FloatR (- 639284) (- 24)),
(FloatR 440 (- 9), (FloatR 654231 (- 16), FloatR (- 535128) (- 24)),
(FloatR 654637 (- 16), FloatR (- 859366) (- 25)), FloatR 550 (- 9),
(FloatR 654231 (- 16), FloatR (- 535128) (- 24)), FloatR 654232 (- 16),
FloatR (- 535127) (- 24)),
(FloatR 330 (- 9), (FloatR 654636 (- 16), FloatR (- 859367) (- 25)),
(FloatR 654953 (- 16), FloatR (- 646385) (- 25)), FloatR 440 (- 9),
(FloatR 654636 (- 16), FloatR (- 859367) (- 25)), FloatR 654637 (- 16),
FloatR (- 859366) (- 25)),
(FloatR 220 (- 9), (FloatR 654952 (- 16), FloatR (- 646387) (- 25)),
(FloatR 655179 (- 16), FloatR (- 863632) (- 26)), FloatR 330 (- 9),
(FloatR 654952 (- 16), FloatR (- 646387) (- 25)), FloatR 654953 (- 16),
FloatR (- 646386) (- 25)),
(FloatR 110 (- 9), (FloatR 655178 (- 16), FloatR (- 863633) (- 26)),
(FloatR 655315 (- 16), FloatR (- 864707) (- 27)), FloatR 220 (- 9),
(FloatR 655178 (- 16), FloatR (- 863633) (- 26)), FloatR 655179 (- 16),
FloatR (- 863632) (- 26)),
(FloatR 0 0, (FloatR 655314 (- 16), FloatR (- 864708) (- 27)),
(FloatR 655360 (- 16), FloatR 869715 (- 57)), FloatR 110 (- 9),
(FloatR 655314 (- 16), FloatR (- 864708) (- 27)), FloatR 655315 (- 16),
FloatR (- 864707) (- 27))])"
oops --"by eval"
end
|
Kiwi Tree was a familyowned and operated professional trees tree company located in Davis. Kiwi Tree was fully http://www.cslb.ca.gov/ licensed and insured by the State of California, the http://www.isaarbor.com/ International Society of Aboriculture, and the http://www.ascaconsultants.org/ American Society of Consulting Arborists. Kiwi Tree was dedicated to preserving and maintaining both the health and appearance of local trees, as well as providing professional and courteous customer care.
2009 Recipient of the City of Davis Environmental Recognition Award (Business Category).
Tree Services
Tree and Shrub Removal
Tree Planting
Stump Grinding
Pruning (both structural and restorative)
Fruit Tree Service
Cabling and Bracing
Chipping and Hauling Wood (and/or cut up on site for mulch and firewood)
Thorough Site Clean Up
Emergency Services/Storm Damage
Commercial Tree Maintenance
Other Landscaping Services Available Upon Request
Free Estimates
Kiwi Tree employs proficient, experienced climbers that are trained in electrical hazard awareness.
Arborist Services
Arborist Reports/Consultations
Tree Inventories
Aerial Inspections
Heritage and Landmark Trees
Consultation is available to assess damage and health issues, including pest and disease identification and treatment options. Kiwi Tree can also assist in developing restoration/management plans for long term maintenance. The company is familiar with local flora and environmental challenges and can recommend appropriate plants and trees that thrive in this area.
20090310 17:14:15 nbsp Ive used Kiwi Tree for several years now and Ive always been quite pleased. They always did a great job whether it was removing dead trees and grinding out the stumps, or trimming the branches of our fruit trees. They are also very reasonable on pricing, friendly, and honest. After paying them they needed to come back because of a equipment problem and the did without any prompting. Id recommend them without question. Users/templets
20100117 11:46:32 nbsp Just had two trees removed by Kiwi Tree (Don); they did a great job. Fast, and a reasonable price. Users/GerryPez
20101011 18:23:04 nbsp Best tree service ever theyve helped me several times, most recently today when they left their dinner to come to the Coop and free a car that was pinned under a fallen branch. Super nice, super smart and good rates too. Users/JulieCross
20120814 13:39:01 nbsp Kiwi Tree did a quick and effective job removing some large, precarious branches that were growing out of a Mulberry Tree into our house and our neighbors house. They let me deal with the green waste to save $$. Actually the whole thing seemed pretty cheap considering the risk involved in operating power tools while climbing. Users/MikeyCrews
20130320 09:02:15 nbsp Kiwi is a great tree service company. Ive used them several times now and I am always pleased with there service and pricing. Just dont deal with the oweners wife she is alittle out there in left field Users/MJones
20130416 17:07:51 nbsp (MJones) I am grateful for your verbal applause of my tree work. Yet I find no mention of your name in my database. Perchance you be using a Nom de Plume. Maybe you have Kiwi Tree confused with another Tree service? Anyhow please feel free to call me at (530) 2205650, to clarify that my wife is not alittle out there in left field
Regards
Don Perkins:..Not a Nom de Plume Users/DonPerkins
|
Require Import Term_Defs Term Eqb_Evidence.
Require Import StructTactics.
Require Import PeanoNat Coq.Program.Tactics.
(*
Inductive EvSubT: Evidence -> Evidence -> Prop :=
| evsub_refl_t : forall e : Evidence, EvSubT e e
| uuSubT: forall e e' i tid l tpl,
EvSubT e e' ->
EvSubT e (uu i l tpl tid e')
| ggSubT: forall e e' p,
EvSubT e e' ->
EvSubT e (gg p e')
| nnSubT: forall e e' i,
EvSubT e e' ->
EvSubT e (nn i e').
*)
Inductive req_evidence: AnnoTerm -> Plc -> Plc -> Evidence -> Evidence -> Prop :=
| is_req_evidence: forall annt t pp p q i e e',
events annt pp e (req i p q t e') ->
req_evidence annt pp q e e'.
Fixpoint check_req (t:AnnoTerm) (pp:Plc) (q:Plc) (e:Evidence) (e':Evidence): bool :=
match t with
| aatt r rp t' => (eqb_evidence e e' && (Nat.eqb q rp)) || (check_req t' rp q e e')
| alseq r t1 t2 => (check_req t1 pp q e e') || (check_req t2 pp q (aeval t1 pp e) e')
| abseq r s t1 t2 =>
(check_req t1 pp q (splitEv_T_l s e) e') || (check_req t2 pp q (splitEv_T_r s e) e')
| abpar r s t1 t2 =>
(check_req t1 pp q (splitEv_T_l s e) e') || (check_req t2 pp q (splitEv_T_r s e) e')
| _ => false
end.
Lemma req_implies_check: forall t pp q e e',
req_evidence t pp q e e' -> check_req t pp q e e' = true.
Proof.
intros.
generalizeEverythingElse t.
induction t; intros.
-
destruct a.
+
cbn.
inversion H.
solve_by_inversion.
+
cbn.
inversion H.
solve_by_inversion.
+
cbn.
inversion H.
solve_by_inversion.
+
cbn.
inversion H.
solve_by_inversion.
-
invc H.
invc H0; subst; cbn.
+
rewrite Bool.orb_true_iff.
left.
rewrite Bool.andb_true_iff.
split.
++
rewrite eqb_eq_evidence.
tauto.
++
apply Nat.eqb_refl.
+
rewrite Bool.orb_true_iff.
right.
eapply IHt.
econstructor.
eassumption.
-
cbn.
invc H.
invc H0.
+
rewrite Bool.orb_true_iff.
left.
eapply IHt1.
econstructor.
eassumption.
+
rewrite Bool.orb_true_iff.
right.
eapply IHt2.
econstructor.
eassumption.
-
cbn.
invc H.
invc H0.
+
rewrite Bool.orb_true_iff.
left.
eapply IHt1.
econstructor.
eassumption.
+
rewrite Bool.orb_true_iff.
right.
eapply IHt2.
econstructor.
eassumption.
-
cbn.
invc H.
invc H0.
+
rewrite Bool.orb_true_iff.
left.
eapply IHt1.
econstructor.
eassumption.
+
rewrite Bool.orb_true_iff.
right.
eapply IHt2.
econstructor.
eassumption.
Defined.
Lemma check_implies_req: forall t pp q e e',
check_req t pp q e e' = true -> req_evidence t pp q e e'.
Proof.
intros.
generalizeEverythingElse t.
induction t; intros.
-
destruct a;
cbn; try solve_by_inversion.
-
cbn in *.
rewrite Bool.orb_true_iff in H.
destruct H.
+
rewrite Bool.andb_true_iff in H.
destruct_conjs.
econstructor.
rewrite eqb_eq_evidence in *.
apply EqNat.beq_nat_true in H0.
subst.
eauto.
+
assert (req_evidence t n q e e') by eauto.
invc H0.
econstructor.
econstructor.
eassumption.
-
cbn in *.
rewrite Bool.orb_true_iff in H.
destruct_conjs.
destruct H.
+
assert (req_evidence t1 pp q e e') by eauto.
invc H0.
econstructor.
apply evtslseql.
eassumption.
+
assert (req_evidence t2 pp q (aeval t1 pp e) e') by eauto.
invc H0.
econstructor.
apply evtslseqr.
eassumption.
-
cbn in *.
rewrite Bool.orb_true_iff in H.
destruct_conjs.
destruct H.
+
assert (req_evidence t1 pp q (splitEv_T_l s e) e') by eauto.
invc H0.
econstructor.
apply evtsbseql.
eassumption.
+
assert (req_evidence t2 pp q (splitEv_T_r s e) e') by eauto.
invc H0.
econstructor.
apply evtsbseqr.
eassumption.
-
cbn in *.
rewrite Bool.orb_true_iff in H.
destruct_conjs.
destruct H.
+
assert (req_evidence t1 pp q (splitEv_T_l s e) e') by eauto.
invc H0.
econstructor.
apply evtsbparl.
eassumption.
+
assert (req_evidence t2 pp q (splitEv_T_r s e) e') by eauto.
invc H0.
econstructor.
apply evtsbparr.
eassumption.
Defined.
(*
(* priv_pol p e --> allow place p to receive evidence with shape e *)
Definition priv_pol := Plc -> Evidence -> Prop.
Check priv_pol.
Definition satisfies_policy (t:AnnoTerm) (pp:Plc) (ee:Evidence)
(q:Plc) (es:Evidence) (pol:priv_pol) :=
req_evidence t pp ee q es -> (pol q es).
Definition test_term: Term := att 1 (asp CPY).
Definition test_term_anno := annotated test_term.
Compute test_term_anno.
Definition test_init_evidence := uu 1 [] 42 442 mt.
Definition test_init_evidence2 := uu 2 [] 42 442 mt.
Definition test_pol (p:Plc) (e:Evidence) :=
match (p,e) with
| (1, (uu 1 [] 42 442 mt)) => False
| _ => True
end.
Example test_term_satisfies_test_pol: forall pp ee q,
satisfies_policy test_term_anno pp ee q mt test_pol.
Proof.
intros.
cbn.
unfold test_init_evidence.
unfold satisfies_policy.
intros.
unfold test_pol.
cbv.
intros.
invc H.
inv H1.
auto.
invc H1.
auto.
solve_by_inversion.
Qed.
*)
|
lemma BseqI: "0 < K \<Longrightarrow> \<forall>n. norm (X n) \<le> K \<Longrightarrow> Bseq X" |
3 is a weak electrical conductor . The trichloride SbCl
|
theory Pedersen imports
Abstract_Commitment
"HOL-Number_Theory.Cong"
CryptHOL.CryptHOL
Cyclic_Group_Ext
Discrete_log
GCD
begin
locale pedersen_base =
fixes \<G> :: "'grp cyclic_group" (structure)
assumes finite_group: "finite (carrier \<G>)"
and order_gt_0: "order \<G> > 0"
begin
type_synonym 'grp' ck = "'grp'"
type_synonym 'grp' vk = "'grp'"
type_synonym plain = "nat"
type_synonym 'grp' commit = "'grp'"
type_synonym opening = "nat"
definition key_gen :: "('grp ck \<times> 'grp vk) spmf"
where
"key_gen = do {
x :: nat \<leftarrow> sample_uniform (order \<G>);
let h = \<^bold>g (^) x;
return_spmf (h, h)
}"
definition commit :: "'grp ck \<Rightarrow> plain \<Rightarrow> ('grp commit \<times> opening) spmf"
where
"commit pub_key m = do {
d :: nat \<leftarrow> sample_uniform (order \<G>);
let c = ((\<^bold>g (^) d) \<otimes> (pub_key (^) m));
return_spmf (c,d)
}"
definition verify :: "'grp vk \<Rightarrow> plain \<Rightarrow> 'grp commit \<Rightarrow> opening \<Rightarrow> bool spmf"
where
"verify v_key m c d = do {
let c' = (\<^bold>g (^) d \<otimes> v_key (^) m);
return_spmf (c = c')
}"
definition valid_msg :: "plain \<Rightarrow> bool"
where "valid_msg msg \<equiv> msg \<in> {..<order \<G>}"
definition \<A>_cond :: "'grp commit \<Rightarrow> plain \<Rightarrow> opening \<Rightarrow> plain \<Rightarrow> opening \<Rightarrow> bool"
where "\<A>_cond c m d m' d' = (m > m' \<and> \<not> [m = m'] (mod order \<G>) \<and> (gcd (m - m') (order \<G>) = 1))"
definition dis_log_\<A> :: "('grp ck, plain, 'grp commit, opening) bind_adv \<Rightarrow> 'grp ck \<Rightarrow> nat spmf"
where "dis_log_\<A> \<A> h = do {
(c, m, d, m', d') \<leftarrow> \<A> h;
_ :: unit \<leftarrow> assert_spmf (m > m' \<and> \<not> [m = m'] (mod order \<G>) \<and> (gcd (m - m') (order \<G>) = 1));
_ :: unit \<leftarrow> assert_spmf (c = \<^bold>g (^) d \<otimes> h (^) m \<and> c = \<^bold>g (^) d' \<otimes> h (^) m');
return_spmf (nat ((int d' - int d) * (fst (bezw (m - m') (order \<G>))) mod order \<G>))}"
sublocale abstract_commitment: abstract_commitment key_gen commit verify valid_msg \<A>_cond .
sublocale discrete_log: dis_log .
end
locale pedersen = pedersen_base + cyclic_group \<G> +
assumes finite_group: "finite (carrier \<G>)"
begin
lemma inverse: assumes "gcd (nat (int m - int m')) (order \<G>) = 1" and m_ge_m': "m > m'"
shows "[(int m - int m') * (fst (bezw (nat (int m - int m')) (order \<G>))) = 1] (mod order \<G>)"
proof-
have 1: "int m - int m' = int (m - m')" using m_ge_m' by simp
have 2: "fst (bezw (nat (int m - int m')) (order \<G>)) * int (m - m') + snd (bezw (nat (int m - int m')) (order \<G>)) * int (order \<G>) = 1"
using bezw_aux assms int_minus by presburger
hence 3: "(fst (bezw (nat (int m - int m')) (order \<G>)) * int (m - m') + snd (bezw (nat (int m - int m')) (order \<G>)) * int (order \<G>)) mod (order \<G>) = 1 mod (order \<G>)"
by (simp add: zmod_int)
hence 4: "(fst (bezw (nat (int m - int m')) (order \<G>)) * int (m - m')) mod (order \<G>) = 1 mod (order \<G>)"
by simp
hence 5: "[(fst (bezw (nat (int m - int m')) (order \<G>))) *(int m - int m') = 1] (mod order \<G>)"
using 1 2 3 cong_int_def by auto
then show ?thesis by(simp add: mult.commute)
qed
lemma mod_one_cancel: assumes "[int y * z * x = y' * x] (mod order \<G>)" and "[z * x = 1] (mod order \<G>)"
shows "[int y = y' * x] (mod order \<G>)"
using assms by (metis ab_semigroup_mult_class.mult_ac(1) cong_refl_int cong_scalar2_int cong_sym_int cong_trans_int mult.left_neutral semiring_normalization_rules(7))
lemma dis_log_break:
fixes d d' m m' :: nat
assumes c: "c = \<^bold>g (^) d \<otimes> (\<^bold>g (^) y) (^) m"
and c': "c = \<^bold>g (^) d' \<otimes> (\<^bold>g (^) y) (^) m'"
and y_less_order: "y < order \<G>"
and gcd: "gcd (m - m') (order \<G>) = 1"
and m_ge_m': "m > m'"
and mm': "\<not> [m = m'] (mod order \<G>)"
shows "y = nat ((int d' - int d) * (fst (bezw (m - m') (order \<G>))) mod order \<G>)"
proof -
have "\<^bold>g (^) (d + y * m) = \<^bold>g (^) (d' + y * m')" using c c' by (simp add: nat_pow_mult nat_pow_pow)
hence "[d + y * m = d' + y * m'] (mod order \<G>)" by(simp add: pow_generator_eq_iff_cong finite_group)
hence "[int d + int y * int m = int d' + int y * int m'] (mod order \<G>)"
by(simp add: transfer_int_nat_cong[symmetric])
from cong_diff_int[OF this cong_refl_int, of "int d + int y * int m'"]
have "[int y * int (m - m') = int d' - int d] (mod order \<G>)" using m_ge_m'
by(simp add: int_distrib of_nat_diff)
hence "[int y * int (m - m') * (fst (bezw (m - m') (order \<G>))) = (int d' - int d) * (fst (bezw (m - m') (order \<G>)))] (mod order \<G>)"
by (simp add: cong_scalar_int)
also have "int y * int (m - m') * (fst (bezw (m - m') (order \<G>))) = int y * (int (m - m') * (fst (bezw (m - m') (order \<G>))))"
by simp
also have "\<dots> = int y * (1 - snd (bezw (m - m') (order \<G>)) * order \<G>)"
using bezw_aux[of "m - m'" "order \<G>"] gcd by(simp add: mult_ac)
also have "[\<dots> = int y] (mod order \<G>)"
by(simp add: right_diff_distrib cong_iff_lin_int)
finally (cong_trans_int[OF cong_sym_eq_int[THEN iffD2]])
have "[int y = (int d' - int d) * (fst (bezw (m - m') (order \<G>)))] (mod order \<G>)" by(simp add: cong_sym_eq_int)
hence "int y mod order \<G> = (int d' - int d) * (fst (bezw (m - m') (order \<G>))) mod order \<G>"
using cong_int_def by blast
hence "y mod order \<G> = (int d' - int d) * (fst (bezw (m - m') (order \<G>))) mod order \<G>"
by (simp add: zmod_int)
then show ?thesis using y_less_order by simp
qed
lemma set_spmf_samp_uni [simp]: "set_spmf (sample_uniform (order \<G>)) = {x. x < order \<G>}"
by(auto simp add: sample_uniform_def)
lemma correct:
shows "spmf (abstract_commitment.correct_game m) True = 1"
using finite_group order_gt_0_iff_finite
apply(simp add: abstract_commitment.correct_game_def Let_def commit_def verify_def)
by(simp add: key_gen_def Let_def bind_spmf_const cong: bind_spmf_cong_simp)
theorem abstract_correct:
shows "abstract_commitment.correct m"
unfolding abstract_commitment.correct_def using correct by simp
lemma perfect_hiding:
shows "spmf (abstract_commitment.hiding_game \<A>) True = 1/2"
including monad_normalisation
proof -
obtain \<A>1 \<A>2 where [simp]: "\<A> = (\<A>1, \<A>2)" by(cases \<A>)
note [simp] = finite_group order_gt_0_iff_finite
have "abstract_commitment.hiding_game (\<A>1, \<A>2) = TRY do {
(ck,vk) \<leftarrow> key_gen;
((m0, m1), \<sigma>) \<leftarrow> \<A>1 vk;
_ :: unit \<leftarrow> assert_spmf (valid_msg m0 \<and> valid_msg m1);
b \<leftarrow> coin_spmf;
(c,d) \<leftarrow> commit ck (if b then m0 else m1);
b' \<leftarrow> \<A>2 c \<sigma>;
return_spmf (b' = b)} ELSE coin_spmf"
by(simp add: abstract_commitment.hiding_game_def)
also have "... = TRY do {
x :: nat \<leftarrow> sample_uniform (order \<G>);
let h = \<^bold>g (^) x;
((m0, m1), \<sigma>) \<leftarrow> \<A>1 h;
_ :: unit \<leftarrow> assert_spmf (valid_msg m0 \<and> valid_msg m1);
b \<leftarrow> coin_spmf;
d :: nat \<leftarrow> sample_uniform (order \<G>);
let c = ((\<^bold>g (^) d) \<otimes> (h (^) (if b then m0 else m1)));
b' \<leftarrow> \<A>2 c \<sigma>;
return_spmf (b' = b)} ELSE coin_spmf"
by(simp add: commit_def key_gen_def Let_def)
also have "... = TRY do {
x :: nat \<leftarrow> sample_uniform (order \<G>);
let h = (\<^bold>g (^) x);
((m0, m1), \<sigma>) \<leftarrow> \<A>1 h;
_ :: unit \<leftarrow> assert_spmf (valid_msg m0 \<and> valid_msg m1);
b \<leftarrow> coin_spmf;
z \<leftarrow> map_spmf (\<lambda>z. \<^bold>g (^) z \<otimes> (h (^) (if b then m0 else m1))) (sample_uniform (order \<G>));
guess :: bool \<leftarrow> \<A>2 z \<sigma>;
return_spmf(guess = b)} ELSE coin_spmf"
by(simp add: bind_map_spmf o_def)
also have "... = TRY do {
x :: nat \<leftarrow> sample_uniform (order \<G>);
let h = (\<^bold>g (^) x);
((m0, m1), \<sigma>) \<leftarrow> \<A>1 h;
_ :: unit \<leftarrow> assert_spmf (valid_msg m0 \<and> valid_msg m1);
b \<leftarrow> coin_spmf;
z \<leftarrow> map_spmf (\<lambda>z. \<^bold>g (^) z) (sample_uniform (order \<G>));
guess :: bool \<leftarrow> \<A>2 z \<sigma>;
return_spmf(guess = b)} ELSE coin_spmf"
by(clarsimp simp add: Let_def sample_uniform_one_time_pad)
also have "... = TRY do {
x :: nat \<leftarrow> sample_uniform (order \<G>);
let h = (\<^bold>g (^) x);
((m0, m1), \<sigma>) \<leftarrow> \<A>1 h;
_ :: unit \<leftarrow> assert_spmf (valid_msg m0 \<and> valid_msg m1);
z \<leftarrow> map_spmf (\<lambda>z. \<^bold>g (^) z) (sample_uniform (order \<G>));
guess :: bool \<leftarrow> \<A>2 z \<sigma>;
map_spmf(op = guess) coin_spmf} ELSE coin_spmf"
by(simp add: map_spmf_conv_bind_spmf)
also have "... = coin_spmf"
by(auto simp add: map_eq_const_coin_spmf try_bind_spmf_lossless2' map_eq_const_coin_spmf Let_def split_def bind_spmf_const try_bind_spmf_lossless2' scale_bind_spmf weight_spmf_le_1 scale_scale_spmf)
ultimately show ?thesis by(simp add: spmf_of_set)
qed
theorem abstract_perfect_hiding:
shows "abstract_commitment.perfect_hiding \<A>"
using perfect_hiding abstract_commitment.perfect_hiding_def by blast
lemma bind_game_eq_dis_log:
shows "abstract_commitment.bind_game \<A> = discrete_log.dis_log (dis_log_\<A> \<A>)"
proof-
have "abstract_commitment.bind_game \<A> = TRY do {
(ck,vk) \<leftarrow> key_gen;
(c, m, d, m', d') \<leftarrow> \<A> ck;
_ :: unit \<leftarrow> assert_spmf(m > m' \<and> \<not> [m = m'] (mod order \<G>) \<and> (gcd (m - m') (order \<G>) = 1));
b \<leftarrow> verify vk m c d;
b' \<leftarrow> verify vk m' c d';
_ :: unit \<leftarrow> assert_spmf (b \<and> b');
return_spmf True} ELSE return_spmf False"
by(simp add: abstract_commitment.bind_game_def \<A>_cond_def)
also have "... = TRY do {
x :: nat \<leftarrow> sample_uniform (Coset.order \<G>);
(c, m, d, m', d') \<leftarrow> \<A> (\<^bold>g (^) x);
_ :: unit \<leftarrow> assert_spmf (m > m' \<and> \<not> [m = m'] (mod order \<G>) \<and> (gcd (m - m') (order \<G>) = 1));
_ :: unit \<leftarrow> assert_spmf (c = \<^bold>g (^) d \<otimes> (\<^bold>g (^) x) (^) m \<and> c = \<^bold>g (^) d' \<otimes> (\<^bold>g (^) x) (^) m');
return_spmf True} ELSE return_spmf False"
by(simp add: verify_def key_gen_def Let_def)
also have "... = TRY do {
x :: nat \<leftarrow> sample_uniform (order \<G>);
(c, m, d, m', d') \<leftarrow> \<A> (\<^bold>g (^) x);
_ :: unit \<leftarrow> assert_spmf (m > m' \<and> \<not> [m = m'] (mod order \<G>) \<and> (gcd (m - m') (order \<G>) = 1));
_ :: unit \<leftarrow> assert_spmf (c = \<^bold>g (^) d \<otimes> (\<^bold>g (^) x) (^) m \<and> c = \<^bold>g (^) d' \<otimes> (\<^bold>g (^) x) (^) m');
return_spmf (x = nat ((int d' - int d) * (fst (bezw (m - m') (order \<G>))) mod order \<G>))} ELSE return_spmf False"
apply(intro try_spmf_cong)
apply(intro bind_spmf_cong[OF refl]; clarsimp?)+
apply(rule dis_log_break)
by auto
ultimately show ?thesis by(simp add: discrete_log.dis_log_def dis_log_\<A>_def Let_def split_def cong: bind_spmf_cong_simp)
qed
theorem pedersen_bind: "abstract_commitment.bind_advantage \<A> = discrete_log.advantage (dis_log_\<A> \<A>)"
using bind_game_eq_dis_log unfolding abstract_commitment.bind_advantage_def discrete_log.advantage_def
by simp
end
locale pedersen_asymp =
fixes \<G> :: "nat \<Rightarrow> 'grp cyclic_group"
assumes pedersen: "\<And>\<eta>. pedersen (\<G> \<eta>)"
begin
sublocale pedersen "\<G> \<eta>" for \<eta> by(simp add: pedersen)
theorem pedersen_correct:
shows "abstract_commitment.correct n m"
using abstract_correct by simp
theorem pedersen_perfect_hiding:
assumes lossless_\<A>: "abstract_commitment.lossless (\<A> n)"
shows "abstract_commitment.perfect_hiding n (\<A> n)"
by (simp add: lossless_\<A> abstract_perfect_hiding)
theorem pedersen_binding:
shows "abstract_commitment.bind_advantage n (\<A> n) = discrete_log.advantage n (dis_log_\<A> n (\<A> n))"
using pedersen_bind by(simp)
theorem "negligible (\<lambda> n. abstract_commitment.bind_advantage n (\<A> n)) \<longleftrightarrow> negligible (\<lambda> n. discrete_log.advantage n (dis_log_\<A> n (\<A> n)))"
by(simp add: pedersen_binding)
end
end
|
The other two tribes followed with similar arrangements. The legend of the Native American skin walker an evil witch or wizard that can transform into an animal at will has its basis in fact.
copy of an academic record that cannot be replaced. With such a finite amount of time to make a lasting impression on these important decision makers, it's crucial that you make the most of this opportunity. We aim to be a budget-friendly platform where each student extra curriculum essay can get the necessary assistance and buy essay from a vetted specialist. Were a custom essay writing service that connects vetted academic writers with students for high-quality writing and editing assistance. Fast turnaround, i have no time to write my paper is what our customers complain about the most. Take a peek at our thread of customer reviews!
This is the place to be! Need help with scientific research? Scholarship organizations receive far more applicants than they can support. A subject matter expert, we set the bar of quality high, and heres how we. GradeMiners in Figures qualified writers Across 50 Academic Disciplines quick turnaround 3-Hour Deadlines Available 24/7 support Toll-Free Hotline Live Chat 3,500 experts IN THE database 96 average satisfaction rate 150 orders completeay 9/10 customer return rate Real-Time Customer Reviews See why 11K students have chosen. Include all the information and forms requested, and answer every question. Grademiners connects students with high-class, screened academics. This works particularly well when you have a series of assignments and want all your copies to be written in one style. Are you among students who put off research and writing until the last day? Youll work with us via your password-protected customer area where your order history is kept safe.
I truly believe that the Barracuda band is all about two main things unity and pride. It has that power to set you free when you need to be, and you have all that..
Penn State and Schreyer Honors College application is made available on, august. Admissions Criteria Schreyer Honors College (SHC) at Penn State Honors College is about more than academic excellence, Criteria: Responses to three essay.. |
(*
Copyright (C) 2021 Susi Lehtola
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)
(* type: gga_exc *)
(* prefix:
gga_x_ityh_optx_params *params;
assert(p->params != NULL);
params = (gga_x_ityh_optx_params * )(p->params);
*)
$include "gga_x_optx.mpl"
$include "gga_x_ityh.mpl"
ityh_enhancement := xs -> optx_f(xs):
|
function kernWriteToFID(kern, FID)
% KERNWRITETOFID Load from an FID written by the C++ implementation.
% FORMAT
% DESC loads in from a file stream the data format produced by
% C++ implementations.
% ARG kern : the kernel structure to write to the stream.
% ARG FID : the file ID from where the data is loaded.
%
% COPYRIGHT : Neil D. Lawrence, 2005, 2006, 2008
%
% SEEALSO : modelReadFromFID, kernCreate, kernReadParamsFromFID
% KERN
writeVersionToFID(FID, 0.2);
writeStringToFID(FID, 'baseType', 'kern');
writeStringToFID(FID, 'type', kern.type);
kernWriteParamsToFID(kern, FID);
|
# below imports enables python 2 and 3 compatible codes
# requires python-future, install by `pip install future`
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
import numpy as np
from scipy import interpolate
from scipy import signal
# from . import decors
def filter(data, axis=-1, win=[]):
pass
def resample(x, y, xq, method='cubic'):
interp = interpolate.interp1d(x, y, kind=method, bounds_error=False, fill_value=0)
yq = interp(xq)
return yq
def calibrate_sampling(v, cali_coeff, method='cubic'):
"""
calibrate the vector to linear wavenumber domain before image reconstruction
Args:
v: vector as 1D numpy array
cali_coeff: polynominal coefficents that maps linear pixel index to its actual wavenumber,
the linear pixel index and actual wavenumber are both normalized to [0, 1]
method: the interpolation kind, can be 'linear' or 'cubic', default to 'cubic'
Returns:
sp: spectrum as 1D numpy array after calibration
"""
linear_idx = np.linspace(0, 1, v.shape[-1]).astype(np.float32)
nonlinear_idx = np.polyval(cali_coeff, linear_idx)
nonlinear_idx[nonlinear_idx < 0] = 0
nonlinear_idx[nonlinear_idx > 1] = 1
v = sig_proc.resample(nonlinear_idx, v, linear_idx, method=method)
return v
def shift_phase(v, poly_coeff, slope=False):
"""
shift_phase adds a pixel dependent phase shift to the 1D signal
Example:
it can be used to
1. add/remove physical dispersion mismatch between sample and reference
2. numerical refocusing, etc.
Args:
v: vector as 1D numpy array that phase shift applies to
poly_coeff: polynominal coefficents for the polyfit of phase shift function
slope (bool): if False, the linear slope from begin to end will be removed to ensure begin == end
if True, keep the linear slope from begin to end.
Returns:
v: vector as 1D numpy array after phase shifted
"""
linear_x = np.linspace(0, 1, v.shape[-1]).astype(np.float32)
if slope:
poly_coeff = np.append(poly_coeff, [-poly_coeff.sum(), 0])
phase_shift = np.polyval(poly_coeff, linear_x)
v = v * np.exp(-1j * phase_shift)
return v
|
lemma LIM_zero_cancel: fixes f :: "'a \<Rightarrow> 'b::real_normed_vector" shows "((\<lambda>x. f x - l) \<longlongrightarrow> 0) F \<Longrightarrow> (f \<longlongrightarrow> l) F" |
## Fourier methods
The Fourier transform (FT) for a well-behaved functions $f$ is defined as:
$$f(k) = \int e^{-ikx} f(x) ~dx$$
The inverse FT is then
$$f(x) = \frac{1}{2\pi} \int e^{ikx} f(k) ~dk$$
## Discrete Fourier transforms (DFTs)
If the function is periodic in real space, $f(x+L) = f(x)$, then the Fourier space is discrete with spacing $\frac{2\pi}{L}$. Moreover, if the real space is periodic as well as discrete with the spacing $h$, then the Fourier space is discrete as well as bounded.
$$f(x) = \sum e^{ikx} f(k) ~dk~~~~~~ \text{where } k = \Bigg[ -\frac{\pi}{h}, \frac{\pi}{h}\Bigg];~~ \text{with interval} \frac{2\pi}{L} $$
This is very much in line with crystallography with $ [ -\frac{\pi}{h}, \frac{\pi}{h} ]$ being the first Brillouin zone. So we see that there is a concept of the maximum wavenumber $ k_{max}=\frac{\pi}{h} $, we will get back to this later in the notes. Usually in computations we need to find FT of discrete function rather than of a well defined analytic function. Since the real space is discrete and periodic, the Fourier space is also discrete and periodic or bounded. Also, the Fourier space is continuous if the real space is unbounded. If the function is defined at $N$ points in real space and one wants to calculate the function at $N$ points in Fourier space, then **DFT** is defined as
$$f_k = \sum_{n=0}^{N-1} f_n ~ e^{-i\frac{2\pi~n~k}{N}}$$
while the inverse transform of this is
$$f_n = \frac1N \sum_{n=0}^{N-1} f_k ~ e^{~i\frac{2\pi~n~k}{N}}$$
To calculate each $f_n$ one needs $N$ computations and it has to be done $N$ times, i.e, the algorithm is simply $\mathcal{O}(N^2)$. This can be implemented numerically as a matrix multiplication, $f_k = M\cdot f_n$, where $M$ is a $N\times N$ matrix.
## Fast fourier tranforms (FFTs)
The discussion here is based on the Cooley-Tukey algorithm. FFTs improves on DFTs by exploiting their symmetries.
$$ \begin{align}
f_k &= \sum_{n=0}^{N-1} f_n e^{-i~\frac{2\pi~k~n}{N}} \\
&= \sum_{n=0}^{N/2-1} f_{2n} e^{-i~\frac{2\pi~k~2n}{N}} &+ \sum_{n=0}^{N/2-1} f_{2n + 1} e^{-i~\frac{2\pi~k~(n+1)}{N}}\\
&= \sum_{n=0}^{N/2 - 1} f_{2n} e^{-i~\frac{2\pi k~n}{N/2}} &+ e^{-i\frac{2\pi k}{N}} \sum_{n=0}^{N/2 - 1} f_{2n + 1} e^{-i~\frac{2\pi~k~n~}{N/2}}\\
&=\vdots &\vdots
\end{align}$$
We can use the symmetry property, from the definition, $f_{N+k} = f_k$. Notice that, because of the tree structure, there are $\ln_2 N$ stages of the calculation. By applying the method of splitting the computation in two halves recursively, the complexity of the problem becomes $\mathcal{O}(N \ln N)$ while the naive algorithm is $\mathcal{O}(N^2)$. This is available in standard python packages like numpy and scipy.
We will now use PyGL to explore its usage to solve physics problems.
```python
import pygl
import numpy as np
import matplotlib.pyplot as plt
dim, Nx, Ny = 2, 128, 128
grid = {"dim":dim, "Nx":Nx, "Ny":Ny}
# now construct the spectral solver
ss = pygl.dms.FourierSpectral(grid)
```
#### We first demonstrate the translation of blob using momentum operator
```python
# The momentum operator, e^{-ikr}, generates translation!
f = plt.figure(figsize=(20, 5), dpi=80);
L, N = 128, 128
x, y = np.meshgrid(np.linspace(0, L, N), np.linspace(0, L, N))
rr = np.sqrt( ((x-L/2)*(x-L/2)+(y-L/2)*(y-L/2))*.5 )
sig = np.fft.fft2(np.exp(-0.1*rr))
def plotFirst(x, y, sig, n_):
sp = f.add_subplot(1, 3, n_ )
plt.pcolormesh(x, y, sig, cmap=plt.cm.Blues)
plt.axis('off');
xx = ([0, -L/4, -L/2,])
yy = ([0, -L/3, L/2])
for i in range(3):
kdotr = ss.kx*xx[i] + ss.ky*yy[i]
sig = sig*np.exp(-1j*kdotr)
plotFirst(x, y, np.real(np.fft.ifftn(sig)), i+1)
```
### Sampling: Aliasing error
We saw that because of the smallest length scale, $h$, in the real space there is a corresponding largest wave-vector, $k_{max}$ in the Fourier space. The error is because of this $k_{max}$ and a signal which has $k>k_{max}$ can not be distinguished on this grid. In the given example, below, we see that if the real space has 10 points that one can not distinguish between $sin(2\pi x/L)$ and $sin(34 \pi x/L)$. In general, $sin(k_1 x)$ and $sin(k_2 x)$ can not be distinguished if $k_1 -k_2$ is a multiple of $\frac{2\pi}{h}$. This is a manifestation of the gem called the sampling theorem which is defined, as on wikipedia:
If a function x(t) contains no frequencies higher than B hertz, it is completely determined by giving its ordinates at a series of points spaced 1/(2B) seconds apart.
```python
L, N = 1, 16
x = np.arange(0, L, L/512)
xx = np.arange(0, L, L/N)
def ff(k, x):
return np.sin(k*x)
f = plt.figure(figsize=(17, 6), dpi=80);
plt.plot(x, ff(x, 2*np.pi), color="#A60628", linewidth=2);
plt.plot(x, ff(x, 34*np.pi), color="#348ABD", linewidth=2);
plt.plot(xx, ff(xx, 2*np.pi), 'o', color="#020e3e", markersize=8)
plt.xlabel('x', fontsize=15); plt.ylabel('y(x)', fontsize=15);
plt.title('Aliasing in sampling of $sin(2\pi x/L)$ and $sin(34 \pi x/L)$', fontsize=24);
plt.axis('off');
```
To avoid this error, we truncate higher mode in PyGL using `ss.dealias'
### Differentiation
We now show the usage of PyGL to compute differentiation matrices. We first compute the second derivative of $\cos x$.
```python
import pygl
import numpy as np
import matplotlib.pyplot as plt
dim, Nx, Ny = 1, 32, 32
grid = {"dim":dim, "Nx":Nx, "Ny":Ny}
ss = pygl.dms.FourierSpectral(grid)
```
```python
def f1(kk, x):
return np.cos(kk*x)
f = plt.figure(figsize=(10, 5), dpi=80);
L, N = Nx, Nx; x=np.arange(0, N); fac=2*np.pi/L
k = ss.kx
fk = np.fft.fft(f1(fac, x))
f1_kk = -k*k*fk
f1_xx = np.real(np.fft.ifft(f1_kk))
plt.plot(x, -f1(fac, x)*fac*fac, color="#348ABD", label = 'analytical', linewidth=2)
plt.plot(x, f1_xx, 'o', color="#A60628", label = 'numerical', markersize=6)
plt.legend(loc = 'best'); plt.xlabel('x', fontsize=15);
```
|
Formal statement is: lemma unbounded_complement_components: assumes C: "C \<in> components (- S)" and S: "connected S" and prev: "if bounded S then connected(frontier S) else \<forall>C \<in> components(frontier S). \<not> bounded C" shows "\<not> bounded C" Informal statement is: If $S$ is a connected set and $C$ is a component of the complement of $S$, then $C$ is unbounded. |
In 2005 , Constantine was released , a feature film that did not use the same title as the comic book , in order to avoid confusion with the Hellraiser horror franchise . The only links to the character of John Constantine were the name and a plotline loosely based on the " Dangerous Habits " story arc ( Hellblazer # 41 – 46 ) . DC Comics announced a sequel to the 2005 Constantine movie was in the works , with producer Lorenzo di Bonaventura linked to the project . He stated : " I 'd love to do it ... We want to do a hard , R @-@ rated version of it . We 're going to scale back the size of the movie to try and persuade the studio to go ahead and make a tough version of it . " In late 2012 , director Guillermo del Toro publicly discussed the notion of creating a film that would star John Constantine alongside other DC / Vertigo characters such as Zatanna , Swamp Thing , and more .
|
[STATEMENT]
lemma take_is_prefix: "prefix (take n xs) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. prefix (take n xs) xs
[PROOF STEP]
unfolding prefix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>zs. xs = take n xs @ zs
[PROOF STEP]
by (metis append_take_drop_id) |
[STATEMENT]
lemma walk_in_V: "walk xs \<Longrightarrow> set xs \<subseteq> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. walk xs \<Longrightarrow> set xs \<subseteq> V
[PROOF STEP]
by (induct rule: walk.induct; simp add: edges_are_in_V) |
#' Run site validation shiny app
#' Runs site validation shiny app embedded in UT IR tools package.
#' @import shiny
#' @importFrom wqTools buildMap
#' @importFrom plyr rbind.fill
#' @importFrom sf st_as_sf
#' @importFrom sf st_drop_geometry
#' @importFrom DT renderDT
#' @importFrom DT datatable
#' @importFrom shinyWidgets pickerInput
#' @export
siteValApp=function(){
shiny::runApp(system.file('siteValApp', package='irTools'))
}
|
From Test Require Import tactic.
Section FOFProblem.
Variable Universe : Set.
Variable UniverseElement : Universe.
Variable wd_ : Universe -> Universe -> Prop.
Variable col_ : Universe -> Universe -> Universe -> Prop.
Variable col_swap1_1 : (forall A B C : Universe, (col_ A B C -> col_ B A C)).
Variable col_swap2_2 : (forall A B C : Universe, (col_ A B C -> col_ B C A)).
Variable col_triv_3 : (forall A B : Universe, col_ A B B).
Variable wd_swap_4 : (forall A B : Universe, (wd_ A B -> wd_ B A)).
Variable col_trans_5 : (forall P Q A B C : Universe, ((wd_ P Q /\ (col_ P Q A /\ (col_ P Q B /\ col_ P Q C))) -> col_ A B C)).
Theorem pipo_6 : (forall O E Eprime A B C D Bprimeprime : Universe, ((wd_ C O /\ (wd_ A O /\ (wd_ B O /\ (wd_ D O /\ (wd_ O E /\ (wd_ O Eprime /\ (wd_ E Eprime /\ (wd_ Eprime C /\ (wd_ B Bprimeprime /\ (col_ O E A /\ (col_ O E B /\ (col_ O E C /\ (col_ O E D /\ col_ O Eprime Bprimeprime))))))))))))) -> col_ O C B)).
Proof.
time tac.
Qed.
End FOFProblem.
|
using HydroRefStations
using Test
using Dates: Day
@testset "HRS.jl" begin
hrs = HRS()
@testset "HRS()" begin
nrows, ncols = size(hrs.sites)
@test nrows > 0 # At least one site.
@test ncols > 0 # At least one column.
@test length(hrs.header) > 0 # At least one header line
@test hrs.header[1][1] != '#'
@test hrs.header[1][1] != ','
@test hrs.header[end][1] != '#'
@test hrs.header[end][end] != '\"'
@test length(hrs.data_types) > 0 # At least one data type.
data_types = hrs.data_types["year"]
@test "annual data" in data_types
@test "11 year moving average" in data_types
@test "seasonal data" ∉ data_types
data_types = hrs.data_types["month"]
@test "monthly data" in data_types
@test "monthly boxplot" in data_types
@test "daily data" ∉ data_types
@test "seasonal data" ∉ data_types
end
@testset "get_data()" begin
awrc_ids = ["410730", "114001A"]
data_types = ["monthly data", "seasonal data"]
for awrc_id in awrc_ids
for data_type in data_types
data, header = get_data(hrs, awrc_id, data_type)
local nrows, ncols = size(data)
@test nrows > 0 # At least one data point.
@test ncols > 0 # At least one column.
@test length(header) > 0 # At least one header line
@test header[end][1] != '#'
@test header[end][end] != '\"'
if data_type == "monthly data"
# Ignore the first and last 12 months in a case of incomplete dataset.
@test maximum(diff(data[!,"Start Date"][13:end-12])) <= Day(31)
@test minimum(diff(data[!,"Start Date"][13:end-12])) >= Day(28)
end
if data_type == "seasonal data"
@test maximum(diff(data[!,"Start Date"][5:end-4])) <= Day(92)
@test minimum(diff(data[!,"Start Date"][5:end-4])) >= Day(89)
end
end
@test_throws ArgumentError get_data(hrs, "invalid ID", "daily data")
@test_throws ArgumentError get_data(hrs, awrc_id, "invalid data type")
end
data, header = get_data(hrs, awrc_ids[1], "SEASONAL DATA")
end
@testset "show()" begin
show_str = repr(hrs)
@test occursin("Hydrologic Reference Stations", show_str)
@test occursin("AWRC", show_str)
@test occursin("Catchment", show_str)
end
@testset "close()" begin
close!(hrs)
@test isempty(hrs.sites)
@test isempty(hrs.header)
@test isempty(hrs.data_types)
end
end |
[STATEMENT]
lemma mult_less_multiset\<^sub>D\<^sub>M: "(M, N) \<in> mult {(x, y). x < y} \<longleftrightarrow> less_multiset\<^sub>D\<^sub>M M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ((M, N) \<in> mult {(x, y). x < y}) = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
unfolding multp_def[of "(<)", symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
using multp_eq_multp\<^sub>D\<^sub>M[of "(<)", simplified]
[PROOF STATE]
proof (prove)
using this:
multp (<) = multp\<^sub>D\<^sub>M (<)
goal (1 subgoal):
1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
by (simp add: multp\<^sub>D\<^sub>M_def less_multiset\<^sub>D\<^sub>M_def) |
(* Title: HOL/Algebra/Subrings.thy
Authors: Martin Baillon and Paulo Emílio de Vilhena
*)
theory Subrings
imports Ring RingHom QuotRing Multiplicative_Group
begin
section \<open>Subrings\<close>
subsection \<open>Definitions\<close>
locale subring =
subgroup H "add_monoid R" + submonoid H R for H and R (structure)
locale subcring = subring +
assumes sub_m_comm: "\<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 = h2 \<otimes> h1"
locale subdomain = subcring +
assumes sub_one_not_zero [simp]: "\<one> \<noteq> \<zero>"
assumes subintegral: "\<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 = \<zero> \<Longrightarrow> h1 = \<zero> \<or> h2 = \<zero>"
locale subfield = subdomain K R for K and R (structure) +
assumes subfield_Units: "Units (R \<lparr> carrier := K \<rparr>) = K - { \<zero> }"
subsection \<open>Basic Properties\<close>
subsubsection \<open>Subrings\<close>
lemma (in ring) subringI:
assumes "H \<subseteq> carrier R"
and "\<one> \<in> H"
and "\<And>h. h \<in> H \<Longrightarrow> \<ominus> h \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<oplus> h2 \<in> H"
shows "subring H R"
using add.subgroupI[OF assms(1) _ assms(3, 5)] assms(2)
submonoid.intro[OF assms(1, 4, 2)]
unfolding subring_def by auto
lemma subringE:
assumes "subring H R"
shows "H \<subseteq> carrier R"
and "\<zero>\<^bsub>R\<^esub> \<in> H"
and "\<one>\<^bsub>R\<^esub> \<in> H"
and "H \<noteq> {}"
and "\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H"
using subring.axioms[OF assms]
unfolding submonoid_def subgroup_def a_inv_def by auto
lemma (in ring) carrier_is_subring: "subring (carrier R) R"
by (simp add: subringI)
lemma (in ring) subring_inter:
assumes "subring I R" and "subring J R"
shows "subring (I \<inter> J) R"
using subringE[OF assms(1)] subringE[OF assms(2)] subringI[of "I \<inter> J"] by auto
lemma (in ring) subring_Inter:
assumes "\<And>I. I \<in> S \<Longrightarrow> subring I R" and "S \<noteq> {}"
shows "subring (\<Inter>S) R"
proof (rule subringI, auto simp add: assms subringE[of _ R])
fix x assume "\<forall>I \<in> S. x \<in> I" thus "x \<in> carrier R"
using assms subringE(1)[of _ R] by blast
qed
lemma (in ring) subring_is_ring:
assumes "subring H R" shows "ring (R \<lparr> carrier := H \<rparr>)"
proof -
interpret group "add_monoid (R \<lparr> carrier := H \<rparr>)" + monoid "R \<lparr> carrier := H \<rparr>"
using subgroup.subgroup_is_group[OF subring.axioms(1) add.is_group] assms
submonoid.submonoid_is_monoid[OF subring.axioms(2) monoid_axioms] by auto
show ?thesis
using subringE(1)[OF assms]
by (unfold_locales, simp_all add: subringE(1)[OF assms] add.m_comm subset_eq l_distr r_distr)
qed
lemma (in ring) ring_incl_imp_subring:
assumes "H \<subseteq> carrier R"
and "ring (R \<lparr> carrier := H \<rparr>)"
shows "subring H R"
using group.group_incl_imp_subgroup[OF add.group_axioms, of H] assms(1)
monoid.monoid_incl_imp_submonoid[OF monoid_axioms assms(1)]
ring.axioms(1, 2)[OF assms(2)] abelian_group.a_group[of "R \<lparr> carrier := H \<rparr>"]
unfolding subring_def by auto
lemma (in ring) subring_iff:
assumes "H \<subseteq> carrier R"
shows "subring H R \<longleftrightarrow> ring (R \<lparr> carrier := H \<rparr>)"
using subring_is_ring ring_incl_imp_subring[OF assms] by auto
subsubsection \<open>Subcrings\<close>
lemma (in ring) subcringI:
assumes "subring H R"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 = h2 \<otimes> h1"
shows "subcring H R"
unfolding subcring_def subcring_axioms_def using assms by simp+
lemma (in cring) subcringI':
assumes "subring H R"
shows "subcring H R"
using subcringI[OF assms] subringE(1)[OF assms] m_comm by auto
lemma subcringE:
assumes "subcring H R"
shows "H \<subseteq> carrier R"
and "\<zero>\<^bsub>R\<^esub> \<in> H"
and "\<one>\<^bsub>R\<^esub> \<in> H"
and "H \<noteq> {}"
and "\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 = h2 \<otimes>\<^bsub>R\<^esub> h1"
using subringE[OF subcring.axioms(1)[OF assms]] subcring.sub_m_comm[OF assms] by simp+
lemma (in cring) carrier_is_subcring: "subcring (carrier R) R"
by (simp add: subcringI' carrier_is_subring)
lemma (in ring) subcring_inter:
assumes "subcring I R" and "subcring J R"
shows "subcring (I \<inter> J) R"
using subcringE[OF assms(1)] subcringE[OF assms(2)]
subcringI[of "I \<inter> J"] subringI[of "I \<inter> J"] by auto
lemma (in ring) subcring_Inter:
assumes "\<And>I. I \<in> S \<Longrightarrow> subcring I R" and "S \<noteq> {}"
shows "subcring (\<Inter>S) R"
proof (rule subcringI)
show "subring (\<Inter>S) R"
using subcring.axioms(1)[of _ R] subring_Inter[of S] assms by auto
next
fix h1 h2 assume h1: "h1 \<in> \<Inter>S" and h2: "h2 \<in> \<Inter>S"
obtain S' where S': "S' \<in> S"
using assms(2) by blast
hence "h1 \<in> S'" "h2 \<in> S'"
using h1 h2 by blast+
thus "h1 \<otimes> h2 = h2 \<otimes> h1"
using subcring.sub_m_comm[OF assms(1)[OF S']] by simp
qed
lemma (in ring) subcring_iff:
assumes "H \<subseteq> carrier R"
shows "subcring H R \<longleftrightarrow> cring (R \<lparr> carrier := H \<rparr>)"
proof
assume A: "subcring H R"
hence ring: "ring (R \<lparr> carrier := H \<rparr>)"
using subring_iff[OF assms] subcring.axioms(1)[OF A] by simp
moreover have "comm_monoid (R \<lparr> carrier := H \<rparr>)"
using monoid.monoid_comm_monoidI[OF ring.is_monoid[OF ring]]
subcring.sub_m_comm[OF A] by auto
ultimately show "cring (R \<lparr> carrier := H \<rparr>)"
using cring_def by blast
next
assume A: "cring (R \<lparr> carrier := H \<rparr>)"
hence "subring H R"
using cring.axioms(1) subring_iff[OF assms] by simp
moreover have "comm_monoid (R \<lparr> carrier := H \<rparr>)"
using A unfolding cring_def by simp
hence"\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 = h2 \<otimes> h1"
using comm_monoid.m_comm[of "R \<lparr> carrier := H \<rparr>"] by auto
ultimately show "subcring H R"
unfolding subcring_def subcring_axioms_def by auto
qed
subsubsection \<open>Subdomains\<close>
lemma (in ring) subdomainI:
assumes "subcring H R"
and "\<one> \<noteq> \<zero>"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 = \<zero> \<Longrightarrow> h1 = \<zero> \<or> h2 = \<zero>"
shows "subdomain H R"
unfolding subdomain_def subdomain_axioms_def using assms by simp+
lemma (in domain) subdomainI':
assumes "subring H R"
shows "subdomain H R"
proof (rule subdomainI[OF subcringI[OF assms]], simp_all)
show "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes> h2 = h2 \<otimes> h1"
using m_comm subringE(1)[OF assms] by auto
show "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H; h1 \<otimes> h2 = \<zero> \<rbrakk> \<Longrightarrow> (h1 = \<zero>) \<or> (h2 = \<zero>)"
using integral subringE(1)[OF assms] by auto
qed
lemma subdomainE:
assumes "subdomain H R"
shows "H \<subseteq> carrier R"
and "\<zero>\<^bsub>R\<^esub> \<in> H"
and "\<one>\<^bsub>R\<^esub> \<in> H"
and "H \<noteq> {}"
and "\<And>h. h \<in> H \<Longrightarrow> \<ominus>\<^bsub>R\<^esub> h \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<oplus>\<^bsub>R\<^esub> h2 \<in> H"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 = h2 \<otimes>\<^bsub>R\<^esub> h1"
and "\<And>h1 h2. \<lbrakk> h1 \<in> H; h2 \<in> H \<rbrakk> \<Longrightarrow> h1 \<otimes>\<^bsub>R\<^esub> h2 = \<zero>\<^bsub>R\<^esub> \<Longrightarrow> h1 = \<zero>\<^bsub>R\<^esub> \<or> h2 = \<zero>\<^bsub>R\<^esub>"
and "\<one>\<^bsub>R\<^esub> \<noteq> \<zero>\<^bsub>R\<^esub>"
using subcringE[OF subdomain.axioms(1)[OF assms]] assms
unfolding subdomain_def subdomain_axioms_def by auto
lemma (in ring) subdomain_iff:
assumes "H \<subseteq> carrier R"
shows "subdomain H R \<longleftrightarrow> domain (R \<lparr> carrier := H \<rparr>)"
proof
assume A: "subdomain H R"
hence cring: "cring (R \<lparr> carrier := H \<rparr>)"
using subcring_iff[OF assms] subdomain.axioms(1)[OF A] by simp
thus "domain (R \<lparr> carrier := H \<rparr>)"
using domain.intro[OF cring] subdomain.subintegral[OF A] subdomain.sub_one_not_zero[OF A]
unfolding domain_axioms_def by auto
next
assume A: "domain (R \<lparr> carrier := H \<rparr>)"
hence subcring: "subcring H R"
using subcring_iff[OF assms] unfolding domain_def by simp
thus "subdomain H R"
using subdomain.intro[OF subcring] domain.integral[OF A] domain.one_not_zero[OF A]
unfolding subdomain_axioms_def by auto
qed
lemma (in domain) subring_is_domain:
assumes "subring H R" shows "domain (R \<lparr> carrier := H \<rparr>)"
using subdomainI'[OF assms] unfolding subdomain_iff[OF subringE(1)[OF assms]] .
(* NEW ====================== *)
lemma (in ring) subdomain_is_domain:
assumes "subdomain H R" shows "domain (R \<lparr> carrier := H \<rparr>)"
using assms unfolding subdomain_iff[OF subdomainE(1)[OF assms]] .
subsubsection \<open>Subfields\<close>
lemma (in ring) subfieldI:
assumes "subcring K R" and "Units (R \<lparr> carrier := K \<rparr>) = K - { \<zero> }"
shows "subfield K R"
proof (rule subfield.intro)
show "subfield_axioms K R"
using assms(2) unfolding subfield_axioms_def .
show "subdomain K R"
proof (rule subdomainI[OF assms(1)], auto)
have subM: "submonoid K R"
using subring.axioms(2)[OF subcring.axioms(1)[OF assms(1)]] .
show contr: "\<one> = \<zero> \<Longrightarrow> False"
proof -
assume one_eq_zero: "\<one> = \<zero>"
have "\<one> \<in> K" and "\<one> \<otimes> \<one> = \<one>"
using submonoid.one_closed[OF subM] by simp+
hence "\<one> \<in> Units (R \<lparr> carrier := K \<rparr>)"
unfolding Units_def by (simp, blast)
hence "\<one> \<noteq> \<zero>"
using assms(2) by simp
thus False
using one_eq_zero by simp
qed
fix k1 k2 assume k1: "k1 \<in> K" and k2: "k2 \<in> K" "k2 \<noteq> \<zero>" and k12: "k1 \<otimes> k2 = \<zero>"
obtain k2' where k2': "k2' \<in> K" "k2' \<otimes> k2 = \<one>" "k2 \<otimes> k2' = \<one>"
using assms(2) k2 unfolding Units_def by auto
have "\<zero> = (k1 \<otimes> k2) \<otimes> k2'"
using k12 k2'(1) submonoid.mem_carrier[OF subM] by fastforce
also have "... = k1"
using k1 k2(1) k2'(1,3) submonoid.mem_carrier[OF subM] by (simp add: m_assoc)
finally have "\<zero> = k1" .
thus "k1 = \<zero>" by simp
qed
qed
lemma (in field) subfieldI':
assumes "subring K R" and "\<And>k. k \<in> K - { \<zero> } \<Longrightarrow> inv k \<in> K"
shows "subfield K R"
proof (rule subfieldI)
show "subcring K R"
using subcringI[OF assms(1)] m_comm subringE(1)[OF assms(1)] by auto
show "Units (R \<lparr> carrier := K \<rparr>) = K - { \<zero> }"
proof
show "K - { \<zero> } \<subseteq> Units (R \<lparr> carrier := K \<rparr>)"
proof
fix k assume k: "k \<in> K - { \<zero> }"
hence inv_k: "inv k \<in> K"
using assms(2) by simp
moreover have "k \<in> carrier R - { \<zero> }"
using subringE(1)[OF assms(1)] k by auto
ultimately have "k \<otimes> inv k = \<one>" "inv k \<otimes> k = \<one>"
by (simp add: field_Units)+
thus "k \<in> Units (R \<lparr> carrier := K \<rparr>)"
unfolding Units_def using k inv_k by auto
qed
next
show "Units (R \<lparr> carrier := K \<rparr>) \<subseteq> K - { \<zero> }"
proof
fix k assume k: "k \<in> Units (R \<lparr> carrier := K \<rparr>)"
then obtain k' where k': "k' \<in> K" "k \<otimes> k' = \<one>"
unfolding Units_def by auto
hence "k \<in> carrier R" and "k' \<in> carrier R"
using k subringE(1)[OF assms(1)] unfolding Units_def by auto
hence "\<zero> = \<one>" if "k = \<zero>"
using that k'(2) by auto
thus "k \<in> K - { \<zero> }"
using k unfolding Units_def by auto
qed
qed
qed
lemma (in field) carrier_is_subfield: "subfield (carrier R) R"
by (auto intro: subfieldI[OF carrier_is_subcring] simp add: field_Units)
lemma subfieldE:
assumes "subfield K R"
shows "subring K R" and "subcring K R"
and "K \<subseteq> carrier R"
and "\<And>k1 k2. \<lbrakk> k1 \<in> K; k2 \<in> K \<rbrakk> \<Longrightarrow> k1 \<otimes>\<^bsub>R\<^esub> k2 = k2 \<otimes>\<^bsub>R\<^esub> k1"
and "\<And>k1 k2. \<lbrakk> k1 \<in> K; k2 \<in> K \<rbrakk> \<Longrightarrow> k1 \<otimes>\<^bsub>R\<^esub> k2 = \<zero>\<^bsub>R\<^esub> \<Longrightarrow> k1 = \<zero>\<^bsub>R\<^esub> \<or> k2 = \<zero>\<^bsub>R\<^esub>"
and "\<one>\<^bsub>R\<^esub> \<noteq> \<zero>\<^bsub>R\<^esub>"
using subdomain.axioms(1)[OF subfield.axioms(1)[OF assms]] subcring_def
subdomainE(1, 8, 9, 10)[OF subfield.axioms(1)[OF assms]] by auto
lemma (in ring) subfield_m_inv:
assumes "subfield K R" and "k \<in> K - { \<zero> }"
shows "inv k \<in> K - { \<zero> }" and "k \<otimes> inv k = \<one>" and "inv k \<otimes> k = \<one>"
proof -
have K: "subring K R" "submonoid K R"
using subfieldE(1)[OF assms(1)] subring.axioms(2) by auto
have monoid: "monoid (R \<lparr> carrier := K \<rparr>)"
using submonoid.submonoid_is_monoid[OF subring.axioms(2)[OF K(1)] is_monoid] .
have "monoid R"
by (simp add: monoid_axioms)
hence k: "k \<in> Units (R \<lparr> carrier := K \<rparr>)"
using subfield.subfield_Units[OF assms(1)] assms(2) by blast
hence unit_of_R: "k \<in> Units R"
using assms(2) subringE(1)[OF subfieldE(1)[OF assms(1)]] unfolding Units_def by auto
have "inv\<^bsub>(R \<lparr> carrier := K \<rparr>)\<^esub> k \<in> Units (R \<lparr> carrier := K \<rparr>)"
by (simp add: k monoid monoid.Units_inv_Units)
hence "inv\<^bsub>(R \<lparr> carrier := K \<rparr>)\<^esub> k \<in> K - { \<zero> }"
using subfield.subfield_Units[OF assms(1)] by blast
thus "inv k \<in> K - { \<zero> }" and "k \<otimes> inv k = \<one>" and "inv k \<otimes> k = \<one>"
using Units_l_inv[OF unit_of_R] Units_r_inv[OF unit_of_R]
using monoid.m_inv_monoid_consistent[OF monoid_axioms k K(2)] by auto
qed
lemma (in ring) subfield_m_inv_simprule:
assumes "subfield K R"
shows "\<lbrakk> k \<in> K - { \<zero> }; a \<in> carrier R \<rbrakk> \<Longrightarrow> k \<otimes> a \<in> K \<Longrightarrow> a \<in> K"
proof -
note subring_props = subringE[OF subfieldE(1)[OF assms]]
assume A: "k \<in> K - { \<zero> }" "a \<in> carrier R" "k \<otimes> a \<in> K"
then obtain k' where k': "k' \<in> K" "k \<otimes> a = k'" by blast
have inv_k: "inv k \<in> K" "inv k \<otimes> k = \<one>"
using subfield_m_inv[OF assms A(1)] by auto
hence "inv k \<otimes> (k \<otimes> a) \<in> K"
using k' A(3) subring_props(6) by auto
thus "a \<in> K"
using m_assoc[of "inv k" k a] A(2) inv_k subring_props(1)
by (metis (no_types, opaque_lifting) A(1) Diff_iff l_one subsetCE)
qed
lemma (in ring) subfield_iff:
shows "\<lbrakk> field (R \<lparr> carrier := K \<rparr>); K \<subseteq> carrier R \<rbrakk> \<Longrightarrow> subfield K R"
and "subfield K R \<Longrightarrow> field (R \<lparr> carrier := K \<rparr>)"
proof-
assume A: "field (R \<lparr> carrier := K \<rparr>)" "K \<subseteq> carrier R"
have "\<And>k1 k2. \<lbrakk> k1 \<in> K; k2 \<in> K \<rbrakk> \<Longrightarrow> k1 \<otimes> k2 = k2 \<otimes> k1"
using comm_monoid.m_comm[OF cring.axioms(2)[OF fieldE(1)[OF A(1)]]] by simp
moreover have "subring K R"
using ring_incl_imp_subring[OF A(2) cring.axioms(1)[OF fieldE(1)[OF A(1)]]] .
ultimately have "subcring K R"
using subcringI by simp
thus "subfield K R"
using field.field_Units[OF A(1)] subfieldI by auto
next
assume A: "subfield K R"
have cring: "cring (R \<lparr> carrier := K \<rparr>)"
using subcring_iff[OF subringE(1)[OF subfieldE(1)[OF A]]] subfieldE(2)[OF A] by simp
thus "field (R \<lparr> carrier := K \<rparr>)"
using cring.cring_fieldI[OF cring] subfield.subfield_Units[OF A] by simp
qed
lemma (in field) subgroup_mult_of :
assumes "subfield K R"
shows "subgroup (K - {\<zero>}) (mult_of R)"
proof (intro group.group_incl_imp_subgroup[OF field_mult_group])
show "K - {\<zero>} \<subseteq> carrier (mult_of R)"
by (simp add: Diff_mono assms carrier_mult_of subfieldE(3))
show "group ((mult_of R) \<lparr> carrier := K - {\<zero>} \<rparr>)"
using field.field_mult_group[OF subfield_iff(2)[OF assms]]
unfolding mult_of_def by simp
qed
subsection \<open>Subring Homomorphisms\<close>
lemma (in ring) hom_imp_img_subring:
assumes "h \<in> ring_hom R S" and "subring K R"
shows "ring (S \<lparr> carrier := h ` K, one := h \<one>, zero := h \<zero> \<rparr>)"
proof -
have [simp]: "h \<one> = \<one>\<^bsub>S\<^esub>"
using assms ring_hom_one by blast
have "ring (R \<lparr> carrier := K \<rparr>)"
by (simp add: assms(2) subring_is_ring)
moreover have "h \<in> ring_hom (R \<lparr> carrier := K \<rparr>) S"
using assms subringE(1)[OF assms (2)] unfolding ring_hom_def
apply simp
apply blast
done
ultimately show ?thesis
using ring.ring_hom_imp_img_ring[of "R \<lparr> carrier := K \<rparr>" h S] by simp
qed
lemma (in ring_hom_ring) img_is_subring:
assumes "subring K R" shows "subring (h ` K) S"
proof -
have "ring (S \<lparr> carrier := h ` K \<rparr>)"
using R.hom_imp_img_subring[OF homh assms] hom_zero hom_one by simp
moreover have "h ` K \<subseteq> carrier S"
using ring_hom_memE(1)[OF homh] subringE(1)[OF assms] by auto
ultimately show ?thesis
using ring_incl_imp_subring by simp
qed
lemma (in ring_hom_ring) img_is_subfield:
assumes "subfield K R" and "\<one>\<^bsub>S\<^esub> \<noteq> \<zero>\<^bsub>S\<^esub>"
shows "inj_on h K" and "subfield (h ` K) S"
proof -
have K: "K \<subseteq> carrier R" "subring K R" "subring (h ` K) S"
using subfieldE(1)[OF assms(1)] subringE(1) img_is_subring by auto
have field: "field (R \<lparr> carrier := K \<rparr>)"
using R.subfield_iff(2) \<open>subfield K R\<close> by blast
moreover have ring: "ring (R \<lparr> carrier := K \<rparr>)"
using K R.ring_axioms R.subring_is_ring by blast
moreover have ringS: "ring (S \<lparr> carrier := h ` K \<rparr>)"
using subring_is_ring K by simp
ultimately have h: "h \<in> ring_hom (R \<lparr> carrier := K \<rparr>) (S \<lparr> carrier := h ` K \<rparr>)"
unfolding ring_hom_def apply auto
using ring_hom_memE[OF homh] K
by (meson contra_subsetD)+
hence ring_hom: "ring_hom_ring (R \<lparr> carrier := K \<rparr>) (S \<lparr> carrier := h ` K \<rparr>) h"
using ring_axioms ring ringS ring_hom_ringI2 by blast
have "h ` K \<noteq> { \<zero>\<^bsub>S\<^esub> }"
using subfieldE(1, 5)[OF assms(1)] subringE(3) assms(2)
by (metis hom_one image_eqI singletonD)
thus "inj_on h K"
using ring_hom_ring.non_trivial_field_hom_imp_inj[OF ring_hom field] by auto
hence "h \<in> ring_iso (R \<lparr> carrier := K \<rparr>) (S \<lparr> carrier := h ` K \<rparr>)"
using h unfolding ring_iso_def bij_betw_def by auto
hence "field (S \<lparr> carrier := h ` K \<rparr>)"
using field.ring_iso_imp_img_field[OF field, of h "S \<lparr> carrier := h ` K \<rparr>"] by auto
thus "subfield (h ` K) S"
using S.subfield_iff[of "h ` K"] K(1) ring_hom_memE(1)[OF homh] by blast
qed
(* NEW ========================================================================== *)
lemma (in ring_hom_ring) induced_ring_hom:
assumes "subring K R" shows "ring_hom_ring (R \<lparr> carrier := K \<rparr>) S h"
proof -
have "h \<in> ring_hom (R \<lparr> carrier := K \<rparr>) S"
using homh subringE(1)[OF assms] unfolding ring_hom_def
by (auto, meson hom_mult hom_add subsetCE)+
thus ?thesis
using R.subring_is_ring[OF assms] ring_axioms
unfolding ring_hom_ring_def ring_hom_ring_axioms_def by auto
qed
(* NEW ========================================================================== *)
lemma (in ring_hom_ring) inj_on_subgroup_iff_trivial_ker:
assumes "subring K R"
shows "inj_on h K \<longleftrightarrow> a_kernel (R \<lparr> carrier := K \<rparr>) S h = { \<zero> }"
using ring_hom_ring.inj_iff_trivial_ker[OF induced_ring_hom[OF assms]] by simp
lemma (in ring_hom_ring) inv_ring_hom:
assumes "inj_on h K" and "subring K R"
shows "ring_hom_ring (S \<lparr> carrier := h ` K \<rparr>) R (inv_into K h)"
proof (intro ring_hom_ringI[OF _ R.ring_axioms], auto)
show "ring (S \<lparr> carrier := h ` K \<rparr>)"
using subring_is_ring[OF img_is_subring[OF assms(2)]] .
next
show "inv_into K h \<one>\<^bsub>S\<^esub> = \<one>\<^bsub>R\<^esub>"
using assms(1) subringE(3)[OF assms(2)] hom_one by (simp add: inv_into_f_eq)
next
fix k1 k2
assume k1: "k1 \<in> K" and k2: "k2 \<in> K"
with \<open>k1 \<in> K\<close> show "inv_into K h (h k1) \<in> carrier R"
using assms(1) subringE(1)[OF assms(2)] by (simp add: subset_iff)
from \<open>k1 \<in> K\<close> and \<open>k2 \<in> K\<close>
have "h k1 \<oplus>\<^bsub>S\<^esub> h k2 = h (k1 \<oplus>\<^bsub>R\<^esub> k2)" and "k1 \<oplus>\<^bsub>R\<^esub> k2 \<in> K"
and "h k1 \<otimes>\<^bsub>S\<^esub> h k2 = h (k1 \<otimes>\<^bsub>R\<^esub> k2)" and "k1 \<otimes>\<^bsub>R\<^esub> k2 \<in> K"
using subringE(1,6,7)[OF assms(2)] by (simp add: subset_iff)+
thus "inv_into K h (h k1 \<oplus>\<^bsub>S\<^esub> h k2) = inv_into K h (h k1) \<oplus>\<^bsub>R\<^esub> inv_into K h (h k2)"
and "inv_into K h (h k1 \<otimes>\<^bsub>S\<^esub> h k2) = inv_into K h (h k1) \<otimes>\<^bsub>R\<^esub> inv_into K h (h k2)"
using assms(1) k1 k2 by simp+
qed
end
|
1
-- @@stderr --
dtrace: invalid probe specifier profile:::profile-97: invalid probe description "profile:::profile-97": Overspecified probe description
|
lemma locally_connected_components: "\<lbrakk>locally connected S; c \<in> components S\<rbrakk> \<Longrightarrow> locally connected c" |
using TradeModels, MarketData, TradeBlotter
signal = (sma(AAPL["Close"],50) .> sma(AAPL["Close"],200));
#signal = (sma(Cl,50) .> sma(Cl,200));
#signal = Cl .> sma(Cl,200);
aapl = FinancialTimeSeries(AAPL, "AAPL")
golden = Blotter(signal, aapl)
trades = tradearray(golden, aapl["Close"])
pnls = convert(Array{Float64}, ([(t.close-t.open) for t in trades].*100))
pos = pnls[pnls.>0]
neg = pnls[pnls.<0]
profitfactor = sum(pos)/abs(sum(neg))
mae = convert(Array{Float64}, ([t.open - minimum(t.timeseries["Low"].values) for t in trades]))
trades
# read from csv, parse into blotter and analyze
# qux = readcsv(Pkg.dir("FinancialBlotter/src/dev/account.csv"));
#
# fee = qux[:,[1,4,5,6,10]];
# fum = fee[2:11, :]
# eurtstamp = DateTime{ISOCalendar, UTC}[parsedatetime_from_TOS(t) for t in fum[:,1]]
# eurvals = convert(Array{Float64},fum[:,[2,5]])
# eurtrades = Blotter(eurtstamp, eurvals, blottercolnames, Ticker("EURUSD"))
#
# # get euro data
#
# fname = Pkg.dir("FinancialBlotter/src/dev/data.csv")
# blob = readcsv(fname)
# tstamps = Date{ISOCalendar}[date(i) for i in blob[:, 1]]
# vals = convert(Array{Float64}, blob[:,2])
# eurta = TimeArray(tstamps, vals, ["Close"])
|
import torch # used to extract data from .pt files
import numpy as np
from sklearn.metrics import confusion_matrix,accuracy_score
import seaborn as sn
import pandas as pd
import matplotlib.pyplot as plt
#Extract data from pt files
(x_train, y_train, x_test, y_test)=torch.load('cifar10.pt')
#Convert X_train and Y_train into numpy array
X_train = np.array(x_train).reshape(1000,32*32*3)#reshaping into 1000 rows of 3072 feature vector
Y_train = np.array(y_train).reshape(1000,1)#reshaping into 1000 rows
#Convert X_test and Y_test into numpy array
X_test = np.array(x_test).reshape(100,32*32*3)#reshaping X_test into rows of 3072 feature vector
Y_test = np.array(y_test).reshape(100,1)#reshaping Y_test into 100 rows
k = 5 # define k
temp = [] # array created to store euclidean distances of a test image to all train images, it refreshes after each test image
resultf = [] # array created to store the final predictions
for i in X_test:
for j in X_train:
temp.append(np.linalg.norm(i-j)) #appending euclidean dist to temp
sort = np.argsort(temp)
resulti = np.zeros(10) # creating a classification vector to count the nearest k neighbours
for p in range(k):
resulti[Y_train[sort[p]]]+=1 # counting the repitition of a class in k neighbours
resultf.append(np.argmax(resulti)) # appending the latest result to the final array
temp = []
# reshaping the final predictions into a 100*1 vector
resultf = np.array(resultf).reshape(100,1)
# creating confusion matrix using predictions and y_test
mat = confusion_matrix(Y_test,resultf)
# measuring accuracy of the predictions
acc = accuracy_score(Y_test,resultf)
print(acc)
#converting confusion matrix into a dataframe
df_cm = pd.DataFrame(mat, index = [i for i in "0123456789"],columns = [i for i in "0123456789"])
#plotting the confusion matrix using seaborn library
plt.figure(figsize = (10,7))
sn.heatmap(df_cm, annot=True)
plt.show()
|
lemma filterlim_pow_at_bot_even: fixes f :: "real \<Rightarrow> real" shows "0 < n \<Longrightarrow> LIM x F. f x :> at_bot \<Longrightarrow> even n \<Longrightarrow> LIM x F. (f x)^n :> at_top" |
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Structures.Group.Base where
open import Cubical.Foundations.Prelude
open import Cubical.Data.Sigma
open import Cubical.Structures.Monoid hiding (⟨_⟩)
private
variable
ℓ : Level
record IsGroup {G : Type ℓ}
(0g : G) (_+_ : G → G → G) (-_ : G → G) : Type ℓ where
constructor isgroup
field
isMonoid : IsMonoid 0g _+_
inverse : (x : G) → (x + (- x) ≡ 0g) × ((- x) + x ≡ 0g)
open IsMonoid isMonoid public
infixl 6 _-_
_-_ : G → G → G
x - y = x + (- y)
invl : (x : G) → (- x) + x ≡ 0g
invl x = inverse x .snd
invr : (x : G) → x + (- x) ≡ 0g
invr x = inverse x .fst
record Group : Type (ℓ-suc ℓ) where
constructor group
field
Carrier : Type ℓ
0g : Carrier
_+_ : Carrier → Carrier → Carrier
-_ : Carrier → Carrier
isGroup : IsGroup 0g _+_ -_
infix 8 -_
infixr 7 _+_
open IsGroup isGroup public
-- Extractor for the carrier type
⟨_⟩ : Group → Type ℓ
⟨_⟩ = Group.Carrier
makeIsGroup : {G : Type ℓ} {0g : G} {_+_ : G → G → G} { -_ : G → G}
(is-setG : isSet G)
(assoc : (x y z : G) → x + (y + z) ≡ (x + y) + z)
(rid : (x : G) → x + 0g ≡ x)
(lid : (x : G) → 0g + x ≡ x)
(rinv : (x : G) → x + (- x) ≡ 0g)
(linv : (x : G) → (- x) + x ≡ 0g)
→ IsGroup 0g _+_ -_
makeIsGroup is-setG assoc rid lid rinv linv =
isgroup (makeIsMonoid is-setG assoc rid lid) λ x → rinv x , linv x
makeGroup : {G : Type ℓ} (0g : G) (_+_ : G → G → G) (-_ : G → G)
(is-setG : isSet G)
(assoc : (x y z : G) → x + (y + z) ≡ (x + y) + z)
(rid : (x : G) → x + 0g ≡ x)
(lid : (x : G) → 0g + x ≡ x)
(rinv : (x : G) → x + (- x) ≡ 0g)
(linv : (x : G) → (- x) + x ≡ 0g)
→ Group
makeGroup 0g _+_ -_ is-setG assoc rid lid rinv linv =
group _ 0g _+_ -_ (makeIsGroup is-setG assoc rid lid rinv linv)
makeGroup-right : ∀ {ℓ} {A : Type ℓ}
→ (id : A)
→ (comp : A → A → A)
→ (inv : A → A)
→ (set : isSet A)
→ (assoc : ∀ a b c → comp a (comp b c) ≡ comp (comp a b) c)
→ (rUnit : ∀ a → comp a id ≡ a)
→ (rCancel : ∀ a → comp a (inv a) ≡ id)
→ Group
makeGroup-right {A = A} id comp inv set assoc rUnit rCancel =
makeGroup id comp inv set assoc rUnit lUnit rCancel lCancel
where
_⨀_ = comp
abstract
lCancel : ∀ a → comp (inv a) a ≡ id
lCancel a =
inv a ⨀ a
≡⟨ sym (rUnit (comp (inv a) a)) ⟩
(inv a ⨀ a) ⨀ id
≡⟨ cong (comp (comp (inv a) a)) (sym (rCancel (inv a))) ⟩
(inv a ⨀ a) ⨀ (inv a ⨀ (inv (inv a)))
≡⟨ assoc _ _ _ ⟩
((inv a ⨀ a) ⨀ (inv a)) ⨀ (inv (inv a))
≡⟨ cong (λ □ → □ ⨀ _) (sym (assoc _ _ _)) ⟩
(inv a ⨀ (a ⨀ inv a)) ⨀ (inv (inv a))
≡⟨ cong (λ □ → (inv a ⨀ □) ⨀ (inv (inv a))) (rCancel a) ⟩
(inv a ⨀ id) ⨀ (inv (inv a))
≡⟨ cong (λ □ → □ ⨀ (inv (inv a))) (rUnit (inv a)) ⟩
inv a ⨀ (inv (inv a))
≡⟨ rCancel (inv a) ⟩
id
∎
lUnit : ∀ a → comp id a ≡ a
lUnit a =
id ⨀ a
≡⟨ cong (λ b → comp b a) (sym (rCancel a)) ⟩
(a ⨀ inv a) ⨀ a
≡⟨ sym (assoc _ _ _) ⟩
a ⨀ (inv a ⨀ a)
≡⟨ cong (comp a) (lCancel a) ⟩
a ⨀ id
≡⟨ rUnit a ⟩
a
∎
makeGroup-left : ∀ {ℓ} {A : Type ℓ}
→ (id : A)
→ (comp : A → A → A)
→ (inv : A → A)
→ (set : isSet A)
→ (assoc : ∀ a b c → comp a (comp b c) ≡ comp (comp a b) c)
→ (lUnit : ∀ a → comp id a ≡ a)
→ (lCancel : ∀ a → comp (inv a) a ≡ id)
→ Group
makeGroup-left {A = A} id comp inv set assoc lUnit lCancel =
makeGroup id comp inv set assoc rUnit lUnit rCancel lCancel
where
abstract
rCancel : ∀ a → comp a (inv a) ≡ id
rCancel a =
comp a (inv a)
≡⟨ sym (lUnit (comp a (inv a))) ⟩
comp id (comp a (inv a))
≡⟨ cong (λ b → comp b (comp a (inv a))) (sym (lCancel (inv a))) ⟩
comp (comp (inv (inv a)) (inv a)) (comp a (inv a))
≡⟨ sym (assoc (inv (inv a)) (inv a) (comp a (inv a))) ⟩
comp (inv (inv a)) (comp (inv a) (comp a (inv a)))
≡⟨ cong (comp (inv (inv a))) (assoc (inv a) a (inv a)) ⟩
comp (inv (inv a)) (comp (comp (inv a) a) (inv a))
≡⟨ cong (λ b → comp (inv (inv a)) (comp b (inv a))) (lCancel a) ⟩
comp (inv (inv a)) (comp id (inv a))
≡⟨ cong (comp (inv (inv a))) (lUnit (inv a)) ⟩
comp (inv (inv a)) (inv a)
≡⟨ lCancel (inv a) ⟩
id
∎
rUnit : ∀ a → comp a id ≡ a
rUnit a =
comp a id
≡⟨ cong (comp a) (sym (lCancel a)) ⟩
comp a (comp (inv a) a)
≡⟨ assoc a (inv a) a ⟩
comp (comp a (inv a)) a
≡⟨ cong (λ b → comp b a) (rCancel a) ⟩
comp id a
≡⟨ lUnit a ⟩
a
∎
|
function [price] = PROJ_Double_Barrier(N,alph,call,L,U, S_0,W,M,T,r,rnCHF)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% About: Pricing Function for Discrete Double Barrier Options using PROJ method
% Models Supported: Levy Processes, including jump diffusions and Black-Scholes model
% Returns: price of contract
% Author: Justin Lars Kirkby
%
% ----------------------
% Contract/Model Params
% ----------------------
% S_0 = initial stock price (e.g. 100)
% W = strike (e.g. 100)
% r = interest rate (e.g. 0.05)
% q = dividend yield (e.g. 0.05)
% T = time remaining until maturity (in years, e.g. T=1)
% M = number of subintervals of [0,T] (total of M+1 monitoring points in time grid, including S_0)
% call = 1 for call (else put)
% [L,U] = barriers
% rnCHF = risk netural characteristic function (function handle with single argument)
%
% ----------------------
% Numerical (PROJ) Params
% ----------------------
% N = number of grid/basis points (power of 2, e.g. 2^12), resolution = 2*alph/(N-1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
l = log(L/S_0); u = log(U/S_0); dt = T/M;
K = N/2;
dx = (u-l)/(K-1);
a = 1/dx;
E = ceil(2*alph/(u-l));
if M<= 12
E = min(E,4);
else
E = min(E,3);
end
a2 = a^2;
N_Ee = E*N;
Cons2 = 24*a2*exp(-r*dt)/N_Ee ;
grand = @(w)rnCHF(w).*(sin(w/(2*a))./w).^2./(2+cos(w/a));
dw = 2*pi*a/N_Ee ;
omega = (dw: dw: (N_Ee -1)*dw); %We calcuate coefficient of w=0 explicitly
zmin = (1 - E*K)*dx; %K corresponds to zero
beta = Cons2*real(fft([1/(24*a^2) exp(-1i*zmin*omega).*feval(grand,omega)]));
toepM = [beta(E*K:-1:(E-1)*K+1)';0; beta((E+1)*K-1:-1:E*K+1)'];
toepM = fft(toepM);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%STEP 1: Payoff Coefficients
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xmin = l;
nnot = floor(1-xmin*a); %index to left of x_0=0
lws = log(W/S_0);
nbar = floor(a*(lws - xmin)+1);
rho = lws - (xmin+(nbar - 1)*dx);
zeta = a*rho;
xnbar = xmin + (nbar - 1)*dx;
Thet = zeros(K,1);
Cons3 = 1/48;
Cons4 = 1/12;
%%%%%% Gaussian Quad Constants
q_plus = (1 + sqrt(3/5))/2; q_minus = (1 - sqrt(3/5))/2;
b3 = sqrt(15); b4 = b3/10;
%%%% PAYOFF CONSTANTS-----------------------------------
varthet_01 = exp(.5*dx)*(5*cosh(b4*dx) - b3*sinh(b4*dx) + 4)/18;
varthet_m10 = exp(-.5*dx)*(5*cosh(b4*dx) + b3*sinh(b4*dx) + 4)/18;
varthet_star = varthet_01 + varthet_m10;
if call==1 %DBC
sigma = 1 - zeta; sigma_plus = (q_plus-.5)*sigma; sigma_minus = (q_minus-.5)*sigma;
es1 = exp(dx*sigma_plus); es2 = exp(dx*sigma_minus);
dbar_0 = .5 + zeta*(.5*zeta-1);
dbar_1 = sigma*(1 - .5*sigma);
d_0 = exp((rho+dx)*.5)*sigma^2/18*(5*((1-q_minus)*es2 +(1-q_plus)*es1) + 4);
d_1 = exp((rho-dx)*.5)*sigma/18*(5*( (.5*(zeta+1) +sigma_minus)*es2 + (.5*(zeta+1) +sigma_plus)*es1 ) + 4*(zeta+1) );
Thet(nbar) = W*(exp(-rho)*d_0 - dbar_0);
Thet(nbar + 1) = W*(exp(dx-rho)*(varthet_01 +d_1) -(.5 + dbar_1) );
Thet(nbar + 2:K-1) = exp(xmin +dx*(nbar+1:K-2))*S_0*varthet_star - W;
Thet(K) = U*varthet_m10 - W/2;
%%%%%%%
p = ifft(toepM.*fft([Thet(1:K);zeros(K,1)]));
Val = p(1:K);
%%%%%%%
for m=M-2:-1:0
Thet(1) = Cons3*(13*Val(1)+15*Val(2)-5*Val(3)+Val(4));
Thet(K) = Cons3*(13*Val(K)+15*Val(K-1)-5*Val(K-2)+Val(K-3));
Thet(2:K -1) = Cons4*(Val(1:K-2)+10*Val(2:K-1)+Val(3:K));
%%%%%%%
p = ifft(toepM.*fft([Thet(1:K);zeros(K,1)]));
Val = p(1:K);
end
else %DBP
zeta_plus = zeta*q_plus; zeta_minus = zeta*q_minus;
rho_plus = rho*q_plus; rho_minus = rho*q_minus;
ed1 = exp(rho_minus); ed2 = exp(rho/2); ed3 = exp(rho_plus);
dbar_1 = zeta^2/2;
dbar_0 = zeta - dbar_1; % dbar_1 = zeta + .5*((zeta - 1)^2 - 1);
d_0 = zeta*(5*( (1-zeta_minus)*ed1 + (1-zeta_plus)*ed3 ) + 4*(2-zeta)*ed2)/18;
d_1 = zeta*( 5*(zeta_minus*ed1 + zeta_plus*ed3) + 4*zeta*ed2 )/18;
Thet(1) = W/2 - L*varthet_01;
Thet(2:nbar-1) = W - exp(xmin +dx*(1:nbar-2))*S_0*varthet_star;
Thet(nbar) = W*(.5 + dbar_0 - exp(-rho)*(varthet_m10 + d_0));
Thet(nbar + 1) = W*(dbar_1 - exp(- rho)*d_1);
%%%%%%%
p = ifft(toepM.*fft([Thet(1:K);zeros(K,1)]));
Val = p(1:K);
%%%%%%%
for m=M-2:-1:0
Thet(1) = Cons3*(13*Val(1)+15*Val(2)-5*Val(3)+Val(4));
Thet(K) = Cons3*(13*Val(K)+15*Val(K-1)-5*Val(K-2)+Val(K-3));
Thet(2:K -1) = Cons4*(Val(1:K-2)+10*Val(2:K-1)+Val(3:K));
%%%%%%%
p = ifft(toepM.*fft([Thet(1:K);zeros(K,1)]));
Val = p(1:K);
end
end
xnot = l+(nnot-1)*dx;
xs = [xnot-2*dx,xnot-dx,xnot,xnot+dx,xnot+2*dx];
ys = [Val(nnot-2),Val(nnot-1),Val(nnot),Val(nnot+1),Val(nnot+2)];
price = spline(xs,ys,0);
end
|
{-# OPTIONS --cubical --safe #-}
module Data.Ternary where
open import Prelude
open import Relation.Nullary.Discrete.FromBoolean
infixl 5 _,0 _,1 _,2
data Tri : Type where
0t : Tri
_,0 _,1 _,2 : Tri → Tri
infix 4 _≡ᴮ_
_≡ᴮ_ : Tri → Tri → Bool
0t ≡ᴮ 0t = true
x ,0 ≡ᴮ y ,0 = x ≡ᴮ y
x ,1 ≡ᴮ y ,1 = x ≡ᴮ y
x ,2 ≡ᴮ y ,2 = x ≡ᴮ y
_ ≡ᴮ _ = false
sound : ∀ x y → T (x ≡ᴮ y) → x ≡ y
sound 0t 0t p = refl
sound (x ,0) (y ,0) p = cong _,0 (sound x y p)
sound (x ,1) (y ,1) p = cong _,1 (sound x y p)
sound (x ,2) (y ,2) p = cong _,2 (sound x y p)
complete : ∀ x → T (x ≡ᴮ x)
complete 0t = tt
complete (x ,0) = complete x
complete (x ,1) = complete x
complete (x ,2) = complete x
_≟_ : (x y : Tri) → Dec (x ≡ y)
_≟_ = from-bool-eq _≡ᴮ_ sound complete
|
module Statistics.Quantile.Util where
import Pipes
import qualified Pipes.Prelude as P
import Statistics.Quantile.Types
import System.IO
tmpDir :: FilePath
tmpDir = "/var/tmp/"
selectFromHandle :: Quantile
-> Selector IO
-> Handle
-> IO Double
selectFromHandle q (Selector select) hin = do
select q $ streamHandle hin
streamHandle :: Handle -> Stream IO
streamHandle hin = Stream (P.fromHandle hin >-> P.map read)
takeStream :: Int -> Stream IO -> Stream IO
takeStream n (Stream p) = Stream $ p >-> P.take n
|
/**
* Copyright (c) 2017 Melown Technologies SE
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef utility_tar_hpp_included_
#define utility_tar_hpp_included_
#include <ctime>
#include <array>
#include <limits>
#include <boost/filesystem/path.hpp>
#include "filedes.hpp"
namespace utility { namespace tar {
enum class Type { invalid, ustar, posix };
struct Block {
std::array<char, 512> data;
};
struct Header : Block {
char* name() { return Block::data.data(); }
const char* name() const { return Block::data.data(); }
char* mode() { return Block::data.data() + 100; }
const char* mode() const { return Block::data.data() + 100; }
char* uid() { return Block::data.data() + 108; }
const char* uid() const { return Block::data.data() + 108; }
char* gid() { return Block::data.data() + 116; }
const char* gid() const { return Block::data.data() + 116; }
char* size() { return Block::data.data() + 124; }
const char* size() const { return Block::data.data() + 124; }
char* mtime() { return Block::data.data() + 136; }
const char* mtime() const { return Block::data.data() + 136; }
char* chksum() { return Block::data.data() + 148; }
const char* chksum() const { return Block::data.data() + 148; }
char* typeflag() { return Block::data.data() + 156; }
const char* typeflag() const { return Block::data.data() + 156; }
char* linkname() { return Block::data.data() + 157; }
const char* linkname() const { return Block::data.data() + 157; }
char* magic() { return Block::data.data() + 257; }
const char* magic() const { return Block::data.data() + 257; }
char* version() { return Block::data.data() + 263; }
const char* version() const { return Block::data.data() + 263; }
char* uname() { return Block::data.data() + 265; }
const char* uname() const { return Block::data.data() + 265; }
char* gname() { return Block::data.data() + 297; }
const char* gname() const { return Block::data.data() + 297; }
char* devmajor() { return Block::data.data() + 329; }
const char* devmajor() const { return Block::data.data() + 329; }
char* devminor() { return Block::data.data() + 337; }
const char* devminor() const { return Block::data.data() + 337; }
char* prefix() { return Block::data.data() + 345; }
const char* prefix() const { return Block::data.data() + 345; }
Type type() const;
bool valid() const { return type() != Type::invalid; }
std::size_t getSize() const;
std::size_t getBlocks() const {
return (getSize() + 511UL) / 512UL;
}
std::size_t getBlocksBytes() const {
return getBlocks() * 512UL;
}
boost::filesystem::path getPath() const;
bool isFile() const;
std::time_t getTime() const;
};
typedef std::vector<char> Data;
class Reader {
public:
Reader() : cursor_() {}
Reader(const boost::filesystem::path &path);
void seek(std::size_t blocks);
void advance(std::size_t blocks);
void skip(const Header &header);
/** Reads one block from current file position.
* Returns false on EOF.
* Throws system_error on error.
*/
bool read(Block &block);
std::size_t cursor() const { return cursor_; }
std::size_t cursorByte() const { return cursor_ * 512; }
/** Reads given amount of bytes starting at given block number.
*/
Data readData(std::size_t block, std::size_t size);
/** Simple structure for file descriptor and block start/end.
*/
struct Filedes {
int fd;
std::size_t start;
std::size_t end;
};
/** Return file descriptor for block index and size.
*/
Filedes filedes(std::size_t block, std::size_t size);
int filedes() const { return fd_; }
/** File info.
*/
struct File {
typedef std::vector<File> list;
boost::filesystem::path path;
std::size_t start;
std::size_t size;
std::size_t end() const { return start + size; }
File(boost::filesystem::path path, std::size_t start
, std::size_t size)
: path(path), start(start), size(size)
{}
};
File::list files(std::size_t limit
= std::numeric_limits<std::size_t>::max());
const boost::filesystem::path& path() const { return path_; }
private:
boost::filesystem::path path_;
utility::Filedes fd_;
std::size_t cursor_;
};
class Writer {
public:
enum Flags {
truncate = 0x01
, create = 0x02
, exclusive = 0x04
};
Writer(const boost::filesystem::path &path
, int flags = Flags::create | Flags::exclusive | Flags::truncate);
void write(const Header &header, std::size_t block, std::size_t size);
void write(const Header &header, const boost::filesystem::path &file);
/** Write file terminator
*/
void end();
private:
boost::filesystem::path path_;
utility::Filedes fd_;
};
// inlines
inline void Reader::skip(const Header &header)
{
advance(header.getBlocks());
}
} } // namespace utility::tar
#endif // utility_tar_hpp_included_
|
Formal statement is: lemma has_complex_derivative_funpow_1: "\<lbrakk>(f has_field_derivative 1) (at z); f z = z\<rbrakk> \<Longrightarrow> (f^^n has_field_derivative 1) (at z)" Informal statement is: If $f$ is a function with a derivative of $1$ at $z$ and $f(z) = z$, then $f^n$ has a derivative of $1$ at $z$. |
Formal statement is: lemma open_sums: fixes T :: "('b::real_normed_vector) set" assumes "open S \<or> open T" shows "open (\<Union>x\<in> S. \<Union>y \<in> T. {x + y})" Informal statement is: If $S$ or $T$ is open, then the Minkowski sum $S + T$ is open. |
#include <boost/any.hpp>
int main()
{
boost::any a;
a = 5;
a = std::string("A string");
return 0;
}
|
```python
%pylab inline
```
Populating the interactive namespace from numpy and matplotlib
```python
import sympy as S
from sympy import stats
p = S.symbols('p',positive=True,real=True)
x=stats.Binomial('x',5,p)
t = S.symbols('t',real=True,positive=True)
mgf = stats.E(S.exp(t*x))
```
```python
from IPython.display import Math
```
```python
Math(S.latex(S.simplify(mgf)))
```
$$p^{5} e^{5 t} + 5 p^{4} \left(- p + 1\right) e^{4 t} + 10 p^{3} \left(p - 1\right)^{2} e^{3 t} - 10 p^{2} \left(p - 1\right)^{3} e^{2 t} + 5 p \left(p - 1\right)^{4} e^{t} - \left(p - 1\right)^{5}$$
```python
import scipy.stats
```
```python
def gen_sample(ns=100,n=10):
out =[]
for i in range(ns):
p=scipy.stats.uniform(0,1).rvs()
out.append(scipy.stats.binom(n,p).rvs())
return out
```
```python
from collections import Counter
xs = gen_sample(1000)
hist(xs,range=(1,10),align='mid')
Counter(xs)
```
## sum of IID normally distributed random variables
```python
S.var('x:2',real=True)
S.var('mu:2',real=True)
S.var('sigma:2',positive=True)
S.var('t',positive=True)
x0=stats.Normal(x0,mu0,sigma0)
x1=stats.Normal(x1,mu1,sigma1)
```
```python
mgf0=S.simplify(stats.E(S.exp(t*x0)))
mgf1=S.simplify(stats.E(S.exp(t*x1)))
mgfY=S.simplify(mgf0*mgf1)
```
```python
Math(S.latex(mgf0))
```
$$e^{\mu_{0} t + \frac{\sigma_{0}^{2} t^{2}}{2}}$$
```python
Math(S.latex(S.powsimp(mgfY)))
```
$$e^{\frac{t}{2} \left(2 \mu_{0} + 2 \mu_{1} + \sigma_{0}^{2} t + \sigma_{1}^{2} t\right)}$$
```python
S.collect(S.expand(S.log(mgfY)),t)
```
t**2*(sigma0**2/2 + sigma1**2/2) + t*(mu0 + mu1)
```python
```
|
/* filter/test_median.c
*
* Copyright (C) 2018 Patrick Alken
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <gsl/gsl_math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_test.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_filter.h>
#include <gsl/gsl_movstat.h>
#include <gsl/gsl_statistics.h>
/* compute filtered data by explicitely constructing window, sorting it and finding median */
int
slow_movmedian(const gsl_filter_end_t etype, const gsl_vector * x, gsl_vector * y, const int K)
{
const size_t H = K / 2;
const size_t n = x->size;
double *window = malloc(K * sizeof(double));
size_t i;
for (i = 0; i < n; ++i)
{
size_t wsize = gsl_movstat_fill(etype, x, i, H, H, window);
double yi = gsl_stats_median(window, 1, wsize);
gsl_vector_set(y, i, yi);
}
free(window);
return GSL_SUCCESS;
}
static void
test_median_proc(const double tol, const size_t n, const size_t K,
const gsl_filter_end_t etype, gsl_rng *rng_p)
{
gsl_filter_median_workspace *w = gsl_filter_median_alloc(K);
gsl_vector *x = gsl_vector_alloc(n);
gsl_vector *y = gsl_vector_alloc(n);
gsl_vector *z = gsl_vector_alloc(n);
char buf[2048];
/* test moving median with random input */
random_vector(x, rng_p);
/* y = median(x) with slow brute force algorithm */
slow_movmedian(etype, x, y, K);
/* z = median(x) */
gsl_filter_median(etype, x, z, w);
/* test y = z */
sprintf(buf, "n=%zu K=%zu endtype=%u median random", n, K, etype);
compare_vectors(tol, z, y, buf);
/* z = median(x) in-place */
gsl_vector_memcpy(z, x);
gsl_filter_median(etype, z, z, w);
sprintf(buf, "n=%zu K=%zu endtype=%u median random in-place", n, K, etype);
compare_vectors(tol, z, y, buf);
gsl_vector_free(x);
gsl_vector_free(y);
gsl_vector_free(z);
gsl_filter_median_free(w);
}
static void
test_median(gsl_rng * rng_p)
{
test_median_proc(GSL_DBL_EPSILON, 1000, 1, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 3, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 5, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 100, 301, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 5000, 17, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 5000, 9, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 50, 901, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 50, 201, GSL_MOVSTAT_END_PADZERO, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 1, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 3, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 5, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 100, 301, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 5000, 17, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 5000, 9, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 50, 901, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 50, 201, GSL_MOVSTAT_END_PADVALUE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 1, GSL_MOVSTAT_END_TRUNCATE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 3, GSL_MOVSTAT_END_TRUNCATE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 1000, 5, GSL_MOVSTAT_END_TRUNCATE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 100, 301, GSL_MOVSTAT_END_TRUNCATE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 5000, 17, GSL_MOVSTAT_END_TRUNCATE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 5000, 9, GSL_MOVSTAT_END_TRUNCATE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 50, 901, GSL_MOVSTAT_END_TRUNCATE, rng_p);
test_median_proc(GSL_DBL_EPSILON, 50, 201, GSL_MOVSTAT_END_TRUNCATE, rng_p);
}
|
module Adder
%default total
||| Calculate the type of an adder function
||| that expected `numargs` arguments (in addition
||| to the initial value argument)
AdderType : (numargs : Nat) -> Type
AdderType Z = Int
AdderType (S k) = (next : Int) -> AdderType k
adder : (numargs : Nat) -> (acc : Int) -> AdderType numargs
adder Z acc = acc
adder (S k) acc = \next => adder k (acc + next)
|
A film version of the novel was released in 2005 , starring Isabella Rossellini , Paul Freeman , and Tomas Milian . Jorge Alí Triana and his daughter Veronica Triana wrote a theatrical adaptation in 2003 .
|
[STATEMENT]
lemma vec_hom_mset: "image_mset hom (vec_mset v) = vec_mset (map_vec hom v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. image_mset hom (vec_mset v) = vec_mset (map_vec hom v)
[PROOF STEP]
apply (induction v)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
1. image_mset hom (vec_mset vNil) = vec_mset (map_vec hom vNil)
2. \<And>a v. image_mset hom (vec_mset v) = vec_mset (map_vec hom v) \<Longrightarrow> image_mset hom (vec_mset (vCons a v)) = vec_mset (map_vec hom (vCons a v))
[PROOF STEP]
apply (metis mset.simps(1) vec_mset_img_map vec_mset_vNil vec_of_list_Nil)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>a v. image_mset hom (vec_mset v) = vec_mset (map_vec hom v) \<Longrightarrow> image_mset hom (vec_mset (vCons a v)) = vec_mset (map_vec hom (vCons a v))
[PROOF STEP]
by (metis mset_vec_eq_mset_list vec_list vec_mset_img_map) |
(* Title: HOL/Auth/n_mutualExOnI_lemma_inv__2_on_rules.thy
Author: Yongjian Li and Kaiqiang Duan, State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
Copyright 2016 State Key Lab of Computer Science, Institute of Software, Chinese Academy of Sciences
*)
header{*The n_mutualExOnI Protocol Case Study*}
theory n_mutualExOnI_lemma_inv__2_on_rules imports n_mutualExOnI_lemma_on_inv__2
begin
section{*All lemmas on causal relation between inv__2*}
lemma lemma_inv__2_on_rules:
assumes b1: "r \<in> rules N" and b2: "(\<exists> p__Inv0 p__Inv1. p__Inv0\<le>N\<and>p__Inv1\<le>N\<and>p__Inv0~=p__Inv1\<and>f=inv__2 p__Inv0 p__Inv1)"
shows "invHoldForRule s f r (invariants N)"
proof -
have c1: "(\<exists> i. i\<le>N\<and>r=n_Try i)\<or>
(\<exists> i. i\<le>N\<and>r=n_Crit i)\<or>
(\<exists> i. i\<le>N\<and>r=n_Exit i)\<or>
(\<exists> i. i\<le>N\<and>r=n_Idle i)"
apply (cut_tac b1, auto) done
moreover {
assume d1: "(\<exists> i. i\<le>N\<and>r=n_Try i)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_TryVsinv__2) done
}
moreover {
assume d1: "(\<exists> i. i\<le>N\<and>r=n_Crit i)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_CritVsinv__2) done
}
moreover {
assume d1: "(\<exists> i. i\<le>N\<and>r=n_Exit i)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_ExitVsinv__2) done
}
moreover {
assume d1: "(\<exists> i. i\<le>N\<and>r=n_Idle i)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_IdleVsinv__2) done
}
ultimately show "invHoldForRule s f r (invariants N)"
by satx
qed
end
|
[STATEMENT]
lemma homeomorphic_empty_space:
"X homeomorphic_space Y \<Longrightarrow> topspace X = {} \<longleftrightarrow> topspace Y = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. X homeomorphic_space Y \<Longrightarrow> (topspace X = {}) = (topspace Y = {})
[PROOF STEP]
by (metis homeomorphic_imp_surjective_map homeomorphic_space image_is_empty) |
import Data.Vect
parameters (len : Nat)
record Foo where
constructor Bar
Gnat : Vect len Nat
foo : Foo 1
foo = Bar _ [0]
|
{-# OPTIONS --cubical --allow-unsolved-metas #-}
open import Agda.Builtin.Cubical.Path
open import Agda.Builtin.Nat
pred : Nat → Nat
pred (suc n) = n
pred zero = zero
data [0-1] : Set where
𝟎 𝟏 : [0-1]
int : 𝟎 ≡ 𝟏
-- The following holes can be filled, so they should not cause a
-- typechecking failure.
0=x : ∀ i → 𝟎 ≡ int i
0=x i = \ j → int {!!}
si : {n m : Nat} → suc n ≡ suc m → n ≡ m
si p i = pred (p {!!})
|
Jamaaladeen Tacuma – bass guitar
|
{-# OPTIONS --without-K --rewriting #-}
module lib.two-semi-categories.TwoSemiCategories where
open import lib.two-semi-categories.FunCategory public
open import lib.two-semi-categories.Functor public
open import lib.two-semi-categories.FunctorInverse public
open import lib.two-semi-categories.FundamentalCategory public
open import lib.two-semi-categories.FunextFunctors public
open import lib.two-semi-categories.GroupToCategory public
|
Wild Campus is a studentrun, expertadvised, and communitysupported program dedicated to the conservation of local wildlife on campus and beyond.
1. Encourage local wildlife on and off campus through:
improvement of habitat for native wildlife, especially those of special concern.
reduction in negative impacts of invasive species.
2. Increase public interest in wildlife conservation through:
educational events for all ages.
facilitation of involvement in wildlife conservation.
3. Provide valuable experience to future conservation professionals by:
providing real world wildlife management experience to students.
training students to effectively communicate science to the public.
putting students in contact with the expertise of faculty on campus.
4. Improve campus visitor experience through:
increased opportunities to observe wildlife.
entertaining educational and community involvement events.
|
function pde = elasticitydata(para)
%% ELASTICITYDATA data for elasticity problem
%
% - mu \Delta u - (mu + lambda) grad(div u) = f in \Omega
% u = g_D on \partial \Omega
%
% Created by Huayi Wei Monday, 27 June 2011.
%
% Copyright (C) Long Chen. See COPYRIGHT.txt for details.
if nargin == 0
lambda = 1;
mu = 1;
else
if ~isstruct(para)
exit('we need a struct data');
end
if ~isfield(para,'lambda') || isempty(para.lambda)
lambda = 1;
else
lambda = para.lambda;
end
if ~isfield(para,'mu') || isempty(para.mu)
mu = 1;
else
mu = para.mu;
end
end
pde = struct('lambda',lambda,'mu',mu, 'f', @f, 'exactu',@exactu,'g_D',@g_D);
%%%%%% subfunctions %%%%%%
function z = f(p)
z = mu*2*pi^2.*exactu(p);
end
function z = exactu(p)
x = p(:,1); y = p(:,2);
z = [cos(pi*x).*cos(pi*y), sin(pi*x).*sin(pi*y)];
end
function z = g_D(p)
z = exactu(p);
end
end |
%SimuNF_nl.m
%tic
function []=timecourse_VF(x0,i)
para
tf=1.5;
[t1,y1]=ode_yu_VF(0,tf,[-x0(1),-x0(2),0,0,0,0,0,0]',dt);
[t2,y2]=ode_yu_VF(0,tf,[-x0(1),-x0(2),0,0,0,0,0,0]',dt);
[t3,y3]=ode_yu_VF(0,tf,[-x0(1),-x0(2),0,0,0,0,0,0]',dt);
[t4,y4]=ode_yu_VF(0,tf,[-x0(1),-x0(2),0,0,0,0,0,0]',dt);
[t5,y5]=ode_yu_VF(0,tf,[-x0(1),-x0(2),0,0,0,0,0,0]',dt);
%%
figure(1)
subplot(222)
%
% hold on
% draw_bg
% line([-0.03 -0.03],[-0.2 0.01], 'linewidth', 2, 'color', [0,0,0])
% line([ 0.03 0.03],[-0.2 0.01], 'linewidth', 2, 'color', [0,0,0])
plot(y1(:,1)+x0(1),y1(:,2)+x0(2), 'b-', ...
y2(:,1)+x0(1),y2(:,2)+x0(2), 'b-', ...
y3(:,1)+x0(1),y3(:,2)+x0(2), 'b-', ...
y4(:,1)+x0(1),y4(:,2)+x0(2), 'b-', ...
y5(:,1)+x0(1),y5(:,2)+x0(2), 'b-', ...
'Linewidth', 1.2)
figure(2)
subplot(8,3,(i-1)*3+2)
plot(t1,sqrt(y1(:,3).^2+y1(:,4).^2), 'b-', ...
t2,sqrt(y2(:,3).^2+y2(:,4).^2), 'b-', ...
t3,sqrt(y3(:,3).^2+y3(:,4).^2), 'b-', ...
t4,sqrt(y4(:,3).^2+y4(:,4).^2), 'b-', ...
t5,sqrt(y5(:,3).^2+y5(:,4).^2), 'b-', ...
'Linewidth', 1.2)
figure(1)
%hold on
%hold off
%axis equal
%axis([-0.075 0.075 -0.3 .075])
end |
import Providers
-- import Data.HVect
-- import Data.Fin
%default total
%language TypeProviders
-- Enumerating observations, in order to be able to reason about
-- sequences, and to avoid introducing contradictory types.
-- Assumptions could depend on a few observations at once, so
-- something like lists of observations should be used instead of
-- single ones, and checks against permutations then, perhaps.
-- #, input, output
postulate blackbox : Integer -> Integer -> Integer
partial parseDigit : Char -> Integer
parseDigit '0' = 0
parseDigit '1' = 1
parseDigit '2' = 2
parseDigit '3' = 3
parseDigit '4' = 4
parseDigit '5' = 5
parseDigit '6' = 6
parseDigit '7' = 7
parseDigit '8' = 8
parseDigit '9' = 9
partial parseInt : String -> Integer
parseInt s = foldl (\x,y => 10*x + parseDigit y) 0 (unpack s)
partial parseState : String -> (Integer, Integer)
parseState s = case (words s) of
[w1, w2] => (parseInt w1, parseInt w2)
partial experiment : Integer -> IO (Provider Type)
experiment inp = do
val <- readFile "/tmp/black-box-test"
(n, out) <- return $ parseState val
fh <- openFile "/tmp/black-box-test" Write
fwrite fh $ show (n + 1) ++ " " ++ show (out + inp)
closeFile fh
return (Provide (blackbox (n + 1) inp = (out + inp)))
%provide (first : Type) with (experiment 2)
%provide (second : Type) with (experiment 4)
%provide (third : Type) with (experiment 1)
alwaysIncreases' : blackbox num1 inp1 = out1 -> blackbox num2 inp2 = out2 -> Type
alwaysIncreases' {num1} {num2} {out1} {out2} b1 b2 = (if num1 <= num2 then out1 <= out2 else out2 <= out1) = True
increasesByInput' : blackbox num1 inp1 = out1 -> blackbox num2 inp2 = out2 -> Type
increasesByInput' {num1} {num2} {inp1} {inp2} {out1} {out2} b1 b2 = case (num1 == num2 - 1) of
True => out2 = out1 + inp2
False => case (num1 == num2 + 1) of
True => out1 = out2 + inp1
False => Unit
c1IncreasesByInput' : (b1:first) -> (b2:second) -> increasesByInput' b1 b2
c1IncreasesByInput' b1 b2 = Refl
c2IncreasesByInput' : (b1:first) -> (b2:second) -> increasesByInput' b2 b1
c2IncreasesByInput' b1 b2 = Refl
c3IncreasesByInput' : (b1:first) -> (b3:third) -> increasesByInput' b1 b3
c3IncreasesByInput' b1 b3 = MkUnit
|
{-# OPTIONS --type-in-type #-}
module DescFix where
open import DescTT
aux : (C : Desc)(D : Desc)(P : Mu C -> Set)(x : [| D |] (Mu C)) -> Set
aux C id P (con y) = P (con y) * aux C C P y
aux C (const K) P k = Unit
aux C (prod D D') P (s , t) = aux C D P s * aux C D' P t
aux C (sigma S T) P (s , t) = aux C (T s) P t
aux C (pi S T) P f = (s : S) -> aux C (T s) P (f s)
gen : (C : Desc)(D : Desc)(P : Mu C -> Set)
(rec : (y : [| C |] Mu C) -> aux C C P y -> P (con y))
(x : [| D |] Mu C) -> aux C D P x
gen C id P rec (con x) = rec x (gen C C P rec x) , gen C C P rec x
gen C (const K) P rec k = Void
gen C (prod D D') P rec (s , t) = gen C D P rec s , gen C D' P rec t
gen C (sigma S T) P rec (s , t) = gen C (T s) P rec t
gen C (pi S T) P rec f = \ s -> gen C (T s) P rec (f s)
fix : (D : Desc)(P : Mu D -> Set)
(rec : (y : [| D |] Mu D) -> aux D D P y -> P (con y))
(x : Mu D) -> P x
fix D P rec (con x) = rec x (gen D D P rec x)
plus : Nat -> Nat -> Nat
plus (con (Ze , Void)) n = n
plus (con (Suc , m)) n = suc (plus m n)
fib : Nat -> Nat
fib = fix NatD (\ _ -> Nat) help
where
help : (m : [| NatD |] Nat) -> aux NatD NatD (\ _ -> Nat) m -> Nat
help (Ze , x) a = suc ze
help (Suc , con (Ze , _)) a = suc ze
help (Suc , con (Suc , con n)) (fib-n , (fib-sn , a)) = plus fib-n fib-sn |
> module FastSimpleProb.Operations
> import FastSimpleProb.SimpleProb
> import FastSimpleProb.BasicOperations
> import FastSimpleProb.MonadicProperties
> import NonNegDouble.NonNegDouble
> import NonNegDouble.BasicOperations
> import Rel.TotalPreorder
> import NonNegDouble.LTEProperties
> import List.Operations
> import List.Properties
> import Fun.Operations
> import Double.Predicates
> %default total
> %access public export
> %auto_implicits off
> |||
> mostProbableProb : {A : Type} -> (Eq A) => SimpleProb A -> (A, NonNegDouble)
> mostProbableProb {A} sp = argmaxMax totalPreorderLTE aps neaps where
> aps : List (A, NonNegDouble)
> aps = map (pair (id, (prob sp))) (nub (support sp))
> nes : List.Operations.NonEmpty (support sp)
> nes = mapPreservesNonEmpty fst (toList sp) (nonEmptyLemma1 sp)
> nens : List.Operations.NonEmpty (nub (support sp))
> nens = nubPreservesNonEmpty (support sp) nes
> neaps : List.Operations.NonEmpty aps
> neaps = mapPreservesNonEmpty (pair (id, (prob sp))) (nub (support sp)) nens
> |||
> mostProbable : {A : Type} -> (Eq A) => SimpleProb A -> A
> mostProbable = fst . mostProbableProb
> |||
> maxProbability : {A : Type} -> (Eq A) => SimpleProb A -> NonNegDouble
> maxProbability = snd . mostProbableProb
> |||
> sortToList : {A : Type} -> (Eq A) => SimpleProb A -> List (A, NonNegDouble)
> sortToList {A} sp = sortBy ord aps where
> aps : List (A, NonNegDouble)
> aps = map (pair (id, (prob sp))) (nub (support sp))
> ord : (A, NonNegDouble) -> (A, NonNegDouble) -> Ordering
> ord (a1, pa1) (a2, pa2) = compare (toDouble pa1) (toDouble pa2)
> |||
> naiveMostProbableProb : {A : Type} -> SimpleProb A -> (A, NonNegDouble)
> naiveMostProbableProb sp = argmaxMax totalPreorderLTE (toList sp) (nonEmptyLemma1 sp)
> |||
> naiveMostProbable : {A : Type} -> SimpleProb A -> A
> naiveMostProbable = fst . naiveMostProbableProb
> |||
> naiveMaxProbability : {A : Type} -> SimpleProb A -> NonNegDouble
> naiveMaxProbability = snd . naiveMostProbableProb
> |||
> naiveSortToList : {A : Type} -> SimpleProb A -> List (A, NonNegDouble)
> naiveSortToList {A} sp = sortBy ord (toList sp) where
> ord : (A, NonNegDouble) -> (A, NonNegDouble) -> Ordering
> ord (a1, pa1) (a2, pa2) = if (toDouble pa1) == (toDouble pa2)
> then EQ
> else if (toDouble pa1) < (toDouble pa2)
> then GT
> else LT
> {-
> ---}
|
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.Sn.Base where
open import Cubical.HITs.Susp
open import Cubical.Foundations.Pointed
open import Cubical.Data.Nat
open import Cubical.Data.NatMinusOne
open import Cubical.Data.Empty
open import Cubical.Foundations.Prelude
S : ℕ₋₁ → Type₀
S neg1 = ⊥
S (ℕ→ℕ₋₁ n) = Susp (S (-1+ n))
S₊ : ℕ → Type₀
S₊ n = S (ℕ→ℕ₋₁ n)
-- Pointed version
S₊∙ : (n : ℕ) → Pointed₀
S₊∙ n = (S₊ n) , north
|
Require Import List.
Import ListNotations.
Require Import String.
(* Borrow from CompCert *)
Require Import Cryptol.Coqlib.
Require Import Cryptol.Bitvectors.
Require Import Cryptol.AST.
Require Import Cryptol.Semantics.
Require Import Cryptol.Utils.
Require Import Cryptol.Builtins.
Require Import Cryptol.BuiltinSem.
Require Import Cryptol.Values.
Require Import Cryptol.EvalTac.
Import HaskellListNotations.
Open Scope string.
Definition whole_prog := [(NonRecursive (Decl (0,"demote") DPrim)),(NonRecursive (Decl (1,"+") DPrim)),(NonRecursive (Decl (2,"-") DPrim)),(NonRecursive (Decl (3,"*") DPrim)),(NonRecursive (Decl (4,"/") DPrim)),(NonRecursive (Decl (5,"%") DPrim)),(NonRecursive (Decl (6,"^^") DPrim)),(NonRecursive (Decl (7,"lg2") DPrim)),(NonRecursive (Decl (9,"True") DPrim)),(NonRecursive (Decl (10,"False") DPrim)),(NonRecursive (Decl (11,"negate") DPrim)),(NonRecursive (Decl (12,"complement") DPrim)),(NonRecursive (Decl (13,"<") DPrim)),(NonRecursive (Decl (14,">") DPrim)),(NonRecursive (Decl (15,"<=") DPrim)),(NonRecursive (Decl (16,">=") DPrim)),(NonRecursive (Decl (17,"==") DPrim)),(NonRecursive (Decl (18,"!=") DPrim)),(NonRecursive (Decl (19,"===") (DExpr (ETAbs (30,"a") (ETAbs (31,"b") (EAbs (89,"f") (EAbs (90,"g") (EAbs (91,"x") (EApp (EApp (ETApp (EVar (17,"==")) (ETyp (TVar (TVBound 31 KType)))) (EApp (EVar (89,"f")) (EVar (91,"x")))) (EApp (EVar (90,"g")) (EVar (91,"x")))))))))))),(NonRecursive (Decl (20,"!==") (DExpr (ETAbs (40,"a") (ETAbs (41,"b") (EAbs (94,"f") (EAbs (95,"g") (EAbs (96,"x") (EApp (EApp (ETApp (EVar (18,"!=")) (ETyp (TVar (TVBound 41 KType)))) (EApp (EVar (94,"f")) (EVar (96,"x")))) (EApp (EVar (95,"g")) (EVar (96,"x")))))))))))),(NonRecursive (Decl (21,"min") (DExpr (ETAbs (50,"a") (EAbs (98,"x") (EAbs (99,"y") (EIf (EApp (EApp (ETApp (EVar (13,"<")) (ETyp (TVar (TVBound 50 KType)))) (EVar (98,"x"))) (EVar (99,"y"))) (EVar (98,"x")) (EVar (99,"y"))))))))),(NonRecursive (Decl (22,"max") (DExpr (ETAbs (56,"a") (EAbs (101,"x") (EAbs (102,"y") (EIf (EApp (EApp (ETApp (EVar (14,">")) (ETyp (TVar (TVBound 56 KType)))) (EVar (101,"x"))) (EVar (102,"y"))) (EVar (101,"x")) (EVar (102,"y"))))))))),(NonRecursive (Decl (23,"/\\") (DExpr (EAbs (103,"x") (EAbs (104,"y") (EIf (EVar (103,"x")) (EVar (104,"y")) (EVar (10,"False")))))))),(NonRecursive (Decl (24,"\\/") (DExpr (EAbs (105,"x") (EAbs (106,"y") (EIf (EVar (105,"x")) (EVar (9,"True")) (EVar (106,"y")))))))),(NonRecursive (Decl (25,"==>") (DExpr (EAbs (107,"a") (EAbs (108,"b") (EIf (EVar (107,"a")) (EVar (108,"b")) (EVar (9,"True")))))))),(NonRecursive (Decl (26,"&&") DPrim)),(NonRecursive (Decl (27,"||") DPrim)),(NonRecursive (Decl (28,"^") DPrim)),(NonRecursive (Decl (29,"zero") DPrim)),(NonRecursive (Decl (30,"<<") DPrim)),(NonRecursive (Decl (31,">>") DPrim)),(NonRecursive (Decl (32,"<<<") DPrim)),(NonRecursive (Decl (33,">>>") DPrim)),(NonRecursive (Decl (34,"#") DPrim)),(NonRecursive (Decl (35,"splitAt") DPrim)),(NonRecursive (Decl (36,"join") DPrim)),(NonRecursive (Decl (37,"split") DPrim)),(NonRecursive (Decl (38,"reverse") DPrim)),(NonRecursive (Decl (39,"transpose") DPrim)),(NonRecursive (Decl (40,"@") DPrim)),(NonRecursive (Decl (41,"@@") DPrim)),(NonRecursive (Decl (42,"!") DPrim)),(NonRecursive (Decl (43,"!!") DPrim)),(NonRecursive (Decl (44,"update") DPrim)),(NonRecursive (Decl (45,"updateEnd") DPrim)),(NonRecursive (Decl (46,"updates") (DExpr (ETAbs (121,"a") (ETAbs (122,"b") (ETAbs (123,"c") (ETAbs (124,"d") (EAbs (166,"xs0") (EAbs (167,"idxs") (EAbs (168,"vals") (EWhere (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (ETyp (TCon (TF TCAdd) [TCon (TC (TCNum 1)) [],TVar (TVBound 124 KNum)]))) (ETyp (TCon (TC TCSeq) [TVar (TVBound 121 KNum),TVar (TVBound 122 KType)]))) (ETyp (TCon (TC (TCNum 0)) []))) (EVar (169,"xss"))) (ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 0)) []))) (ETyp (TCon (TC (TCNum 0)) [])))) [(Recursive [(Decl (169,"xss") (DExpr (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (ETyp (TCon (TC (TCNum 1)) []))) (ETyp (TVar (TVBound 124 KNum)))) (ETyp (TCon (TC TCSeq) [TVar (TVBound 121 KNum),TVar (TVBound 122 KType)]))) (EList [(EVar (166,"xs0"))])) (EComp (EApp (EApp (EApp (ETApp (ETApp (ETApp (EVar (44,"update")) (ETyp (TVar (TVBound 121 KNum)))) (ETyp (TVar (TVBound 122 KType)))) (ETyp (TVar (TVBound 123 KNum)))) (EVar (170,"xs"))) (EVar (171,"i"))) (EVar (172,"b"))) [[(From (170,"xs") (EVar (169,"xss")))],[(From (171,"i") (EVar (167,"idxs")))],[(From (172,"b") (EVar (168,"vals")))]]))))])]))))))))))),(NonRecursive (Decl (47,"updatesEnd") (DExpr (ETAbs (156,"a") (ETAbs (157,"b") (ETAbs (158,"c") (ETAbs (159,"d") (EAbs (177,"xs0") (EAbs (178,"idxs") (EAbs (179,"vals") (EWhere (EApp (EApp (ETApp (ETApp (ETApp (EVar (42,"!")) (ETyp (TCon (TF TCAdd) [TCon (TC (TCNum 1)) [],TVar (TVBound 159 KNum)]))) (ETyp (TCon (TC TCSeq) [TVar (TVBound 156 KNum),TVar (TVBound 157 KType)]))) (ETyp (TCon (TC (TCNum 0)) []))) (EVar (180,"xss"))) (ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 0)) []))) (ETyp (TCon (TC (TCNum 0)) [])))) [(Recursive [(Decl (180,"xss") (DExpr (EApp (EApp (ETApp (ETApp (ETApp (EVar (34,"#")) (ETyp (TCon (TC (TCNum 1)) []))) (ETyp (TVar (TVBound 159 KNum)))) (ETyp (TCon (TC TCSeq) [TVar (TVBound 156 KNum),TVar (TVBound 157 KType)]))) (EList [(EVar (177,"xs0"))])) (EComp (EApp (EApp (EApp (ETApp (ETApp (ETApp (EVar (45,"updateEnd")) (ETyp (TVar (TVBound 156 KNum)))) (ETyp (TVar (TVBound 157 KType)))) (ETyp (TVar (TVBound 158 KNum)))) (EVar (181,"xs"))) (EVar (182,"i"))) (EVar (183,"b"))) [[(From (181,"xs") (EVar (180,"xss")))],[(From (182,"i") (EVar (178,"idxs")))],[(From (183,"b") (EVar (179,"vals")))]]))))])]))))))))))),(NonRecursive (Decl (48,"fromThen") DPrim)),(NonRecursive (Decl (49,"fromTo") DPrim)),(NonRecursive (Decl (50,"fromThenTo") DPrim)),(NonRecursive (Decl (51,"infFrom") DPrim)),(NonRecursive (Decl (52,"infFromThen") DPrim)),(NonRecursive (Decl (53,"error") DPrim)),(NonRecursive (Decl (54,"pmult") DPrim)),(NonRecursive (Decl (55,"pdiv") DPrim)),(NonRecursive (Decl (56,"pmod") DPrim)),(NonRecursive (Decl (57,"random") DPrim)),(NonRecursive (Decl (61,"take") (DExpr (ETAbs (214,"front") (ETAbs (215,"back") (ETAbs (216,"elem") (EAbs (212,"__p1") (EWhere (EVar (214,"x")) [(NonRecursive (Decl (213,"__p2") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (35,"splitAt")) (ETyp (TVar (TVBound 214 KNum)))) (ETyp (TVar (TVBound 215 KNum)))) (ETyp (TVar (TVBound 216 KType)))) (EVar (212,"__p1")))))),(NonRecursive (Decl (214,"x") (DExpr (ESel (EVar (213,"__p2")) (TupleSel 0))))),(NonRecursive (Decl (215,"__p0") (DExpr (ESel (EVar (213,"__p2")) (TupleSel 1)))))])))))))),(NonRecursive (Decl (62,"drop") (DExpr (ETAbs (231,"front") (ETAbs (232,"back") (ETAbs (233,"elem") (EAbs (219,"__p4") (EWhere (EVar (222,"y")) [(NonRecursive (Decl (220,"__p5") (DExpr (EApp (ETApp (ETApp (ETApp (EVar (35,"splitAt")) (ETyp (TVar (TVBound 231 KNum)))) (ETyp (TVar (TVBound 232 KNum)))) (ETyp (TVar (TVBound 233 KType)))) (EVar (219,"__p4")))))),(NonRecursive (Decl (221,"__p3") (DExpr (ESel (EVar (220,"__p5")) (TupleSel 0))))),(NonRecursive (Decl (222,"y") (DExpr (ESel (EVar (220,"__p5")) (TupleSel 1)))))])))))))),(NonRecursive (Decl (63,"tail") (DExpr (ETAbs (249,"a") (ETAbs (250,"b") (EAbs (225,"xs") (EApp (ETApp (ETApp (ETApp (EVar (62,"drop")) (ETyp (TCon (TC (TCNum 1)) []))) (ETyp (TVar (TVBound 249 KNum)))) (ETyp (TVar (TVBound 250 KType)))) (EVar (225,"xs"))))))))),(NonRecursive (Decl (64,"width") (DExpr (ETAbs (255,"bits") (ETAbs (256,"len") (ETAbs (257,"elem") (EAbs (229,"__p6") (ETApp (ETApp (EVar (0,"demote")) (ETyp (TVar (TVBound 256 KNum)))) (ETyp (TVar (TVBound 255 KNum))))))))))),(NonRecursive (Decl (65,"undefined") (DExpr (ETAbs (260,"a") (EApp (ETApp (ETApp (EVar (53,"error")) (ETyp (TVar (TVBound 260 KType)))) (ETyp (TCon (TC (TCNum 9)) []))) (EList [(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 117)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 110)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 100)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 101)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 102)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 105)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 110)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 101)) []))) (ETyp (TCon (TC (TCNum 8)) []))),(ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 100)) []))) (ETyp (TCon (TC (TCNum 8)) [])))])))))),(NonRecursive (Decl (66,"groupBy") (DExpr (ETAbs (265,"each") (ETAbs (266,"parts") (ETAbs (267,"elem") (ETApp (ETApp (ETApp (EVar (37,"split")) (ETyp (TVar (TVBound 266 KNum)))) (ETyp (TVar (TVBound 265 KNum)))) (ETyp (TVar (TVBound 267 KType)))))))))),(NonRecursive (Decl (68,"trace") DPrim)),(NonRecursive (Decl (69,"traceVal") (DExpr (ETAbs (273,"n") (ETAbs (274,"a") (EAbs (240,"msg") (EAbs (241,"x") (EApp (EApp (EApp (ETApp (ETApp (ETApp (EVar (68,"trace")) (ETyp (TVar (TVBound 273 KNum)))) (ETyp (TVar (TVBound 274 KType)))) (ETyp (TVar (TVBound 274 KType)))) (EVar (240,"msg"))) (EVar (241,"x"))) (EVar (241,"x")))))))))),(NonRecursive (Decl (242,"x") (DExpr (ETAbs (283,"a") (EAbs (249,"v") (EApp (ETApp (EVar (29,"zero")) (ETyp (TCon (TC TCFun) [TVar (TVBound 283 KType),TCon (TC TCSeq) [TCon (TC (TCNum 16)) [],TCon (TC TCBit) []]]))) (EVar (249,"v")))))))),(NonRecursive (Decl (243,"xprop") (DExpr (ETAbs (290,"") (EAbs (250,"v") (EApp (EApp (ETApp (EVar (17,"==")) (ETyp (TCon (TC TCSeq) [TCon (TC (TCNum 16)) [],TCon (TC TCBit) []]))) (EApp (ETApp (EVar (242,"x")) (ETyp (TVar (TVBound 290 KType)))) (EVar (250,"v")))) (ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 0)) []))) (ETyp (TCon (TC (TCNum 16)) []))))))))),(NonRecursive (Decl (244,"y") (DExpr (EAbs (251,"a") (EAbs (252,"b") (EApp (EApp (ETApp (EVar (29,"zero")) (ETyp (TCon (TC TCFun) [TCon (TC TCSeq) [TCon (TC (TCNum 12)) [],TCon (TC TCBit) []],TCon (TC TCFun) [TCon (TC TCSeq) [TCon (TC (TCNum 4)) [],TCon (TC TCBit) []],TCon (TC TCSeq) [TCon (TC (TCNum 17)) [],TCon (TC TCBit) []]]]))) (EVar (251,"a"))) (EVar (252,"b")))))))),(NonRecursive (Decl (245,"yprop") (DExpr (EAbs (253,"v") (EAbs (254,"w") (EApp (EApp (ETApp (EVar (17,"==")) (ETyp (TCon (TC TCSeq) [TCon (TC (TCNum 17)) [],TCon (TC TCBit) []]))) (EApp (EApp (EVar (244,"y")) (EVar (253,"v"))) (EVar (254,"w")))) (ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 0)) []))) (ETyp (TCon (TC (TCNum 17)) []))))))))),(NonRecursive (Decl (246,"t1") (DExpr (EApp (ETApp (EVar (242,"x")) (ETyp (TCon (TC TCSeq) [TCon (TC (TCNum 4)) [],TCon (TC TCBit) []]))) (ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 13)) []))) (ETyp (TCon (TC (TCNum 4)) []))))))),(NonRecursive (Decl (247,"t2") (DExpr (EApp (EApp (EVar (244,"y")) (ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 2)) []))) (ETyp (TCon (TC (TCNum 12)) [])))) (ETApp (ETApp (EVar (0,"demote")) (ETyp (TCon (TC (TCNum 3)) []))) (ETyp (TCon (TC (TCNum 4)) [])))))))].
Definition ge := bind_decl_groups whole_prog gempty.
Definition t1 : ident := (246,"t1").
Definition t2 : ident := (247,"t2").
|
(*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*)
(* License: BSD, terms see file ./LICENSE *)
theory Addr_Type
imports "~~/src/HOL/Word/Word"
begin
type_synonym addr_bitsize = "64"
type_synonym addr = "addr_bitsize word"
definition addr_bitsize :: nat where "addr_bitsize \<equiv> 64"
definition addr_align :: nat where "addr_align \<equiv> 2"
declare addr_align_def[simp]
definition addr_card :: nat where
"addr_card \<equiv> card (UNIV::addr set)"
declare addr_bitsize_def[simp]
lemma addr_card:
"addr_card = 2^addr_bitsize"
by (simp add: addr_card_def card_word)
lemma len_of_addr_card:
"2 ^ len_of TYPE(addr_bitsize) = addr_card"
by (simp add: addr_card)
lemma of_nat_addr_card [simp]:
"of_nat addr_card = (0::addr)"
by (simp add: addr_card)
end
|
\documentclass[main.tex]{subfiles}
\begin{document}
\section{T-products and Wick's theorem}
\marginpar{Saturday\\ 2020-6-13, \\ compiled \\ \today}
We have shown up to now that in order to describe an interacting QFT it is sufficient to:
\begin{enumerate}
\item know the free evolution of the fields, which is governed by \(H_0 \) and described in the Heisenberg picture;
\item be able to calculate the time-evolution operator up to an arbitrary perturbative order with \eqref{eq:dyson-series}.
\end{enumerate}
When we write the Hamiltonian, we always mean the \textbf{normal-ordered} Hamiltonian.
\begin{definition}
The \(S\)-matrix evolution operator is given by:
%
\begin{subequations} \label{eq:s-matrix}
\begin{align}
S = U_I (- \infty , \infty )
&= T \qty[\exp(-i \int_{- \infty }^{\infty } \dd{\tau }H _{\text{int}}^{I} (\tau ))] \\
&= T \qty[\exp(-i \int \dd[4]{x} \mathscr{H} _{\text{int}}^{I} (x))]
\,.
\end{align}
\end{subequations}
\end{definition}
This object describes all the interaction that can happen over all of time (this is used when describing actual interactions, temporal infinity is asymptotically the same as the particles flying away and not interacting anymore).
In the calculation of such an object, we will need to compute products such as
%
\begin{align}
T \qty[\mathscr{H} _{\text{int}}^{I}(x_1 ) \mathscr{H} _{\text{int}}^{I}(x_2 )]
= T \qty[ N[\overline{\psi} \slashed{A} \psi ]_{x_1 }N[\overline{\psi} \slashed{A} \psi ]_{x_2 }]
\,,
\end{align}
%
where we wrote the QED interaction Hamiltonian density. The way to compute these objects is to make use of \textbf{Wick's theorem}.
\subsection{Wick theorem for a real scalar field}
We start from the simplest case and then generalize to more complex ones.
\begin{definition}
The \textbf{Feynman propagator} for a real scalar field is defined as
%
\begin{align}
D_F (x-y) = \bra{0} T[\varphi (x) \varphi (y)] \ket{0}
= \contraction{}{\varphi}{(x)}{\varphi }
\varphi (x) \varphi (y)
\,.
\end{align}
\end{definition}
Now, from the definition of the time-ordered product we have that
%
\begin{subequations}
\begin{align}
D_F (x-y) &=
[x_0 > y_0 ]
\bra{0} \varphi (x) \varphi (y) \ket{0}
+
[x_0 < y_0 ]
\bra{0} \varphi (y) \varphi (x) \ket{0} \\
&=
[x_0 > y_0 ]
\bra{0} \varphi_{+} (x) \varphi_{-} (y) \ket{0}
+
[x_0 < y_0 ]
\bra{0} \varphi_{+} (y) \varphi_{-} (x) \ket{0} \\
&=
[x_0 > y_0 ]
D_+ (x-y)
-
[x_0 < y_0 ]
D_- (x-y)
\,,
\end{align}
\end{subequations}
%
since \(\varphi_{+} \ket{0} = 0\) and \(\bra{0} \varphi_{-} = 0 \), as \(\varphi_{+} \sim a\) and \(\varphi_{-} \sim a ^\dag\).
Here \(D_{\pm}\) are the components of the covariant commutator defined in section \ref{sec:covariant-commutators}.
Then, the crucial statement is that
\begin{claim}
\begin{align}
T [\varphi (x) \varphi (y)] = N[\varphi (x) \varphi (y)] + D_F (x-y)
\,.
\end{align}
\end{claim}
\begin{proof}
We prove this by writing the term \(T[\varphi \varphi ] - N[ \varphi \varphi ]\) explicitly: we get
%
\begin{subequations}
\begin{align}
& T[\varphi (x)\varphi (y)] - N[\varphi (x) \varphi (y)] = \\
\begin{split}
&= [x_0 > y_0 ] \qty(\varphi (x) \varphi (y)) + [x_0 < y_0 ] \qty(\varphi (y) \varphi (x)) \\
&
- \qty([x_0 > y_0 ] + [x_0 < y_0 ]) N [\varphi (x)\varphi (y)]
\end{split} \\
\begin{split}
&=
[x_0 > y_0 ] \qty(\varphi_{-} (x) \varphi_{-} (y) + \varphi_{+} (x) \varphi_{+} (y) + \varphi_{-} (x) \varphi_{+} (y) + \hlc{teal}{\varphi_{+} (x) \varphi_{-} (y)}) \\
&
+
[x_0 < y_0 ] \qty(\varphi_{-} (y) \varphi_{-} (x) + \varphi_{+} (y) \varphi_{+} (x) + \varphi_{-} (y) \varphi_{+} (x) + \hlc{teal}{\varphi_{+} (y) \varphi_{-} (x)})
\\
&
-
[x_0 > y_0 ]
\qty(\varphi_{-} (x) \varphi_{-} (y) + \varphi_{+} (x) \varphi_{+} (y) + \varphi_{-} (x) \varphi_{+} (y) + \hlc{teal}{\varphi_{-} (y) \varphi_{+} (x)} )
\\
&
-
[x_0 < y_0 ]
\qty(\varphi_{-} (x) \varphi_{-} (y) + \varphi_{+} (x) \varphi_{+} (y) + \varphi_{-} (x) \varphi_{+} (y) + \hlc{teal}{\varphi_{-} (y) \varphi_{+} (x)} )
\end{split} \\
&= [x_0 > y_0 ] \qty(\varphi_{+} (x) \varphi_{-} (y) - \varphi_{-} (y) \varphi_{+} (x))
- [x_0 < y_0 ] \qty(\varphi_{-} (x) \varphi_{+} (y) - \varphi_{+}(y) \varphi_{-}(x)) \\
&=
[x_0 > y_0 ]
D_+ (x-y)
-
[x_0 < y_0 ]
D_- (x-y) \\
&= D_F (x-y)
\,.
\end{align}
\end{subequations}
\end{proof}
Wick's theorem for scalar fields is the generalization of this result to \(n\) fields:
It states that
%
\begin{subequations}
\begin{align}
\begin{split}
T [\varphi (x_1 ) \varphi (x_2 ) \dots \varphi (x_n)]
&=
N [\varphi (x_1 ) \varphi (x_2 )\dots \varphi (x_n)] \\
&+ \sum_{i} N[\varphi (x_1 )\dots \varphi (x_{i-1}) D_F (x_i- x_{i+1}) \varphi (x_{i+2}) \dots \varphi (x_n)] \\
&+ \sum _{ij}
N[\varphi (x_1 )\dots \varphi (x_{i-1}) D_F (x_i- x_{i+1}) \varphi (x_{i+2}) \dots \\
& \dots \varphi (x_{j-1}) D_F (x_j- x_{j+1}) \varphi (x_{j+2}) \dots \varphi (x_n)] \\
&+ \text{all possible contractions}
\,.
\end{split}
\end{align}
\end{subequations}
A \textbf{corollary} of Wick's theorem states that contractions of fields evaluated at the same time do not contribute to the \(T\)-product. Formally, this is stated as:
%
\begin{align}
T \qty[N[\varphi (x) \varphi (x)] \varphi (x_1 )\dots \varphi (x_n)]
= T \qty[\varphi^2(x) \varphi (x_1 )\dots \varphi (x_n)] _{\text{NCET}}
\,,
\end{align}
%
where the left hand side contains No Contractions at Equal Time --- that is, when we compute the time-ordered product using Wick's theorem we ignore the contractions we would have to compute at equal time.
\begin{proof}
The product \(N[\varphi (x) \varphi (x)]\) can be written, by Wick's theorem, as
%
\begin{align}
N[\varphi (x) \varphi (x)] = T[\varphi (x) \varphi (x)] - D_F (x - x)
\,,
\end{align}
%
where \(T[\varphi (x) \varphi (x)] = \varphi (x) \varphi (x)\). So, if we multiply by the field at the other times and take the time-ordering we find
%
\begin{align}
T \qty[N[\varphi (x) \varphi (x)] \varphi (x_1 )\dots \varphi (x_n)]
= T[\varphi^2(x) \varphi_1 (x) \dots \varphi_n (x)]
- D_F(x-x) T[\varphi_1 (x) \dots \varphi_n (x)]
\,,
\end{align}
%
and the term containing \(D_F( x-x)\) is precisely a contraction at equal time, which we ignore.
\end{proof}
This statement can be \textbf{generalized} to complex scalar fields and to vector fields.
\begin{definition}
For a complex scalar field \(\varphi \), the Feynman propagator is given by
%
\begin{align}
D_F (x-y) = \bra{0} T [\varphi (x) \varphi ^\dag (x)] \ket{0}
\,.
\end{align}
\end{definition}
\begin{claim}
This is the same function which was calculated for the real scalar field; one can show that the other contractions vanish:
%
\begin{align}
\bra{0} T[\varphi (x) \varphi (x)] \ket{0}
= 0 =
\bra{0} T[\varphi ^\dag(x) \varphi ^\dag (x)] \ket{0}
\,.
\end{align}
\end{claim}
\begin{proof}
\todo[inline]{Still to state properly, but this is due to the fact that \(a\) (\(a ^\dag\)) and \(b\) (\(b ^\dag\)) commute with each other, whereas \(a\) does not commute with \(a ^\dag\).}
\end{proof}
\begin{definition}
For a real vector field \(A^{\mu }\) and a complex vector field \(\omega^{\mu }\) the Feynman propagator reads:
%
\begin{subequations}
\begin{align}
D^{\mu \nu }_{F, \text{ real}} (x-y) &= \bra{0} T[A^{\mu }(x) A^{\nu }(y) ]\ket{0} \\
D^{\mu \nu }_{F, \text{ complex}} (x-y) &= \bra{0} T[\omega^{\mu }(x) \omega^{\nu \dag}(y) ]\ket{0}
\,.
\end{align}
\end{subequations}
\end{definition}
\begin{claim}
In the Feynman gauge \(\xi = 1\) we have that
%
\begin{align}
D^{\mu \nu }_{F} (x-y) = [x_0 > y_0 ]
D^{\mu \nu }_{+ } (x-y)
+
[x_0 < y_0 ]
D^{\mu \nu }_{-}(x-y)
= - \eta^{\mu \nu } D_F (x-y)
\,.
\end{align}
\end{claim}
Note that for a complex vector field the propagators between \(\omega^{\mu } \omega^{\nu }\) and \(\omega^{\mu \dag} \omega^{\nu \dag}\) vanish.
The Wick theorem generalizes to the complex scalar, and to the real and complex vector: we have
%
\begin{subequations}
\begin{align}
T[\varphi (x) \varphi ^\dag (y)] &= N[\varphi (x) \varphi ^\dag (y)] + D_F (x-y) \\
T[A^{\mu } (x) A^{\nu } (y)] &= N[A^{\mu } (x) A^{\nu } (y)] + D_F^{\mu \nu } (x-y) \\
T[\omega^{\mu } (x) \omega^{\nu \dag} (y)] &= N[\omega^{\mu } (x) \omega^{\nu \dag } (y)] + D_F^{\mu \nu } (x-y)
\,.
\end{align}
\end{subequations}
\subsection{Feynman propagator for fermions}
For fermionic fields the discussion gets a little more complicated because of the minus signs coming from the anticommutators.
\begin{definition}
The Feynman propagator for fermions is defined as
%
\begin{align}
S^{F}_{\alpha \beta } (x-y)
&= \bra{0}T[\psi_{\alpha }(x) \overline{\psi}_{\beta }(y)] \ket{0}
= - \bra{0} T[\overline{\psi}_\alpha (x) \psi_{\beta }(y)] \ket{0}
\,.
\end{align}
\end{definition}
\begin{claim}
We have the following expression for the propagator:
%
\begin{subequations}
\begin{align}
S_F(x-y) &= [x_0 > y_0 ] S_+ (x-y) - [x_0 < y_0 ] S_- (x-y) \\
&= \qty(i \slashed{\partial} + m) D_F (x-y)
\,.
\end{align}
\end{subequations}
\end{claim}
\begin{claim}
Wick's theorem holds in this case as well:
%
\begin{align}
T[\psi_{\alpha }(x) \overline{\psi}_{\beta }(y)]
= N [\psi_{\alpha }(x) \overline{\psi}_{\beta }(y)]
+ S^{F}_{\alpha \beta }
\,.
\end{align}
\end{claim}
\begin{proof}
Let us write explicitly the difference \(T[\psi \overline{\psi}] - N[\psi \overline{\psi}]\). We find something that is similar to the scalar case, but there is a crucial difference: instead of commuting operators when we switch them around for normal or time ordering, we anticommute them, so we swap their positions and change the sign. This then yields:
%
\begin{subequations}
\begin{align}
&T[\psi_{\alpha } (x) \overline{\psi}_{\beta } (y)] - N[\psi_{\alpha } (x) \overline{\psi}_{\beta } (y)] = \\
\begin{split}
&=
[x_0 > y_0 ] \qty(
\psi_{\alpha }^{-} (x) \overline{\psi}^{-}_{\beta }(y)+
\psi_{\alpha }^{+} (x) \overline{\psi}^{+}_{\beta }(y)+
\psi_{\alpha }^{-} (x) \overline{\psi}^{+}_{\beta }(y)+
\psi_{\alpha }^{+} (x) \overline{\psi}^{-}_{\beta }(y)
) \\
&-
[x_0 < y_0 ]\qty(
\overline{\psi}_{\beta }^{-} (y) \psi^{-}_{\alpha } (x)+
\overline{\psi}_{\beta }^{+} (y) \psi^{+}_{\alpha } (x)+
\overline{\psi}_{\beta }^{-} (y) \psi^{+}_{\alpha } (x)+
\overline{\psi}_{\beta }^{+} (y) \psi^{-}_{\alpha } (x)
) \\
&-
[x_0 > y_0 ] \qty(
\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{-}(y)+
\psi_{\alpha }^{+}(x) \overline{\psi}_{\beta }^{+}(y)+
\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)-
\overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
)\\
&-
[x_0 < y_0 ] \qty(
\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{-}(y)+
\psi_{\alpha }^{+}(x) \overline{\psi}_{\beta }^{+}(y)+
\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)-
\overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
)
\end{split}\\
\begin{split}
&= [x_0 > y_0 ]\qty(
\psi_{\alpha }^{-} (x) \overline{\psi}^{+}_{\beta }(y)+
\psi_{\alpha }^{+} (x) \overline{\psi}^{-}_{\beta }(y)-
\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)+
\overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
) \\
&+
[x_0 < y_0 ]\bigg(-
\overline{\psi}_{\beta }^{-} (y) \psi^{-}_{\alpha } (x)-
\overline{\psi}_{\beta }^{+} (y) \psi^{+}_{\alpha } (x)-
\overline{\psi}_{\beta }^{-} (y) \psi^{+}_{\alpha } (x)-
\overline{\psi}_{\beta }^{+} (y) \psi^{-}_{\alpha } (x)+\\
&\phantom{=}\
-\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{-}(y)-
\psi_{\alpha }^{+}(x) \overline{\psi}_{\beta }^{+}(y)-
\psi_{\alpha }^{-}(x) \overline{\psi}_{\beta }^{+}(y)+
\overline{\psi}_{\beta }^{-}(y) \psi_{\alpha }^{+}(x)
\bigg)
\end{split}
\,.
\end{align}
\end{subequations}
\todo[inline]{To finish calculation}
\end{proof}
\subsection{General statement of Wick's theorem}
We denote by \(B_i (x_i)\) a generic field, which may be real or complex, of spin 0, \(1/2\) or 1. Then, Wick's theorem states that \textbf{the \(T\)-product of \(n\) such fields can be written as}:
%
\begin{subequations}
\begin{align}
\begin{split}
& T[B_1 (x_1 ) B_2 (x_2 ) \dots B_n (x_n)]= \\
&= N[B_1 (x_1 ) B_2 (x_2 ) \dots B_n (x_n)] \\
&+ \sum _{ij} (-)^{P_{ij}}
N[ \dots \bcontraction{}{B}{_i (x_i)}{B}
B_i(x_i)B_j(x_j) \dots] \\
&+ \sum _{ijkl} (-)^{P_{ij}+P_{kl}} N[\dots \bcontraction{}{B}{_i (x_i)}{B}
B_i(x_i)B_j(x_j) \dots \bcontraction{}{B}{_k (x_k)}{B}
B_k(x_k)B_l(x_l) \dots] \\
&+ \dots \,,
\end{split}
\end{align}
\end{subequations}
%
where \(P_{ij}\) is the number of fermion operator swaps we need to perform to bring \(B_i\) and \(B_j\) to the front; the normal-ordered product with \(\hat{B}_i\) means that it is taken removing \(B_i\).
Note that, while we are summing over all possible pairings, the only nonvanishing propagators are those between two copies of the same field.
We have the same \textbf{corollary} as before: normal-ordered contractions of fields at the same time do not contribute; we have
%
\begin{align}
T \qty[N[B_1 (x) B_2 (x)] B_3 (x_3 ) \dots B_n (x_n)]
= T \qty[B_1 (x) B_2 (x) B_3 (x_3) \dots B_n (x_n)]_{NCET}
\,.
\end{align}
\subsection{Feynman propagators}
The Feynman propagators play a central role in the perturbative expansion. What is their physical interpretation?
\subsubsection{Real scalar}
As we saw, the propagator for a real scalar field can be written in terms of the Vacuum Expectation Value of the fields as:
%
\begin{align}
D_F(x-y) = [x_0 > y_0 ] \bra{0} \varphi_+ (x) \varphi_{-} (y) \ket{0}
+ [x_0 < y_0 ] \bra{0}\varphi_{+} (y) \varphi_{-}(x) \ket{0}
\,.
\end{align}
What do these pieces mean? Let us first consider the case where \(x_0 > y_0 \): then we only have
%
\begin{align}
D_F (x-y) = \bra{0} \varphi_{+} (x) \varphi_{-} (y) \ket{0} \sim \bra{0} a a ^\dag \ket{0}
\,,
\end{align}
%
which can be read from right to left as:
\begin{enumerate}
\item we start from the vacuum \(\ket{0}\);
\item we apply the operator \(\varphi_{-} (y)\), which creates a particle of indeterminate momentum at the position \(y\);
\item the particle is destroyed at the position \(x\) by the operator \(\varphi_{+}(x)\);
\item we return to the vacuum state \(\bra{0}\).
\end{enumerate}
This can be represented graphically as shown in
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{feynman}
\vertex (y) {\(y\)};
\vertex [below right = 2cm and 2cm of y] (x) {\(x\)};
\vertex [right = 4cm of y] (y0) {\(y_0 \)};
\vertex [below right = 2cm and 4cm of y] (x0) {\(x_0 \)};
\diagram*{
(y) -- [scalar, momentum] (x),
(y0) -- [fermion, edge label = \(t\)] (x0)
};
\end{feynman}
\end{tikzpicture}
\caption{Virtual scalar particle. Time is shown as going downward, the diagram shows the virtual scalar particle being created at \(y\) and then destroyed at \(x\).}
\label{fig:virtual-scalar-particle-diagram-1}
\end{figure}
Now, let us consider the other case: \(x_0 < y_0 \). Now, the second term contributes, so we have
%
\begin{align}
D_F (x-y) = \bra{0} \varphi_{+} (y) \varphi_{-} (x) \ket{0} \sim \bra{0} a a ^\dag \ket{0}
\,,
\end{align}
%
so we can interpret it again as:
\begin{enumerate}
\item we start from the vacuum \(\ket{0}\);
\item we apply the operator \(\varphi_{-} (x)\), which creates a particle of indeterminate momentum at the position \(x\);
\item the particle is destroyed at the position \(y\) by the operator \(\varphi_{+}(y)\);
\item we return to the vacuum state \(\bra{0}\).
\end{enumerate}
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\begin{feynman}
\vertex (x) {\(x\)};
\vertex [below left = 2cm and 2cm of x] (y) {\(y\)};
\vertex [right = 2cm of x] (x0) {\(x_0 \)};
\vertex [below right = 2cm and 2cm of x] (y0) {\(y_0 \)};
\diagram*{
(x) -- [scalar, momentum] (y),
(x0) -- [fermion, edge label = \(t\)] (y0)
};
\end{feynman}
\end{tikzpicture}
\caption{Virtual scalar particle. Time is shown as going downward, the diagram shows the virtual scalar particle being created at \(x\) and then destroyed at \(y\).}
\label{fig:virtual-scalar-particle-diagram-2}
\end{figure}
Neither of these two is Lorentz invariant; however the full propagator is. So, we depict it as shown in figure \ref{fig:virtual-scalar-particle-diagram}.
\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = y to x]{
y [particle=\(y\)] -- [scalar, momentum=\(a\), reversed momentum'=\(a\)] x [particle=\(x\)]
};
\caption{Scalar virtual particle. Time goes either upward or downward.}
\label{fig:virtual-scalar-particle-diagram}
\end{figure}
% \todo[inline]{What does \(a\) mean here?}
A note of caution: the diagrammatic approach is nice but it does not represent the physical trajectory of a particle, since it does not enforce it being on shell.
Nevertheless, just like a quantum particle can tunnel through a potential barrier higher than its energy, the propagator describes a probabilistic physical process.
\subsubsection{Explicit calculation of the scalar propagator}
Starting from the expression we derived in an earlier chapter for the propagator \eqref{eq:scalar-field-propagator} as an integral in momentum space, we can write
%
\begin{subequations}
\begin{align}
D_F (x-y) &= [x_0 > y_0 ] D_+ (x-y) + [x_0 < y_0 ] D_- (x-y) \\
&= \frac{1}{(2 \pi )^3} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\qty[[x_0 > y_0 ] e^{-ik(x-y)} + [x_0 < y_0 ] e^{ik(x-y)}] \\
&= i \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}}\frac{e^{-ik(x-y)}}{k^2-m^2}\\
&= \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}} \widetilde{D}_{F} (k) e^{-ik (x-y)} \label{eq:fermion-propagator-momentum-space}
\,.
\end{align}
\end{subequations}
This defines the scalar propagator in momentum space
%
\begin{align}
\widetilde{D}_{F}(k) = \frac{i}{k^2- m^2}
\,,
\end{align}
%
while the integration region is \(\mathbb{R}^{3}\) for the coordinates \(\vec{k}\), and for the coordinate \(k^{0}\) it is a contour following the real axis rightward, except for circling the singularity \(k_0 = - \omega_{k}\) from below, and \(k^{0} = \omega_{k}\) from above.
This shows explicitly that the propagator \emph{must} represent an \textbf{off-shell} particle: we must have \(k^2 \neq m^2\), otherwise the propagator diverges.
\subsubsection{Complex scalar field}
For the complex scalar field we have that
%
\begin{subequations}
\begin{align}
\varphi_{+} &\sim a(k) e^{-ikx}
&
\varphi_{-} &\sim b ^\dag(k) e^{ikx} \\
\varphi_{+}^\dag &\sim b(k) e^{-ikx}
&
\varphi_{-}^\dag &\sim a ^\dag(k) e^{ikx}
\,.
\end{align}
\end{subequations}
So, the propagator is given by
%
\begin{subequations}
\begin{align}
D_F (x-y) &= \bra{0} T [\varphi (x) \varphi ^\dag (y)] \ket{0} \\
&= [x_0 > y_0 ] \bra{0} \varphi_{+} (x) \varphi_{-}^\dag(y) \ket{0}
+ [x_0 < y_0 ] \bra{0} \varphi_{+}^\dag(y) \varphi_{-}(x) \ket{0}
\,,
\end{align}
\end{subequations}
%
since we get the only nonvanishing contributions when we have coupled operators together, such as \(a \) and \(a ^\dag\).
So, if \(x_0 > y_0 \) we have the particle \(a\) propagating from \(y\) to \(x\), while if \(x_0 < y_0 \) the antiparticle \(b\) propagates from \(x\) to \(y\).
Then, we can draw our diagram as shown in figure \ref{fig:virtual-charged-scalar-particle-diagram}: the arrow denotes the direction of propagation of the virtual particle \(a\), while the antiparticle \(b\) propagates in the other direction.
\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = x to y]{
x [particle=\(x\)] -- [charged scalar, momentum=\(a\), reversed momentum'=\(b\)] y [particle=\(y\)]
};
\caption{Scalar charged virtual particle. Time goes either upward or downward.}
\label{fig:virtual-charged-scalar-particle-diagram}
\end{figure}
\begin{claim}
While the real scalar particle propagator is symmetric:
%
\begin{align}
D_F^{\mathbb{R}} (x-y) =D_F^{\mathbb{R}} (y-x)
\,,
\end{align}
%
the complex scalar particle propagator is not:
%
\begin{align}
D_F^{\mathbb{C}} (x-y) \neq D_F^{\mathbb{C}} (y-x)
\,.
\end{align}
\end{claim}
\begin{proof}
The expression for the real scalar field propagator is explicitly symmetric under \(x \leftrightarrow y\), while for the complex field the term with \(x_0 > y_0 \) depends on \(a\), while the other one depends on \(b\).
\end{proof}
Because of this, we need to have an arrow to represent the direction of the particle flow.
\subsubsection{Propagator for a real vector}
The interpretation in this case is similar to the real scalar: the propagator is written as
%
\begin{subequations}
\begin{align}
D^{\mu \nu }_{F} (x-y) &= \bra{0} T[A^{\mu }(x) A^{\nu }(y)] \ket{0} \\
&= [x_0 > y_0 ] \bra{0} A^{\mu }_{+}(x) A^{\nu }_{-}(y) \ket{0}
+ [x_0 < y_0 ] \bra{0} A^{\nu }_{+} y A^{\mu }_{-}(x) \ket{0}
\,.
\end{align}
\end{subequations}
This is represented diagrammatically as shown in figure \ref{fig:virtual-photon-diagram}.
\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = y to x]{
y [particle={\(y\), \(\nu \)}] -- [photon, momentum=, reversed momentum'=] x [particle={\(x\), \(\mu \)}]
};
\caption{Virtual photon.}
\label{fig:virtual-photon-diagram}
\end{figure}
Since the vector field has an index, this index must be attached to both of the points.
The explicit expression for the photon propagator is given by
%
\begin{align}
D^{\mu \nu }_{F} (x-y) = \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}}
e^{-ik(x-y)} \widetilde{D}^{\mu \nu }_{F} (k) \overset{\xi = 1}{=} - \eta^{\mu \nu } D_F (x-y)
\,,
\end{align}
%
where the momentum-space propagator is generally given by
%
\begin{align}
\widetilde{D}^{\mu \nu }_{F} (k) = - \frac{i}{k^2} \qty(\eta^{ \mu \nu } - (1 - \xi ) \frac{k^{\mu }k^{\nu }}{k^2})
\overset{\xi = 1}{=}
- i \frac{\eta^{\mu \nu }}{k^2}
\,.
\end{align}
The integration circuit is the same one we had in the scalar case; now \(\omega_{k} = \abs{k}\) since the photon is massless.
The \textbf{complex vector} does not have any more complications than those found in combining the complex scalar and the real vector.
\subsubsection{Propagator for a fermion}
We have seen that the definition of the propagator for a Dirac fermion is
%
\begin{subequations}
\begin{align}
S^{\alpha \beta }_{F}(x-y)
&= \bra{0} T \qty[ \psi^{\alpha } (x) \overline{\psi}^{\beta }(y)] \ket{0} \\
&= [x_0 > y_0 ]
\bra{0} \psi_{+}^{\alpha }(x) \overline{\psi}_{-}^{\beta } (y)\ket{0}
- [x_0 < y_0 ]
\bra{0} \overline{\psi}^{\beta }_{+}(y) \psi^{\alpha }_{-}(x) \ket{0}
\,.
\end{align}
\end{subequations}
The interpretation now follows that of the complex scalar field, since the fermion is complex-valued.
If \(x_0 > y_0 \), we only have the first piece:
%
\begin{align}
S^{\alpha \beta }_{F} (x-y) = \bra{0} \psi_{+}^{\alpha }(x) \overline{\psi}_{-}^{\beta } (y)\ket{0}
\,,
\end{align}
%
and since \(\psi_{+} \sim c\), while \(\psi_{-} \sim c ^\dag\), this represents a particle of type \(c\) being created and then annihilated.
We represent this with a full line with an arrow, going in the same direction as the particle.
The contribution we have when \(x_0 < y_0 \), on the other hand, is given by
%
\begin{align}
S^{\alpha \beta }_{F}(x- y) =
- \bra{0} \overline{\psi}^{\beta }_{+}(y) \psi^{\alpha }_{-}(x) \ket{0}
\,.
\end{align}
This is represented with a full line as well, and now the arrow goes in the opposite direction to the antiparticle. This is because \(\overline{\psi}_{+} \sim d\), while \(\psi_{-} \sim d ^\dag\). So, the total (Lorentz-invariant) propagator is represented as shown in figure \ref{fig:virtual-photon-diagram}.
\begin{figure}[ht]
\centering
\feynmandiagram [horizontal = y to x]{
y [particle={\(y\), \(\beta\)}] -- [fermion, momentum={\(e^{-} = c\)}, reversed momentum'={\(e^{+} = d\)}] x [particle={\(x\), \(\alpha \)}]
};
\caption{Virtual fermion.}
\label{fig:virtual-fermion-diagram}
\end{figure}
The analytic expression for the propagator in position and momentum space is given by:
%
\begin{subequations}
\begin{align}
S_F (x-y) &= \int_{C_F} \frac{ \dd[4]{k}}{(2 \pi )^{4}} e^{-ik (x-y)}
\widetilde{S}_{F} (k) = \qty(i \slashed{\partial} + m )D_F(x-y) \\
S_F (k) &= \frac{i}{\slashed{k} - m} = i \frac{\slashed{k} + m }{k^2- m^2} \label{eq:fermion-propagator-momentum-space-explicit}
\,.
\end{align}
\end{subequations}
Note that these integrals are often written in an \textbf{equivalent} way, using the \(+i \epsilon \) prescription:
%
\begin{subequations}
\begin{align}
D_F (x-y) &= \int \frac{ \dd[4]{k}}{(2 \pi )^{4}} \frac{e^{-ik(x-y)}}{k^2- m^2 + i \epsilon } \\
\widetilde{D}_{F} &= \frac{i}{k^2- m^2 + i \epsilon }
\,,
\end{align}
\end{subequations}
%
where the integral is now straight along the real axis for the coordinate \(k_0 \); this way of writing is equivalent as long as we send \(\epsilon \to 0 \). Instead of integrating around the poles, we integrate straight and move the poles out of the way.\footnote{Like a galactic highway.}
\subsection{Uncontracted fields: physical interpretation}
In the expansion of the time-ordered product with the use of Wick's theorem we get contractions of fields (propagators) and normal-ordered products of uncontracted fields. What is the physical interpretation oof the latter?
\subsubsection{Uncontracted real scalar field}
We only have two possible terms: \(\varphi_{+}\) and \(\varphi_{-}\).
The first of these can be written as
%
\begin{subequations}
\begin{align}
\varphi_{+}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a(k) e^{-ikx} \\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
a -- [scalar, momentum = \(a\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}
So, we interpret it as a particle of intederminate momentum being annihilated at \(x\).
On the other hand, we have
\begin{subequations}
\begin{align}
\varphi_{-}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a ^\dag(k) e^{ikx} \\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
x [particle = \(x\)] -- [scalar, reversed momentum = \(a\)] a
};
\end{align}
\end{subequations}
So, \(\varphi_{-} (x)\) represents a particle being created ad \(x\) with indeterminate momentum.
\subsubsection{Uncontracted complex scalar field}
Now we have:
\begin{subequations}
\begin{align}
\varphi_{+}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a(k) e^{-ikx} \\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
a -- [charged scalar, momentum = \(a\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}
\begin{subequations}
\begin{align}
\varphi_{-} ^\dag(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
a ^\dag(k) e^{ikx} \\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
x [particle = \(x\)] -- [charged scalar, reversed momentum = \(a\)] a
};
\end{align}
\end{subequations}
\begin{subequations}
\begin{align}
\varphi_{+} ^\dag(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
b(k) e^{-ikx} \\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
a -- [anti charged scalar, momentum = \(b\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}
\begin{subequations}
\begin{align}
\varphi_{-} (x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
b ^\dag(k) e^{ikx} \\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
x [particle = \(x\)] -- [anti charged scalar, reversed momentum = \(b\)] a
};
\end{align}
\end{subequations}
Notice that the arrow tracks the direction in which the charge flows.
\subsubsection{Uncontracted real vector field}
The interpretation is always the same, I will write all the diagrams for completeness.
%
\begin{subequations}
\begin{align}
A^{\mu }_{+}(x) &= \frac{1}{(2\pi )^{3/2}}
\int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{\lambda } \epsilon^{\mu}_{\lambda } (k )a_{\lambda }(k) e^{-ikx} \\
&= \feynmandiagram[inline=(a.base), horizontal = a to x]{
a -- [photon, momentum] x [particle={\(x\), \(\mu \)}]
};
\end{align}
\end{subequations}
%
%
\begin{subequations}
\begin{align}
A^{\mu }_{-}(x) &= \frac{1}{(2\pi )^{3/2}}
\int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{\lambda } \epsilon^{\mu, *}_{\lambda } (k )a ^\dag_{\lambda }(k) e^{ikx} \\
&= \feynmandiagram[inline=(x.base), horizontal = x to a]{
x [particle={\(x\), \(\mu \)}] -- [photon, momentum] a
};
\end{align}
\end{subequations}
\subsubsection{Uncontracted Dirac fermion}
\begin{subequations}
\begin{align}
\psi_{+}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} c_r (k) u_r (k) e^{-ikx}
\\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
a -- [fermion, momentum = \(c\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}
\begin{subequations}
\begin{align}
\overline{\psi}_{-}(x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} c_r ^\dag (k) \overline{u}_r (k) e^{+ikx}
\\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
x [particle = \(x\)] -- [fermion, reversed momentum = \(c\)] a
};
\end{align}
\end{subequations}
\begin{subequations}
\begin{align}
\overline{\psi}_{+} (x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} d_r (k) \overline{v}_r (k) e^{-ikx}
\\
&= \feynmandiagram[baseline=(a.base), horizontal = a to x]{
a -- [anti fermion, momentum = \(d\)] x [particle = \(x\)]
};
\end{align}
\end{subequations}
\begin{subequations}
\begin{align}
\psi_{-} (x) &= \frac{1}{(2 \pi )^{3/2}} \int \frac{ \dd[3]{k}}{\sqrt{2 \omega_{k}}}
\sum _{r} d_r ^\dag (k) v_r (k) e^{ikx}
\\
&= \feynmandiagram[baseline=(x.base), horizontal = x to a]{
x [particle = \(x\)] -- [anti fermion, reversed momentum = \(d\)] a
};
\end{align}
\end{subequations}
\end{document}
|
Let me congratulate on you on taking charge of the ministries of finance, corporate affairs and defence.
I submit that as finance minister you are inheriting the legacy of Shri James Wilson, a fee trade activist who became British India's first finance minister (called finance member then) who introduced Income Tax in India in 1860 to overcome the losses on account of the ‘Military Mutiny’ of 1857 by Indian revolutionary soldiers and after British Government realized that it cannot govern India indirectly through the fiction of the East India Company.
I wish to draw your attention towards your article “My Call Detail Records and A Citizen’s Right to Privacy” as the Leader of Opposition, Rajya Sabha which was published in Urdu, Gujarati, Hindi and English.
Your reading about the adverse implications of the disease called biometric identification syndrome spread by automatic identification and intelligence companies through likes of Shri Nandan Nilekani is quite accurate.
I submit that your comprehension is in sync with former intelligence contractor, Shri Edward Snowden’s disclosures. General Keith Alexander, as director of USA’s National Security Agency (NSA) had instructed information gathering saying, "sniff it all, know it all, collect it all, process it all and exploit it all”. This came to light when Russia Today made available some crucial pieces of information which was edited out NBC News broadcasted interview of Shri Snowden on the night of May 28, 2014. Shri Snowden observed, “The problem with mass surveillance is that we’re piling more hay on a haystack we already don’t understand.” This is what has been attempted by Shri Nilekani and people like Shri Sam Pitroda through Public Information Infrastructure and Innovations (PIII) who headed it in the rank of a cabinet minister.
It must be noted that by Notification No. A-43011/02/2009-Adm.1 (Vol II) dated 02.07.2009 appointment of Shri Nilekani as Chairperson of UIDAI in the rank and status of a Cabinet Minister was approved for an initial tenure 5 years. On March 5, 2014, Lok Sabha election dates were announced. On 09.03.2014, Shri Nilekani officially joined Indian National Congress without resigning from the post of Chairman, UIDAI. He wrote a letter to the Prime Minister relinquishing the post of Chairman, UIDAI vide ref.no. Chairman / 34/2013-UIDAI on 13.03.2014 but his resignation as accepted on 18.03.2014 by the ‘competent authority’ in Planning Commission, Government of India vide Notification no. F.6 /2009-Adm.I, with retrospective effect from March 13, 2014.
I submit that Shri Nilekani has been caught red handed in violation of the Central Civil Services (Conduct) Rules 1964. Under Rule 5 of the Rules regarding “Taking part in politics and elections” reads: “No Government servant shall be a member of, or be otherwise associated with, any political party or any organisation which takes part in politics nor shall he take part in, subscribe in aid of, or assist in any other manner, any political movement or activity.” While implicitly and informally Shri Nilekani functioned as a member of the Indian National Congress from July 2, 2009 but between March 9, 2014 and March 18, 2014, he functioned totally illegally and illegitimately by throwing all norms to the dustbin with impunity so far.
I wish to submit how biometric aadhhar is linked to Goods and Services Tax Network (GSTN). It may be noted that the sovereign function of the tax administration is being transferred to Goods and Services Tax Network, a private body. This approach appears to have no parallel anywhere in the world.
I submit that a New Indian Express story ‘Aadhar cut down to size, data mining projects raise concerns’ (Sept 29, 2013) underlined how NIUs like GSTN are linked to biometric UID/aadhaar number. Supreme Court’s verdict on the legitimacy, legality and constitutionality of this identifier is likely to impact NIUs as well.
I submit that no taxation without political representation was the battle cry of the American Revolution. The issue is how GST can be imposed when there is no political representation in the GSTN. Chief Ministers of all non-Congress States and all the non-Congress parties be vigilant against the subversion of hard earned rights of true political representation in matters of taxation. Amidst opposition from Chief Ministers and officials from the Central Board of Excise and Customs (CBEC), GSTN is meant for controlling all new indirect tax data from the Centre and states.
It is noteworthy that Tamil Nadu Chief Minister Dr J Jayalalithaa had sent a letter dated August 18, 2011 to non-Congress Chief Ministers urging them to stridently oppose the introduction of a Goods and Services Tax (GST). She argued that it would affect the fiscal autonomy of States. In the light of the proposal for GSTN, Dr Jayalalithaa’s opposition has been proven right because as per the plan, entire individual data—direct and indirect taxes—including registration, return and payment by taxpayers will be in custody of a NIU. It is a case of handing over of public data to a private entity. It is akin to day light robbery.
I submit that your predecessors have at the Finance Ministry have compelled the CBEC and Central Board of Direct Taxes (CBDT) to sign MoU for the sharing of data. This is to ensure that GSTN will be able to access and process the entire tax data-both direct and indirect taxes. It has asked the CBEC to hand over the processing of data for tax surveillance to GSTN. This has been done without any security or privacy safeguards.
I submit that such initiatives will lead to handing over the control over indirect and direct tax data to GSTN for tax profiling and surveillance without any legislation passed by Parliament, the personal sensitive information like biometric data is being handed over to UIDAI and its partner companies like Accenture from USA and Safran from France. This undermines citizens’ sovereignty, states’ autonomy and national security for good.
I submit that in April 2013, a number of news reports announced that the Government has ‘decided to set up a special purpose vehicle to provide information technology support to various stakeholders under the proposed Goods and Services Tax (GST)’. The Goods and Services Tax is a value-added tax that is expected to replace all indirect taxes on goods and services imposed by the Centre and Indian states. The special purpose vehicle has been named the Goods and Services Tax Network (GSTN), is seen as an important step in ushering in a little understood but much touted reform, because it will make it possible to bring together taxation data from the Centre and states that was so far processed separately. The GSTN is already in place as a private limited company despite strong opposition by senior officials of the Central Board of Excise and Customs (CBEC), and Shri Naveen Kumar, former chief secretary of Bihar, has been appointed chairman. This body will control all new indirect tax data from the Centre and states and will have access to past data as well. The charges it will impose for processing this data will be the revenue that sustains its operations.
I submit that since the Finance Ministry headed by your predecessors directed the CBEC and Central Board of Direct Taxes (CBDT) to sign MoU for the sharing of data, Goods and Services Tax Network will be able to access and process the entire tax data of the country, both of direct and indirect taxes. Obviously, this should have been a matter for far more public debate than it has evoked, but the actual process of setting up Goods and Services Tax Network is far more alarming than this broad outline. Since it will have to be in place before the Goods and Services Tax is rolled out, the Finance Ministry has asked the CBEC to hand over the processing of data for tax surveillance to Goods and Services Tax Network, which would ensure it a revenue stream as soon as it takes over these functions.
As a result, Goods and Services Tax Network body will be the sole information hub for linking and processing all of India’s tax data, something that has never been attempted by the Government, leave alone a private entity. This is being done in the absence of any security or privacy provisions in place.
I submit that in January 2011, the Technology Advisory Group for Unique Projects (TAGUP) headed by Shri Nilekani recommended the setting up of five infotech intensive financial projects—for the Income Tax Department, National Pension Scheme, Reserve Bank of India, and for tracking government expenditure and Goods and Services Tax Network for the Goods and Services Tax. A similar structure for each of the five was proposed, a not-for-profit Section 25 company, with a self-sustaining revenue model, where the Government’s holding would be restricted to 49 per cent and private institutional holding set at 51 per cent.
Having gone through relevant documents, I submit that the not-for-profit structure of GSTN means that before the company can sustain itself by levying user fees, it needs funds to hire the staff. Private investors—Housing Development Finance Corp Ltd, HDFC Bank Ltd, LIC Housing Finance Ltd, ICICI Bank Ltd and NSE Strategic Investment Corp Ltd—have no incentive to provide the necessary money. Therefore, GSTN has been set up on equity of just Rs 10 crore and the Government has provided it a one-time grant of Rs 315 crore. In effect, the government has funded a start-up that it does not even have majority control of.
I submit that despite the issue of money required, since GSTN is already in place as a self-sustaining body, it needs sources of revenue other than those that would be eventually generated from receiving and processing Goods and Services Tax data. This is unfolding as a result of the recommendations of the Empowered Group on IT Infrastructure for Goods and Services Tax headed by Shri Nilekani.
I submit that in November 2011, when the CBEC was brought fully into the picture, Ms Sheila Sangwan, then Member had summarised the problems with the Empowered Group’s proposals: ‘…a meeting was held wherein ‘There was unanimity amongst the officers present that the sovereign function to be performed by the tax administration should be kept out of the purview of the GST’ and GSTN, a private body. Ms Sangwan had pointed out that much the same could be done through a government-controlled body that would outsource computing requirements but would not lose control over the data. This has the advantage of retaining the security and privacy safeguards and legal controls that already exist for such data.
I submit that these apprehensions of senior officers of the CBEC have been set aside. In fact security at GSTN due to private control is worrisome. It is clear that tax profiling and surveillance has been handed over to GSTN without any legal mandate, the way biometric aadhaar unfolded.
I submit that this signals movement towards a regime where the country’s entire tax data will be accessible through a body which will be in no position to guarantee security standards.
I submit that likes of Shri Nilekani have been allowed to distort language and commit linguistic corruption to take away the sovereign function of tax collection from the Government and hand it over to National Information Utilities (NIUs) which is purported to be a private company with public purpose and which has profit making as motive but not profit maximizing.
I submit that in his book which was first published in 2008, Shri Nilekani is deeply worried because “zeroing in on a definite identity for each citizen particularly difficult, since each government department works as a different turf and with different groups of people.” He argues that “Our databases are in these disconnected silos” and states that “NIUs would be databases that amass information…” which will connect all these “disconnected silos”.
I submit that in this unprecedented move country’s most sensitive financial data -entire tax data of Indians has been turned over to a private firm, set up as a special purpose vehicle (SPV) named GSTN, an IT company on the recommendations of Shri Nilekani headed panel. GSTN is supposed to provide information technology support under the proposed Goods and Services Tax (GST). There is no provision for data security in it.
As you are aware GST is a value-added tax which is expected to replace all indirect taxes on goods and services imposed by the Centre and Indian states. GST will replace the State VAT, Central Excise, Service Tax and a few other indirect taxes will be a broad-based, single, comprehensive tax levied on goods and services. It will be levied at every stage of the production-distribution chain by giving the benefit of Input Tax Credit (ITC) of the tax remitted at previous stages. GST is based on a destination-based taxation system, where tax is levied on final consumption. It is expected to broaden the tax base, foster a common market across the country, reduce compliance costs, and promote exports. The GST will be a dual tax with levy by both Central and State tax administrations on the same base. The GST demands a well-designed and robust IT system for realizing its potential in reforming indirect taxation in India. The IT system for GST would be a unique project, which will integrate the Central and State tax administration.
I submit that while presenting the Union Budget in 2011-12, the then Union Finance Minister Pranab Mukherjee informed the Lok Sabha that Technology Advisory Group for Unique Projects (TAGUP) headed by Shri Nilekani, Chairman, Unique Identification Authority of India (UIDAI) which submitted its report dated January 31, 2011 and its recommendations have been accepted in principle. Other members of the TAG UP included Shri C. B. Bhave Chairman, SEBIR, Shri Chandrasekhar, Secretary, Department of Telecommunications, Shri Dhirendra Swarup, Former Chairman, PFRDAS, Shri S. Khan Former Member, CBDTP. Shri R. V. Ramanan Former Member, CBEC and Dr. Nachiket Mor Chairman, IFMR Trust.
I wish to reiterate that NIU is manifestly an exercise in linguistic corruption with the aim of ‘building a coalition for change’.
The TAG UP report reveals, “GSTN is an NIU that is being set up to serve multiple levels of Governments (Central and State) in GST”. It also states that “The IT Strategy for GST was defined and accepted within Government even before the NIU was selected.” It is noteworthy that IT Strategy for GST was also defined by Shri Nilekani.
I submit that in November 2011, Ms Sheila Sangwan, Member (Budget and Computerisation), had summarised the problems with the GSTN related proposals: ‘…a meeting was held on 14/15 November 2011 in the Chairman’s office (Shri S K Goel) to discuss the structure and functions of the proposed GSTN… Dr Nandan Nilekani has mentioned as minuted that there is need to go in for the SPV even without GST being introduced. ..There was unanimity amongst the officers present that the sovereign function to be performed by the tax administration should be kept out of the purview of the GST.’ It was noted that ‘Across the tax administration in the world, the privacy of taxpayer data is accorded utmost priority and it is the practice to house this data in Government hands…’ So far Chairman of CBEC has not addressed the essential question of who would be the repository of the data.
The question is why is CBEC made to hurry to comply with the whims and fancies of Shri Nilekani and his coalition partners given the fact that Nilekani has never taken oath of office and secrecy?
I submit that Shri Naveen Kumar, the head of GSTN when was asked about control of the data said, “We will start from scratch with our own servers and beginning with a list of dealers we will start building a database of transactions on our system. For this, we do not need additional data from the Customs or any other department.” It is quite evident that servers of GSTN, a private company will be stored in a Grid of sort.
I submit that as Finance Minister Shri Pranab Mukherjee announced that India has “voluntarily sought a full-fledged Financial Sector Assessment Programme” from International Monetary Fund (IMF) and the World Bank in January, 2011. This is similar to the voluntariness displayed in the drafting of Sixth Plan (1980-1985) after secret negotiations with the Bank.
I wish to draw your attention towards a chapter ‘Extended and Specialized Lending,’ in Silent Revolution The International Monetary Fund 1979–1989 by James M. Boughton published by IMF in October 2001, it is revealed that Congress Prime Minister Indira Gandhi “gave the go-ahead to enter into secret negotiations” with IMF, following which on November 25, 1980, Shri R.N. Malhotra, Secretary, Economic Affairs, Ministry of Finance “visited the Managing Director at the Fund to signal his country’s interest in obtaining a credit arrangement under the Extended Fund Facility (EFF) that offered the option of longer-term credits. The first negotiating mission went to New Delhi in January 1981, led by Tun Thin, Director of the Asian Department. The then Finance Minister, Shri R. Venkataraman, met with IMF’s Managing Director in Washington and subsequently signed and submitted the Letter of Intent on September 28, 1981. Following the IMF’s approval for EFF, Indian National Congress led government faced massive criticism for subjecting itself to IMF’s conditionality.
I submit that in an exercise of sophistry, this Congress led government argued that “the EFF arrangement did not impose conditionality at all, because it was fully consistent with the policies that were already incorporated in the Sixth Five-Year Plan” and after having internalized the conditionality imposed by IMF, Mrs Indira Gandhi informed the Parliament that “the arrangement does not force us to borrow, nor shall we borrow unless it is for the national interest. There is absolutely no question of our accepting any programme which is incompatible with our policy, declared and accepted by Parliament. It is inconceivable that anybody should think that we would accept assistance from any external agency which dictates terms which are not in consonance with such policies.” This IMF publication unequivocally establishes that Mrs Indira Gandhi lied to the Parliament and misled the nation.
I submit that GSTN is being created with an ulterior motive to bring it under the financial sector surveillance program of the IMF, World Bank Group in continuation of the policies pursued since the days of Mrs Indira Gandhi. These policies have made India servile to the dictates of the Bank. GSTN helps the World Bank Group to make deeper inroads and erode the financial sovereignty of the country in complicity with the ministers of the Congress party. The new government must reverse this trend in national interest.
I submit that Foreign Policy magazine of the Washington Post Company listed Shri Nilekani, apparently a protégé of Shri Mukherjee as one of the Top 100 Global Thinkers in 2010. This was prior to disclosures about invasion of privacy by intelligence agencies of USA and UK by monitoring emails, web searches, and telephone records. And the disclosures by Wikileaks about the keen interest of US administration in the aadhaar project. It appears that Shri Nilekani undertook their task by collating biometric data of India. It is admitted his well wishers like the President of World Bank have volunteered his services to other developing countries as well. This was done in April 2013 at World Bank in Washington.
I submit that in October 2012, in an interview with McKinsey & Company, Shri Nilekani said, “Our goal, our vision, is by 2014 to have at least half a billion people on the system, which will make it one of the world’s largest online ID infrastructures. So that’s one metric of success. The second is we’d like to see two or three major applications that use this ID infrastructure. One of them is electronic benefit transfer, where governments will pay pensions, scholarships, or whatever entitlements by cash. And the third is [that] the mobile industry will use [the ID infrastructure] for verification”.
He added, “In the US, to me, the two big examples are the Internet, which was originally conceived as a defense project, and GPS. Again, it was a defense project. Both these things, though they began as [part of] a government defense infrastructure, today are the basis for huge innovation.” Shri Nilekani was/is aware that the substratum of the “world’s largest online ID infrastructures” is Internet which is in total control of US Government and US companies.
b) Copy of contract of UIDAI with M/s Accenture for Biometric Technology"
After examining these documents I wrote to UIDAI submitting that with regard to the M/s Accenture for Biometric Technology, I noticed that the first 237 pages appear to be in order but after that there is a one pager titled Annexure J Technical Bid Technical Bid as submitted by M/s Accenture Services Pvt Ltd. The Technical Bid document is missing. After that there is a one pager titled Annexure K Commercial Bid as submitted by M/s Accenture Services Pvt Ltd. The Commercial Bid document is missing.
Company Private Limited. The Commercial Bid document is missing. These very pages were missing from the contract agreement of Ernst and Young as well. Also its pagination was not in order.
I also wrote to CIC responding to their letter dated September 10, 2013 stating that their reasoning for sharing the document due to "contractual obligation in respect of BSP (Biometric Solution Provider) contracts" having expired is flawed in the light of the previous judgment of Central Information Commission (CIC). Under the Right to Information (RTI) Act, the Public Information Officer (PIO) cannot deny information citing commercial confidence for agreements between a public authority and private party. While giving this judgment, CIC said “The claim of 'commercial confidence' in denying access to agreements between private parties and the masters of the public authorities—citizens—runs counter to the principles of the Right to Information.
“Any agreement entered into by the government is an agreement deemed to have been entered into on behalf of and in the interest of ‘We the people’. Hence if any citizen wants to know the contents of such an agreement he is in the position of a principal asking his agent to disclose to him the terms of the agreement entered into by the agent on behalf of the principal. No agent can refuse to disclose any such information to his principal,” the CIC said in its order dated 27 July 2009. An appeal for getting the missing pages has been filed by Col. Mathew Thomas and Qaneez Sukhrani who had filed the RTI applications, the former had asked me to appear on his behalf.
I submit that there is a need to examine the minutes of the admitted meeting between Mongo DB and UIDAI. It was evident from one of the RTI replies that UIDAI had given tasks to some company with whom it had no contract agreement. Its sounds like the R&D Centre of Bhopal which was operated by Union Carbide Corporation without permission based on "recognition"
I urge you to set up an inquiry commission to ascertain whether or not Internet that remains a defense project deeply allied with USA’s National Security Agency (NSA) is structurally linked to biometric aadhaar, National Population Register (NPR), PIII and GSTN. It is not without reason that Shri Nilekani maintained a deafening silence amidst NSA’s surveillance on Indian ministers and officialdom. In such a backdrop, it does not seem strange that PMO under the previous regime has withheld the correspondence it had with Shri Nilekani all through his tenure. The commission must unearth the players who wish to create and function through a fiction of private company with public purpose and profit making as the motive but not profit maximizing called NIU like GSTN.
Let me take the opportunity to submit that the Ministry of Defense must order a probe into the circumstances under which Admiral Nirmal Kumar Verma who as the Chief of the Naval Staff of Indian Navy, from 31 August 2009 to 31 August 2012 and as Chairman, Chiefs of Staff Committee got himself biometrically profiled on 18 August 2011 for aadhaar number. It must be examined whether he took the permission of Ministry of Defence before subjecting himself to the ignominy of being biometrically profiled. It is noteworthy that in November 2012, Admiral Verma was appointed as the High Commissioner to Canada. The probe must examine whether or not Admiral Verma’s biometric profile is available with Canada’s Communications Security Establishment Canada (CSEC), which is part of the intelligence sharing alliance comprising of US, UK, Australia, Canada, New Zealand and France. In a seemingly unrelated development, Shri Nilekani was awarded an honorary Doctor of Laws degree by the Rotman School of Management at the University of Toronto, Canada on 31 May 2011.
I submit that Shri Nilekani was given ID Limelight Award at the global summit on automatic identification ID WORLD International Congress, 2010 in Milan, Italy on November 16, 2010 wherein Safran Morpho (Safran group) was a key sponsor of the ID Congress. Its subsidiary, Sagem Morpho Security Pvt Ltd has been awarded contract for the purchase of Biometric Authentication Devices on 2 February 2011 by the UIDAI. Earlier, on 30 July 2010, in a joint press release, it was announced that “the Mahindra Satyam and Morpho led consortium has been selected as one of the key partners to implement and deliver the Aadhaar program by UIDAI (Unique Identification Authority of India).” This means that at least two contracts have been awarded to the French conglomerate led consortium. Is it a coincidence that Morpho (Safran group) sponsored the award to chairman, UIDAI and the former got a contract from the latter?
It is noteworthy that Shri Tariq Malik, the then Deputy Chairman of Pakistan’s National Database Registration Authority (NADRA) was given the ID Outstanding Achievement Award on November 3, 2009 in Milan at the eighth ID WORLD International Congress.
In an interview, Shri Julian Assange, founder of WikiLeaks informed Imran Khan, a noted politician from Pakistan about the grave act of omission and commission. Shri Assange said, “…we discovered a cable in 2009 from the Islamabad Embassy. Prime minister Gilani and interior minister Malik went into the (US) embassy and offered to share National Database and Registration Authority (NADRA) – and NADRA is the national data and registration agency database. The system is currently connected through passport data but the government of Pakistan is adding voice and facial recognition capability and has installed a pilot biometric system as the Chennai border crossing, where 30,000 to 35,000 people cross each day. This NADRA system is the voting record system for all voters in Pakistan. A front company was set up in the United Kingdom – International Identity Services, which was hired as the consultants for NADRA to squirrel out the NADRA data for all of Pakistan. What do you think about that? Is that a…? It seems to me that that is a theft of some national treasure of Pakistan, the entire Pakistani database registry of its people.” The interview is available here.
It must be noted that NPR is being prepared by Shri C Chandramouli, census commissioner & registrar general of India, is meant to create resident identity cards is exactly like Pakistan’s version of biometric exercise for citizens’ identity card which was completed by NADRA, ministry of interior, Government of Pakistan and their database has been handed over to US Government.
I submit that Dr M Vijayanunni, former Census Commissioner and Registrar General of India underlined had explained reasons for China giving up a similar exercise on Rajya Sabha TV on 2 February 2013.
In view of the above, if Shri Nilekani’s initiatives including GSTN are not reversed and he is not held liable and accountable in an exemplary manner for his illegal and illegitimate conduct and creation of questionable institutional entities, it will set a very bad precedent for ever.
I will be happy to share documents and references which have been cited above.
Thanks to inform us about tax statements and know your pan card detail to take benefit of pan card. |
theory Functions
imports Main
begin
datatype 'a tree = Tip |
Node "'a tree" 'a "'a tree"
fun mirror :: "'a tree \<Rightarrow> 'a tree" where
"mirror Tip = Tip" |
"mirror (Node l a r) = Node (mirror r) a (mirror l)"
lemma mirror_mirror : "mirror (mirror t) = t"
apply(induction t)
apply(auto)
done
fun lookup :: "('a * 'b) list \<Rightarrow> 'a \<Rightarrow> 'b option" where
"lookup [] x = None" |
"lookup ((a,b)#ps) x = (if x = a then Some b else lookup ps x)"
definition sq :: "nat \<Rightarrow> nat" where
"sq n = n * n"
abbreviation sq' :: "nat \<Rightarrow> nat" where
"sq' n == n * n"
end
|
module State
import World
import Command
%default total
public export
data State : Type where
MkState : World.World -> List Command -> State
export
isOver : State -> Bool
isOver (MkState world Nil) = True
isOver (MkState world _) = didWin world
|
[STATEMENT]
lemma mult_less_multiset\<^sub>D\<^sub>M: "(M, N) \<in> mult {(x, y). x < y} \<longleftrightarrow> less_multiset\<^sub>D\<^sub>M M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ((M, N) \<in> mult {(x, y). x < y}) = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
unfolding multp_def[of "(<)", symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
using multp_eq_multp\<^sub>D\<^sub>M[of "(<)", simplified]
[PROOF STATE]
proof (prove)
using this:
multp (<) = multp\<^sub>D\<^sub>M (<)
goal (1 subgoal):
1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
by (simp add: multp\<^sub>D\<^sub>M_def less_multiset\<^sub>D\<^sub>M_def) |
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p✝ q p : MvPolynomial σ R
⊢ degrees (-p) = degrees p
[PROOFSTEP]
rw [degrees, support_neg]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p✝ q p : MvPolynomial σ R
⊢ (Finset.sup (support p) fun s => ↑toMultiset s) = degrees p
[PROOFSTEP]
rfl
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p✝ q✝ : MvPolynomial σ R
inst✝ : DecidableEq σ
p q : MvPolynomial σ R
⊢ degrees (p - q) ≤ degrees p ⊔ degrees q
[PROOFSTEP]
simpa only [sub_eq_add_neg] using le_trans (degrees_add p (-q)) (by rw [degrees_neg])
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p✝ q✝ : MvPolynomial σ R
inst✝ : DecidableEq σ
p q : MvPolynomial σ R
⊢ degrees p ⊔ degrees (-q) ≤ degrees p ⊔ degrees q
[PROOFSTEP]
rw [degrees_neg]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
⊢ vars (-p) = vars p
[PROOFSTEP]
simp [vars, degrees_neg]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : DecidableEq σ
⊢ vars (p - q) ⊆ vars p ∪ vars q
[PROOFSTEP]
convert vars_add_subset p (-q) using 2
[GOAL]
case h.e'_3.h.e'_4
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : DecidableEq σ
⊢ p - q = p + -q
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
case h.e'_4.h.e'_4
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : DecidableEq σ
⊢ vars q = vars (-q)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : DecidableEq σ
hpq : Disjoint (vars p) (vars q)
⊢ vars (p - q) = vars p ∪ vars q
[PROOFSTEP]
rw [← vars_neg q] at hpq
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : DecidableEq σ
hpq : Disjoint (vars p) (vars (-q))
⊢ vars (p - q) = vars p ∪ vars q
[PROOFSTEP]
convert vars_add_of_disjoint hpq using 2
[GOAL]
case h.e'_2.h.e'_4
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : DecidableEq σ
hpq : Disjoint (vars p) (vars (-q))
⊢ p - q = p + -q
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
case h.e'_3.h.e'_4
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : DecidableEq σ
hpq : Disjoint (vars p) (vars (-q))
⊢ vars q = vars (-q)
[PROOFSTEP]
simp [sub_eq_add_neg]
[GOAL]
R✝ : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R✝
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R✝
p q : MvPolynomial σ R✝
inst✝ : CommRing S
f✝ : R✝ →+* S
g : σ → S
R : Type u
c : ℤ →+* S
f : MvPolynomial R ℤ →+* S
x : MvPolynomial R ℤ
⊢ eval₂ c (↑f ∘ X) x = ↑f x
[PROOFSTEP]
apply
MvPolynomial.induction_on x
(fun n => by
rw [hom_C f, eval₂_C]
exact eq_intCast c n)
(fun p q hp hq => by
rw [eval₂_add, hp, hq]
exact (f.map_add _ _).symm)
(fun p n hp => by
rw [eval₂_mul, eval₂_X, hp]
exact (f.map_mul _ _).symm)
[GOAL]
R✝ : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R✝
e : ℕ
n✝ m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R✝
p q : MvPolynomial σ R✝
inst✝ : CommRing S
f✝ : R✝ →+* S
g : σ → S
R : Type u
c : ℤ →+* S
f : MvPolynomial R ℤ →+* S
x : MvPolynomial R ℤ
n : ℤ
⊢ eval₂ c (↑f ∘ X) (↑C n) = ↑f (↑C n)
[PROOFSTEP]
rw [hom_C f, eval₂_C]
[GOAL]
R✝ : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R✝
e : ℕ
n✝ m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R✝
p q : MvPolynomial σ R✝
inst✝ : CommRing S
f✝ : R✝ →+* S
g : σ → S
R : Type u
c : ℤ →+* S
f : MvPolynomial R ℤ →+* S
x : MvPolynomial R ℤ
n : ℤ
⊢ ↑c n = ↑n
[PROOFSTEP]
exact eq_intCast c n
[GOAL]
R✝ : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R✝
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R✝
p✝ q✝ : MvPolynomial σ R✝
inst✝ : CommRing S
f✝ : R✝ →+* S
g : σ → S
R : Type u
c : ℤ →+* S
f : MvPolynomial R ℤ →+* S
x p q : MvPolynomial R ℤ
hp : eval₂ c (↑f ∘ X) p = ↑f p
hq : eval₂ c (↑f ∘ X) q = ↑f q
⊢ eval₂ c (↑f ∘ X) (p + q) = ↑f (p + q)
[PROOFSTEP]
rw [eval₂_add, hp, hq]
[GOAL]
R✝ : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R✝
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R✝
p✝ q✝ : MvPolynomial σ R✝
inst✝ : CommRing S
f✝ : R✝ →+* S
g : σ → S
R : Type u
c : ℤ →+* S
f : MvPolynomial R ℤ →+* S
x p q : MvPolynomial R ℤ
hp : eval₂ c (↑f ∘ X) p = ↑f p
hq : eval₂ c (↑f ∘ X) q = ↑f q
⊢ ↑f p + ↑f q = ↑f (p + q)
[PROOFSTEP]
exact (f.map_add _ _).symm
[GOAL]
R✝ : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R✝
e : ℕ
n✝ m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R✝
p✝ q : MvPolynomial σ R✝
inst✝ : CommRing S
f✝ : R✝ →+* S
g : σ → S
R : Type u
c : ℤ →+* S
f : MvPolynomial R ℤ →+* S
x p : MvPolynomial R ℤ
n : R
hp : eval₂ c (↑f ∘ X) p = ↑f p
⊢ eval₂ c (↑f ∘ X) (p * X n) = ↑f (p * X n)
[PROOFSTEP]
rw [eval₂_mul, eval₂_X, hp]
[GOAL]
R✝ : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R✝
e : ℕ
n✝ m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R✝
p✝ q : MvPolynomial σ R✝
inst✝ : CommRing S
f✝ : R✝ →+* S
g : σ → S
R : Type u
c : ℤ →+* S
f : MvPolynomial R ℤ →+* S
x p : MvPolynomial R ℤ
n : R
hp : eval₂ c (↑f ∘ X) p = ↑f p
⊢ ↑f p * (↑f ∘ X) n = ↑f (p * X n)
[PROOFSTEP]
exact (f.map_mul _ _).symm
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝¹ : CommRing R
p q : MvPolynomial σ R
inst✝ : CommRing S
f✝ : R →+* S
g f : σ → S
x : σ
⊢ (fun f => ↑f ∘ X) ((fun f => eval₂Hom (Int.castRingHom S) f) f) x = f x
[PROOFSTEP]
simp only [coe_eval₂Hom, Function.comp_apply, eval₂_X]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
⊢ degreeOf x (f - g) < k
[PROOFSTEP]
classical
rw [degreeOf_lt_iff h]
intro m hm
by_contra' hc
have h := support_sub σ f g hm
simp only [mem_support_iff, Ne.def, coeff_sub, sub_eq_zero] at hm
cases' Finset.mem_union.1 h with cf cg
· exact hm (hf m cf hc)
· exact hm (hg m cg hc)
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
⊢ degreeOf x (f - g) < k
[PROOFSTEP]
rw [degreeOf_lt_iff h]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
⊢ ∀ (m : σ →₀ ℕ), m ∈ support (f - g) → ↑m x < k
[PROOFSTEP]
intro m hm
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m✝ : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
m : σ →₀ ℕ
hm : m ∈ support (f - g)
⊢ ↑m x < k
[PROOFSTEP]
by_contra' hc
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m✝ : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
m : σ →₀ ℕ
hm : m ∈ support (f - g)
hc : k ≤ ↑m x
⊢ False
[PROOFSTEP]
have h := support_sub σ f g hm
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m✝ : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h✝ : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
m : σ →₀ ℕ
hm : m ∈ support (f - g)
hc : k ≤ ↑m x
h : m ∈ support f ∪ support g
⊢ False
[PROOFSTEP]
simp only [mem_support_iff, Ne.def, coeff_sub, sub_eq_zero] at hm
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m✝ : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h✝ : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
m : σ →₀ ℕ
hc : k ≤ ↑m x
h : m ∈ support f ∪ support g
hm : ¬coeff m f = coeff m g
⊢ False
[PROOFSTEP]
cases' Finset.mem_union.1 h with cf cg
[GOAL]
case inl
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m✝ : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h✝ : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
m : σ →₀ ℕ
hc : k ≤ ↑m x
h : m ∈ support f ∪ support g
hm : ¬coeff m f = coeff m g
cf : m ∈ support f
⊢ False
[PROOFSTEP]
exact hm (hf m cf hc)
[GOAL]
case inr
R : Type u
S : Type v
σ : Type u_1
a a' a₁ a₂ : R
e : ℕ
n m✝ : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q : MvPolynomial σ R
x : σ
f g : MvPolynomial σ R
k : ℕ
h✝ : 0 < k
hf : ∀ (m : σ →₀ ℕ), m ∈ support f → k ≤ ↑m x → coeff m f = coeff m g
hg : ∀ (m : σ →₀ ℕ), m ∈ support g → k ≤ ↑m x → coeff m f = coeff m g
m : σ →₀ ℕ
hc : k ≤ ↑m x
h : m ∈ support f ∪ support g
hm : ¬coeff m f = coeff m g
cg : m ∈ support g
⊢ False
[PROOFSTEP]
exact hm (hg m cg hc)
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a✝ a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q a : MvPolynomial σ R
⊢ totalDegree (-a) = totalDegree a
[PROOFSTEP]
simp only [totalDegree, support_neg]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a✝ a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q a b : MvPolynomial σ R
⊢ totalDegree (a - b) = totalDegree (a + -b)
[PROOFSTEP]
rw [sub_eq_add_neg]
[GOAL]
R : Type u
S : Type v
σ : Type u_1
a✝ a' a₁ a₂ : R
e : ℕ
n m : σ
s : σ →₀ ℕ
inst✝ : CommRing R
p q a b : MvPolynomial σ R
⊢ max (totalDegree a) (totalDegree (-b)) = max (totalDegree a) (totalDegree b)
[PROOFSTEP]
rw [totalDegree_neg]
|
= = = Oxides and hydroxides = = =
|
function Rx=correlmx(x,p,Rxtype);
% Rx=correlmx(x,p,Rxtype) correlation matrix of a signal
%
% Rx : correlation matrix (p+1) x (p+1)
% x : analyzed signal
% p : last autocorrelation lag
% Rxtype : computation algorithm (default : 'fbhermitian')
% possible values : 'hermitian', 'fbhermitian', 'burg' or 'fbburg'
%
% example :
%
% N=100; sig=real(fmconst(N,0.1))+0.4*randn(N,1);
% Rx=correlmx(sig,2,'burg'); [v,d] = eig(Rx), acos(-0.5*v(2,1)/v(1,1))/(2*pi)
% Rx=correlmx(sig,2,'hermitian'); [v,d] = eig(Rx), acos(-0.5*v(2,1)/v(1,1))/(2*pi)
% F. Auger, july 1998.
if (nargin<2),
error('At least two parameters required');
elseif (nargin==2),
Rxtype='fbhermitian';
end;
[L,xcol]=size(x);
if xcol>1,
error('x must be a column vector');
elseif p>L,
error('L must be greater than p');
elseif p<1,
error('p must be greater than 0');
end;
Rxtype=upper(Rxtype);
if strcmp(Rxtype,'HERMITIAN')|strcmp(Rxtype,'FBHERMITIAN'),
vector=x(p+1-(0:p)); Rx=conj(vector) * vector.';
for t=p+2:L,
vector=x(t-(0:p)); Rx=Rx+conj(vector) * vector.';
end;
Rx=Rx/(L-p);
elseif strcmp(Rxtype,'BURG')|strcmp(Rxtype,'FBBURG'),
R0=sum(abs(x).^2)/L; % variance
Rpos=zeros(1,p); Rneg=zeros(1,p);
for n=1:p,
Rpos(n)=sum(x(n+1:L).*conj(x(1:L-n)))/(L-n);
Rneg(n)=sum(x(1:L-n).*conj(x(n+1:L)))/(L-n);
end;
Rx=toeplitz([R0 Rpos],[R0 Rneg]);
else error(['unknown algorithm name' Rxtype]);
end;
if strcmp(Rxtype(1:2),'FB'),
Rx=0.5*(Rx+Rx');
end;
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
[STATEMENT]
lemma mult_less_multiset\<^sub>D\<^sub>M: "(M, N) \<in> mult {(x, y). x < y} \<longleftrightarrow> less_multiset\<^sub>D\<^sub>M M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. ((M, N) \<in> mult {(x, y). x < y}) = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
unfolding multp_def[of "(<)", symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
using multp_eq_multp\<^sub>D\<^sub>M[of "(<)", simplified]
[PROOF STATE]
proof (prove)
using this:
multp (<) = multp\<^sub>D\<^sub>M (<)
goal (1 subgoal):
1. multp (<) M N = less_multiset\<^sub>D\<^sub>M M N
[PROOF STEP]
by (simp add: multp\<^sub>D\<^sub>M_def less_multiset\<^sub>D\<^sub>M_def) |
(*
Copyright (C) 2017 M.A.L. Marques
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*)
(* type: work_gga_x *)
$define gga_x_pbe_sol_params
$include "gga_x_pbe.mpl"
cc := 100:
c1 := 0.5217:
f1 := s -> f0_pbe(s)*(cc - s^4) + c1*s^3.5*(1 + s^2):
f2 := s -> cc + s^6:
f := x -> f1(X2S*x)/f2(X2S*x): |
If $f$ is convex, then $f'$ is monotone increasing. |
module Sesi
using JuMP
using Gurobi
using CSV
using DataFrames
using JSON
using IterTools
include("design.jl")
include("forecast.jl")
include("model.jl")
include("utils.jl")
end
|
<unk> : lying to harm a person 's reputation and providing opportunity to others to make false judgements concerning them .
|
setwd("P:/2019 0970 151 000/User Data/Faraz-Export IDAVE folders/Models2.5")
library(tidyverse)
library(h2o)
library(inspectdf)
tabna <- function(x){table(x, useNA = "ifany")}
##adding cihi vars
dfx <- readRDS("./dfx_v2.5.rds")
h2o.init()
dfx %>% inspect_na() %>% print(n=10)
dfx <- drop_na(dfx)
features <- read.csv("mutualInfo_features.csv")
features$X <- levels(features$X)[features$X]
names(features)[1:2] <- c("predictor", "mutInf")
features[grep("^flag", features$predictor), "is_ed"] <- FALSE
features[grep("^patserv", features$predictor), "is_ed"] <- FALSE
features[
which(features$predictor %in% c("acutelos", "scu", "prior_hosp_90d",
"prior_hosp_365d", "readm_90d")), "is_ed"] <- FALSE
features[is.na(features$is_ed), "is_ed"] <- TRUE
# sum(features$is_ed)
# [1] 37
# sum(features$is_ed[1:40])
# [1] 21
sel_feat_ed_small <- features[1:40,] %>% filter(is_ed) %>% .$predictor
sel_feat_ed_big <- features %>% filter(is_ed) %>% .$predictor
sel_feat <- features[1:40,] %>% .$predictor
df.hex <- as.h2o(dfx)
# Now that we have our tuned model and parameters, we train the models on the train sample and test
# on the hold-out test sample
df.split <- h2o.splitFrame(df.hex, ratios = c(0.8), seed = 1234)
train <- df.split[[1]]
test <- df.split[[2]]
##Loading top 5 GBM models
gbm_models <- c()
path <- "./hypeTune_results/top5_gbm_models_cv"
model_names <- grep("^GBM_model", list.files(path), value=T)
for(model in model_names){
gbm_models <- c(gbm_models, h2o.loadModel(paste(path, model, sep = "/")))
}
#Now we have 5 models that we can use their "hyperTuned" parameters
gbm_models[[1]]@parameters
# $model_id
# [1] "GBM_model_R_1623451639824_53840"
# $nfolds
# [1] 5
# $score_tree_interval
# [1] 10
# $fold_assignment
# [1] "Stratified"
# $balance_classes
# [1] TRUE
# $ntrees
# [1] 356
# $max_depth
# [1] 12
# $min_rows
# [1] 256
# $nbins_cats
# [1] 16
# $stopping_metric
# [1] "AUCPR"
# $stopping_tolerance
# [1] 1e-04
# $seed
# [1] 1234
# $learn_rate
# [1] 0.05
# $learn_rate_annealing
# [1] 0.99
# $distribution
# [1] "bernoulli"
# $sample_rate_per_class
# [1] 0.0948 0.7900
# $col_sample_rate
# [1] 0.99
# $col_sample_rate_change_per_level
# [1] 1.09
# $col_sample_rate_per_tree
# [1] 0.7
# $min_split_improvement
# [1] 0
# $histogram_type
# [1] "RoundRobin"
# $categorical_encoding
# [1] "Enum"
# $x
# [1] "rural" "female_flag" "age_grp" "triage"
# [5] "admambul" "cacsit1_grp3" "cacsitcnt1" "cacsitcnt"
# [9] "prv_grp" "prv_orthop" "frail_grp" "all_Cachx_3L"
# [13] "acutelos" "readm_90d" "flag_cardiovers" "flag_feeding_tb"
# [17] "flag_mvent_ge96" "flag_pa_nutrit" "flag_radiother" "flag_tracheost"
# [21] "flag_vasc_accdv" "scu" "dementia_comorb" "dementia_main"
# [25] "paralysis" "weightloss" "psychoses" "main_PhysInj_1L"
# [29] "main_MentBehav_1L" "main_Zfactors_1L" "main_MusclSkelt_1L" "patserv_34"
# [33] "patserv_72" "patserv_38" "patserv_17" "patserv_64"
# [37] "patserv_39" "patserv_12" "patserv_15" "patserv_36"
# $y
# [1] "alc_status"
res <- new_resultFrame()
for (i in c(1:5)){
gbm <- gbm_models[[i]]
newGBM <- do.call(h2o.gbm,
#update parameters models, original models were cross validated, no need for that now, also change predictors in here
{
p <- gbm@parameters
p$model_id = paste0("GBM_ed_small_", i)
p$training_frame = train
p$validation_frame = test
p$nfolds = NULL
p$fold_assignment = NULL
p$ntrees = 1000
p$x = sel_feat_ed_small
p$stopping_rounds = 5
p$stopping_tolerance = 1e-4
p$score_tree_interval = 10
p$sample_rate = NULL
p
})
res <- add_results(newGBM, res)
}
###Bigger just ed features
for (i in c(1:5)){
gbm <- gbm_models[[i]]
newGBM <- do.call(h2o.gbm,
#update parameters models, original models were cross validated, no need for that now, also change predictors in here
{
p <- gbm@parameters
p$model_id = paste0("GBM_ed_big_", i)
p$training_frame = train
p$validation_frame = test
p$nfolds = NULL
p$fold_assignment = NULL
p$ntrees = 1000
p$x = sel_feat_ed_big
p$stopping_rounds = 5
p$stopping_tolerance = 1e-4
p$score_tree_interval = 10
p$sample_rate = NULL
p
})
res <- add_results(newGBM, res)
}
###Now top mixed cihi and ED features
for (i in c(1:5)){
gbm <- gbm_models[[i]]
newGBM <- do.call(h2o.gbm,
#update parameters models, original models were cross validated, no need for that now, also change predictors in here
{
p <- gbm@parameters
p$model_id = paste0("GBM_ed_plusCIHI_", i)
p$training_frame = train
p$validation_frame = test
p$nfolds = NULL
p$fold_assignment = NULL
p$ntrees = 1000
p$x = sel_feat
p$stopping_rounds = 5
p$stopping_tolerance = 1e-4
p$score_tree_interval = 10
p$sample_rate = NULL
p
})
res <- add_results(newGBM, res)
}
write.csv(res, "./Final Results/gbm_plusMinusCihi.csv", row.names=F)
######
# Now for the Random Forest models
rf_models <- c()
path <- "./hypeTune_results/top5_RF_models_cv"
model_names <- grep("^DRF_model", list.files(path), value=T)
for(model in model_names){
rf_models <- c(rf_models, h2o.loadModel(paste(path, model, sep = "/")))
}
#Now we have 5 models that we can use their "hyperTuned" parameters
newRF <- c()
for (i in c(2:5)){
rf_model <- rf_models[[i]]
newRF<- c( newRF, do.call(h2o.randomForest,
#update parameters models, original models were cross validated, no need for that now, also change predictors in here
{
p <- rf_model@parameters
p$model_id = paste0("RF_ed_small_", i)
p$training_frame = train
p$validation_frame = test
p$nfolds = NULL
p$fold_assignment = NULL
p$ntrees = 1000
p$x = sel_feat_ed_small
p$stopping_rounds = 5
p$stopping_tolerance = 1e-4
p$score_tree_interval = 10
p$sample_rate = NULL
p$mtries <- as.integer(p$mtries / 40 * length(p$x)) #as the features sizes is changing, using mtries as a percentage
p
}))
res <- add_results(newRF[[i]], res)
}
###
for (i in c(1:5)){
rf_model <- rf_models[[i]]
newRF<- c( newRF, do.call(h2o.randomForest,
#update parameters models, original models were cross validated, no need for that now, also change predictors in here
{
p <- rf_model@parameters
p$model_id = paste0("RF_ed_big_", i)
p$training_frame = train
p$validation_frame = test
p$nfolds = NULL
p$fold_assignment = NULL
p$ntrees = 1000
p$x = sel_feat_ed_big
p$stopping_rounds = 5
p$stopping_tolerance = 1e-4
p$score_tree_interval = 10
p$sample_rate = NULL
p$mtries <- as.integer(p$mtries / 40 * length(p$x)) #as the features sizes is changing, using mtries as a percentage
p
}))
res <- add_results(newRF[[i+10]], res)
}
for (i in c(6:10)){
res <- add_results(newRF[[i]], res)
}
for (i in c(1:5)){
rf_model <- rf_models[[i]]
newRF<- c( newRF, do.call(h2o.randomForest,
#update parameters models, original models were cross validated, no need for that now, also change predictors in here
{
p <- rf_model@parameters
p$model_id = paste0("RF_ed_plusCIHI_", i)
p$training_frame = train
p$validation_frame = test
p$nfolds = NULL
p$fold_assignment = NULL
p$ntrees = 1000
p$x = sel_feat
p$stopping_rounds = 5
p$stopping_tolerance = 1e-4
p$score_tree_interval = 10
p$sample_rate = NULL
p$mtries <- as.integer(p$mtries / 40 * length(p$x)) #as the features sizes is changing, using mtries as a percentage
p
}))
res <- add_results(newRF[[i]], res)
}
write.csv(res, "./Final Results/gbmANDrf_plusMinusCihi.csv", row.names=F)
|
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
p : X = Y
⊢ X ⟶ Y
[PROOFSTEP]
rw [p]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
p : X = Y
⊢ Y ⟶ Y
[PROOFSTEP]
exact 𝟙 _
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Z : C
p : X = Y
q : Y = Z
⊢ eqToHom p ≫ eqToHom q = eqToHom (_ : X = Z)
[PROOFSTEP]
cases p
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Z : C
q : X = Z
⊢ eqToHom (_ : X = X) ≫ eqToHom q = eqToHom (_ : X = Z)
[PROOFSTEP]
cases q
[GOAL]
case refl.refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X : C
⊢ eqToHom (_ : X = X) ≫ eqToHom (_ : X = X) = eqToHom (_ : X = X)
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Y' : C
p : Y = Y'
f : X ⟶ Y
g : X ⟶ Y'
h : f ≫ eqToHom p = g
⊢ f = (f ≫ eqToHom p) ≫ eqToHom (_ : Y' = Y)
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Y' : C
p : Y = Y'
f : X ⟶ Y
g : X ⟶ Y'
h : f = g ≫ eqToHom (_ : Y' = Y)
⊢ f ≫ eqToHom p = g
[PROOFSTEP]
simp [eq_whisker h (eqToHom p)]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X X' Y : C
p : X = X'
f : X ⟶ Y
g : X' ⟶ Y
h : eqToHom p ≫ g = f
⊢ g = eqToHom (_ : X' = X) ≫ eqToHom p ≫ g
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X X' Y : C
p : X = X'
f : X ⟶ Y
g : X' ⟶ Y
h : g = eqToHom (_ : X' = X) ≫ f
⊢ eqToHom p ≫ eqToHom (_ : X' = X) ≫ f = f
[PROOFSTEP]
simp [whisker_eq _ h]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort ?u.2415
f g : β → C
z : (b : β) → f b ⟶ g b
j j' : β
w : j = j'
⊢ g j = g j'
[PROOFSTEP]
simp [w]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort ?u.2415
f g : β → C
z : (b : β) → f b ⟶ g b
j j' : β
w : j = j'
⊢ f j = f j'
[PROOFSTEP]
simp [w]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort u_1
f g : β → C
z : (b : β) → f b ⟶ g b
j j' : β
w : j = j'
⊢ z j ≫ eqToHom (_ : g j = g j') = eqToHom (_ : f j = f j') ≫ z j'
[PROOFSTEP]
cases w
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort u_1
f g : β → C
z : (b : β) → f b ⟶ g b
j : β
⊢ z j ≫ eqToHom (_ : g j = g j) = eqToHom (_ : f j = f j) ≫ z j
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort ?u.3466
f g : β → C
z : (b : β) → f b ≅ g b
j j' : β
w : j = j'
⊢ g j = g j'
[PROOFSTEP]
simp [w]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort ?u.3466
f g : β → C
z : (b : β) → f b ≅ g b
j j' : β
w : j = j'
⊢ f j = f j'
[PROOFSTEP]
simp [w]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort u_1
f g : β → C
z : (b : β) → f b ≅ g b
j j' : β
w : j = j'
⊢ (z j).hom ≫ eqToHom (_ : g j = g j') = eqToHom (_ : f j = f j') ≫ (z j').hom
[PROOFSTEP]
cases w
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort u_1
f g : β → C
z : (b : β) → f b ≅ g b
j : β
⊢ (z j).hom ≫ eqToHom (_ : g j = g j) = eqToHom (_ : f j = f j) ≫ (z j).hom
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort ?u.4552
f g : β → C
z : (b : β) → f b ≅ g b
j j' : β
w : j = j'
⊢ f j = f j'
[PROOFSTEP]
simp [w]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort ?u.4552
f g : β → C
z : (b : β) → f b ≅ g b
j j' : β
w : j = j'
⊢ g j = g j'
[PROOFSTEP]
simp [w]
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort u_1
f g : β → C
z : (b : β) → f b ≅ g b
j j' : β
w : j = j'
⊢ (z j).inv ≫ eqToHom (_ : f j = f j') = eqToHom (_ : g j = g j') ≫ (z j').inv
[PROOFSTEP]
cases w
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
β : Sort u_1
f g : β → C
z : (b : β) → f b ≅ g b
j : β
⊢ (z j).inv ≫ eqToHom (_ : f j = f j) = eqToHom (_ : g j = g j) ≫ (z j).inv
[PROOFSTEP]
simp
/- Porting note: simpNF complains about this not reducing but it is clearly used
in `congrArg_mpr_hom_left`. It has been no-linted. -/
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Z : C
p : X = Y
q : Y ⟶ Z
⊢ cast (_ : (Y ⟶ Z) = (X ⟶ Z)) q = eqToHom p ≫ q
[PROOFSTEP]
cases p
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Z : C
q : X ⟶ Z
⊢ cast (_ : (X ⟶ Z) = (X ⟶ Z)) q = eqToHom (_ : X = X) ≫ q
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Z : C
p : X = Y
q : Y ⟶ Z
⊢ Eq.mpr (_ : (X ⟶ Z) = (Y ⟶ Z)) q = eqToHom p ≫ q
[PROOFSTEP]
cases p
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Z : C
q : X ⟶ Z
⊢ Eq.mpr (_ : (X ⟶ Z) = (X ⟶ Z)) q = eqToHom (_ : X = X) ≫ q
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Z : C
p : X ⟶ Y
q : Z = Y
⊢ cast (_ : (X ⟶ Y) = (X ⟶ Z)) p = p ≫ eqToHom (_ : Y = Z)
[PROOFSTEP]
cases q
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
p : X ⟶ Y
⊢ cast (_ : (X ⟶ Y) = (X ⟶ Y)) p = p ≫ eqToHom (_ : Y = Y)
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Z : C
p : X ⟶ Y
q : Z = Y
⊢ Eq.mpr (_ : (X ⟶ Z) = (X ⟶ Y)) p = p ≫ eqToHom (_ : Y = Z)
[PROOFSTEP]
cases q
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
p : X ⟶ Y
⊢ Eq.mpr (_ : (X ⟶ Y) = (X ⟶ Y)) p = p ≫ eqToHom (_ : Y = Y)
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
p : X = Y
⊢ eqToHom p ≫ eqToHom (_ : Y = X) = 𝟙 X
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
p : X = Y
⊢ eqToHom (_ : Y = X) ≫ eqToHom p = 𝟙 Y
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Z : C
p : X = Y
q : Y = Z
⊢ eqToIso p ≪≫ eqToIso q = eqToIso (_ : X = Z)
[PROOFSTEP]
ext
[GOAL]
case w
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y Z : C
p : X = Y
q : Y = Z
⊢ (eqToIso p ≪≫ eqToIso q).hom = (eqToIso (_ : X = Z)).hom
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
h : X = Y
⊢ (eqToHom h).op = eqToHom (_ : op Y = op X)
[PROOFSTEP]
cases h
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X : C
⊢ (eqToHom (_ : X = X)).op = eqToHom (_ : op X = op X)
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : Cᵒᵖ
h : X = Y
⊢ (eqToHom h).unop = eqToHom (_ : Y.unop = X.unop)
[PROOFSTEP]
cases h
[GOAL]
case refl
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X : Cᵒᵖ
⊢ (eqToHom (_ : X = X)).unop = eqToHom (_ : X.unop = X.unop)
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝ : Category.{v₁, u₁} C
X Y : C
h : X = Y
⊢ inv (eqToHom h) = eqToHom (_ : Y = X)
[PROOFSTEP]
aesop_cat
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
h_obj : ∀ (X : C), F.obj X = G.obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y), F.map f = eqToHom (_ : F.obj X = G.obj X) ≫ G.map f ≫ eqToHom (_ : G.obj Y = F.obj Y))
_auto✝
⊢ F = G
[PROOFSTEP]
match F, G with
| mk F_pre _ _, mk G_pre _ _ =>
match F_pre, G_pre with
-- Porting note: did not unfold the Prefunctor unlike Lean3
| Prefunctor.mk F_obj _,
Prefunctor.mk G_obj
_ =>
obtain rfl : F_obj = G_obj := by
ext X
apply h_obj
congr
funext X Y f
simpa using h_map X Y f
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
F_pre : C ⥤q D
map_id✝¹ : ∀ (X : C), F_pre.map (𝟙 X) = 𝟙 (F_pre.obj X)
map_comp✝¹ : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z), F_pre.map (f ≫ g) = F_pre.map f ≫ F_pre.map g
G_pre : C ⥤q D
map_id✝ : ∀ (X : C), G_pre.map (𝟙 X) = 𝟙 (G_pre.obj X)
map_comp✝ : ∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z), G_pre.map (f ≫ g) = G_pre.map f ≫ G_pre.map g
h_obj : ∀ (X : C), (mk F_pre).obj X = (mk G_pre).obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y),
(mk F_pre).map f =
eqToHom (_ : (mk F_pre).obj X = (mk G_pre).obj X) ≫
(mk G_pre).map f ≫ eqToHom (_ : (mk G_pre).obj Y = (mk F_pre).obj Y))
_auto✝
⊢ mk F_pre = mk G_pre
[PROOFSTEP]
match F_pre, G_pre with
-- Porting note: did not unfold the Prefunctor unlike Lean3
| Prefunctor.mk F_obj _,
Prefunctor.mk G_obj
_ =>
obtain rfl : F_obj = G_obj := by
ext X
apply h_obj
congr
funext X Y f
simpa using h_map X Y f
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
F_pre G_pre : C ⥤q D
F_obj : C → D
map✝¹ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
G_obj : C → D
map✝ : {X Y : C} → (X ⟶ Y) → (G_obj X ⟶ G_obj Y)
map_id✝¹ : ∀ (X : C), { obj := F_obj, map := map✝¹ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝¹ }.obj X)
map_comp✝¹ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝¹ }.map (f ≫ g) =
{ obj := F_obj, map := map✝¹ }.map f ≫ { obj := F_obj, map := map✝¹ }.map g
map_id✝ : ∀ (X : C), { obj := G_obj, map := map✝ }.map (𝟙 X) = 𝟙 ({ obj := G_obj, map := map✝ }.obj X)
map_comp✝ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := G_obj, map := map✝ }.map (f ≫ g) =
{ obj := G_obj, map := map✝ }.map f ≫ { obj := G_obj, map := map✝ }.map g
h_obj : ∀ (X : C), (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := G_obj, map := map✝ }).obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y),
(mk { obj := F_obj, map := map✝¹ }).map f =
eqToHom (_ : (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := G_obj, map := map✝ }).obj X) ≫
(mk { obj := G_obj, map := map✝ }).map f ≫
eqToHom (_ : (mk { obj := G_obj, map := map✝ }).obj Y = (mk { obj := F_obj, map := map✝¹ }).obj Y))
_auto✝
⊢ mk { obj := F_obj, map := map✝¹ } = mk { obj := G_obj, map := map✝ }
[PROOFSTEP]
obtain rfl : F_obj = G_obj := by
ext X
apply h_obj
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
F_pre G_pre : C ⥤q D
F_obj : C → D
map✝¹ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
G_obj : C → D
map✝ : {X Y : C} → (X ⟶ Y) → (G_obj X ⟶ G_obj Y)
map_id✝¹ : ∀ (X : C), { obj := F_obj, map := map✝¹ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝¹ }.obj X)
map_comp✝¹ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝¹ }.map (f ≫ g) =
{ obj := F_obj, map := map✝¹ }.map f ≫ { obj := F_obj, map := map✝¹ }.map g
map_id✝ : ∀ (X : C), { obj := G_obj, map := map✝ }.map (𝟙 X) = 𝟙 ({ obj := G_obj, map := map✝ }.obj X)
map_comp✝ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := G_obj, map := map✝ }.map (f ≫ g) =
{ obj := G_obj, map := map✝ }.map f ≫ { obj := G_obj, map := map✝ }.map g
h_obj : ∀ (X : C), (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := G_obj, map := map✝ }).obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y),
(mk { obj := F_obj, map := map✝¹ }).map f =
eqToHom (_ : (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := G_obj, map := map✝ }).obj X) ≫
(mk { obj := G_obj, map := map✝ }).map f ≫
eqToHom (_ : (mk { obj := G_obj, map := map✝ }).obj Y = (mk { obj := F_obj, map := map✝¹ }).obj Y))
_auto✝
⊢ F_obj = G_obj
[PROOFSTEP]
ext X
[GOAL]
case h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
F_pre G_pre : C ⥤q D
F_obj : C → D
map✝¹ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
G_obj : C → D
map✝ : {X Y : C} → (X ⟶ Y) → (G_obj X ⟶ G_obj Y)
map_id✝¹ : ∀ (X : C), { obj := F_obj, map := map✝¹ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝¹ }.obj X)
map_comp✝¹ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝¹ }.map (f ≫ g) =
{ obj := F_obj, map := map✝¹ }.map f ≫ { obj := F_obj, map := map✝¹ }.map g
map_id✝ : ∀ (X : C), { obj := G_obj, map := map✝ }.map (𝟙 X) = 𝟙 ({ obj := G_obj, map := map✝ }.obj X)
map_comp✝ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := G_obj, map := map✝ }.map (f ≫ g) =
{ obj := G_obj, map := map✝ }.map f ≫ { obj := G_obj, map := map✝ }.map g
h_obj : ∀ (X : C), (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := G_obj, map := map✝ }).obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y),
(mk { obj := F_obj, map := map✝¹ }).map f =
eqToHom (_ : (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := G_obj, map := map✝ }).obj X) ≫
(mk { obj := G_obj, map := map✝ }).map f ≫
eqToHom (_ : (mk { obj := G_obj, map := map✝ }).obj Y = (mk { obj := F_obj, map := map✝¹ }).obj Y))
_auto✝
X : C
⊢ F_obj X = G_obj X
[PROOFSTEP]
apply h_obj
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
F_pre G_pre : C ⥤q D
F_obj : C → D
map✝¹ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
map_id✝¹ : ∀ (X : C), { obj := F_obj, map := map✝¹ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝¹ }.obj X)
map_comp✝¹ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝¹ }.map (f ≫ g) =
{ obj := F_obj, map := map✝¹ }.map f ≫ { obj := F_obj, map := map✝¹ }.map g
map✝ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
map_id✝ : ∀ (X : C), { obj := F_obj, map := map✝ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝ }.obj X)
map_comp✝ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝ }.map (f ≫ g) =
{ obj := F_obj, map := map✝ }.map f ≫ { obj := F_obj, map := map✝ }.map g
h_obj : ∀ (X : C), (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := F_obj, map := map✝ }).obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y),
(mk { obj := F_obj, map := map✝¹ }).map f =
eqToHom (_ : (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := F_obj, map := map✝ }).obj X) ≫
(mk { obj := F_obj, map := map✝ }).map f ≫
eqToHom (_ : (mk { obj := F_obj, map := map✝ }).obj Y = (mk { obj := F_obj, map := map✝¹ }).obj Y))
_auto✝
⊢ mk { obj := F_obj, map := map✝¹ } = mk { obj := F_obj, map := map✝ }
[PROOFSTEP]
congr
[GOAL]
case e_toPrefunctor.e_map
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
F_pre G_pre : C ⥤q D
F_obj : C → D
map✝¹ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
map_id✝¹ : ∀ (X : C), { obj := F_obj, map := map✝¹ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝¹ }.obj X)
map_comp✝¹ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝¹ }.map (f ≫ g) =
{ obj := F_obj, map := map✝¹ }.map f ≫ { obj := F_obj, map := map✝¹ }.map g
map✝ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
map_id✝ : ∀ (X : C), { obj := F_obj, map := map✝ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝ }.obj X)
map_comp✝ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝ }.map (f ≫ g) =
{ obj := F_obj, map := map✝ }.map f ≫ { obj := F_obj, map := map✝ }.map g
h_obj : ∀ (X : C), (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := F_obj, map := map✝ }).obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y),
(mk { obj := F_obj, map := map✝¹ }).map f =
eqToHom (_ : (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := F_obj, map := map✝ }).obj X) ≫
(mk { obj := F_obj, map := map✝ }).map f ≫
eqToHom (_ : (mk { obj := F_obj, map := map✝ }).obj Y = (mk { obj := F_obj, map := map✝¹ }).obj Y))
_auto✝
⊢ map✝¹ = map✝
[PROOFSTEP]
funext X Y f
[GOAL]
case e_toPrefunctor.e_map.h.h.h
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
F_pre G_pre : C ⥤q D
F_obj : C → D
map✝¹ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
map_id✝¹ : ∀ (X : C), { obj := F_obj, map := map✝¹ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝¹ }.obj X)
map_comp✝¹ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝¹ }.map (f ≫ g) =
{ obj := F_obj, map := map✝¹ }.map f ≫ { obj := F_obj, map := map✝¹ }.map g
map✝ : {X Y : C} → (X ⟶ Y) → (F_obj X ⟶ F_obj Y)
map_id✝ : ∀ (X : C), { obj := F_obj, map := map✝ }.map (𝟙 X) = 𝟙 ({ obj := F_obj, map := map✝ }.obj X)
map_comp✝ :
∀ {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z),
{ obj := F_obj, map := map✝ }.map (f ≫ g) =
{ obj := F_obj, map := map✝ }.map f ≫ { obj := F_obj, map := map✝ }.map g
h_obj : ∀ (X : C), (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := F_obj, map := map✝ }).obj X
h_map :
autoParam
(∀ (X Y : C) (f : X ⟶ Y),
(mk { obj := F_obj, map := map✝¹ }).map f =
eqToHom (_ : (mk { obj := F_obj, map := map✝¹ }).obj X = (mk { obj := F_obj, map := map✝ }).obj X) ≫
(mk { obj := F_obj, map := map✝ }).map f ≫
eqToHom (_ : (mk { obj := F_obj, map := map✝ }).obj Y = (mk { obj := F_obj, map := map✝¹ }).obj Y))
_auto✝
X Y : C
f : X ⟶ Y
⊢ map✝¹ f = map✝ f
[PROOFSTEP]
simpa using h_map X Y f
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
W X Y Z : C
f : W ⟶ X
g : Y ⟶ Z
h : W = Y
h' : X = Z
⊢ f = eqToHom h ≫ g ≫ eqToHom (_ : Z = X) ↔ HEq f g
[PROOFSTEP]
cases h
[GOAL]
case refl
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
W X Z : C
f : W ⟶ X
h' : X = Z
g : W ⟶ Z
⊢ f = eqToHom (_ : W = W) ≫ g ≫ eqToHom (_ : Z = X) ↔ HEq f g
[PROOFSTEP]
cases h'
[GOAL]
case refl.refl
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
W X : C
f g : W ⟶ X
⊢ f = eqToHom (_ : W = W) ≫ g ≫ eqToHom (_ : X = X) ↔ HEq f g
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
h : F = G
X : C
⊢ F.obj X = G.obj X
[PROOFSTEP]
rw [h]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
h : F = G
X Y : C
f : X ⟶ Y
⊢ F.map f = eqToHom (_ : F.obj X = G.obj X) ≫ G.map f ≫ eqToHom (_ : G.obj Y = F.obj Y)
[PROOFSTEP]
subst h
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X Y : C
f : X ⟶ Y
⊢ F.map f = eqToHom (_ : F.obj X = F.obj X) ≫ F.map f ≫ eqToHom (_ : F.obj Y = F.obj Y)
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
X Y : C
e : X ≅ Y
hX : F.obj X = G.obj X
hY : F.obj Y = G.obj Y
⊢ F.obj X = G.obj X
[PROOFSTEP]
rw [hX]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
X Y : C
e : X ≅ Y
hX : F.obj X = G.obj X
hY : F.obj Y = G.obj Y
⊢ G.obj Y = F.obj Y
[PROOFSTEP]
rw [hY]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
X Y : C
e : X ≅ Y
hX : F.obj X = G.obj X
hY : F.obj Y = G.obj Y
h₂ : F.map e.hom = eqToHom (_ : F.obj X = G.obj X) ≫ G.map e.hom ≫ eqToHom (_ : G.obj Y = F.obj Y)
⊢ F.obj Y = G.obj Y
[PROOFSTEP]
rw [hY]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
X Y : C
e : X ≅ Y
hX : F.obj X = G.obj X
hY : F.obj Y = G.obj Y
h₂ : F.map e.hom = eqToHom (_ : F.obj X = G.obj X) ≫ G.map e.hom ≫ eqToHom (_ : G.obj Y = F.obj Y)
⊢ G.obj X = F.obj X
[PROOFSTEP]
rw [hX]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
X Y : C
e : X ≅ Y
hX : F.obj X = G.obj X
hY : F.obj Y = G.obj Y
h₂ : F.map e.hom = eqToHom (_ : F.obj X = G.obj X) ≫ G.map e.hom ≫ eqToHom (_ : G.obj Y = F.obj Y)
⊢ F.map e.inv = eqToHom (_ : F.obj Y = G.obj Y) ≫ G.map e.inv ≫ eqToHom (_ : G.obj X = F.obj X)
[PROOFSTEP]
simp only [← IsIso.Iso.inv_hom e, Functor.map_inv, h₂, IsIso.inv_comp, inv_eqToHom, Category.assoc]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X Y : C
f g : X ⟶ Y
h : f = g
⊢ F.map f = F.map g
[PROOFSTEP]
rw [h]
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
F G : C ⥤ D
X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
hx : F.obj X = G.obj X
hy : F.obj Y = G.obj Y
hz : F.obj Z = G.obj Z
hf : HEq (F.map f) (G.map f)
hg : HEq (F.map g) (G.map g)
⊢ HEq (F.map (f ≫ g)) (G.map (f ≫ g))
[PROOFSTEP]
rw [F.map_comp, G.map_comp]
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
F G : C ⥤ D
X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
hx : F.obj X = G.obj X
hy : F.obj Y = G.obj Y
hz : F.obj Z = G.obj Z
hf : HEq (F.map f) (G.map f)
hg : HEq (F.map g) (G.map g)
⊢ HEq (F.map f ≫ F.map g) (G.map f ≫ G.map g)
[PROOFSTEP]
congr
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
F G : C ⥤ D
X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
hobj : ∀ (X : C), F.obj X = G.obj X
hmap : ∀ {X Y : C} (f : X ⟶ Y), HEq (F.map f) (G.map f)
⊢ HEq (F.map (f ≫ g)) (G.map (f ≫ g))
[PROOFSTEP]
rw [Functor.hext hobj fun _ _ => hmap]
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
F G : C ⥤ D
X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
H : D ⥤ E
hx : F.obj X = G.obj X
hy : F.obj Y = G.obj Y
hmap : HEq (F.map f) (G.map f)
⊢ HEq ((F ⋙ H).map f) ((G ⋙ H).map f)
[PROOFSTEP]
dsimp
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
F G : C ⥤ D
X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
H : D ⥤ E
hx : F.obj X = G.obj X
hy : F.obj Y = G.obj Y
hmap : HEq (F.map f) (G.map f)
⊢ HEq (H.map (F.map f)) (H.map (G.map f))
[PROOFSTEP]
congr
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
F G : C ⥤ D
X Y Z : C
f : X ⟶ Y
g : Y ⟶ Z
H : D ⥤ E
hobj : ∀ (X : C), F.obj X = G.obj X
hmap : ∀ {X Y : C} (f : X ⟶ Y), HEq (F.map f) (G.map f)
⊢ HEq ((F ⋙ H).map f) ((G ⋙ H).map f)
[PROOFSTEP]
rw [Functor.hext hobj fun _ _ => hmap]
[GOAL]
C : Type u₁
inst✝² : Category.{v₁, u₁} C
D : Type u₂
inst✝¹ : Category.{v₂, u₂} D
E : Type u₃
inst✝ : Category.{v₃, u₃} E
F✝ G✝ : C ⥤ D
X✝ Y✝ Z : C
f✝ : X✝ ⟶ Y✝
g : Y✝ ⟶ Z
F G : C ⥤ D
h : F = G
X Y : C
f : X ⟶ Y
⊢ HEq (F.map f) (G.map f)
[PROOFSTEP]
rw [h]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X Y : C
p : X = Y
⊢ F.map (eqToHom p) = eqToHom (_ : F.obj X = F.obj Y)
[PROOFSTEP]
cases p
[GOAL]
case refl
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X : C
⊢ F.map (eqToHom (_ : X = X)) = eqToHom (_ : F.obj X = F.obj X)
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X Y : C
p : X = Y
⊢ F.mapIso (eqToIso p) = eqToIso (_ : F.obj X = F.obj Y)
[PROOFSTEP]
ext
[GOAL]
case w
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X Y : C
p : X = Y
⊢ (F.mapIso (eqToIso p)).hom = (eqToIso (_ : F.obj X = F.obj Y)).hom
[PROOFSTEP]
cases p
[GOAL]
case w.refl
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X : C
⊢ (F.mapIso (eqToIso (_ : X = X))).hom = (eqToIso (_ : F.obj X = F.obj X)).hom
[PROOFSTEP]
simp
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
h : F = G
X : C
⊢ NatTrans.app (eqToHom h) X = eqToHom (_ : F.obj X = G.obj X)
[PROOFSTEP]
subst h
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F : C ⥤ D
X : C
⊢ NatTrans.app (eqToHom (_ : F = F)) X = eqToHom (_ : F.obj X = F.obj X)
[PROOFSTEP]
rfl
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
α : F ⟶ G
X Y : C
h : X = Y
⊢ app α X = F.map (eqToHom h) ≫ app α Y ≫ G.map (eqToHom (_ : Y = X))
[PROOFSTEP]
rw [α.naturality_assoc]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
F G : C ⥤ D
α : F ⟶ G
X Y : C
h : X = Y
⊢ app α X = app α X ≫ G.map (eqToHom h) ≫ G.map (eqToHom (_ : Y = X))
[PROOFSTEP]
simp [eqToHom_map]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
X Y : C
f : X ⟶ Y
⊢ f = eqToHom (_ : X = X) ≫ f ≫ eqToHom (_ : Y = Y)
[PROOFSTEP]
simp only [Category.id_comp, eqToHom_refl, Category.comp_id]
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
ι : Type u_1
F G : ι → C
α : (i : ι) → F i ⟶ G i
i j : ι
h : i = j
⊢ α i = eqToHom (_ : F i = F j) ≫ α j ≫ eqToHom (_ : G j = G i)
[PROOFSTEP]
subst h
[GOAL]
C : Type u₁
inst✝¹ : Category.{v₁, u₁} C
D : Type u₂
inst✝ : Category.{v₂, u₂} D
ι : Type u_1
F G : ι → C
α : (i : ι) → F i ⟶ G i
i : ι
⊢ α i = eqToHom (_ : F i = F i) ≫ α i ≫ eqToHom (_ : G i = G i)
[PROOFSTEP]
simp
|
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
⊢ a - b ≤ c ↔ a ≤ b + c
[PROOFSTEP]
rw [tsub_le_iff_right, add_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
⊢ a - b ≤ c ↔ a - c ≤ b
[PROOFSTEP]
rw [tsub_le_iff_left, tsub_le_iff_right]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b - c ≤ a + (b - c)
[PROOFSTEP]
rw [tsub_le_iff_left, add_left_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b ≤ a + (c + (b - c))
[PROOFSTEP]
exact add_le_add_left le_add_tsub a
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b - c ≤ a - c + b
[PROOFSTEP]
rw [add_comm, add_comm _ b]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ b + a - c ≤ b + (a - c)
[PROOFSTEP]
exact add_tsub_le_assoc
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b ≤ a + c + (b - c)
[PROOFSTEP]
rw [add_assoc]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b ≤ a + (c + (b - c))
[PROOFSTEP]
exact add_le_add_left le_add_tsub a
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b ≤ a - c + (b + c)
[PROOFSTEP]
rw [add_comm a, add_comm (a - c)]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ b + a ≤ b + c + (a - c)
[PROOFSTEP]
exact add_le_add_add_tsub
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a - c ≤ a - b + (b - c)
[PROOFSTEP]
rw [tsub_le_iff_left, ← add_assoc, add_right_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a ≤ c + (b - c) + (a - b)
[PROOFSTEP]
exact le_add_tsub.trans (add_le_add_right le_add_tsub _)
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ c - a - (c - b) ≤ b - a
[PROOFSTEP]
rw [tsub_le_iff_left, tsub_le_iff_left, add_left_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ c ≤ c - b + (a + (b - a))
[PROOFSTEP]
exact le_tsub_add.trans (add_le_add_left le_add_tsub _)
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b - (c + d) ≤ a - c + (b - d)
[PROOFSTEP]
rw [add_comm c, tsub_le_iff_left, add_assoc, ← tsub_le_iff_left, ← tsub_le_iff_left]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b - d - c ≤ a - c + (b - d)
[PROOFSTEP]
refine' (tsub_le_tsub_right add_tsub_le_assoc c).trans _
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + (b - d) - c ≤ a - c + (b - d)
[PROOFSTEP]
rw [add_comm a, add_comm (a - c)]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ b - d + a - c ≤ b - d + (a - c)
[PROOFSTEP]
exact add_tsub_le_assoc
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b - (a + c) ≤ b - c
[PROOFSTEP]
rw [tsub_le_iff_left, add_assoc]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + b ≤ a + (c + (b - c))
[PROOFSTEP]
exact add_le_add_left le_add_tsub _
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + c - (b + c) ≤ a - b
[PROOFSTEP]
rw [tsub_le_iff_left, add_right_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁴ : Preorder α
inst✝³ : AddCommSemigroup α
inst✝² : Sub α
inst✝¹ : OrderedSub α
a b c d : α
inst✝ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
⊢ a + c ≤ b + (a - b) + c
[PROOFSTEP]
exact add_le_add_right le_add_tsub c
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
⊢ a ≤ a + b - b
[PROOFSTEP]
rw [add_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
⊢ a ≤ b + a - b
[PROOFSTEP]
exact hb.le_add_tsub_swap
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
h : a + b ≤ c
⊢ b + a ≤ c
[PROOFSTEP]
rwa [add_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : AddCommMonoid α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
⊢ a - b ≤ 0 ↔ a ≤ b
[PROOFSTEP]
rw [tsub_le_iff_left, add_zero]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a✝ b✝ c✝ d b a c : α
⊢ b - a - c = b - (a + c)
[PROOFSTEP]
apply le_antisymm
[GOAL]
case a
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a✝ b✝ c✝ d b a c : α
⊢ b - a - c ≤ b - (a + c)
[PROOFSTEP]
rw [tsub_le_iff_left, tsub_le_iff_left, ← add_assoc, ← tsub_le_iff_left]
[GOAL]
case a
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a✝ b✝ c✝ d b a c : α
⊢ b - (a + c) ≤ b - a - c
[PROOFSTEP]
rw [tsub_le_iff_left, add_assoc, ← tsub_le_iff_left, ← tsub_le_iff_left]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a✝ b✝ c✝ d a b c : α
⊢ a - (b + c) = a - c - b
[PROOFSTEP]
rw [add_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a✝ b✝ c✝ d a b c : α
⊢ a - (c + b) = a - c - b
[PROOFSTEP]
apply tsub_add_eq_tsub_tsub
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
⊢ a - b - c = a - c - b
[PROOFSTEP]
rw [← tsub_add_eq_tsub_tsub, tsub_add_eq_tsub_tsub_swap]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
h : a = c + b
⊢ c ≤ a - b
[PROOFSTEP]
rw [h]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
h : a = c + b
⊢ c ≤ c + b - b
[PROOFSTEP]
exact hb.le_add_tsub
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
h : a = b + c
⊢ a = c + b
[PROOFSTEP]
rw [add_comm, h]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
⊢ a + b = a + b
[PROOFSTEP]
rw [add_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
h : a - b < c
⊢ a < b + c
[PROOFSTEP]
rw [lt_iff_le_and_ne, ← tsub_le_iff_left]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
h : a - b < c
⊢ a - b ≤ c ∧ a ≠ b + c
[PROOFSTEP]
refine' ⟨h.le, _⟩
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hb : AddLECancellable b
h : a - b < c
⊢ a ≠ b + c
[PROOFSTEP]
rintro rfl
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
b c d : α
hb : AddLECancellable b
h : b + c - b < c
⊢ False
[PROOFSTEP]
simp [hb] at h
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hc : AddLECancellable c
h : a - c < b
⊢ a < b + c
[PROOFSTEP]
rw [lt_iff_le_and_ne, ← tsub_le_iff_right]
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hc : AddLECancellable c
h : a - c < b
⊢ a - c ≤ b ∧ a ≠ b + c
[PROOFSTEP]
refine' ⟨h.le, _⟩
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hc : AddLECancellable c
h : a - c < b
⊢ a ≠ b + c
[PROOFSTEP]
rintro rfl
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
b c d : α
hc : AddLECancellable c
h : b + c - c < b
⊢ False
[PROOFSTEP]
simp [hc] at h
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
hc : AddLECancellable c
h : a + c < b
⊢ a ≠ b - c
[PROOFSTEP]
rintro rfl
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
b c d : α
hc : AddLECancellable c
h : b - c + c < b
⊢ False
[PROOFSTEP]
exact h.not_le le_tsub_add
[GOAL]
α : Type u_1
β : Type u_2
inst✝³ : PartialOrder α
inst✝² : AddCommSemigroup α
inst✝¹ : Sub α
inst✝ : OrderedSub α
a b c d : α
ha : AddLECancellable a
h : a + c < b
⊢ c + a < b
[PROOFSTEP]
rwa [add_comm]
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁵ : PartialOrder α
inst✝⁴ : AddCommSemigroup α
inst✝³ : Sub α
inst✝² : OrderedSub α
a✝ b✝ c✝ d : α
inst✝¹ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a c b : α
⊢ a + c - (b + c) = a - b
[PROOFSTEP]
refine' add_tsub_add_le_tsub_right.antisymm (tsub_le_iff_right.2 <| le_of_add_le_add_right _)
[GOAL]
case refine'_1
α : Type u_1
β : Type u_2
inst✝⁵ : PartialOrder α
inst✝⁴ : AddCommSemigroup α
inst✝³ : Sub α
inst✝² : OrderedSub α
a✝ b✝ c✝ d : α
inst✝¹ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a c b : α
⊢ α
case refine'_2
α : Type u_1
β : Type u_2
inst✝⁵ : PartialOrder α
inst✝⁴ : AddCommSemigroup α
inst✝³ : Sub α
inst✝² : OrderedSub α
a✝ b✝ c✝ d : α
inst✝¹ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a c b : α
⊢ a + ?refine'_1 ≤ a + c - (b + c) + b + ?refine'_1
[PROOFSTEP]
exact c
[GOAL]
case refine'_2
α : Type u_1
β : Type u_2
inst✝⁵ : PartialOrder α
inst✝⁴ : AddCommSemigroup α
inst✝³ : Sub α
inst✝² : OrderedSub α
a✝ b✝ c✝ d : α
inst✝¹ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a c b : α
⊢ a + c ≤ a + c - (b + c) + b + c
[PROOFSTEP]
rw [add_assoc]
[GOAL]
case refine'_2
α : Type u_1
β : Type u_2
inst✝⁵ : PartialOrder α
inst✝⁴ : AddCommSemigroup α
inst✝³ : Sub α
inst✝² : OrderedSub α
a✝ b✝ c✝ d : α
inst✝¹ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a c b : α
⊢ a + c ≤ a + c - (b + c) + (b + c)
[PROOFSTEP]
exact le_tsub_add
[GOAL]
α : Type u_1
β : Type u_2
inst✝⁵ : PartialOrder α
inst✝⁴ : AddCommSemigroup α
inst✝³ : Sub α
inst✝² : OrderedSub α
a✝ b✝ c✝ d : α
inst✝¹ : CovariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
inst✝ : ContravariantClass α α (fun x x_1 => x + x_1) fun x x_1 => x ≤ x_1
a b c : α
⊢ a + b - (a + c) = b - c
[PROOFSTEP]
rw [add_comm a b, add_comm a c, add_tsub_add_eq_tsub_right]
|
/**
* Swaggy Jenkins
* Jenkins API clients generated from Swagger / Open API specification
*
* The version of the OpenAPI document: 1.1.2-pre.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI-Generator 5.4.0.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "FreeStyleProject.h"
#include <string>
#include <vector>
#include <sstream>
#include <stdexcept>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
using boost::property_tree::ptree;
using boost::property_tree::read_json;
using boost::property_tree::write_json;
namespace org {
namespace openapitools {
namespace server {
namespace model {
FreeStyleProject::FreeStyleProject(boost::property_tree::ptree const& pt)
{
fromPropertyTree(pt);
}
std::string FreeStyleProject::toJsonString(bool prettyJson /* = false */)
{
return toJsonString_internal(prettyJson);
}
void FreeStyleProject::fromJsonString(std::string const& jsonString)
{
fromJsonString_internal(jsonString);
}
boost::property_tree::ptree FreeStyleProject::toPropertyTree()
{
return toPropertyTree_internal();
}
void FreeStyleProject::fromPropertyTree(boost::property_tree::ptree const& pt)
{
fromPropertyTree_internal(pt);
}
std::string FreeStyleProject::toJsonString_internal(bool prettyJson)
{
std::stringstream ss;
write_json(ss, this->toPropertyTree(), prettyJson);
return ss.str();
}
void FreeStyleProject::fromJsonString_internal(std::string const& jsonString)
{
std::stringstream ss(jsonString);
ptree pt;
read_json(ss,pt);
this->fromPropertyTree(pt);
}
ptree FreeStyleProject::toPropertyTree_internal()
{
ptree pt;
ptree tmp_node;
pt.put("_class", m__class);
pt.put("name", m_Name);
pt.put("url", m_Url);
pt.put("color", m_Color);
// generate tree for Actions
if (!m_Actions.empty()) {
for (const auto &childEntry : m_Actions) {
tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree()));
}
pt.add_child("actions", tmp_node);
tmp_node.clear();
}
pt.put("description", m_Description);
pt.put("displayName", m_DisplayName);
pt.put("displayNameOrNull", m_DisplayNameOrNull);
pt.put("fullDisplayName", m_FullDisplayName);
pt.put("fullName", m_FullName);
pt.put("buildable", m_Buildable);
// generate tree for Builds
if (!m_Builds.empty()) {
for (const auto &childEntry : m_Builds) {
tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree()));
}
pt.add_child("builds", tmp_node);
tmp_node.clear();
}
if (m_FirstBuild != nullptr) {
pt.add_child("firstBuild", m_FirstBuild->toPropertyTree());
}
// generate tree for HealthReport
if (!m_HealthReport.empty()) {
for (const auto &childEntry : m_HealthReport) {
tmp_node.push_back(std::make_pair("", childEntry->toPropertyTree()));
}
pt.add_child("healthReport", tmp_node);
tmp_node.clear();
}
pt.put("inQueue", m_InQueue);
pt.put("keepDependencies", m_KeepDependencies);
if (m_LastBuild != nullptr) {
pt.add_child("lastBuild", m_LastBuild->toPropertyTree());
}
if (m_LastCompletedBuild != nullptr) {
pt.add_child("lastCompletedBuild", m_LastCompletedBuild->toPropertyTree());
}
pt.put("lastFailedBuild", m_LastFailedBuild);
if (m_LastStableBuild != nullptr) {
pt.add_child("lastStableBuild", m_LastStableBuild->toPropertyTree());
}
if (m_LastSuccessfulBuild != nullptr) {
pt.add_child("lastSuccessfulBuild", m_LastSuccessfulBuild->toPropertyTree());
}
pt.put("lastUnstableBuild", m_LastUnstableBuild);
pt.put("lastUnsuccessfulBuild", m_LastUnsuccessfulBuild);
pt.put("nextBuildNumber", m_NextBuildNumber);
pt.put("queueItem", m_QueueItem);
pt.put("concurrentBuild", m_ConcurrentBuild);
if (m_Scm != nullptr) {
pt.add_child("scm", m_Scm->toPropertyTree());
}
return pt;
}
void FreeStyleProject::fromPropertyTree_internal(ptree const &pt)
{
ptree tmp_node;
m__class = pt.get("_class", "");
m_Name = pt.get("name", "");
m_Url = pt.get("url", "");
m_Color = pt.get("color", "");
// push all items of Actions into member vector
if (pt.get_child_optional("actions")) {
for (const auto &childTree : pt.get_child("actions")) {
std::shared_ptr<FreeStyleProjectactions> val =
std::make_shared<FreeStyleProjectactions>(childTree.second);
m_Actions.emplace_back(std::move(val));
}
}
m_Description = pt.get("description", "");
m_DisplayName = pt.get("displayName", "");
m_DisplayNameOrNull = pt.get("displayNameOrNull", "");
m_FullDisplayName = pt.get("fullDisplayName", "");
m_FullName = pt.get("fullName", "");
m_Buildable = pt.get("buildable", false);
// push all items of Builds into member vector
if (pt.get_child_optional("builds")) {
for (const auto &childTree : pt.get_child("builds")) {
std::shared_ptr<FreeStyleBuild> val =
std::make_shared<FreeStyleBuild>(childTree.second);
m_Builds.emplace_back(std::move(val));
}
}
if (pt.get_child_optional("firstBuild")) {
m_FirstBuild = std::make_shared<FreeStyleBuild>();
m_FirstBuild->fromPropertyTree(pt.get_child("firstBuild"));
}
// push all items of HealthReport into member vector
if (pt.get_child_optional("healthReport")) {
for (const auto &childTree : pt.get_child("healthReport")) {
std::shared_ptr<FreeStyleProjecthealthReport> val =
std::make_shared<FreeStyleProjecthealthReport>(childTree.second);
m_HealthReport.emplace_back(std::move(val));
}
}
m_InQueue = pt.get("inQueue", false);
m_KeepDependencies = pt.get("keepDependencies", false);
if (pt.get_child_optional("lastBuild")) {
m_LastBuild = std::make_shared<FreeStyleBuild>();
m_LastBuild->fromPropertyTree(pt.get_child("lastBuild"));
}
if (pt.get_child_optional("lastCompletedBuild")) {
m_LastCompletedBuild = std::make_shared<FreeStyleBuild>();
m_LastCompletedBuild->fromPropertyTree(pt.get_child("lastCompletedBuild"));
}
m_LastFailedBuild = pt.get("lastFailedBuild", "");
if (pt.get_child_optional("lastStableBuild")) {
m_LastStableBuild = std::make_shared<FreeStyleBuild>();
m_LastStableBuild->fromPropertyTree(pt.get_child("lastStableBuild"));
}
if (pt.get_child_optional("lastSuccessfulBuild")) {
m_LastSuccessfulBuild = std::make_shared<FreeStyleBuild>();
m_LastSuccessfulBuild->fromPropertyTree(pt.get_child("lastSuccessfulBuild"));
}
m_LastUnstableBuild = pt.get("lastUnstableBuild", "");
m_LastUnsuccessfulBuild = pt.get("lastUnsuccessfulBuild", "");
m_NextBuildNumber = pt.get("nextBuildNumber", 0);
m_QueueItem = pt.get("queueItem", "");
m_ConcurrentBuild = pt.get("concurrentBuild", false);
if (pt.get_child_optional("scm")) {
m_Scm = std::make_shared<NullSCM>();
m_Scm->fromPropertyTree(pt.get_child("scm"));
}
}
std::string FreeStyleProject::get_Class() const
{
return m__class;
}
void FreeStyleProject::set_Class(std::string value)
{
m__class = value;
}
std::string FreeStyleProject::getName() const
{
return m_Name;
}
void FreeStyleProject::setName(std::string value)
{
m_Name = value;
}
std::string FreeStyleProject::getUrl() const
{
return m_Url;
}
void FreeStyleProject::setUrl(std::string value)
{
m_Url = value;
}
std::string FreeStyleProject::getColor() const
{
return m_Color;
}
void FreeStyleProject::setColor(std::string value)
{
m_Color = value;
}
std::vector<std::shared_ptr<FreeStyleProjectactions>> FreeStyleProject::getActions() const
{
return m_Actions;
}
void FreeStyleProject::setActions(std::vector<std::shared_ptr<FreeStyleProjectactions>> value)
{
m_Actions = value;
}
std::string FreeStyleProject::getDescription() const
{
return m_Description;
}
void FreeStyleProject::setDescription(std::string value)
{
m_Description = value;
}
std::string FreeStyleProject::getDisplayName() const
{
return m_DisplayName;
}
void FreeStyleProject::setDisplayName(std::string value)
{
m_DisplayName = value;
}
std::string FreeStyleProject::getDisplayNameOrNull() const
{
return m_DisplayNameOrNull;
}
void FreeStyleProject::setDisplayNameOrNull(std::string value)
{
m_DisplayNameOrNull = value;
}
std::string FreeStyleProject::getFullDisplayName() const
{
return m_FullDisplayName;
}
void FreeStyleProject::setFullDisplayName(std::string value)
{
m_FullDisplayName = value;
}
std::string FreeStyleProject::getFullName() const
{
return m_FullName;
}
void FreeStyleProject::setFullName(std::string value)
{
m_FullName = value;
}
bool FreeStyleProject::isBuildable() const
{
return m_Buildable;
}
void FreeStyleProject::setBuildable(bool value)
{
m_Buildable = value;
}
std::vector<std::shared_ptr<FreeStyleBuild>> FreeStyleProject::getBuilds() const
{
return m_Builds;
}
void FreeStyleProject::setBuilds(std::vector<std::shared_ptr<FreeStyleBuild>> value)
{
m_Builds = value;
}
std::shared_ptr<FreeStyleBuild> FreeStyleProject::getFirstBuild() const
{
return m_FirstBuild;
}
void FreeStyleProject::setFirstBuild(std::shared_ptr<FreeStyleBuild> value)
{
m_FirstBuild = value;
}
std::vector<std::shared_ptr<FreeStyleProjecthealthReport>> FreeStyleProject::getHealthReport() const
{
return m_HealthReport;
}
void FreeStyleProject::setHealthReport(std::vector<std::shared_ptr<FreeStyleProjecthealthReport>> value)
{
m_HealthReport = value;
}
bool FreeStyleProject::isInQueue() const
{
return m_InQueue;
}
void FreeStyleProject::setInQueue(bool value)
{
m_InQueue = value;
}
bool FreeStyleProject::isKeepDependencies() const
{
return m_KeepDependencies;
}
void FreeStyleProject::setKeepDependencies(bool value)
{
m_KeepDependencies = value;
}
std::shared_ptr<FreeStyleBuild> FreeStyleProject::getLastBuild() const
{
return m_LastBuild;
}
void FreeStyleProject::setLastBuild(std::shared_ptr<FreeStyleBuild> value)
{
m_LastBuild = value;
}
std::shared_ptr<FreeStyleBuild> FreeStyleProject::getLastCompletedBuild() const
{
return m_LastCompletedBuild;
}
void FreeStyleProject::setLastCompletedBuild(std::shared_ptr<FreeStyleBuild> value)
{
m_LastCompletedBuild = value;
}
std::string FreeStyleProject::getLastFailedBuild() const
{
return m_LastFailedBuild;
}
void FreeStyleProject::setLastFailedBuild(std::string value)
{
m_LastFailedBuild = value;
}
std::shared_ptr<FreeStyleBuild> FreeStyleProject::getLastStableBuild() const
{
return m_LastStableBuild;
}
void FreeStyleProject::setLastStableBuild(std::shared_ptr<FreeStyleBuild> value)
{
m_LastStableBuild = value;
}
std::shared_ptr<FreeStyleBuild> FreeStyleProject::getLastSuccessfulBuild() const
{
return m_LastSuccessfulBuild;
}
void FreeStyleProject::setLastSuccessfulBuild(std::shared_ptr<FreeStyleBuild> value)
{
m_LastSuccessfulBuild = value;
}
std::string FreeStyleProject::getLastUnstableBuild() const
{
return m_LastUnstableBuild;
}
void FreeStyleProject::setLastUnstableBuild(std::string value)
{
m_LastUnstableBuild = value;
}
std::string FreeStyleProject::getLastUnsuccessfulBuild() const
{
return m_LastUnsuccessfulBuild;
}
void FreeStyleProject::setLastUnsuccessfulBuild(std::string value)
{
m_LastUnsuccessfulBuild = value;
}
int32_t FreeStyleProject::getNextBuildNumber() const
{
return m_NextBuildNumber;
}
void FreeStyleProject::setNextBuildNumber(int32_t value)
{
m_NextBuildNumber = value;
}
std::string FreeStyleProject::getQueueItem() const
{
return m_QueueItem;
}
void FreeStyleProject::setQueueItem(std::string value)
{
m_QueueItem = value;
}
bool FreeStyleProject::isConcurrentBuild() const
{
return m_ConcurrentBuild;
}
void FreeStyleProject::setConcurrentBuild(bool value)
{
m_ConcurrentBuild = value;
}
std::shared_ptr<NullSCM> FreeStyleProject::getScm() const
{
return m_Scm;
}
void FreeStyleProject::setScm(std::shared_ptr<NullSCM> value)
{
m_Scm = value;
}
std::vector<FreeStyleProject> createFreeStyleProjectVectorFromJsonString(const std::string& json)
{
std::stringstream sstream(json);
boost::property_tree::ptree pt;
boost::property_tree::json_parser::read_json(sstream,pt);
auto vec = std::vector<FreeStyleProject>();
for (const auto& child: pt) {
vec.emplace_back(FreeStyleProject(child.second));
}
return vec;
}
}
}
}
}
|
-- Negación del universal: Caracterización de funciones no pares
-- =============================================================
import data.real.basic
variable (f : ℝ → ℝ)
-- ----------------------------------------------------
-- Ejercicio 1. Definir la función
-- par : (ℝ → ℝ) → Prop
-- tal que (par f) expresa que f es par.
-- ----------------------------------------------------
def par : (ℝ → ℝ) → Prop
| f := ∀ x, f (-x) = f x
-- ----------------------------------------------------
-- Ejercicio 2. Demostrar que
-- ¬par f ↔ ∃ x, f (-x) ≠ f x
-- ----------------------------------------------------
-- 1ª demostración
example : ¬par f ↔ ∃ x, f (-x) ≠ f x :=
begin
split,
{ contrapose,
intro h1,
rw not_not,
unfold par,
intro x,
by_contradiction h2,
apply h1,
use x, },
{ intro h1,
intro h2,
unfold par at h2,
cases h1 with x hx,
apply hx,
exact h2 x, },
end
-- 2ª demostración
example : ¬par f ↔ ∃ x, f (-x) ≠ f x :=
begin
split,
{ contrapose,
intro h1,
rw not_not,
intro x,
by_contradiction h2,
apply h1,
use x, },
{ rintros ⟨x, hx⟩ h',
exact hx (h' x) },
end
-- 3ª demostración
example : ¬par f ↔ ∃ x, f (-x) ≠ f x :=
begin
unfold par,
push_neg,
end
-- 4ª demostración
example : ¬par f ↔ ∃ x, f (-x) ≠ f x :=
iff.intro
( have h1 : ¬(∃ x, f (-x) ≠ f x) → ¬¬par f,
{ assume h2 : ¬(∃ x, f (-x) ≠ f x),
have h3 : par f,
{ assume x,
have h4 : ¬(f (-x) ≠ f x),
{ assume h5 : f (-x) ≠ f x,
have h6 : ∃ x, f (-x) ≠ f x,
from exists.intro x h5,
show false,
from h2 h6, },
show f (-x) = f x,
from not_not.mp h4},
show ¬¬par f,
from not_not.mpr h3 },
show ¬par f → (∃ x, f (-x) ≠ f x),
from not_imp_not.mp h1)
( assume h1 : ∃ x, f (-x) ≠ f x,
show ¬par f,
{ assume h2 : par f,
show false, from
exists.elim h1
( assume x,
assume hx : f (-x) ≠ f x,
have h3 : f (-x) = f x,
from h2 x,
show false,
from hx h3)})
-- 5ª demostración
example : ¬par f ↔ ∃ x, f (-x) ≠ f x :=
-- by suggest
not_forall
-- 6ª demostración
example : ¬par f ↔ ∃ x, f (-x) ≠ f x :=
-- by hint
by simp [par]
|
The arguments are 2 2 4 1 0
The value of arg4 = 0
-- @@stderr --
dtrace: error on enabled probe ID 2 (ID 1: dtrace:::BEGIN): invalid address ({ptr}) in action #2 at DIF offset 4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.